summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/ufs/ufs/ufs_bmap.c21
-rw-r--r--sys/ufs/ufs/ufs_extern.h174
-rw-r--r--sys/ufs/ufs/ufs_ihash.c7
-rw-r--r--sys/ufs/ufs/ufs_inode.c31
-rw-r--r--sys/ufs/ufs/ufs_lookup.c70
-rw-r--r--sys/ufs/ufs/ufs_quota.c23
-rw-r--r--sys/ufs/ufs/ufs_readwrite.c24
-rw-r--r--sys/ufs/ufs/ufs_vfsops.c12
-rw-r--r--sys/ufs/ufs/ufs_vnops.c421
9 files changed, 467 insertions, 316 deletions
diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c
index 426839a2f17..bb736b5ab3a 100644
--- a/sys/ufs/ufs/ufs_bmap.c
+++ b/sys/ufs/ufs/ufs_bmap.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ufs_bmap.c,v 1.2 1994/06/29 06:47:24 cgd Exp $ */
+/* $OpenBSD: ufs_bmap.c,v 1.2 1996/02/27 07:21:24 niklas Exp $ */
+/* $NetBSD: ufs_bmap.c,v 1.3 1996/02/09 22:36:00 christos Exp $ */
/*
* Copyright (c) 1989, 1991, 1993
@@ -41,6 +42,7 @@
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/vnode.h>
@@ -61,15 +63,16 @@
* number to index into the array of block pointers described by the dinode.
*/
int
-ufs_bmap(ap)
+ufs_bmap(v)
+ void *v;
+{
struct vop_bmap_args /* {
struct vnode *a_vp;
daddr_t a_bn;
struct vnode **a_vpp;
daddr_t *a_bnp;
int *a_runp;
- } */ *ap;
-{
+ } */ *ap = v;
/*
* Check for underlying vnode requests and ensure that logical
* to physical mapping is requested.
@@ -114,13 +117,13 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
struct indir a[NIADDR], *xap;
daddr_t daddr;
long metalbn;
- int error, maxrun, num;
+ int error, maxrun = 0, num;
ip = VTOI(vp);
mp = vp->v_mount;
ump = VFSTOUFS(mp);
#ifdef DIAGNOSTIC
- if (ap != NULL && nump == NULL || ap == NULL && nump != NULL)
+ if ((ap != NULL && nump == NULL) || (ap == NULL && nump != NULL))
panic("ufs_bmaparray: invalid arguments");
#endif
@@ -138,7 +141,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
xap = ap == NULL ? a : ap;
if (!nump)
nump = &num;
- if (error = ufs_getlbns(vp, bn, xap, nump))
+ if ((error = ufs_getlbns(vp, bn, xap, nump)) != 0)
return (error);
num = *nump;
@@ -166,7 +169,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
*/
metalbn = xap->in_lbn;
- if (daddr == 0 && !incore(vp, metalbn) || metalbn == bn)
+ if ((daddr == 0 && !incore(vp, metalbn)) || metalbn == bn)
break;
/*
* If we get here, we've either got the block in the cache
@@ -190,7 +193,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
bp->b_flags |= B_READ;
VOP_STRATEGY(bp);
curproc->p_stats->p_ru.ru_inblock++; /* XXX */
- if (error = biowait(bp)) {
+ if ((error = biowait(bp)) != 0) {
brelse(bp);
return (error);
}
diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h
index c495adfe125..4dbeed61a92 100644
--- a/sys/ufs/ufs/ufs_extern.h
+++ b/sys/ufs/ufs/ufs_extern.h
@@ -1,4 +1,5 @@
-/* $NetBSD: ufs_extern.h,v 1.4 1994/12/14 13:03:58 mycroft Exp $ */
+/* $OpenBSD: ufs_extern.h,v 1.2 1996/02/27 07:21:25 niklas Exp $ */
+/* $NetBSD: ufs_extern.h,v 1.5 1996/02/09 22:36:03 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -36,91 +37,132 @@
*/
struct buf;
+struct componentname;
struct direct;
struct disklabel;
+struct dquot;
struct fid;
struct flock;
+struct indir;
struct inode;
struct mbuf;
struct mount;
struct nameidata;
struct proc;
struct ucred;
+struct ufs_args;
+struct ufsmount;
struct uio;
struct vattr;
struct vnode;
-struct ufs_args;
__BEGIN_DECLS
-int ufs_abortop __P((struct vop_abortop_args *));
-int ufs_access __P((struct vop_access_args *));
-int ufs_advlock __P((struct vop_advlock_args *));
-int ufs_bmap __P((struct vop_bmap_args *));
-int ufs_check_export __P((struct mount *, struct ufid *, struct mbuf *,
- struct vnode **, int *exflagsp, struct ucred **));
-int ufs_checkpath __P((struct inode *, struct inode *, struct ucred *));
-int ufs_close __P((struct vop_close_args *));
-int ufs_create __P((struct vop_create_args *));
-void ufs_dirbad __P((struct inode *, doff_t, char *));
-int ufs_dirbadentry __P((struct vnode *, struct direct *, int));
-int ufs_dirempty __P((struct inode *, ino_t, struct ucred *));
-int ufs_direnter __P((struct inode *, struct vnode *,struct componentname *));
-int ufs_dirremove __P((struct vnode *, struct componentname*));
-int ufs_dirrewrite
- __P((struct inode *, struct inode *, struct componentname *));
-int ufs_getattr __P((struct vop_getattr_args *));
-int ufs_getlbns __P((struct vnode *, daddr_t, struct indir *, int *));
-struct vnode *
- ufs_ihashget __P((dev_t, ino_t));
-void ufs_ihashinit __P((void));
-void ufs_ihashins __P((struct inode *));
-struct vnode *
- ufs_ihashlookup __P((dev_t, ino_t));
-void ufs_ihashrem __P((struct inode *));
-int ufs_inactive __P((struct vop_inactive_args *));
-int ufs_init __P((void));
-int ufs_ioctl __P((struct vop_ioctl_args *));
-int ufs_islocked __P((struct vop_islocked_args *));
+int ufs_abortop __P((void *));
+int ufs_access __P((void *));
+int ufs_advlock __P((void *));
+int ufs_bmap __P((void *));
+int ufs_close __P((void *));
+int ufs_create __P((void *));
+int ufs_getattr __P((void *));
+int ufs_inactive __P((void *));
+int ufs_ioctl __P((void *));
+int ufs_islocked __P((void *));
#ifdef NFSSERVER
-int lease_check __P((struct vop_lease_args *));
+int lease_check __P((void *));
#define ufs_lease_check lease_check
#else
-#define ufs_lease_check ((int (*) __P((struct vop_lease_args *)))nullop)
+#define ufs_lease_check ((int (*) __P((void *)))nullop)
#endif
-int ufs_link __P((struct vop_link_args *));
-int ufs_lock __P((struct vop_lock_args *));
-int ufs_lookup __P((struct vop_lookup_args *));
-int ufs_makeinode __P((int mode, struct vnode *, struct vnode **, struct componentname *));
-int ufs_mkdir __P((struct vop_mkdir_args *));
-int ufs_mknod __P((struct vop_mknod_args *));
-int ufs_mmap __P((struct vop_mmap_args *));
-int ufs_open __P((struct vop_open_args *));
-int ufs_pathconf __P((struct vop_pathconf_args *));
-int ufs_print __P((struct vop_print_args *));
-int ufs_readdir __P((struct vop_readdir_args *));
-int ufs_readlink __P((struct vop_readlink_args *));
-int ufs_reclaim __P((struct vnode *));
-int ufs_remove __P((struct vop_remove_args *));
-int ufs_rename __P((struct vop_rename_args *));
-int ufs_rmdir __P((struct vop_rmdir_args *));
-int ufs_root __P((struct mount *, struct vnode **));
-int ufs_seek __P((struct vop_seek_args *));
-int ufs_select __P((struct vop_select_args *));
-int ufs_setattr __P((struct vop_setattr_args *));
-int ufs_start __P((struct mount *, int, struct proc *));
-int ufs_strategy __P((struct vop_strategy_args *));
-int ufs_symlink __P((struct vop_symlink_args *));
-int ufs_unlock __P((struct vop_unlock_args *));
-int ufs_whiteout __P((struct vop_whiteout_args *));
-int ufs_vinit __P((struct mount *,
- int (**)(), int (**)(), struct vnode **));
-int ufsspec_close __P((struct vop_close_args *));
-int ufsspec_read __P((struct vop_read_args *));
-int ufsspec_write __P((struct vop_write_args *));
+int ufs_link __P((void *));
+int ufs_lock __P((void *));
+int ufs_lookup __P((void *));
+int ufs_mkdir __P((void *));
+int ufs_mknod __P((void *));
+int ufs_mmap __P((void *));
+int ufs_open __P((void *));
+int ufs_pathconf __P((void *));
+int ufs_print __P((void *));
+int ufs_readdir __P((void *));
+int ufs_readlink __P((void *));
+int ufs_remove __P((void *));
+int ufs_rename __P((void *));
+int ufs_rmdir __P((void *));
+int ufs_seek __P((void *));
+int ufs_select __P((void *));
+int ufs_setattr __P((void *));
+int ufs_strategy __P((void *));
+int ufs_symlink __P((void *));
+int ufs_unlock __P((void *));
+int ufs_whiteout __P((void *));
+int ufsspec_close __P((void *));
+int ufsspec_read __P((void *));
+int ufsspec_write __P((void *));
#ifdef FIFO
-int ufsfifo_read __P((struct vop_read_args *));
-int ufsfifo_write __P((struct vop_write_args *));
-int ufsfifo_close __P((struct vop_close_args *));
+int ufsfifo_read __P((void *));
+int ufsfifo_write __P((void *));
+int ufsfifo_close __P((void *));
#endif
+
+/* ufs_bmap.c */
+int ufs_bmaparray __P((struct vnode *, daddr_t, daddr_t *, struct indir *,
+ int *, int *));
+int ufs_getlbns __P((struct vnode *, daddr_t, struct indir *, int *));
+
+/* ufs_ihash.c */
+void ufs_ihashinit __P((void));
+struct vnode *ufs_ihashlookup __P((dev_t, ino_t));
+struct vnode *ufs_ihashget __P((dev_t, ino_t));
+void ufs_ihashins __P((struct inode *));
+void ufs_ihashrem __P((struct inode *));
+
+/* ufs_inode.c */
+void ufs_init __P((void));
+int ufs_reclaim __P((struct vnode *));
+
+/* ufs_lookup.c */
+void ufs_dirbad __P((struct inode *, doff_t, char *));
+int ufs_dirbadentry __P((struct vnode *, struct direct *, int));
+int ufs_direnter __P((struct inode *, struct vnode *,
+ struct componentname *));
+int ufs_direnter2 __P((struct vnode *, struct direct *, struct ucred *,
+ struct proc *));
+int ufs_dirremove __P((struct vnode *, struct componentname *));
+int ufs_dirrewrite __P((struct inode *, struct inode *,
+ struct componentname *));
+int ufs_dirempty __P((struct inode *, ino_t, struct ucred *));
+int ufs_checkpath __P((struct inode *, struct inode *, struct ucred *));
+
+/* ufs_quota.c */
+int getinoquota __P((struct inode *));
+int chkdq __P((struct inode *, long, struct ucred *, int));
+int chkdqchg __P((struct inode *, long, struct ucred *, int));
+int chkiq __P((struct inode *, long, struct ucred *, int));
+int chkiqchg __P((struct inode *, long, struct ucred *, int));
+void chkdquot __P((struct inode *));
+int quotaon __P((struct proc *, struct mount *, int, caddr_t));
+int quotaoff __P((struct proc *, struct mount *, int));
+int getquota __P((struct mount *, u_long, int, caddr_t));
+int setquota __P((struct mount *, u_long, int, caddr_t));
+int setuse __P((struct mount *, u_long, int, caddr_t));
+int qsync __P((struct mount *));
+int dqget __P((struct vnode *, u_long, struct ufsmount *, int,
+ struct dquot **));
+void dqref __P((struct dquot *));
+void dqrele __P((struct vnode *, struct dquot *));
+int dqsync __P((struct vnode *, struct dquot *));
+void dqflush __P((struct vnode *));
+
+/* ufs_vfsops.c */
+int ufs_start __P((struct mount *, int, struct proc *));
+int ufs_root __P((struct mount *, struct vnode **));
+int ufs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
+int ufs_check_export __P((struct mount *, struct ufid *, struct mbuf *,
+ struct vnode **, int *, struct ucred **));
+
+/* ufs_vnops.c */
+int ufs_vinit __P((struct mount *, int (**) __P((void *)),
+ int (**) __P((void *)), struct vnode **));
+int ufs_makeinode __P((int, struct vnode *, struct vnode **,
+ struct componentname *));
__END_DECLS
diff --git a/sys/ufs/ufs/ufs_ihash.c b/sys/ufs/ufs/ufs_ihash.c
index 6e3ea5e4c2e..a9b7227942d 100644
--- a/sys/ufs/ufs/ufs_ihash.c
+++ b/sys/ufs/ufs/ufs_ihash.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ufs_ihash.c,v 1.2 1994/06/29 06:47:26 cgd Exp $ */
+/* $OpenBSD: ufs_ihash.c,v 1.2 1996/02/27 07:21:26 niklas Exp $ */
+/* $NetBSD: ufs_ihash.c,v 1.3 1996/02/09 22:36:04 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -123,7 +124,7 @@ ufs_ihashins(ip)
struct inode **ipp, *iq;
ipp = &ihashtbl[INOHASH(ip->i_dev, ip->i_number)];
- if (iq = *ipp)
+ if ((iq = *ipp) != NULL)
iq->i_prev = &ip->i_next;
ip->i_next = iq;
ip->i_prev = ipp;
@@ -146,7 +147,7 @@ ufs_ihashrem(ip)
{
register struct inode *iq;
- if (iq = ip->i_next)
+ if ((iq = ip->i_next) != NULL)
iq->i_prev = ip->i_prev;
*ip->i_prev = iq;
#ifdef DIAGNOSTIC
diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c
index 6478a32fe7a..063c2d97010 100644
--- a/sys/ufs/ufs/ufs_inode.c
+++ b/sys/ufs/ufs/ufs_inode.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ufs_inode.c,v 1.5 1994/12/14 13:03:59 mycroft Exp $ */
+/* $OpenBSD: ufs_inode.c,v 1.2 1996/02/27 07:21:27 niklas Exp $ */
+/* $NetBSD: ufs_inode.c,v 1.6 1996/02/09 22:36:05 christos Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -47,6 +48,7 @@
#include <sys/mount.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/namei.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
@@ -55,30 +57,31 @@
u_long nextgennumber; /* Next generation number to assign. */
-int
+void
ufs_init()
{
- static int done;
+ static int done = 0;
if (done)
- return (0);
+ return;
done = 1;
ufs_ihashinit();
#ifdef QUOTA
dqinit();
#endif
- return (0);
+ return;
}
/*
* Last reference to an inode. If necessary, write or delete it.
*/
int
-ufs_inactive(ap)
+ufs_inactive(v)
+ void *v;
+{
struct vop_inactive_args /* {
struct vnode *a_vp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct inode *ip = VTOI(vp);
struct timeval tv;
@@ -139,7 +142,6 @@ ufs_reclaim(vp)
register struct vnode *vp;
{
register struct inode *ip;
- int i;
extern int prtactive;
if (prtactive && vp->v_usecount != 0)
@@ -158,10 +160,13 @@ ufs_reclaim(vp)
ip->i_devvp = 0;
}
#ifdef QUOTA
- for (i = 0; i < MAXQUOTAS; i++) {
- if (ip->i_dquot[i] != NODQUOT) {
- dqrele(vp, ip->i_dquot[i]);
- ip->i_dquot[i] = NODQUOT;
+ {
+ int i;
+ for (i = 0; i < MAXQUOTAS; i++) {
+ if (ip->i_dquot[i] != NODQUOT) {
+ dqrele(vp, ip->i_dquot[i]);
+ ip->i_dquot[i] = NODQUOT;
+ }
}
}
#endif
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index ea54eb242d4..0b31a22a17c 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ufs_lookup.c,v 1.6 1995/05/30 11:41:38 mycroft Exp $ */
+/* $OpenBSD: ufs_lookup.c,v 1.2 1996/02/27 07:21:28 niklas Exp $ */
+/* $NetBSD: ufs_lookup.c,v 1.7 1996/02/09 22:36:06 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -41,6 +42,7 @@
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/buf.h>
#include <sys/file.h>
@@ -96,13 +98,14 @@ int dirchk = 0;
* nor deleting, add name to cache
*/
int
-ufs_lookup(ap)
+ufs_lookup(v)
+ void *v;
+{
struct vop_lookup_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vdp; /* vnode for directory being searched */
register struct inode *dp; /* inode for directory being searched */
struct buf *bp; /* a buffer of directory entries */
@@ -142,7 +145,7 @@ ufs_lookup(ap)
*/
if ((dp->i_mode & IFMT) != IFDIR)
return (ENOTDIR);
- if (error = VOP_ACCESS(vdp, VEXEC, cred, cnp->cn_proc))
+ if ((error = VOP_ACCESS(vdp, VEXEC, cred, cnp->cn_proc)) != 0)
return (error);
/*
@@ -152,7 +155,7 @@ ufs_lookup(ap)
* check the name cache to see if the directory/name pair
* we are looking for is known already.
*/
- if (error = cache_lookup(vdp, vpp, cnp)) {
+ if ((error = cache_lookup(vdp, vpp, cnp)) != 0) {
int vpid; /* capability number of vnode */
if (error == ENOENT)
@@ -190,7 +193,7 @@ ufs_lookup(ap)
if (lockparent && pdp != vdp && (flags & ISLASTCN))
VOP_UNLOCK(pdp);
}
- if (error = VOP_LOCK(pdp))
+ if ((error = VOP_LOCK(pdp)) != 0)
return (error);
vdp = pdp;
dp = VTOI(pdp);
@@ -249,8 +252,9 @@ searchloop:
if ((dp->i_offset & bmask) == 0) {
if (bp != NULL)
brelse(bp);
- if (error =
- VOP_BLKATOFF(vdp, (off_t)dp->i_offset, NULL, &bp))
+ error = VOP_BLKATOFF(vdp, (off_t)dp->i_offset, NULL,
+ &bp);
+ if (error)
return (error);
entryoffsetinblock = 0;
}
@@ -272,7 +276,7 @@ searchloop:
*/
ep = (struct direct *)((char *)bp->b_data + entryoffsetinblock);
if (ep->d_reclen == 0 ||
- dirchk && ufs_dirbadentry(vdp, ep, entryoffsetinblock)) {
+ (dirchk && ufs_dirbadentry(vdp, ep, entryoffsetinblock))) {
int i;
ufs_dirbad(dp, dp->i_offset, "mangled entry");
@@ -397,7 +401,8 @@ notfound:
* Access for write is interpreted as allowing
* creation of files in the directory.
*/
- if (error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc))
+ error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc);
+ if (error)
return (error);
/*
* Return an indication of where the new directory
@@ -483,7 +488,8 @@ found:
/*
* Write access to directory required to delete files.
*/
- if (error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc))
+ error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc);
+ if (error)
return (error);
/*
* Return pointer to current entry in dp->i_offset,
@@ -500,7 +506,8 @@ found:
*vpp = vdp;
return (0);
}
- if (error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp))
+ error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp);
+ if (error)
return (error);
/*
* If directory is "sticky", then user must own
@@ -529,7 +536,8 @@ found:
*/
if (nameiop == RENAME && wantparent &&
(flags & ISLASTCN)) {
- if (error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc))
+ error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc);
+ if (error)
return (error);
/*
* Careful about locking second inode.
@@ -537,7 +545,8 @@ found:
*/
if (dp->i_number == dp->i_ino)
return (EISDIR);
- if (error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp))
+ error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp);
+ if (error)
return (error);
*vpp = tdp;
cnp->cn_flags |= SAVENAME;
@@ -568,7 +577,8 @@ found:
pdp = vdp;
if (flags & ISDOTDOT) {
VOP_UNLOCK(pdp); /* race to get the inode */
- if (error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) {
+ error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp);
+ if (error) {
VOP_LOCK(pdp);
return (error);
}
@@ -582,7 +592,8 @@ found:
VREF(vdp); /* we want ourself, ie "." */
*vpp = vdp;
} else {
- if (error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp))
+ error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp);
+ if (error)
return (error);
if (!lockparent || !(flags & ISLASTCN))
VOP_UNLOCK(pdp);
@@ -701,6 +712,7 @@ ufs_direnter(ip, dvp, cnp)
* Common entry point for directory entry removal used by ufs_direnter
* and ufs_whiteout
*/
+int
ufs_direnter2(dvp, dirp, cr, p)
struct vnode *dvp;
struct direct *dirp;
@@ -772,7 +784,8 @@ ufs_direnter2(dvp, dirp, cr, p)
/*
* Get the block containing the space for the new directory entry.
*/
- if (error = VOP_BLKATOFF(dvp, (off_t)dp->i_offset, &dirbuf, &bp))
+ error = VOP_BLKATOFF(dvp, (off_t)dp->i_offset, &dirbuf, &bp);
+ if (error)
return (error);
/*
* Find space for the new entry. In the simple case, the entry at
@@ -852,8 +865,9 @@ ufs_dirremove(dvp, cnp)
/*
* Whiteout entry: set d_ino to WINO.
*/
- if (error =
- VOP_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep, &bp))
+ error = VOP_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep,
+ &bp);
+ if (error)
return (error);
ep->d_ino = WINO;
ep->d_type = DT_WHT;
@@ -866,8 +880,9 @@ ufs_dirremove(dvp, cnp)
/*
* First entry in block: set d_ino to zero.
*/
- if (error =
- VOP_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep, &bp))
+ error = VOP_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep,
+ &bp);
+ if (error)
return (error);
ep->d_ino = 0;
error = VOP_BWRITE(bp);
@@ -877,8 +892,9 @@ ufs_dirremove(dvp, cnp)
/*
* Collapse new free space into previous entry.
*/
- if (error = VOP_BLKATOFF(dvp, (off_t)(dp->i_offset - dp->i_count),
- (char **)&ep, &bp))
+ error = VOP_BLKATOFF(dvp, (off_t)(dp->i_offset - dp->i_count),
+ (char **)&ep, &bp);
+ if (error)
return (error);
ep->d_reclen += dp->i_reclen;
error = VOP_BWRITE(bp);
@@ -901,7 +917,8 @@ ufs_dirrewrite(dp, ip, cnp)
struct vnode *vdp = ITOV(dp);
int error;
- if (error = VOP_BLKATOFF(vdp, (off_t)dp->i_offset, (char **)&ep, &bp))
+ error = VOP_BLKATOFF(vdp, (off_t)dp->i_offset, (char **)&ep, &bp);
+ if (error)
return (error);
ep->d_ino = ip->i_number;
if (vdp->v_mount->mnt_maxsymlinklen > 0)
@@ -1029,7 +1046,8 @@ ufs_checkpath(source, target, cred)
if (dirbuf.dotdot_ino == rootino)
break;
vput(vp);
- if (error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &vp)) {
+ error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &vp);
+ if (error) {
vp = NULL;
break;
}
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index 9e70ecf1525..bf17101b9e4 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ufs_quota.c,v 1.7 1995/03/08 01:51:38 cgd Exp $ */
+/* $OpenBSD: ufs_quota.c,v 1.2 1996/02/27 07:21:29 niklas Exp $ */
+/* $NetBSD: ufs_quota.c,v 1.8 1996/02/09 22:36:09 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -137,7 +138,7 @@ chkdq(ip, change, cred, flags)
for (i = 0; i < MAXQUOTAS; i++) {
if ((dq = ip->i_dquot[i]) == NODQUOT)
continue;
- if (error = chkdqchg(ip, change, cred, i))
+ if ((error = chkdqchg(ip, change, cred, i)) != 0)
return (error);
}
}
@@ -252,7 +253,7 @@ chkiq(ip, change, cred, flags)
for (i = 0; i < MAXQUOTAS; i++) {
if ((dq = ip->i_dquot[i]) == NODQUOT)
continue;
- if (error = chkiqchg(ip, change, cred, i))
+ if ((error = chkiqchg(ip, change, cred, i)) != 0)
return (error);
}
}
@@ -372,7 +373,7 @@ quotaon(p, mp, type, fname)
vpp = &ump->um_quotas[type];
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname, p);
- if (error = vn_open(&nd, FREAD|FWRITE, 0))
+ if ((error = vn_open(&nd, FREAD|FWRITE, 0)) != 0)
return (error);
vp = nd.ni_vp;
VOP_UNLOCK(vp);
@@ -417,7 +418,7 @@ again:
continue;
if (vget(vp, 1))
goto again;
- if (error = getinoquota(VTOI(vp))) {
+ if ((error = getinoquota(VTOI(vp))) != 0) {
vput(vp);
break;
}
@@ -498,7 +499,7 @@ getquota(mp, id, type, addr)
struct dquot *dq;
int error;
- if (error = dqget(NULLVP, id, VFSTOUFS(mp), type, &dq))
+ if ((error = dqget(NULLVP, id, VFSTOUFS(mp), type, &dq)) != 0)
return (error);
error = copyout((caddr_t)&dq->dq_dqb, addr, sizeof (struct dqblk));
dqrele(NULLVP, dq);
@@ -521,9 +522,10 @@ setquota(mp, id, type, addr)
struct dqblk newlim;
int error;
- if (error = copyin(addr, (caddr_t)&newlim, sizeof (struct dqblk)))
+ error = copyin(addr, (caddr_t)&newlim, sizeof (struct dqblk));
+ if (error)
return (error);
- if (error = dqget(NULLVP, id, ump, type, &ndq))
+ if ((error = dqget(NULLVP, id, ump, type, &ndq)) != 0)
return (error);
dq = ndq;
while (dq->dq_flags & DQ_LOCK) {
@@ -580,9 +582,10 @@ setuse(mp, id, type, addr)
struct dqblk usage;
int error;
- if (error = copyin(addr, (caddr_t)&usage, sizeof (struct dqblk)))
+ error = copyin(addr, (caddr_t)&usage, sizeof (struct dqblk));
+ if (error)
return (error);
- if (error = dqget(NULLVP, id, ump, type, &ndq))
+ if ((error = dqget(NULLVP, id, ump, type, &ndq)) != 0)
return (error);
dq = ndq;
while (dq->dq_flags & DQ_LOCK) {
diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c
index a53539baff1..f9ff9a1eca7 100644
--- a/sys/ufs/ufs/ufs_readwrite.c
+++ b/sys/ufs/ufs/ufs_readwrite.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ufs_readwrite.c,v 1.7 1995/07/24 21:20:53 cgd Exp $ */
+/* $OpenBSD: ufs_readwrite.c,v 1.2 1996/02/27 07:21:31 niklas Exp $ */
+/* $NetBSD: ufs_readwrite.c,v 1.8 1996/02/09 22:36:11 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -59,14 +60,16 @@
* Vnode op for reading.
*/
/* ARGSUSED */
-READ(ap)
+int
+READ(v)
+ void *v;
+{
struct vop_read_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp;
register struct inode *ip;
register struct uio *uio;
@@ -145,8 +148,9 @@ READ(ap)
break;
xfersize = size;
}
- if (error =
- uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio))
+ error = uiomove((char *)bp->b_data + blkoffset, (int)xfersize,
+ uio);
+ if (error)
break;
brelse(bp);
}
@@ -159,14 +163,16 @@ READ(ap)
/*
* Vnode op for writing.
*/
-WRITE(ap)
+int
+WRITE(v)
+ void *v;
+{
struct vop_write_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp;
register struct uio *uio;
register struct inode *ip;
diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c
index 1ba8596ceb7..95406f517a7 100644
--- a/sys/ufs/ufs/ufs_vfsops.c
+++ b/sys/ufs/ufs/ufs_vfsops.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ufs_vfsops.c,v 1.3 1995/05/10 18:00:45 cgd Exp $ */
+/* $OpenBSD: ufs_vfsops.c,v 1.2 1996/02/27 07:21:32 niklas Exp $ */
+/* $NetBSD: ufs_vfsops.c,v 1.4 1996/02/09 22:36:12 christos Exp $ */
/*
* Copyright (c) 1991, 1993, 1994
@@ -81,7 +82,7 @@ ufs_root(mp, vpp)
struct vnode *nvp;
int error;
- if (error = VFS_VGET(mp, (ino_t)ROOTINO, &nvp))
+ if ((error = VFS_VGET(mp, (ino_t)ROOTINO, &nvp)) != 0)
return (error);
*vpp = nvp;
return (0);
@@ -98,11 +99,12 @@ ufs_quotactl(mp, cmds, uid, arg, p)
caddr_t arg;
struct proc *p;
{
- int cmd, type, error;
#ifndef QUOTA
return (EOPNOTSUPP);
#else
+ int cmd, type, error;
+
if (uid == -1)
uid = p->p_cred->p_ruid;
cmd = cmds >> SUBCMDSHIFT;
@@ -115,7 +117,7 @@ ufs_quotactl(mp, cmds, uid, arg, p)
break;
/* fall through */
default:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
}
@@ -187,7 +189,7 @@ ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)
if (np == NULL)
return (EACCES);
- if (error = VFS_VGET(mp, ufhp->ufid_ino, &nvp)) {
+ if ((error = VFS_VGET(mp, ufhp->ufid_ino, &nvp)) != 0) {
*vpp = NULLVP;
return (error);
}
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 62da3ec5472..d60d319783d 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ufs_vnops.c,v 1.11 1995/10/09 11:19:32 mycroft Exp $ */
+/* $OpenBSD: ufs_vnops.c,v 1.2 1996/02/27 07:21:33 niklas Exp $ */
+/* $NetBSD: ufs_vnops.c,v 1.17 1996/02/11 02:06:13 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -59,6 +60,7 @@
#include <vm/vm.h>
#include <miscfs/specfs/specdev.h>
+#include <miscfs/fifofs/fifo.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
@@ -91,21 +93,18 @@ union _qcvt {
* Create a regular file
*/
int
-ufs_create(ap)
+ufs_create(v)
+ void *v;
+{
struct vop_create_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
- } */ *ap;
-{
- int error;
-
- if (error =
+ } */ *ap = v;
+ return
ufs_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode),
- ap->a_dvp, ap->a_vpp, ap->a_cnp))
- return (error);
- return (0);
+ ap->a_dvp, ap->a_vpp, ap->a_cnp);
}
/*
@@ -113,22 +112,23 @@ ufs_create(ap)
*/
/* ARGSUSED */
int
-ufs_mknod(ap)
+ufs_mknod(v)
+ void *v;
+{
struct vop_mknod_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vattr *vap = ap->a_vap;
register struct vnode **vpp = ap->a_vpp;
register struct inode *ip;
int error;
- if (error =
+ if ((error =
ufs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode),
- ap->a_dvp, vpp, ap->a_cnp))
+ ap->a_dvp, vpp, ap->a_cnp)) != 0)
return (error);
ip = VTOI(*vpp);
ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE;
@@ -158,14 +158,15 @@ ufs_mknod(ap)
*/
/* ARGSUSED */
int
-ufs_open(ap)
+ufs_open(v)
+ void *v;
+{
struct vop_open_args /* {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
/*
* Files marked append-only must be opened for appending.
@@ -183,14 +184,15 @@ ufs_open(ap)
*/
/* ARGSUSED */
int
-ufs_close(ap)
+ufs_close(v)
+ void *v;
+{
struct vop_close_args /* {
struct vnode *a_vp;
int a_fflag;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct inode *ip = VTOI(vp);
@@ -200,18 +202,18 @@ ufs_close(ap)
}
int
-ufs_access(ap)
+ufs_access(v)
+ void *v;
+{
struct vop_access_args /* {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct inode *ip = VTOI(vp);
mode_t mode = ap->a_mode;
- int error;
#ifdef DIAGNOSTIC
if (!VOP_ISLOCKED(vp)) {
@@ -222,12 +224,20 @@ ufs_access(ap)
#ifdef QUOTA
if (mode & VWRITE)
switch (vp->v_type) {
+ int error;
case VDIR:
case VLNK:
case VREG:
- if (error = getinoquota(ip))
+ if ((error = getinoquota(ip)) != 0)
return (error);
break;
+ case VBAD:
+ case VBLK:
+ case VCHR:
+ case VSOCK:
+ case VFIFO:
+ case VNON:
+ break;
}
#endif
@@ -240,14 +250,15 @@ ufs_access(ap)
/* ARGSUSED */
int
-ufs_getattr(ap)
+ufs_getattr(v)
+ void *v;
+{
struct vop_getattr_args /* {
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct inode *ip = VTOI(vp);
register struct vattr *vap = ap->a_vap;
@@ -264,12 +275,12 @@ ufs_getattr(ap)
vap->va_gid = ip->i_gid;
vap->va_rdev = (dev_t)ip->i_rdev;
vap->va_size = ip->i_din.di_size;
- vap->va_atime.ts_sec = ip->i_atime;
- vap->va_atime.ts_nsec = ip->i_atimensec;
- vap->va_mtime.ts_sec = ip->i_mtime;
- vap->va_mtime.ts_nsec = ip->i_mtimensec;
- vap->va_ctime.ts_sec = ip->i_ctime;
- vap->va_ctime.ts_nsec = ip->i_ctimensec;
+ vap->va_atime.tv_sec = ip->i_atime;
+ vap->va_atime.tv_nsec = ip->i_atimensec;
+ vap->va_mtime.tv_sec = ip->i_mtime;
+ vap->va_mtime.tv_nsec = ip->i_mtimensec;
+ vap->va_ctime.tv_sec = ip->i_ctime;
+ vap->va_ctime.tv_nsec = ip->i_ctimensec;
vap->va_flags = ip->i_flags;
vap->va_gen = ip->i_gen;
/* this doesn't belong here */
@@ -289,14 +300,15 @@ ufs_getattr(ap)
* Set attribute vnode op. called from several syscalls
*/
int
-ufs_setattr(ap)
+ufs_setattr(v)
+ void *v;
+{
struct vop_setattr_args /* {
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vattr *vap = ap->a_vap;
register struct vnode *vp = ap->a_vp;
register struct inode *ip = VTOI(vp);
@@ -338,31 +350,35 @@ ufs_setattr(ap)
/*
* Go through the fields and update iff not VNOVAL.
*/
- if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL)
- if (error = ufs_chown(vp, vap->va_uid, vap->va_gid, cred, p))
+ if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) {
+ error = ufs_chown(vp, vap->va_uid, vap->va_gid, cred, p);
+ if (error)
return (error);
+ }
if (vap->va_size != VNOVAL) {
if (vp->v_type == VDIR)
return (EISDIR);
- if (error = VOP_TRUNCATE(vp, vap->va_size, 0, cred, p))
+ error = VOP_TRUNCATE(vp, vap->va_size, 0, cred, p);
+ if (error)
return (error);
}
ip = VTOI(vp);
- if (vap->va_atime.ts_sec != VNOVAL || vap->va_mtime.ts_sec != VNOVAL) {
+ if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
if (cred->cr_uid != ip->i_uid &&
(error = suser(cred, &p->p_acflag)) &&
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
(error = VOP_ACCESS(vp, VWRITE, cred, p))))
return (error);
- if (vap->va_atime.ts_sec != VNOVAL)
+ if (vap->va_atime.tv_sec != VNOVAL)
ip->i_flag |= IN_ACCESS;
- if (vap->va_mtime.ts_sec != VNOVAL)
+ if (vap->va_mtime.tv_sec != VNOVAL)
ip->i_flag |= IN_CHANGE | IN_UPDATE;
- atimeval.tv_sec = vap->va_atime.ts_sec;
- atimeval.tv_usec = vap->va_atime.ts_nsec / 1000;
- mtimeval.tv_sec = vap->va_mtime.ts_sec;
- mtimeval.tv_usec = vap->va_mtime.ts_nsec / 1000;
- if (error = VOP_UPDATE(vp, &atimeval, &mtimeval, 1))
+ atimeval.tv_sec = vap->va_atime.tv_sec;
+ atimeval.tv_usec = vap->va_atime.tv_nsec / 1000;
+ mtimeval.tv_sec = vap->va_mtime.tv_sec;
+ mtimeval.tv_usec = vap->va_mtime.tv_nsec / 1000;
+ error = VOP_UPDATE(vp, &atimeval, &mtimeval, 1);
+ if (error)
return (error);
}
error = 0;
@@ -439,7 +455,7 @@ ufs_chown(vp, uid, gid, cred, p)
ogid = ip->i_gid;
ouid = ip->i_uid;
#ifdef QUOTA
- if (error = getinoquota(ip))
+ if ((error = getinoquota(ip)) != 0)
return (error);
if (ouid == uid) {
dqrele(vp, ip->i_dquot[USRQUOTA]);
@@ -511,7 +527,10 @@ good:
/* ARGSUSED */
int
-ufs_ioctl(ap)
+ufs_ioctl(v)
+ void *v;
+{
+#if 0
struct vop_ioctl_args /* {
struct vnode *a_vp;
u_long a_command;
@@ -519,23 +538,25 @@ ufs_ioctl(ap)
int a_fflag;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
-
+ } */ *ap = v;
+#endif
return (ENOTTY);
}
/* ARGSUSED */
int
-ufs_select(ap)
+ufs_select(v)
+ void *v;
+{
+#if 0
struct vop_select_args /* {
struct vnode *a_vp;
int a_which;
int a_fflags;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
+#endif
/*
* We should really check to see if I/O is possible.
@@ -550,14 +571,17 @@ ufs_select(ap)
*/
/* ARGSUSED */
int
-ufs_mmap(ap)
+ufs_mmap(v)
+ void *v;
+{
+#if 0
struct vop_mmap_args /* {
struct vnode *a_vp;
int a_fflags;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
+#endif
return (EINVAL);
}
@@ -569,31 +593,39 @@ ufs_mmap(ap)
*/
/* ARGSUSED */
int
-ufs_seek(ap)
+ufs_seek(v)
+ void *v;
+{
+#if 0
struct vop_seek_args /* {
struct vnode *a_vp;
off_t a_oldoff;
off_t a_newoff;
struct ucred *a_cred;
- } */ *ap;
-{
+ } */ *ap = v;
+#endif
return (0);
}
int
-ufs_remove(ap)
+ufs_remove(v)
+ void *v;
+{
struct vop_remove_args /* {
struct vnode *a_dvp;
struct vnode *a_vp;
struct componentname *a_cnp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct inode *ip;
register struct vnode *vp = ap->a_vp;
register struct vnode *dvp = ap->a_dvp;
int error;
+ if (vp->v_type == VDIR) {
+ error = EISDIR;
+ goto out;
+ }
ip = VTOI(vp);
if ((ip->i_flags & (IMMUTABLE | APPEND)) ||
(VTOI(dvp)->i_flags & APPEND)) {
@@ -617,15 +649,16 @@ out:
* link vnode call
*/
int
-ufs_link(ap)
+ufs_link(v)
+ void *v;
+{
struct vop_link_args /* {
+ struct vnode *a_dvp;
struct vnode *a_vp;
- struct vnode *a_tdvp;
struct componentname *a_cnp;
- } */ *ap;
-{
+ } */ *ap = v;
+ register struct vnode *dvp = ap->a_dvp;
register struct vnode *vp = ap->a_vp;
- register struct vnode *tdvp = ap->a_tdvp;
register struct componentname *cnp = ap->a_cnp;
register struct inode *ip;
struct timeval tv;
@@ -635,42 +668,47 @@ ufs_link(ap)
if ((cnp->cn_flags & HASBUF) == 0)
panic("ufs_link: no name");
#endif
- if (vp->v_mount != tdvp->v_mount) {
- VOP_ABORTOP(vp, cnp);
+ if (vp->v_type == VDIR) {
+ VOP_ABORTOP(dvp, cnp);
+ error = EISDIR;
+ goto out2;
+ }
+ if (dvp->v_mount != vp->v_mount) {
+ VOP_ABORTOP(dvp, cnp);
error = EXDEV;
goto out2;
}
- if (vp != tdvp && (error = VOP_LOCK(tdvp))) {
- VOP_ABORTOP(vp, cnp);
+ if (dvp != vp && (error = VOP_LOCK(vp))) {
+ VOP_ABORTOP(dvp, cnp);
goto out2;
}
- ip = VTOI(tdvp);
+ ip = VTOI(vp);
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
- VOP_ABORTOP(vp, cnp);
+ VOP_ABORTOP(dvp, cnp);
error = EMLINK;
goto out1;
}
if (ip->i_flags & (IMMUTABLE | APPEND)) {
- VOP_ABORTOP(vp, cnp);
+ VOP_ABORTOP(dvp, cnp);
error = EPERM;
goto out1;
}
ip->i_nlink++;
ip->i_flag |= IN_CHANGE;
tv = time;
- error = VOP_UPDATE(tdvp, &tv, &tv, 1);
+ error = VOP_UPDATE(vp, &tv, &tv, 1);
if (!error)
- error = ufs_direnter(ip, vp, cnp);
+ error = ufs_direnter(ip, dvp, cnp);
if (error) {
ip->i_nlink--;
ip->i_flag |= IN_CHANGE;
}
FREE(cnp->cn_pnbuf, M_NAMEI);
out1:
- if (vp != tdvp)
- VOP_UNLOCK(tdvp);
+ if (dvp != vp)
+ VOP_UNLOCK(vp);
out2:
- vput(vp);
+ vput(dvp);
return (error);
}
@@ -678,17 +716,18 @@ out2:
* whiteout vnode call
*/
int
-ufs_whiteout(ap)
+ufs_whiteout(v)
+ void *v;
+{
struct vop_whiteout_args /* {
struct vnode *a_dvp;
struct componentname *a_cnp;
int a_flags;
- } */ *ap;
-{
+ } */ *ap = v;
struct vnode *dvp = ap->a_dvp;
struct componentname *cnp = ap->a_cnp;
struct direct newdir;
- int error;
+ int error = 0;
switch (ap->a_flags) {
case LOOKUP:
@@ -757,7 +796,9 @@ ufs_whiteout(ap)
* directory.
*/
int
-ufs_rename(ap)
+ufs_rename(v)
+ void *v;
+{
struct vop_rename_args /* {
struct vnode *a_fdvp;
struct vnode *a_fvp;
@@ -765,8 +806,7 @@ ufs_rename(ap)
struct vnode *a_tdvp;
struct vnode *a_tvp;
struct componentname *a_tcnp;
- } */ *ap;
-{
+ } */ *ap = v;
struct vnode *tvp = ap->a_tvp;
register struct vnode *tdvp = ap->a_tdvp;
struct vnode *fvp = ap->a_fvp;
@@ -835,7 +875,7 @@ abortit:
(void) relookup(fdvp, &fvp, fcnp);
return (VOP_REMOVE(fdvp, fvp, fcnp));
}
- if (error = VOP_LOCK(fvp))
+ if ((error = VOP_LOCK(fvp)) != 0)
goto abortit;
dp = VTOI(fdvp);
ip = VTOI(fvp);
@@ -879,7 +919,7 @@ abortit:
ip->i_nlink++;
ip->i_flag |= IN_CHANGE;
tv = time;
- if (error = VOP_UPDATE(fvp, &tv, &tv, 1)) {
+ if ((error = VOP_UPDATE(fvp, &tv, &tv, 1)) != 0) {
VOP_UNLOCK(fvp);
goto bad;
}
@@ -903,11 +943,11 @@ abortit:
goto bad;
if (xp != NULL)
vput(tvp);
- if (error = ufs_checkpath(ip, dp, tcnp->cn_cred))
+ if ((error = ufs_checkpath(ip, dp, tcnp->cn_cred)) != 0)
goto out;
if ((tcnp->cn_flags & SAVESTART) == 0)
panic("ufs_rename: lost to startdir");
- if (error = relookup(tdvp, &tvp, tcnp))
+ if ((error = relookup(tdvp, &tvp, tcnp)) != 0)
goto out;
dp = VTOI(tdvp);
xp = NULL;
@@ -936,10 +976,10 @@ abortit:
}
dp->i_nlink++;
dp->i_flag |= IN_CHANGE;
- if (error = VOP_UPDATE(tdvp, &tv, &tv, 1))
+ if ((error = VOP_UPDATE(tdvp, &tv, &tv, 1)) != 0)
goto bad;
}
- if (error = ufs_direnter(ip, tdvp, tcnp)) {
+ if ((error = ufs_direnter(ip, tdvp, tcnp)) != 0) {
if (doingdirectory && newparent) {
dp->i_nlink--;
dp->i_flag |= IN_CHANGE;
@@ -988,7 +1028,7 @@ abortit:
error = EISDIR;
goto bad;
}
- if (error = ufs_dirrewrite(dp, ip, tcnp))
+ if ((error = ufs_dirrewrite(dp, ip, tcnp)) != 0)
goto bad;
/*
* If the target directory is in the same
@@ -1143,14 +1183,15 @@ static struct odirtemplate omastertemplate = {
* Mkdir system call
*/
int
-ufs_mkdir(ap)
+ufs_mkdir(v)
+ void *v;
+{
struct vop_mkdir_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *dvp = ap->a_dvp;
register struct vattr *vap = ap->a_vap;
register struct componentname *cnp = ap->a_cnp;
@@ -1176,7 +1217,7 @@ ufs_mkdir(ap)
* but not have it entered in the parent directory. The entry is
* made later after writing "." and ".." entries.
*/
- if (error = VOP_VALLOC(dvp, dmode, cnp->cn_cred, &tvp))
+ if ((error = VOP_VALLOC(dvp, dmode, cnp->cn_cred, &tvp)) != 0)
goto out;
ip = VTOI(tvp);
ip->i_uid = cnp->cn_cred->cr_uid;
@@ -1208,7 +1249,7 @@ ufs_mkdir(ap)
*/
dp->i_nlink++;
dp->i_flag |= IN_CHANGE;
- if (error = VOP_UPDATE(dvp, &tv, &tv, 1))
+ if ((error = VOP_UPDATE(dvp, &tv, &tv, 1)) != 0)
goto bad;
/* Initialize directory with "." and ".." from static template. */
@@ -1235,7 +1276,7 @@ ufs_mkdir(ap)
}
/* Directory set up, now install it's entry in the parent directory. */
- if (error = ufs_direnter(ip, dvp, cnp)) {
+ if ((error = ufs_direnter(ip, dvp, cnp)) != 0) {
dp->i_nlink--;
dp->i_flag |= IN_CHANGE;
}
@@ -1260,13 +1301,14 @@ out:
* Rmdir system call.
*/
int
-ufs_rmdir(ap)
+ufs_rmdir(v)
+ void *v;
+{
struct vop_rmdir_args /* {
struct vnode *a_dvp;
struct vnode *a_vp;
struct componentname *a_cnp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct vnode *dvp = ap->a_dvp;
register struct componentname *cnp = ap->a_cnp;
@@ -1305,7 +1347,7 @@ ufs_rmdir(ap)
* inode. If we crash in between, the directory
* will be reattached to lost+found,
*/
- if (error = ufs_dirremove(dvp, cnp))
+ if ((error = ufs_dirremove(dvp, cnp)) != 0)
goto out;
dp->i_nlink--;
dp->i_flag |= IN_CHANGE;
@@ -1338,21 +1380,23 @@ out:
* symlink -- make a symbolic link
*/
int
-ufs_symlink(ap)
+ufs_symlink(v)
+ void *v;
+{
struct vop_symlink_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
char *a_target;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp, **vpp = ap->a_vpp;
register struct inode *ip;
int len, error;
- if (error = ufs_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp,
- vpp, ap->a_cnp))
+ error = ufs_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp,
+ vpp, ap->a_cnp);
+ if (error)
return (error);
vp = *vpp;
len = strlen(ap->a_target);
@@ -1379,7 +1423,9 @@ ufs_symlink(ap)
* by <sys/dirent.h>.
*/
int
-ufs_readdir(ap)
+ufs_readdir(v)
+ void *v;
+{
struct vop_readdir_args /* {
struct vnode *a_vp;
struct uio *a_uio;
@@ -1387,8 +1433,7 @@ ufs_readdir(ap)
int *a_eofflag;
u_long *a_cookies;
int ncookies;
- } */ *ap;
-{
+ } */ *ap = v;
register struct uio *uio = ap->a_uio;
int error;
size_t count, lost;
@@ -1477,13 +1522,14 @@ ufs_readdir(ap)
* Return target name of a symbolic link
*/
int
-ufs_readlink(ap)
+ufs_readlink(v)
+ void *v;
+{
struct vop_readlink_args /* {
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct inode *ip = VTOI(vp);
int isize;
@@ -1503,12 +1549,13 @@ ufs_readlink(ap)
*/
/* ARGSUSED */
int
-ufs_abortop(ap)
+ufs_abortop(v)
+ void *v;
+{
struct vop_abortop_args /* {
struct vnode *a_dvp;
struct componentname *a_cnp;
- } */ *ap;
-{
+ } */ *ap = v;
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
return (0);
@@ -1518,14 +1565,17 @@ ufs_abortop(ap)
* Lock an inode. If its already locked, set the WANT bit and sleep.
*/
int
-ufs_lock(ap)
+ufs_lock(v)
+ void *v;
+{
struct vop_lock_args /* {
struct vnode *a_vp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct inode *ip;
+#ifdef DIAGNOSTIC
struct proc *p = curproc; /* XXX */
+#endif
start:
while (vp->v_flag & VXLOCK) {
@@ -1568,13 +1618,16 @@ start:
*/
int lockcount = 90;
int
-ufs_unlock(ap)
+ufs_unlock(v)
+ void *v;
+{
struct vop_unlock_args /* {
struct vnode *a_vp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct inode *ip = VTOI(ap->a_vp);
+#ifdef DIAGNOSTIC
struct proc *p = curproc; /* XXX */
+#endif
#ifdef DIAGNOSTIC
if ((ip->i_flag & IN_LOCKED) == 0) {
@@ -1599,11 +1652,12 @@ ufs_unlock(ap)
* Check for a locked inode.
*/
int
-ufs_islocked(ap)
+ufs_islocked(v)
+ void *v;
+{
struct vop_islocked_args /* {
struct vnode *a_vp;
- } */ *ap;
-{
+ } */ *ap = v;
if (VTOI(ap->a_vp)->i_flag & IN_LOCKED)
return (1);
@@ -1615,11 +1669,12 @@ ufs_islocked(ap)
* then call the device strategy routine.
*/
int
-ufs_strategy(ap)
+ufs_strategy(v)
+ void *v;
+{
struct vop_strategy_args /* {
struct buf *a_bp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct buf *bp = ap->a_bp;
register struct vnode *vp = bp->b_vp;
register struct inode *ip;
@@ -1629,8 +1684,9 @@ ufs_strategy(ap)
if (vp->v_type == VBLK || vp->v_type == VCHR)
panic("ufs_strategy: spec");
if (bp->b_blkno == bp->b_lblkno) {
- if (error =
- VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno, NULL)) {
+ error = VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno,
+ NULL);
+ if (error) {
bp->b_error = error;
bp->b_flags |= B_ERROR;
biodone(bp);
@@ -1653,11 +1709,12 @@ ufs_strategy(ap)
* Print out the contents of an inode.
*/
int
-ufs_print(ap)
+ufs_print(v)
+ void *v;
+{
struct vop_print_args /* {
struct vnode *a_vp;
- } */ *ap;
-{
+ } */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct inode *ip = VTOI(vp);
@@ -1681,14 +1738,15 @@ ufs_print(ap)
* Read wrapper for special devices.
*/
int
-ufsspec_read(ap)
+ufsspec_read(v)
+ void *v;
+{
struct vop_read_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
- } */ *ap;
-{
+ } */ *ap = v;
/*
* Set access flag.
@@ -1701,14 +1759,15 @@ ufsspec_read(ap)
* Write wrapper for special devices.
*/
int
-ufsspec_write(ap)
+ufsspec_write(v)
+ void *v;
+{
struct vop_write_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
- } */ *ap;
-{
+ } */ *ap = v;
/*
* Set update and change flags.
@@ -1723,14 +1782,15 @@ ufsspec_write(ap)
* Update the times on the inode then do device close.
*/
int
-ufsspec_close(ap)
+ufsspec_close(v)
+ void *v;
+{
struct vop_close_args /* {
struct vnode *a_vp;
int a_fflag;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
+ } */ *ap = v;
register struct inode *ip = VTOI(ap->a_vp);
if (ap->a_vp->v_usecount > 1 && !(ip->i_flag & IN_LOCKED))
@@ -1743,15 +1803,16 @@ ufsspec_close(ap)
* Read wrapper for fifo's
*/
int
-ufsfifo_read(ap)
+ufsfifo_read(v)
+ void *v;
+{
struct vop_read_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
- } */ *ap;
-{
- extern int (**fifo_vnodeop_p)();
+ } */ *ap = v;
+ extern int (**fifo_vnodeop_p) __P((void *));
/*
* Set access flag.
@@ -1764,15 +1825,16 @@ ufsfifo_read(ap)
* Write wrapper for fifo's.
*/
int
-ufsfifo_write(ap)
+ufsfifo_write(v)
+ void *v;
+{
struct vop_write_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
- } */ *ap;
-{
- extern int (**fifo_vnodeop_p)();
+ } */ *ap = v;
+ extern int (**fifo_vnodeop_p) __P((void *));
/*
* Set update and change flags.
@@ -1786,15 +1848,17 @@ ufsfifo_write(ap)
*
* Update the times on the inode then do device close.
*/
-ufsfifo_close(ap)
+int
+ufsfifo_close(v)
+ void *v;
+{
struct vop_close_args /* {
struct vnode *a_vp;
int a_fflag;
struct ucred *a_cred;
struct proc *a_p;
- } */ *ap;
-{
- extern int (**fifo_vnodeop_p)();
+ } */ *ap = v;
+ extern int (**fifo_vnodeop_p) __P((void *));
register struct inode *ip = VTOI(ap->a_vp);
if (ap->a_vp->v_usecount > 1 && !(ip->i_flag & IN_LOCKED))
@@ -1806,13 +1870,15 @@ ufsfifo_close(ap)
/*
* Return POSIX pathconf information applicable to ufs filesystems.
*/
-ufs_pathconf(ap)
+int
+ufs_pathconf(v)
+ void *v;
+{
struct vop_pathconf_args /* {
struct vnode *a_vp;
int a_name;
register_t *a_retval;
- } */ *ap;
-{
+ } */ *ap = v;
switch (ap->a_name) {
case _PC_LINK_MAX:
@@ -1843,15 +1909,16 @@ ufs_pathconf(ap)
* Advisory record locking support
*/
int
-ufs_advlock(ap)
+ufs_advlock(v)
+ void *v;
+{
struct vop_advlock_args /* {
struct vnode *a_vp;
caddr_t a_id;
int a_op;
struct flock *a_fl;
int a_flags;
- } */ *ap;
-{
+ } */ *ap = v;
register struct inode *ip = VTOI(ap->a_vp);
return (lf_advlock(&ip->i_lockf, ip->i_size, ap->a_id, ap->a_op,
@@ -1865,8 +1932,8 @@ ufs_advlock(ap)
int
ufs_vinit(mntp, specops, fifoops, vpp)
struct mount *mntp;
- int (**specops)();
- int (**fifoops)();
+ int (**specops) __P((void *));
+ int (**fifoops) __P((void *));
struct vnode **vpp;
{
struct inode *ip;
@@ -1878,7 +1945,7 @@ ufs_vinit(mntp, specops, fifoops, vpp)
case VCHR:
case VBLK:
vp->v_op = specops;
- if (nvp = checkalias(vp, ip->i_rdev, mntp)) {
+ if ((nvp = checkalias(vp, ip->i_rdev, mntp)) != NULL) {
/*
* Discard unneeded vnode, but save its inode.
*/
@@ -1904,6 +1971,13 @@ ufs_vinit(mntp, specops, fifoops, vpp)
#else
return (EOPNOTSUPP);
#endif
+ case VNON:
+ case VBAD:
+ case VSOCK:
+ case VLNK:
+ case VDIR:
+ case VREG:
+ break;
}
if (ip->i_number == ROOTINO)
vp->v_flag |= VROOT;
@@ -1940,17 +2014,14 @@ ufs_makeinode(mode, dvp, vpp, cnp)
if ((mode & IFMT) == 0)
mode |= IFREG;
- if (error = VOP_VALLOC(dvp, mode, cnp->cn_cred, &tvp)) {
+ if ((error = VOP_VALLOC(dvp, mode, cnp->cn_cred, &tvp)) != 0) {
free(cnp->cn_pnbuf, M_NAMEI);
vput(dvp);
return (error);
}
ip = VTOI(tvp);
ip->i_gid = pdir->i_gid;
- if ((mode & IFMT) == IFLNK)
- ip->i_uid = pdir->i_uid;
- else
- ip->i_uid = cnp->cn_cred->cr_uid;
+ ip->i_uid = cnp->cn_cred->cr_uid;
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
@@ -1976,9 +2047,9 @@ ufs_makeinode(mode, dvp, vpp, cnp)
* Make sure inode goes to disk before directory entry.
*/
tv = time;
- if (error = VOP_UPDATE(tvp, &tv, &tv, 1))
+ if ((error = VOP_UPDATE(tvp, &tv, &tv, 1)) != 0)
goto bad;
- if (error = ufs_direnter(ip, dvp, cnp))
+ if ((error = ufs_direnter(ip, dvp, cnp)) != 0)
goto bad;
if ((cnp->cn_flags & SAVESTART) == 0)
FREE(cnp->cn_pnbuf, M_NAMEI);