ufs prototype changes

This commit is contained in:
christos 1996-02-09 22:36:00 +00:00
parent 573481f5fc
commit 273fa18bff
9 changed files with 426 additions and 287 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_bmap.c,v 1.2 1994/06/29 06:47:24 cgd Exp $ */
/* $NetBSD: ufs_bmap.c,v 1.3 1996/02/09 22:36:00 christos Exp $ */
/*
* Copyright (c) 1989, 1991, 1993
@ -41,6 +41,7 @@
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/vnode.h>
@ -61,15 +62,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 +116,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 +140,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 +168,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 +192,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);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_extern.h,v 1.4 1994/12/14 13:03:58 mycroft Exp $ */
/* $NetBSD: ufs_extern.h,v 1.5 1996/02/09 22:36:03 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -36,91 +36,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

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_ihash.c,v 1.2 1994/06/29 06:47:26 cgd 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 +123,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 +146,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

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_inode.c,v 1.5 1994/12/14 13:03:59 mycroft Exp $ */
/* $NetBSD: ufs_inode.c,v 1.6 1996/02/09 22:36:05 christos Exp $ */
/*
* Copyright (c) 1991, 1993
@ -47,6 +47,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 +56,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 +141,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 +159,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

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_lookup.c,v 1.6 1995/05/30 11:41:38 mycroft Exp $ */
/* $NetBSD: ufs_lookup.c,v 1.7 1996/02/09 22:36:06 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@ -41,6 +41,7 @@
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/buf.h>
#include <sys/file.h>
@ -96,13 +97,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 +144,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 +154,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 +192,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 +251,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 +275,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 +400,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 +487,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 +505,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 +535,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 +544,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 +576,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 +591,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 +711,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 +783,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 +864,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 +879,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 +891,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 +916,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 +1045,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;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_quota.c,v 1.7 1995/03/08 01:51:38 cgd Exp $ */
/* $NetBSD: ufs_quota.c,v 1.8 1996/02/09 22:36:09 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -137,7 +137,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 +252,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 +372,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 +417,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 +498,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 +521,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 +581,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) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_readwrite.c,v 1.7 1995/07/24 21:20:53 cgd Exp $ */
/* $NetBSD: ufs_readwrite.c,v 1.8 1996/02/09 22:36:11 christos Exp $ */
/*-
* Copyright (c) 1993
@ -59,14 +59,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 +147,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 +162,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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vfsops.c,v 1.3 1995/05/10 18:00:45 cgd Exp $ */
/* $NetBSD: ufs_vfsops.c,v 1.4 1996/02/09 22:36:12 christos Exp $ */
/*
* Copyright (c) 1991, 1993, 1994
@ -81,7 +81,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 +98,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 +116,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 +188,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);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vnops.c,v 1.14 1996/02/09 14:46:08 mycroft Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.15 1996/02/09 22:36:13 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -59,6 +59,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 +92,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 +111,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 +157,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 +183,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 +201,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 +223,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 +249,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;
@ -289,14 +299,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,13 +349,16 @@ 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);
@ -362,7 +376,8 @@ ufs_setattr(ap)
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;
if (error = VOP_UPDATE(vp, &atimeval, &mtimeval, 1))
error = VOP_UPDATE(vp, &atimeval, &mtimeval, 1);
if (error)
return (error);
}
error = 0;
@ -439,7 +454,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 +526,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 +537,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 +570,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,26 +592,30 @@ 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;
@ -621,14 +648,15 @@ 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 componentname *a_cnp;
} */ *ap;
{
register struct vnode *dvp = ap->a_dvp;
} */ *ap = v;
register struct vnode *tdvp = ap->a_dvp;
register struct vnode *vp = ap->a_vp;
register struct componentname *cnp = ap->a_cnp;
register struct inode *ip;
@ -687,17 +715,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:
@ -766,7 +795,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;
@ -774,8 +805,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;
@ -844,7 +874,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);
@ -888,7 +918,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;
}
@ -912,11 +942,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;
@ -945,10 +975,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;
@ -997,7 +1027,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
@ -1152,14 +1182,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;
@ -1185,7 +1216,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;
@ -1217,7 +1248,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. */
@ -1244,7 +1275,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;
}
@ -1269,13 +1300,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;
@ -1314,7 +1346,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;
@ -1347,21 +1379,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);
@ -1388,7 +1422,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;
@ -1396,8 +1432,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;
@ -1486,13 +1521,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;
@ -1512,12 +1548,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);
@ -1527,14 +1564,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) {
@ -1577,13 +1617,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) {
@ -1608,11 +1651,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);
@ -1624,11 +1668,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;
@ -1638,8 +1683,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);
@ -1662,11 +1708,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);
@ -1690,14 +1737,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.
@ -1710,14 +1758,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.
@ -1732,14 +1781,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))
@ -1752,15 +1802,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.
@ -1773,15 +1824,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.
@ -1795,15 +1847,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))
@ -1815,13 +1869,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:
@ -1852,15 +1908,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,
@ -1874,8 +1931,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;
@ -1887,7 +1944,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.
*/
@ -1913,6 +1970,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;
@ -1949,14 +2013,17 @@ 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;
ip->i_uid = cnp->cn_cred->cr_uid;
if ((mode & IFMT) == IFLNK)
ip->i_uid = pdir->i_uid;
else
ip->i_uid = cnp->cn_cred->cr_uid;
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
@ -1982,9 +2049,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);