SCCS-vsn: sys/ufs/ffs/ffs_alloc.c 7.36
SCCS-vsn: sys/ufs/ffs/ffs_balloc.c 7.20
SCCS-vsn: sys/ufs/ffs/ffs_inode.c 7.52
SCCS-vsn: sys/ufs/ffs/ffs_subr.c 7.20
SCCS-vsn: sys/ufs/ffs/ffs_vnops.c 7.78
SCCS-vsn: sys/ufs/ffs/ufs_inode.c 7.46
SCCS-vsn: sys/ufs/ufs/ufs_inode.c 7.46
SCCS-vsn: sys/ufs/ffs/ufs_lookup.c 7.46
SCCS-vsn: sys/ufs/ufs/ufs_lookup.c 7.46
SCCS-vsn: sys/ufs/ffs/ufs_vnops.c 7.91
SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 7.91
SCCS-vsn: sys/ufs/lfs/lfs_alloc.c 7.45
SCCS-vsn: sys/ufs/lfs/lfs_bio.c 7.10
SCCS-vsn: sys/ufs/lfs/lfs_balloc.c 7.30
SCCS-vsn: sys/ufs/lfs/lfs_inode.c 7.65
SCCS-vsn: sys/ufs/lfs/lfs_subr.c 7.11
SCCS-vsn: sys/ufs/lfs/lfs_vnops.c 7.82
SCCS-vsn: sys/ufs/mfs/mfs_vnops.c 7.32
SCCS-vsn: sys/miscfs/deadfs/dead_vnops.c 7.19
SCCS-vsn: sys/miscfs/fifofs/fifo_vnops.c 7.14
SCCS-vsn: sys/miscfs/specfs/spec_vnops.c 7.44
SCCS-vsn: sys/nfs/nfs_bio.c 7.25
SCCS-vsn: sys/nfs/nfs_node.c 7.39
SCCS-vsn: sys/nfs/nfs_vnops.c 7.76
24 files changed:
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)dead_vnops.c 7.18 (Berkeley) %G%
+ * @(#)dead_vnops.c 7.19 (Berkeley) %G%
int
dead_lookup (ap)
struct vop_lookup_args *ap;
int
dead_lookup (ap)
struct vop_lookup_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#undef dvp
-#undef vpp
-#undef cnp
/*
* Open always fails as if device did not exist.
/*
* Open always fails as if device did not exist.
/* ARGSUSED */
dead_open (ap)
struct vop_open_args *ap;
/* ARGSUSED */
dead_open (ap)
struct vop_open_args *ap;
-#define vp (ap->a_vp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef mode
-#undef cred
-#undef p
/* ARGSUSED */
dead_read (ap)
struct vop_read_args *ap;
/* ARGSUSED */
dead_read (ap)
struct vop_read_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
+ if (chkvnlock(ap->a_vp))
panic("dead_read: lock");
/*
* Return EOF for character devices, EIO for others
*/
panic("dead_read: lock");
/*
* Return EOF for character devices, EIO for others
*/
- if (vp->v_type != VCHR)
+ if (ap->a_vp->v_type != VCHR)
return (EIO);
return (0);
}
return (EIO);
return (0);
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/* ARGSUSED */
dead_write (ap)
struct vop_write_args *ap;
/* ARGSUSED */
dead_write (ap)
struct vop_write_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
+ if (chkvnlock(ap->a_vp))
panic("dead_write: lock");
return (EIO);
}
panic("dead_write: lock");
return (EIO);
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Device ioctl operation.
/*
* Device ioctl operation.
/* ARGSUSED */
dead_ioctl (ap)
struct vop_ioctl_args *ap;
/* ARGSUSED */
dead_ioctl (ap)
struct vop_ioctl_args *ap;
-#define vp (ap->a_vp)
-#define com (ap->a_command)
-#define data (ap->a_data)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
+ if (!chkvnlock(ap->a_vp))
- return (VOP_IOCTL(vp, com, data, fflag, cred, p));
+ return (VOP_IOCTL(ap->a_vp, ap->a_command, ap->a_data, ap->a_fflag, ap->a_cred, ap->a_p));
-#undef vp
-#undef com
-#undef data
-#undef fflag
-#undef cred
-#undef p
/* ARGSUSED */
dead_select (ap)
struct vop_select_args *ap;
/* ARGSUSED */
dead_select (ap)
struct vop_select_args *ap;
-#define vp (ap->a_vp)
-#define which (ap->a_which)
-#define fflags (ap->a_fflags)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef which
-#undef fflags
-#undef cred
-#undef p
/*
* Just call the device strategy routine
*/
dead_strategy (ap)
struct vop_strategy_args *ap;
/*
* Just call the device strategy routine
*/
dead_strategy (ap)
struct vop_strategy_args *ap;
- if (bp->b_vp == NULL || !chkvnlock(bp->b_vp)) {
- bp->b_flags |= B_ERROR;
- biodone(bp);
+ if (ap->a_bp->b_vp == NULL || !chkvnlock(ap->a_bp->b_vp)) {
+ ap->a_bp->b_flags |= B_ERROR;
+ biodone(ap->a_bp);
- return (VOP_STRATEGY(bp));
+ return (VOP_STRATEGY(ap->a_bp));
/*
* Wait until the vnode has finished changing state.
*/
dead_lock (ap)
struct vop_lock_args *ap;
/*
* Wait until the vnode has finished changing state.
*/
dead_lock (ap)
struct vop_lock_args *ap;
+ if (!chkvnlock(ap->a_vp))
+ return (VOP_LOCK(ap->a_vp));
/*
* Wait until the vnode has finished changing state.
*/
dead_bmap (ap)
struct vop_bmap_args *ap;
/*
* Wait until the vnode has finished changing state.
*/
dead_bmap (ap)
struct vop_bmap_args *ap;
-#define vp (ap->a_vp)
-#define bn (ap->a_bn)
-#define vpp (ap->a_vpp)
-#define bnp (ap->a_bnp)
+ if (!chkvnlock(ap->a_vp))
- return (VOP_BMAP(vp, bn, vpp, bnp));
+ return (VOP_BMAP(ap->a_vp, ap->a_bn, ap->a_vpp, ap->a_bnp));
-#undef vp
-#undef bn
-#undef vpp
-#undef bnp
/*
* Print out the contents of a dead vnode.
/*
* Print out the contents of a dead vnode.
/* ARGSUSED */
dead_print (ap)
struct vop_print_args *ap;
/* ARGSUSED */
dead_print (ap)
struct vop_print_args *ap;
{
printf("tag VT_NON, dead vnode\n");
}
{
printf("tag VT_NON, dead vnode\n");
}
/*
* Empty vnode failed operation
/*
* Empty vnode failed operation
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)fifo_vnops.c 7.13 (Berkeley) %G%
+ * @(#)fifo_vnops.c 7.14 (Berkeley) %G%
/* ARGSUSED */
fifo_lookup (ap)
struct vop_lookup_args *ap;
/* ARGSUSED */
fifo_lookup (ap)
struct vop_lookup_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#undef dvp
-#undef vpp
-#undef cnp
/*
* Open called to set up a new instance of a fifo or
/*
* Open called to set up a new instance of a fifo or
/* ARGSUSED */
fifo_open (ap)
struct vop_open_args *ap;
/* ARGSUSED */
fifo_open (ap)
struct vop_open_args *ap;
-#define vp (ap->a_vp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
USES_VOP_CLOSE;
USES_VOP_LOCK;
{
USES_VOP_CLOSE;
USES_VOP_LOCK;
int error;
static char openstr[] = "fifo";
int error;
static char openstr[] = "fifo";
- if ((mode & (FREAD|FWRITE)) == (FREAD|FWRITE))
+ if ((ap->a_mode & (FREAD|FWRITE)) == (FREAD|FWRITE))
- if ((fip = vp->v_fifoinfo) == NULL) {
+ if ((fip = ap->a_vp->v_fifoinfo) == NULL) {
MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK);
MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK);
+ ap->a_vp->v_fifoinfo = fip;
if (error = socreate(AF_UNIX, &rso, SOCK_STREAM, 0)) {
free(fip, M_VNODE);
if (error = socreate(AF_UNIX, &rso, SOCK_STREAM, 0)) {
free(fip, M_VNODE);
+ ap->a_vp->v_fifoinfo = NULL;
return (error);
}
fip->fi_readsock = rso;
if (error = socreate(AF_UNIX, &wso, SOCK_STREAM, 0)) {
(void)soclose(rso);
free(fip, M_VNODE);
return (error);
}
fip->fi_readsock = rso;
if (error = socreate(AF_UNIX, &wso, SOCK_STREAM, 0)) {
(void)soclose(rso);
free(fip, M_VNODE);
+ ap->a_vp->v_fifoinfo = NULL;
return (error);
}
fip->fi_writesock = wso;
return (error);
}
fip->fi_writesock = wso;
(void)soclose(wso);
(void)soclose(rso);
free(fip, M_VNODE);
(void)soclose(wso);
(void)soclose(rso);
free(fip, M_VNODE);
+ ap->a_vp->v_fifoinfo = NULL;
return (error);
}
fip->fi_readers = fip->fi_writers = 0;
return (error);
}
fip->fi_readers = fip->fi_writers = 0;
rso->so_state |= SS_CANTSENDMORE;
}
error = 0;
rso->so_state |= SS_CANTSENDMORE;
}
error = 0;
+ if (ap->a_mode & FREAD) {
fip->fi_readers++;
if (fip->fi_readers == 1) {
fip->fi_writesock->so_state &= ~SS_CANTSENDMORE;
if (fip->fi_writers > 0)
wakeup((caddr_t)&fip->fi_writers);
}
fip->fi_readers++;
if (fip->fi_readers == 1) {
fip->fi_writesock->so_state &= ~SS_CANTSENDMORE;
if (fip->fi_writers > 0)
wakeup((caddr_t)&fip->fi_writers);
}
+ if (ap->a_mode & O_NONBLOCK)
return (0);
while (fip->fi_writers == 0) {
return (0);
while (fip->fi_writers == 0) {
error = tsleep((caddr_t)&fip->fi_readers, PSOCK,
openstr, 0);
error = tsleep((caddr_t)&fip->fi_readers, PSOCK,
openstr, 0);
if (error)
break;
}
} else {
fip->fi_writers++;
if (error)
break;
}
} else {
fip->fi_writers++;
- if (fip->fi_readers == 0 && (mode & O_NONBLOCK)) {
+ if (fip->fi_readers == 0 && (ap->a_mode & O_NONBLOCK)) {
error = ENXIO;
} else {
if (fip->fi_writers == 1) {
error = ENXIO;
} else {
if (fip->fi_writers == 1) {
wakeup((caddr_t)&fip->fi_readers);
}
while (fip->fi_readers == 0) {
wakeup((caddr_t)&fip->fi_readers);
}
while (fip->fi_readers == 0) {
error = tsleep((caddr_t)&fip->fi_writers,
PSOCK, openstr, 0);
error = tsleep((caddr_t)&fip->fi_writers,
PSOCK, openstr, 0);
if (error)
break;
}
}
}
if (error)
if (error)
break;
}
}
}
if (error)
- VOP_CLOSE(vp, mode, cred, p);
+ VOP_CLOSE(ap->a_vp, ap->a_mode, ap->a_cred, ap->a_p);
-#undef vp
-#undef mode
-#undef cred
-#undef p
/* ARGSUSED */
fifo_read (ap)
struct vop_read_args *ap;
/* ARGSUSED */
fifo_read (ap)
struct vop_read_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
USES_VOP_LOCK;
USES_VOP_UNLOCK;
{
USES_VOP_LOCK;
USES_VOP_UNLOCK;
- register struct socket *rso = vp->v_fifoinfo->fi_readsock;
+ register struct socket *rso = ap->a_vp->v_fifoinfo->fi_readsock;
int error, startresid;
#ifdef DIAGNOSTIC
int error, startresid;
#ifdef DIAGNOSTIC
- if (uio->uio_rw != UIO_READ)
+ if (ap->a_uio->uio_rw != UIO_READ)
panic("fifo_read mode");
#endif
panic("fifo_read mode");
#endif
- if (uio->uio_resid == 0)
+ if (ap->a_uio->uio_resid == 0)
- if (ioflag & IO_NDELAY)
+ if (ap->a_ioflag & IO_NDELAY)
rso->so_state |= SS_NBIO;
rso->so_state |= SS_NBIO;
- startresid = uio->uio_resid;
- VOP_UNLOCK(vp);
- error = soreceive(rso, (struct mbuf **)0, uio, (int *)0,
+ startresid = ap->a_uio->uio_resid;
+ VOP_UNLOCK(ap->a_vp);
+ error = soreceive(rso, (struct mbuf **)0, ap->a_uio, (int *)0,
(struct mbuf **)0, (struct mbuf **)0);
(struct mbuf **)0, (struct mbuf **)0);
/*
* Clear EOF indication after first such return.
*/
/*
* Clear EOF indication after first such return.
*/
- if (uio->uio_resid == startresid)
+ if (ap->a_uio->uio_resid == startresid)
rso->so_state &= ~SS_CANTRCVMORE;
rso->so_state &= ~SS_CANTRCVMORE;
- if (ioflag & IO_NDELAY)
+ if (ap->a_ioflag & IO_NDELAY)
rso->so_state &= ~SS_NBIO;
return (error);
}
rso->so_state &= ~SS_NBIO;
return (error);
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/* ARGSUSED */
fifo_write (ap)
struct vop_write_args *ap;
/* ARGSUSED */
fifo_write (ap)
struct vop_write_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
USES_VOP_LOCK;
USES_VOP_UNLOCK;
{
USES_VOP_LOCK;
USES_VOP_UNLOCK;
- struct socket *wso = vp->v_fifoinfo->fi_writesock;
+ struct socket *wso = ap->a_vp->v_fifoinfo->fi_writesock;
int error;
#ifdef DIAGNOSTIC
int error;
#ifdef DIAGNOSTIC
- if (uio->uio_rw != UIO_WRITE)
+ if (ap->a_uio->uio_rw != UIO_WRITE)
panic("fifo_write mode");
#endif
panic("fifo_write mode");
#endif
- if (ioflag & IO_NDELAY)
+ if (ap->a_ioflag & IO_NDELAY)
wso->so_state |= SS_NBIO;
wso->so_state |= SS_NBIO;
- VOP_UNLOCK(vp);
- error = sosend(wso, (struct mbuf *)0, uio, 0, (struct mbuf *)0, 0);
- VOP_LOCK(vp);
- if (ioflag & IO_NDELAY)
+ VOP_UNLOCK(ap->a_vp);
+ error = sosend(wso, (struct mbuf *)0, ap->a_uio, 0, (struct mbuf *)0, 0);
+ VOP_LOCK(ap->a_vp);
+ if (ap->a_ioflag & IO_NDELAY)
wso->so_state &= ~SS_NBIO;
return (error);
}
wso->so_state &= ~SS_NBIO;
return (error);
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Device ioctl operation.
/*
* Device ioctl operation.
/* ARGSUSED */
fifo_ioctl (ap)
struct vop_ioctl_args *ap;
/* ARGSUSED */
fifo_ioctl (ap)
struct vop_ioctl_args *ap;
-#define vp (ap->a_vp)
-#define com (ap->a_command)
-#define data (ap->a_data)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
struct file filetmp;
int error;
{
struct file filetmp;
int error;
+ if (ap->a_command == FIONBIO)
- if (fflag & FREAD)
- filetmp.f_data = (caddr_t)vp->v_fifoinfo->fi_readsock;
+ if (ap->a_fflag & FREAD)
+ filetmp.f_data = (caddr_t)ap->a_vp->v_fifoinfo->fi_readsock;
- filetmp.f_data = (caddr_t)vp->v_fifoinfo->fi_writesock;
- return (soo_ioctl(&filetmp, com, data, p));
+ filetmp.f_data = (caddr_t)ap->a_vp->v_fifoinfo->fi_writesock;
+ return (soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_p));
-#undef vp
-#undef com
-#undef data
-#undef fflag
-#undef cred
-#undef p
/* ARGSUSED */
fifo_select (ap)
struct vop_select_args *ap;
/* ARGSUSED */
fifo_select (ap)
struct vop_select_args *ap;
-#define vp (ap->a_vp)
-#define which (ap->a_which)
-#define fflag (ap->a_fflags)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
struct file filetmp;
int error;
{
struct file filetmp;
int error;
- if (fflag & FREAD)
- filetmp.f_data = (caddr_t)vp->v_fifoinfo->fi_readsock;
+ if (ap->a_fflags & FREAD)
+ filetmp.f_data = (caddr_t)ap->a_vp->v_fifoinfo->fi_readsock;
- filetmp.f_data = (caddr_t)vp->v_fifoinfo->fi_writesock;
- return (soo_select(&filetmp, which, p));
+ filetmp.f_data = (caddr_t)ap->a_vp->v_fifoinfo->fi_writesock;
+ return (soo_select(&filetmp, ap->a_which, ap->a_p));
-#undef vp
-#undef which
-#undef fflag
-#undef cred
-#undef p
/*
* This is a noop, simply returning what one has been given.
*/
fifo_bmap (ap)
struct vop_bmap_args *ap;
/*
* This is a noop, simply returning what one has been given.
*/
fifo_bmap (ap)
struct vop_bmap_args *ap;
-#define vp (ap->a_vp)
-#define bn (ap->a_bn)
-#define vpp (ap->a_vpp)
-#define bnp (ap->a_bnp)
- if (vpp != NULL)
- *vpp = vp;
- if (bnp != NULL)
- *bnp = bn;
+ if (ap->a_vpp != NULL)
+ *ap->a_vpp = ap->a_vp;
+ if (ap->a_bnp != NULL)
+ *ap->a_bnp = ap->a_bn;
-#undef vp
-#undef bn
-#undef vpp
-#undef bnp
/*
* At the moment we do not do any locking.
/*
* At the moment we do not do any locking.
/* ARGSUSED */
fifo_lock (ap)
struct vop_lock_args *ap;
/* ARGSUSED */
fifo_lock (ap)
struct vop_lock_args *ap;
/* ARGSUSED */
fifo_unlock (ap)
struct vop_unlock_args *ap;
/* ARGSUSED */
fifo_unlock (ap)
struct vop_unlock_args *ap;
/*
* Device close routine
/*
* Device close routine
/* ARGSUSED */
fifo_close (ap)
struct vop_close_args *ap;
/* ARGSUSED */
fifo_close (ap)
struct vop_close_args *ap;
-#define vp (ap->a_vp)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
- register struct fifoinfo *fip = vp->v_fifoinfo;
+ register struct fifoinfo *fip = ap->a_vp->v_fifoinfo;
+ if (ap->a_fflag & FWRITE) {
fip->fi_writers--;
if (fip->fi_writers == 0)
socantrcvmore(fip->fi_readsock);
fip->fi_writers--;
if (fip->fi_writers == 0)
socantrcvmore(fip->fi_readsock);
if (fip->fi_readers == 0)
socantsendmore(fip->fi_writesock);
}
if (fip->fi_readers == 0)
socantsendmore(fip->fi_writesock);
}
- if (vp->v_usecount > 1)
+ if (ap->a_vp->v_usecount > 1)
return (0);
error1 = soclose(fip->fi_readsock);
error2 = soclose(fip->fi_writesock);
FREE(fip, M_VNODE);
return (0);
error1 = soclose(fip->fi_readsock);
error2 = soclose(fip->fi_writesock);
FREE(fip, M_VNODE);
+ ap->a_vp->v_fifoinfo = NULL;
if (error1)
return (error1);
return (error2);
}
if (error1)
return (error1);
return (error2);
}
-#undef vp
-#undef fflag
-#undef cred
-#undef p
/*
* Print out the contents of a fifo vnode.
*/
fifo_print (ap)
struct vop_print_args *ap;
/*
* Print out the contents of a fifo vnode.
*/
fifo_print (ap)
struct vop_print_args *ap;
+ fifo_printinfo(ap->a_vp);
/*
* Print out internal contents of a fifo vnode.
/*
* Print out internal contents of a fifo vnode.
/* ARGSUSED */
fifo_advlock (ap)
struct vop_advlock_args *ap;
/* ARGSUSED */
fifo_advlock (ap)
struct vop_advlock_args *ap;
-#define vp (ap->a_vp)
-#define id (ap->a_id)
-#define op (ap->a_op)
-#define fl (ap->a_fl)
-#define flags (ap->a_flags)
-#undef vp
-#undef id
-#undef op
-#undef fl
-#undef flags
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)spec_vnops.c 7.43 (Berkeley) %G%
+ * @(#)spec_vnops.c 7.44 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
spec_lookup (ap)
struct vop_lookup_args *ap;
int
spec_lookup (ap)
struct vop_lookup_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#undef dvp
-#undef vpp
-#undef cnp
/*
* Open a special file: Don't allow open if fs is mounted -nodev,
/*
* Open a special file: Don't allow open if fs is mounted -nodev,
/* ARGSUSED */
spec_open (ap)
struct vop_open_args *ap;
/* ARGSUSED */
spec_open (ap)
struct vop_open_args *ap;
-#define vp (ap->a_vp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
USES_VOP_LOCK;
USES_VOP_UNLOCK;
{
USES_VOP_LOCK;
USES_VOP_UNLOCK;
- dev_t dev = (dev_t)vp->v_rdev;
+ dev_t dev = (dev_t)ap->a_vp->v_rdev;
register int maj = major(dev);
int error;
register int maj = major(dev);
int error;
- if (vp->v_mount && (vp->v_mount->mnt_flag & MNT_NODEV))
+ if (ap->a_vp->v_mount && (ap->a_vp->v_mount->mnt_flag & MNT_NODEV))
+ switch (ap->a_vp->v_type) {
case VCHR:
if ((u_int)maj >= nchrdev)
return (ENXIO);
case VCHR:
if ((u_int)maj >= nchrdev)
return (ENXIO);
- VOP_UNLOCK(vp);
- error = (*cdevsw[maj].d_open)(dev, mode, S_IFCHR, p);
- VOP_LOCK(vp);
+ VOP_UNLOCK(ap->a_vp);
+ error = (*cdevsw[maj].d_open)(dev, ap->a_mode, S_IFCHR, ap->a_p);
+ VOP_LOCK(ap->a_vp);
return (error);
case VBLK:
if ((u_int)maj >= nblkdev)
return (ENXIO);
return (error);
case VBLK:
if ((u_int)maj >= nblkdev)
return (ENXIO);
- if (error = ufs_mountedon(vp))
+ if (error = ufs_mountedon(ap->a_vp))
- return ((*bdevsw[maj].d_open)(dev, mode, S_IFBLK, p));
+ return ((*bdevsw[maj].d_open)(dev, ap->a_mode, S_IFBLK, ap->a_p));
-#undef vp
-#undef mode
-#undef cred
-#undef p
/* ARGSUSED */
spec_read (ap)
struct vop_read_args *ap;
/* ARGSUSED */
spec_read (ap)
struct vop_read_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
USES_VOP_LOCK;
USES_VOP_UNLOCK;
{
USES_VOP_LOCK;
USES_VOP_UNLOCK;
- struct proc *p = uio->uio_procp;
+ struct proc *p = ap->a_uio->uio_procp;
struct buf *bp;
daddr_t bn, nextbn;
long bsize, bscale;
struct buf *bp;
daddr_t bn, nextbn;
long bsize, bscale;
int error = 0;
#ifdef DIAGNOSTIC
int error = 0;
#ifdef DIAGNOSTIC
- if (uio->uio_rw != UIO_READ)
+ if (ap->a_uio->uio_rw != UIO_READ)
- if (uio->uio_segflg == UIO_USERSPACE && uio->uio_procp != curproc)
+ if (ap->a_uio->uio_segflg == UIO_USERSPACE && ap->a_uio->uio_procp != curproc)
panic("spec_read proc");
#endif
panic("spec_read proc");
#endif
- if (uio->uio_resid == 0)
+ if (ap->a_uio->uio_resid == 0)
+ switch (ap->a_vp->v_type) {
- VOP_UNLOCK(vp);
- error = (*cdevsw[major(vp->v_rdev)].d_read)
- (vp->v_rdev, uio, ioflag);
- VOP_LOCK(vp);
+ VOP_UNLOCK(ap->a_vp);
+ error = (*cdevsw[major(ap->a_vp->v_rdev)].d_read)
+ (ap->a_vp->v_rdev, ap->a_uio, ap->a_ioflag);
+ VOP_LOCK(ap->a_vp);
return (error);
case VBLK:
return (error);
case VBLK:
- if (uio->uio_offset < 0)
+ if (ap->a_uio->uio_offset < 0)
return (EINVAL);
bsize = BLKDEV_IOSIZE;
return (EINVAL);
bsize = BLKDEV_IOSIZE;
- if ((*bdevsw[major(vp->v_rdev)].d_ioctl)(vp->v_rdev, DIOCGPART,
+ if ((*bdevsw[major(ap->a_vp->v_rdev)].d_ioctl)(ap->a_vp->v_rdev, DIOCGPART,
(caddr_t)&dpart, FREAD, p) == 0) {
if (dpart.part->p_fstype == FS_BSDFFS &&
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
(caddr_t)&dpart, FREAD, p) == 0) {
if (dpart.part->p_fstype == FS_BSDFFS &&
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
}
bscale = bsize / DEV_BSIZE;
do {
}
bscale = bsize / DEV_BSIZE;
do {
- bn = (uio->uio_offset / DEV_BSIZE) &~ (bscale - 1);
- on = uio->uio_offset % bsize;
- n = MIN((unsigned)(bsize - on), uio->uio_resid);
- if (vp->v_lastr + bscale == bn) {
+ bn = (ap->a_uio->uio_offset / DEV_BSIZE) &~ (bscale - 1);
+ on = ap->a_uio->uio_offset % bsize;
+ n = MIN((unsigned)(bsize - on), ap->a_uio->uio_resid);
+ if (ap->a_vp->v_lastr + bscale == bn) {
- error = breadn(vp, bn, (int)bsize, &nextbn,
+ error = breadn(ap->a_vp, bn, (int)bsize, &nextbn,
(int *)&bsize, 1, NOCRED, &bp);
} else
(int *)&bsize, 1, NOCRED, &bp);
} else
- error = bread(vp, bn, (int)bsize, NOCRED, &bp);
- vp->v_lastr = bn;
+ error = bread(ap->a_vp, bn, (int)bsize, NOCRED, &bp);
+ ap->a_vp->v_lastr = bn;
n = MIN(n, bsize - bp->b_resid);
if (error) {
brelse(bp);
return (error);
}
n = MIN(n, bsize - bp->b_resid);
if (error) {
brelse(bp);
return (error);
}
- error = uiomove(bp->b_un.b_addr + on, n, uio);
+ error = uiomove(bp->b_un.b_addr + on, n, ap->a_uio);
if (n + on == bsize)
bp->b_flags |= B_AGE;
brelse(bp);
if (n + on == bsize)
bp->b_flags |= B_AGE;
brelse(bp);
- } while (error == 0 && uio->uio_resid > 0 && n != 0);
+ } while (error == 0 && ap->a_uio->uio_resid > 0 && n != 0);
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/* ARGSUSED */
spec_write (ap)
struct vop_write_args *ap;
/* ARGSUSED */
spec_write (ap)
struct vop_write_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
USES_VOP_LOCK;
USES_VOP_UNLOCK;
{
USES_VOP_LOCK;
USES_VOP_UNLOCK;
- struct proc *p = uio->uio_procp;
+ struct proc *p = ap->a_uio->uio_procp;
struct buf *bp;
daddr_t bn;
int bsize, blkmask;
struct buf *bp;
daddr_t bn;
int bsize, blkmask;
int error = 0;
#ifdef DIAGNOSTIC
int error = 0;
#ifdef DIAGNOSTIC
- if (uio->uio_rw != UIO_WRITE)
+ if (ap->a_uio->uio_rw != UIO_WRITE)
panic("spec_write mode");
panic("spec_write mode");
- if (uio->uio_segflg == UIO_USERSPACE && uio->uio_procp != curproc)
+ if (ap->a_uio->uio_segflg == UIO_USERSPACE && ap->a_uio->uio_procp != curproc)
panic("spec_write proc");
#endif
panic("spec_write proc");
#endif
+ switch (ap->a_vp->v_type) {
- VOP_UNLOCK(vp);
- error = (*cdevsw[major(vp->v_rdev)].d_write)
- (vp->v_rdev, uio, ioflag);
- VOP_LOCK(vp);
+ VOP_UNLOCK(ap->a_vp);
+ error = (*cdevsw[major(ap->a_vp->v_rdev)].d_write)
+ (ap->a_vp->v_rdev, ap->a_uio, ap->a_ioflag);
+ VOP_LOCK(ap->a_vp);
return (error);
case VBLK:
return (error);
case VBLK:
- if (uio->uio_resid == 0)
+ if (ap->a_uio->uio_resid == 0)
- if (uio->uio_offset < 0)
+ if (ap->a_uio->uio_offset < 0)
return (EINVAL);
bsize = BLKDEV_IOSIZE;
return (EINVAL);
bsize = BLKDEV_IOSIZE;
- if ((*bdevsw[major(vp->v_rdev)].d_ioctl)(vp->v_rdev, DIOCGPART,
+ if ((*bdevsw[major(ap->a_vp->v_rdev)].d_ioctl)(ap->a_vp->v_rdev, DIOCGPART,
(caddr_t)&dpart, FREAD, p) == 0) {
if (dpart.part->p_fstype == FS_BSDFFS &&
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
(caddr_t)&dpart, FREAD, p) == 0) {
if (dpart.part->p_fstype == FS_BSDFFS &&
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
}
blkmask = (bsize / DEV_BSIZE) - 1;
do {
}
blkmask = (bsize / DEV_BSIZE) - 1;
do {
- bn = (uio->uio_offset / DEV_BSIZE) &~ blkmask;
- on = uio->uio_offset % bsize;
- n = MIN((unsigned)(bsize - on), uio->uio_resid);
+ bn = (ap->a_uio->uio_offset / DEV_BSIZE) &~ blkmask;
+ on = ap->a_uio->uio_offset % bsize;
+ n = MIN((unsigned)(bsize - on), ap->a_uio->uio_resid);
- bp = getblk(vp, bn, bsize);
+ bp = getblk(ap->a_vp, bn, bsize);
- error = bread(vp, bn, bsize, NOCRED, &bp);
+ error = bread(ap->a_vp, bn, bsize, NOCRED, &bp);
n = MIN(n, bsize - bp->b_resid);
if (error) {
brelse(bp);
return (error);
}
n = MIN(n, bsize - bp->b_resid);
if (error) {
brelse(bp);
return (error);
}
- error = uiomove(bp->b_un.b_addr + on, n, uio);
+ error = uiomove(bp->b_un.b_addr + on, n, ap->a_uio);
if (n + on == bsize) {
bp->b_flags |= B_AGE;
bawrite(bp);
} else
bdwrite(bp);
if (n + on == bsize) {
bp->b_flags |= B_AGE;
bawrite(bp);
} else
bdwrite(bp);
- } while (error == 0 && uio->uio_resid > 0 && n != 0);
+ } while (error == 0 && ap->a_uio->uio_resid > 0 && n != 0);
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Device ioctl operation.
/*
* Device ioctl operation.
/* ARGSUSED */
spec_ioctl (ap)
struct vop_ioctl_args *ap;
/* ARGSUSED */
spec_ioctl (ap)
struct vop_ioctl_args *ap;
-#define vp (ap->a_vp)
-#define com (ap->a_command)
-#define data (ap->a_data)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
- dev_t dev = vp->v_rdev;
+ dev_t dev = ap->a_vp->v_rdev;
+ switch (ap->a_vp->v_type) {
- return ((*cdevsw[major(dev)].d_ioctl)(dev, com, data,
- fflag, p));
+ return ((*cdevsw[major(dev)].d_ioctl)(dev, ap->a_command, ap->a_data,
+ ap->a_fflag, ap->a_p));
- if (com == 0 && (int)data == B_TAPE)
+ if (ap->a_command == 0 && (int)ap->a_data == B_TAPE)
if (bdevsw[major(dev)].d_flags & B_TAPE)
return (0);
else
return (1);
if (bdevsw[major(dev)].d_flags & B_TAPE)
return (0);
else
return (1);
- return ((*bdevsw[major(dev)].d_ioctl)(dev, com, data,
- fflag, p));
+ return ((*bdevsw[major(dev)].d_ioctl)(dev, ap->a_command, ap->a_data,
+ ap->a_fflag, ap->a_p));
default:
panic("spec_ioctl");
/* NOTREACHED */
}
}
default:
panic("spec_ioctl");
/* NOTREACHED */
}
}
-#undef vp
-#undef com
-#undef data
-#undef fflag
-#undef cred
-#undef p
/* ARGSUSED */
spec_select (ap)
struct vop_select_args *ap;
/* ARGSUSED */
spec_select (ap)
struct vop_select_args *ap;
-#define vp (ap->a_vp)
-#define which (ap->a_which)
-#define fflags (ap->a_fflags)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
+ switch (ap->a_vp->v_type) {
default:
return (1); /* XXX */
case VCHR:
default:
return (1); /* XXX */
case VCHR:
- dev = vp->v_rdev;
- return (*cdevsw[major(dev)].d_select)(dev, which, p);
+ dev = ap->a_vp->v_rdev;
+ return (*cdevsw[major(dev)].d_select)(dev, ap->a_which, ap->a_p);
-#undef vp
-#undef which
-#undef fflags
-#undef cred
-#undef p
/*
* Just call the device strategy routine
*/
spec_strategy (ap)
struct vop_strategy_args *ap;
/*
* Just call the device strategy routine
*/
spec_strategy (ap)
struct vop_strategy_args *ap;
- (*bdevsw[major(bp->b_dev)].d_strategy)(bp);
+ (*bdevsw[major(ap->a_bp->b_dev)].d_strategy)(ap->a_bp);
/*
* This is a noop, simply returning what one has been given.
*/
spec_bmap (ap)
struct vop_bmap_args *ap;
/*
* This is a noop, simply returning what one has been given.
*/
spec_bmap (ap)
struct vop_bmap_args *ap;
-#define vp (ap->a_vp)
-#define bn (ap->a_bn)
-#define vpp (ap->a_vpp)
-#define bnp (ap->a_bnp)
- if (vpp != NULL)
- *vpp = vp;
- if (bnp != NULL)
- *bnp = bn;
+ if (ap->a_vpp != NULL)
+ *ap->a_vpp = ap->a_vp;
+ if (ap->a_bnp != NULL)
+ *ap->a_bnp = ap->a_bn;
-#undef vp
-#undef bn
-#undef vpp
-#undef bnp
/*
* At the moment we do not do any locking.
/*
* At the moment we do not do any locking.
/* ARGSUSED */
spec_lock (ap)
struct vop_lock_args *ap;
/* ARGSUSED */
spec_lock (ap)
struct vop_lock_args *ap;
/* ARGSUSED */
spec_unlock (ap)
struct vop_unlock_args *ap;
/* ARGSUSED */
spec_unlock (ap)
struct vop_unlock_args *ap;
/*
* Device close routine
/*
* Device close routine
/* ARGSUSED */
spec_close (ap)
struct vop_close_args *ap;
/* ARGSUSED */
spec_close (ap)
struct vop_close_args *ap;
-#define vp (ap->a_vp)
-#define flag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
- dev_t dev = vp->v_rdev;
+ dev_t dev = ap->a_vp->v_rdev;
int (*devclose) __P((dev_t, int, int, struct proc *));
int mode;
int (*devclose) __P((dev_t, int, int, struct proc *));
int mode;
+ switch (ap->a_vp->v_type) {
* of forcably closing the device, otherwise we only
* close on last reference.
*/
* of forcably closing the device, otherwise we only
* close on last reference.
*/
- if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
+ if (vcount(ap->a_vp) > 1 && (ap->a_vp->v_flag & VXLOCK) == 0)
return (0);
devclose = cdevsw[major(dev)].d_close;
mode = S_IFCHR;
return (0);
devclose = cdevsw[major(dev)].d_close;
mode = S_IFCHR;
* we must invalidate any in core blocks, so that
* we can, for instance, change floppy disks.
*/
* we must invalidate any in core blocks, so that
* we can, for instance, change floppy disks.
*/
- vflushbuf(vp, 0);
- if (vinvalbuf(vp, 1))
+ vflushbuf(ap->a_vp, 0);
+ if (vinvalbuf(ap->a_vp, 1))
return (0);
/*
* We do not want to really close the device if it
return (0);
/*
* We do not want to really close the device if it
* sum of the reference counts on all the aliased
* vnodes descends to one, we are on last close.
*/
* sum of the reference counts on all the aliased
* vnodes descends to one, we are on last close.
*/
- if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
+ if (vcount(ap->a_vp) > 1 && (ap->a_vp->v_flag & VXLOCK) == 0)
return (0);
devclose = bdevsw[major(dev)].d_close;
mode = S_IFBLK;
return (0);
devclose = bdevsw[major(dev)].d_close;
mode = S_IFBLK;
panic("spec_close: not special");
}
panic("spec_close: not special");
}
- return ((*devclose)(dev, flag, mode, p));
+ return ((*devclose)(dev, ap->a_fflag, mode, ap->a_p));
-#undef vp
-#undef flag
-#undef cred
-#undef p
/*
* Print out the contents of a special device vnode.
*/
spec_print (ap)
struct vop_print_args *ap;
/*
* Print out the contents of a special device vnode.
*/
spec_print (ap)
struct vop_print_args *ap;
- printf("tag VT_NON, dev %d, %d\n", major(vp->v_rdev),
- minor(vp->v_rdev));
+ printf("tag VT_NON, dev %d, %d\n", major(ap->a_vp->v_rdev),
+ minor(ap->a_vp->v_rdev));
/*
* Special device advisory byte-level locks.
/*
* Special device advisory byte-level locks.
/* ARGSUSED */
spec_advlock (ap)
struct vop_advlock_args *ap;
/* ARGSUSED */
spec_advlock (ap)
struct vop_advlock_args *ap;
-#define vp (ap->a_vp)
-#define id (ap->a_id)
-#define op (ap->a_op)
-#define fl (ap->a_fl)
-#define flags (ap->a_flags)
-#undef vp
-#undef id
-#undef op
-#undef fl
-#undef flags
/*
* Special device failed operation
/*
* Special device failed operation
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)nfs_bio.c 7.24 (Berkeley) %G%
+ * @(#)nfs_bio.c 7.25 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
*/
nfs_write (ap)
struct vop_write_args *ap;
*/
nfs_write (ap)
struct vop_write_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
USES_VOP_GETATTR;
register int biosize;
{
USES_VOP_GETATTR;
register int biosize;
- struct proc *p = uio->uio_procp;
+ struct proc *p = ap->a_uio->uio_procp;
- struct nfsnode *np = VTONFS(vp);
+ struct nfsnode *np = VTONFS(ap->a_vp);
struct vattr vattr;
struct nfsmount *nmp;
daddr_t lbn, bn;
int n, on, error = 0;
#ifdef DIAGNOSTIC
struct vattr vattr;
struct nfsmount *nmp;
daddr_t lbn, bn;
int n, on, error = 0;
#ifdef DIAGNOSTIC
- if (uio->uio_rw != UIO_WRITE)
+ if (ap->a_uio->uio_rw != UIO_WRITE)
- if (uio->uio_segflg == UIO_USERSPACE && uio->uio_procp != curproc)
+ if (ap->a_uio->uio_segflg == UIO_USERSPACE && ap->a_uio->uio_procp != curproc)
panic("nfs_write proc");
#endif
panic("nfs_write proc");
#endif
- if (vp->v_type != VREG)
+ if (ap->a_vp->v_type != VREG)
- if (ioflag & (IO_APPEND | IO_SYNC)) {
+ if (ap->a_ioflag & (IO_APPEND | IO_SYNC)) {
if (np->n_flag & NMODIFIED) {
np->n_flag &= ~NMODIFIED;
if (np->n_flag & NMODIFIED) {
np->n_flag &= ~NMODIFIED;
+ vinvalbuf(ap->a_vp, TRUE);
- if (ioflag & IO_APPEND) {
+ if (ap->a_ioflag & IO_APPEND) {
- if (error = VOP_GETATTR(vp, &vattr, cred, p))
+ if (error = VOP_GETATTR(ap->a_vp, &vattr, ap->a_cred, p))
- uio->uio_offset = np->n_size;
+ ap->a_uio->uio_offset = np->n_size;
- nmp = VFSTONFS(vp->v_mount);
- if (uio->uio_offset < 0)
+ nmp = VFSTONFS(ap->a_vp->v_mount);
+ if (ap->a_uio->uio_offset < 0)
- if (uio->uio_resid == 0)
+ if (ap->a_uio->uio_resid == 0)
return (0);
/*
* Maybe this should be above the vnode op call, but so long as
* file servers have no limits, i don't think it matters
*/
return (0);
/*
* Maybe this should be above the vnode op call, but so long as
* file servers have no limits, i don't think it matters
*/
- if (p && uio->uio_offset + uio->uio_resid >
+ if (p && ap->a_uio->uio_offset + ap->a_uio->uio_resid >
p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
psignal(p, SIGXFSZ);
return (EFBIG);
p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
psignal(p, SIGXFSZ);
return (EFBIG);
* If non-cachable, just do the rpc
*/
if ((nmp->nm_flag & NFSMNT_NQNFS) &&
* If non-cachable, just do the rpc
*/
if ((nmp->nm_flag & NFSMNT_NQNFS) &&
- NQNFS_CKINVALID(vp, np, NQL_WRITE)) {
+ NQNFS_CKINVALID(ap->a_vp, np, NQL_WRITE)) {
- error = nqnfs_getlease(vp, NQL_WRITE, cred, p);
+ error = nqnfs_getlease(ap->a_vp, NQL_WRITE, ap->a_cred, p);
} while (error == NQNFS_EXPIRED);
if (error)
return (error);
if (QUADNE(np->n_lrev, np->n_brev) ||
(np->n_flag & NQNFSNONCACHE)) {
} while (error == NQNFS_EXPIRED);
if (error)
return (error);
if (QUADNE(np->n_lrev, np->n_brev) ||
(np->n_flag & NQNFSNONCACHE)) {
+ vinvalbuf(ap->a_vp, TRUE);
np->n_brev = np->n_lrev;
}
}
if (np->n_flag & NQNFSNONCACHE)
np->n_brev = np->n_lrev;
}
}
if (np->n_flag & NQNFSNONCACHE)
- return (nfs_writerpc(vp, uio, cred));
+ return (nfs_writerpc(ap->a_vp, ap->a_uio, ap->a_cred));
nfsstats.biocache_writes++;
nfsstats.biocache_writes++;
- lbn = uio->uio_offset / biosize;
- on = uio->uio_offset & (biosize-1);
- n = MIN((unsigned)(biosize - on), uio->uio_resid);
- if (uio->uio_offset + n > np->n_size) {
- np->n_size = uio->uio_offset + n;
- vnode_pager_setsize(vp, (u_long)np->n_size);
+ lbn = ap->a_uio->uio_offset / biosize;
+ on = ap->a_uio->uio_offset & (biosize-1);
+ n = MIN((unsigned)(biosize - on), ap->a_uio->uio_resid);
+ if (ap->a_uio->uio_offset + n > np->n_size) {
+ np->n_size = ap->a_uio->uio_offset + n;
+ vnode_pager_setsize(ap->a_vp, (u_long)np->n_size);
}
bn = lbn * (biosize / DEV_BSIZE);
again:
}
bn = lbn * (biosize / DEV_BSIZE);
again:
- bp = getblk(vp, bn, biosize);
+ bp = getblk(ap->a_vp, bn, biosize);
if (bp->b_wcred == NOCRED) {
if (bp->b_wcred == NOCRED) {
- crhold(cred);
- bp->b_wcred = cred;
+ crhold(ap->a_cred);
+ bp->b_wcred = ap->a_cred;
* In case getblk() and/or bwrite() delayed us.
*/
if ((nmp->nm_flag & NFSMNT_NQNFS) &&
* In case getblk() and/or bwrite() delayed us.
*/
if ((nmp->nm_flag & NFSMNT_NQNFS) &&
- NQNFS_CKINVALID(vp, np, NQL_WRITE)) {
+ NQNFS_CKINVALID(ap->a_vp, np, NQL_WRITE)) {
- error = nqnfs_getlease(vp, NQL_WRITE, cred, p);
+ error = nqnfs_getlease(ap->a_vp, NQL_WRITE, ap->a_cred, p);
} while (error == NQNFS_EXPIRED);
if (error) {
brelse(bp);
} while (error == NQNFS_EXPIRED);
if (error) {
brelse(bp);
}
if (QUADNE(np->n_lrev, np->n_brev) ||
(np->n_flag & NQNFSNONCACHE)) {
}
if (QUADNE(np->n_lrev, np->n_brev) ||
(np->n_flag & NQNFSNONCACHE)) {
+ vinvalbuf(ap->a_vp, TRUE);
np->n_brev = np->n_lrev;
}
}
np->n_brev = np->n_lrev;
}
}
- if (error = uiomove(bp->b_un.b_addr + on, n, uio)) {
+ if (error = uiomove(bp->b_un.b_addr + on, n, ap->a_uio)) {
brelse(bp);
return (error);
}
brelse(bp);
return (error);
}
/*
* If the lease is non-cachable or IO_SYNC do bwrite().
*/
/*
* If the lease is non-cachable or IO_SYNC do bwrite().
*/
- if ((np->n_flag & NQNFSNONCACHE) || (ioflag & IO_SYNC)) {
+ if ((np->n_flag & NQNFSNONCACHE) || (ap->a_ioflag & IO_SYNC)) {
bp->b_proc = p;
bwrite(bp);
} else if ((n+on) == biosize &&
bp->b_proc = p;
bwrite(bp);
} else if ((n+on) == biosize &&
bp->b_proc = (struct proc *)0;
bdwrite(bp);
}
bp->b_proc = (struct proc *)0;
bdwrite(bp);
}
- } while (error == 0 && uio->uio_resid > 0 && n != 0);
+ } while (error == 0 && ap->a_uio->uio_resid > 0 && n != 0);
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)nfs_node.c 7.38 (Berkeley) %G%
+ * @(#)nfs_node.c 7.39 (Berkeley) %G%
nfs_inactive (ap)
struct vop_inactive_args *ap;
nfs_inactive (ap)
struct vop_inactive_args *ap;
-#define vp (ap->a_vp)
-#define p (ap->a_p)
{
register struct nfsnode *np;
register struct sillyrename *sp;
extern int prtactive;
{
register struct nfsnode *np;
register struct sillyrename *sp;
extern int prtactive;
- np = VTONFS(vp);
- if (prtactive && vp->v_usecount != 0)
- vprint("nfs_inactive: pushing active", vp);
+ np = VTONFS(ap->a_vp);
+ if (prtactive && ap->a_vp->v_usecount != 0)
+ vprint("nfs_inactive: pushing active", ap->a_vp);
sp = np->n_sillyrename;
np->n_sillyrename = (struct sillyrename *)0;
if (sp) {
/*
* Remove the silly file that was rename'd earlier
*/
sp = np->n_sillyrename;
np->n_sillyrename = (struct sillyrename *)0;
if (sp) {
/*
* Remove the silly file that was rename'd earlier
*/
+ nfs_removeit(sp, ap->a_p);
crfree(sp->s_cred);
vrele(sp->s_dvp);
#ifdef SILLYSEPARATE
crfree(sp->s_cred);
vrele(sp->s_dvp);
#ifdef SILLYSEPARATE
np->n_flag &= NMODIFIED;
return (0);
}
np->n_flag &= NMODIFIED;
return (0);
}
/*
* Reclaim an nfsnode so that it can be used for other purposes.
*/
nfs_reclaim (ap)
struct vop_reclaim_args *ap;
/*
* Reclaim an nfsnode so that it can be used for other purposes.
*/
nfs_reclaim (ap)
struct vop_reclaim_args *ap;
- register struct nfsnode *np = VTONFS(vp);
- register struct nfsmount *nmp = VFSTONFS(vp->v_mount);
+ register struct nfsnode *np = VTONFS(ap->a_vp);
+ register struct nfsmount *nmp = VFSTONFS(ap->a_vp->v_mount);
- if (prtactive && vp->v_usecount != 0)
- vprint("nfs_reclaim: pushing active", vp);
+ if (prtactive && ap->a_vp->v_usecount != 0)
+ vprint("nfs_reclaim: pushing active", ap->a_vp);
/*
* Remove the nfsnode from its hash chain.
*/
/*
* Remove the nfsnode from its hash chain.
*/
else
np->n_tprev->n_tnext = np->n_tnext;
}
else
np->n_tprev->n_tnext = np->n_tnext;
}
- cache_purge(vp);
- FREE(vp->v_data, M_NFSNODE);
- vp->v_data = (void *)0;
+ cache_purge(ap->a_vp);
+ FREE(ap->a_vp->v_data, M_NFSNODE);
+ ap->a_vp->v_data = (void *)0;
/*
* Lock an nfsnode
*/
nfs_lock (ap)
struct vop_lock_args *ap;
/*
* Lock an nfsnode
*/
nfs_lock (ap)
struct vop_lock_args *ap;
/*
* Unlock an nfsnode
*/
nfs_unlock (ap)
struct vop_unlock_args *ap;
/*
* Unlock an nfsnode
*/
nfs_unlock (ap)
struct vop_unlock_args *ap;
/*
* Check for a locked nfsnode
*/
nfs_islocked (ap)
struct vop_islocked_args *ap;
/*
* Check for a locked nfsnode
*/
nfs_islocked (ap)
struct vop_islocked_args *ap;
/*
* Nfs abort op, called after namei() when a CREATE/DELETE isn't actually
/*
* Nfs abort op, called after namei() when a CREATE/DELETE isn't actually
int
nfs_abortop (ap)
struct vop_abortop_args *ap;
int
nfs_abortop (ap)
struct vop_abortop_args *ap;
-#define dvp (ap->a_dvp)
-#define cnp (ap->a_cnp)
- if ((cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)nfs_vnops.c 7.75 (Berkeley) %G%
+ * @(#)nfs_vnops.c 7.76 (Berkeley) %G%
int
nfs_access (ap)
struct vop_access_args *ap;
int
nfs_access (ap)
struct vop_access_args *ap;
-#define vp (ap->a_vp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define procp (ap->a_p)
{
USES_VOP_GETATTR;
register struct vattr *vap;
{
USES_VOP_GETATTR;
register struct vattr *vap;
* If you're the super-user,
* you always get access.
*/
* If you're the super-user,
* you always get access.
*/
+ if (ap->a_cred->cr_uid == 0)
return (0);
vap = &vattr;
return (0);
vap = &vattr;
- if (error = VOP_GETATTR(vp, vap, cred, procp))
+ if (error = VOP_GETATTR(ap->a_vp, vap, ap->a_cred, ap->a_p))
return (error);
/*
* Access check is based on only one of owner, group, public.
* If not owner, then check group. If not a member of the
* group, then check public access.
*/
return (error);
/*
* Access check is based on only one of owner, group, public.
* If not owner, then check group. If not a member of the
* group, then check public access.
*/
- if (cred->cr_uid != vap->va_uid) {
- mode >>= 3;
- gp = cred->cr_groups;
- for (i = 0; i < cred->cr_ngroups; i++, gp++)
+ if (ap->a_cred->cr_uid != vap->va_uid) {
+ ap->a_mode >>= 3;
+ gp = ap->a_cred->cr_groups;
+ for (i = 0; i < ap->a_cred->cr_ngroups; i++, gp++)
if (vap->va_gid == *gp)
goto found;
if (vap->va_gid == *gp)
goto found;
- if ((vap->va_mode & mode) != 0)
+ if ((vap->va_mode & ap->a_mode) != 0)
return (0);
return (EACCES);
}
return (0);
return (EACCES);
}
-#undef vp
-#undef mode
-#undef cred
-#undef procp
int
nfs_open (ap)
struct vop_open_args *ap;
int
nfs_open (ap)
struct vop_open_args *ap;
-#define vp (ap->a_vp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define procp (ap->a_p)
- if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK)
+ if (ap->a_vp->v_type != VREG && ap->a_vp->v_type != VDIR && ap->a_vp->v_type != VLNK)
- if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NQNFS) == 0)
- VTONFS(vp)->n_attrstamp = 0; /* For Open/Close consistency */
+ if ((VFSTONFS(ap->a_vp->v_mount)->nm_flag & NFSMNT_NQNFS) == 0)
+ VTONFS(ap->a_vp)->n_attrstamp = 0; /* For Open/Close consistency */
-#undef vp
-#undef mode
-#undef cred
-#undef procp
int
nfs_close (ap)
struct vop_close_args *ap;
int
nfs_close (ap)
struct vop_close_args *ap;
-#define vp (ap->a_vp)
-#define fflags (ap->a_fflag)
-#define cred (ap->a_cred)
-#define procp (ap->a_p)
- register struct nfsnode *np = VTONFS(vp);
+ register struct nfsnode *np = VTONFS(ap->a_vp);
int error = 0;
if ((np->n_flag & NMODIFIED) &&
int error = 0;
if ((np->n_flag & NMODIFIED) &&
- (VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NQNFS) == 0 &&
- vp->v_type == VREG) {
+ (VFSTONFS(ap->a_vp->v_mount)->nm_flag & NFSMNT_NQNFS) == 0 &&
+ ap->a_vp->v_type == VREG) {
np->n_flag &= ~NMODIFIED;
np->n_flag &= ~NMODIFIED;
+ vinvalbuf(ap->a_vp, TRUE);
np->n_attrstamp = 0;
if (np->n_flag & NWRITEERR) {
np->n_flag &= ~NWRITEERR;
np->n_attrstamp = 0;
if (np->n_flag & NWRITEERR) {
np->n_flag &= ~NWRITEERR;
-#undef vp
-#undef fflags
-#undef cred
-#undef procp
/*
* nfs getattr call from vfs.
/*
* nfs getattr call from vfs.
int
nfs_getattr (ap)
struct vop_getattr_args *ap;
int
nfs_getattr (ap)
struct vop_getattr_args *ap;
-#define vp (ap->a_vp)
-#define vap (ap->a_vap)
-#define cred (ap->a_cred)
-#define procp (ap->a_p)
{
register caddr_t cp;
caddr_t bpos, dpos;
{
register caddr_t cp;
caddr_t bpos, dpos;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
/* First look in the cache.. */
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
/* First look in the cache.. */
- if (nfs_getattrcache(vp, vap) == 0)
+ if (nfs_getattrcache(ap->a_vp, ap->a_vap) == 0)
return (0);
nfsstats.rpccnt[NFSPROC_GETATTR]++;
return (0);
nfsstats.rpccnt[NFSPROC_GETATTR]++;
- nfsm_reqhead(vp, NFSPROC_GETATTR, NFSX_FH);
- nfsm_fhtom(vp);
- nfsm_request(vp, NFSPROC_GETATTR, procp, cred);
- nfsm_loadattr(vp, vap);
+ nfsm_reqhead(ap->a_vp, NFSPROC_GETATTR, NFSX_FH);
+ nfsm_fhtom(ap->a_vp);
+ nfsm_request(ap->a_vp, NFSPROC_GETATTR, ap->a_p, ap->a_cred);
+ nfsm_loadattr(ap->a_vp, ap->a_vap);
nfsm_reqdone;
return (error);
}
nfsm_reqdone;
return (error);
}
-#undef vp
-#undef vap
-#undef cred
-#undef procp
int
nfs_setattr (ap)
struct vop_setattr_args *ap;
int
nfs_setattr (ap)
struct vop_setattr_args *ap;
-#define vp (ap->a_vp)
-#define vap (ap->a_vap)
-#define cred (ap->a_cred)
-#define procp (ap->a_p)
{
register struct nfsv2_sattr *sp;
register caddr_t cp;
{
register struct nfsv2_sattr *sp;
register caddr_t cp;
u_long *tl;
int error = 0;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
u_long *tl;
int error = 0;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
- struct nfsnode *np = VTONFS(vp);
+ struct nfsnode *np = VTONFS(ap->a_vp);
u_quad_t frev;
nfsstats.rpccnt[NFSPROC_SETATTR]++;
u_quad_t frev;
nfsstats.rpccnt[NFSPROC_SETATTR]++;
- nfsm_reqhead(vp, NFSPROC_SETATTR, NFSX_FH+NFSX_SATTR);
- nfsm_fhtom(vp);
+ nfsm_reqhead(ap->a_vp, NFSPROC_SETATTR, NFSX_FH+NFSX_SATTR);
+ nfsm_fhtom(ap->a_vp);
nfsm_build(sp, struct nfsv2_sattr *, NFSX_SATTR);
nfsm_build(sp, struct nfsv2_sattr *, NFSX_SATTR);
- if (vap->va_mode == 0xffff)
+ if (ap->a_vap->va_mode == 0xffff)
sp->sa_mode = VNOVAL;
else
sp->sa_mode = VNOVAL;
else
- sp->sa_mode = vtonfs_mode(vp->v_type, vap->va_mode);
- if (vap->va_uid == 0xffff)
+ sp->sa_mode = vtonfs_mode(ap->a_vp->v_type, ap->a_vap->va_mode);
+ if (ap->a_vap->va_uid == 0xffff)
sp->sa_uid = VNOVAL;
else
sp->sa_uid = VNOVAL;
else
- sp->sa_uid = txdr_unsigned(vap->va_uid);
- if (vap->va_gid == 0xffff)
+ sp->sa_uid = txdr_unsigned(ap->a_vap->va_uid);
+ if (ap->a_vap->va_gid == 0xffff)
sp->sa_gid = VNOVAL;
else
sp->sa_gid = VNOVAL;
else
- sp->sa_gid = txdr_unsigned(vap->va_gid);
- sp->sa_size = txdr_unsigned(vap->va_size);
- sp->sa_atime.tv_sec = txdr_unsigned(vap->va_atime.tv_sec);
- sp->sa_atime.tv_usec = txdr_unsigned(vap->va_flags);
- txdr_time(&vap->va_mtime, &sp->sa_mtime);
- if (vap->va_size != VNOVAL || vap->va_mtime.tv_sec != VNOVAL ||
- vap->va_atime.tv_sec != VNOVAL) {
+ sp->sa_gid = txdr_unsigned(ap->a_vap->va_gid);
+ sp->sa_size = txdr_unsigned(ap->a_vap->va_size);
+ sp->sa_atime.tv_sec = txdr_unsigned(ap->a_vap->va_atime.tv_sec);
+ sp->sa_atime.tv_usec = txdr_unsigned(ap->a_vap->va_flags);
+ txdr_time(&ap->a_vap->va_mtime, &sp->sa_mtime);
+ if (ap->a_vap->va_size != VNOVAL || ap->a_vap->va_mtime.tv_sec != VNOVAL ||
+ ap->a_vap->va_atime.tv_sec != VNOVAL) {
if (np->n_flag & NMODIFIED) {
np->n_flag &= ~NMODIFIED;
if (np->n_flag & NMODIFIED) {
np->n_flag &= ~NMODIFIED;
- if (vap->va_size == 0)
- vinvalbuf(vp, FALSE);
+ if (ap->a_vap->va_size == 0)
+ vinvalbuf(ap->a_vp, FALSE);
+ vinvalbuf(ap->a_vp, TRUE);
- nfsm_request(vp, NFSPROC_SETATTR, procp, cred);
- nfsm_loadattr(vp, (struct vattr *)0);
- if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NQNFS) &&
- NQNFS_CKCACHABLE(vp, NQL_WRITE)) {
+ nfsm_request(ap->a_vp, NFSPROC_SETATTR, ap->a_p, ap->a_cred);
+ nfsm_loadattr(ap->a_vp, (struct vattr *)0);
+ if ((VFSTONFS(ap->a_vp->v_mount)->nm_flag & NFSMNT_NQNFS) &&
+ NQNFS_CKCACHABLE(ap->a_vp, NQL_WRITE)) {
nfsm_dissect(tl, u_long *, 2*NFSX_UNSIGNED);
fxdr_hyper(tl, &frev);
if (QUADGT(frev, np->n_brev))
nfsm_dissect(tl, u_long *, 2*NFSX_UNSIGNED);
fxdr_hyper(tl, &frev);
if (QUADGT(frev, np->n_brev))
nfsm_reqdone;
return (error);
}
nfsm_reqdone;
return (error);
}
-#undef vp
-#undef vap
-#undef cred
-#undef procp
/*
* nfs lookup call, one step at a time...
/*
* nfs lookup call, one step at a time...
int
nfs_lookup (ap)
struct vop_lookup_args *ap;
int
nfs_lookup (ap)
struct vop_lookup_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
{
USES_VOP_GETATTR;
register struct vnode *vdp;
{
USES_VOP_GETATTR;
register struct vnode *vdp;
int nqlflag, cachable;
u_quad_t frev;
int nqlflag, cachable;
u_quad_t frev;
- *vpp = NULL;
- if (dvp->v_type != VDIR)
+ *ap->a_vpp = NULL;
+ if (ap->a_dvp->v_type != VDIR)
- lockparent = cnp->cn_flags & LOCKPARENT;
- wantparent = cnp->cn_flags & (LOCKPARENT|WANTPARENT);
- nmp = VFSTONFS(dvp->v_mount);
- np = VTONFS(dvp);
- if ((error = cache_lookup(dvp, vpp, cnp)) && error != ENOENT) {
+ lockparent = ap->a_cnp->cn_flags & LOCKPARENT;
+ wantparent = ap->a_cnp->cn_flags & (LOCKPARENT|WANTPARENT);
+ nmp = VFSTONFS(ap->a_dvp->v_mount);
+ np = VTONFS(ap->a_dvp);
+ if ((error = cache_lookup(ap->a_dvp, ap->a_vpp, ap->a_cnp)) && error != ENOENT) {
struct vattr vattr;
int vpid;
struct vattr vattr;
int vpid;
vpid = vdp->v_id;
/*
* See the comment starting `Step through' in ufs/ufs_lookup.c
* for an explanation of the locking protocol
*/
vpid = vdp->v_id;
/*
* See the comment starting `Step through' in ufs/ufs_lookup.c
* for an explanation of the locking protocol
*/
+ if (ap->a_dvp == vdp) {
VREF(vdp);
error = 0;
} else
VREF(vdp);
error = 0;
} else
if (!error) {
if (vpid == vdp->v_id) {
if (nmp->nm_flag & NFSMNT_NQNFS) {
if (!error) {
if (vpid == vdp->v_id) {
if (nmp->nm_flag & NFSMNT_NQNFS) {
- if (NQNFS_CKCACHABLE(dvp, NQL_READ)) {
+ if (NQNFS_CKCACHABLE(ap->a_dvp, NQL_READ)) {
if (QUADNE(np->n_lrev, np->n_brev) ||
(np->n_flag & NMODIFIED)) {
np->n_direofoffset = 0;
if (QUADNE(np->n_lrev, np->n_brev) ||
(np->n_flag & NMODIFIED)) {
np->n_direofoffset = 0;
+ cache_purge(ap->a_dvp);
np->n_flag &= ~NMODIFIED;
np->n_flag &= ~NMODIFIED;
+ vinvalbuf(ap->a_dvp, FALSE);
np->n_brev = np->n_lrev;
} else {
nfsstats.lookupcache_hits++;
np->n_brev = np->n_lrev;
} else {
nfsstats.lookupcache_hits++;
- if (cnp->cn_nameiop != LOOKUP &&
- (cnp->cn_flags&ISLASTCN))
- cnp->cn_flags |= SAVENAME;
+ if (ap->a_cnp->cn_nameiop != LOOKUP &&
+ (ap->a_cnp->cn_flags&ISLASTCN))
+ ap->a_cnp->cn_flags |= SAVENAME;
- } else if (!VOP_GETATTR(vdp, &vattr, cnp->cn_cred, cnp->cn_proc) &&
+ } else if (!VOP_GETATTR(vdp, &vattr, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc) &&
vattr.va_ctime.tv_sec == VTONFS(vdp)->n_ctime) {
nfsstats.lookupcache_hits++;
vattr.va_ctime.tv_sec == VTONFS(vdp)->n_ctime) {
nfsstats.lookupcache_hits++;
- if (cnp->cn_nameiop != LOOKUP && (cnp->cn_flags&ISLASTCN))
- cnp->cn_flags |= SAVENAME;
+ if (ap->a_cnp->cn_nameiop != LOOKUP && (ap->a_cnp->cn_flags&ISLASTCN))
+ ap->a_cnp->cn_flags |= SAVENAME;
return (0);
}
cache_purge(vdp);
}
vrele(vdp);
}
return (0);
}
cache_purge(vdp);
}
vrele(vdp);
}
}
error = 0;
nfsstats.lookupcache_misses++;
nfsstats.rpccnt[NFSPROC_LOOKUP]++;
}
error = 0;
nfsstats.lookupcache_misses++;
nfsstats.rpccnt[NFSPROC_LOOKUP]++;
- len = cnp->cn_namelen;
- nfsm_reqhead(dvp, NFSPROC_LOOKUP, NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(len));
+ len = ap->a_cnp->cn_namelen;
+ nfsm_reqhead(ap->a_dvp, NFSPROC_LOOKUP, NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(len));
/*
* For nqnfs optionally piggyback a getlease request for the name
/*
* For nqnfs optionally piggyback a getlease request for the name
*/
if (nmp->nm_flag & NFSMNT_NQNFS) {
if ((nmp->nm_flag & NFSMNT_NQLOOKLEASE) &&
*/
if (nmp->nm_flag & NFSMNT_NQNFS) {
if ((nmp->nm_flag & NFSMNT_NQLOOKLEASE) &&
- ((cnp->cn_flags&MAKEENTRY) && (cnp->cn_nameiop != DELETE || !(cnp->cn_flags&ISLASTCN)))) {
+ ((ap->a_cnp->cn_flags&MAKEENTRY) && (ap->a_cnp->cn_nameiop != DELETE || !(ap->a_cnp->cn_flags&ISLASTCN)))) {
nfsm_build(tl, u_long *, 2*NFSX_UNSIGNED);
*tl++ = txdr_unsigned(NQL_READ);
*tl = txdr_unsigned(nmp->nm_leaseterm);
nfsm_build(tl, u_long *, 2*NFSX_UNSIGNED);
*tl++ = txdr_unsigned(NQL_READ);
*tl = txdr_unsigned(nmp->nm_leaseterm);
- nfsm_fhtom(dvp);
- nfsm_strtom(cnp->cn_nameptr, len, NFS_MAXNAMLEN);
+ nfsm_fhtom(ap->a_dvp);
+ nfsm_strtom(ap->a_cnp->cn_nameptr, len, NFS_MAXNAMLEN);
- nfsm_request(dvp, NFSPROC_LOOKUP, cnp->cn_proc, cnp->cn_cred);
+ nfsm_request(ap->a_dvp, NFSPROC_LOOKUP, ap->a_cnp->cn_proc, ap->a_cnp->cn_cred);
- if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) &&
- (cnp->cn_flags & ISLASTCN) && error == ENOENT)
+ if ((ap->a_cnp->cn_nameiop == CREATE || ap->a_cnp->cn_nameiop == RENAME) &&
+ (ap->a_cnp->cn_flags & ISLASTCN) && error == ENOENT)
- if (cnp->cn_nameiop != LOOKUP && (cnp->cn_flags&ISLASTCN))
- cnp->cn_flags |= SAVENAME;
+ if (ap->a_cnp->cn_nameiop != LOOKUP && (ap->a_cnp->cn_flags&ISLASTCN))
+ ap->a_cnp->cn_flags |= SAVENAME;
return (error);
}
if (nmp->nm_flag & NFSMNT_NQNFS) {
return (error);
}
if (nmp->nm_flag & NFSMNT_NQNFS) {
/*
* Handle RENAME case...
*/
/*
* Handle RENAME case...
*/
- if (cnp->cn_nameiop == RENAME && wantparent && (cnp->cn_flags&ISLASTCN)) {
+ if (ap->a_cnp->cn_nameiop == RENAME && wantparent && (ap->a_cnp->cn_flags&ISLASTCN)) {
if (!bcmp(np->n_fh.fh_bytes, (caddr_t)fhp, NFSX_FH)) {
m_freem(mrep);
return (EISDIR);
}
if (!bcmp(np->n_fh.fh_bytes, (caddr_t)fhp, NFSX_FH)) {
m_freem(mrep);
return (EISDIR);
}
- if (error = nfs_nget(dvp->v_mount, fhp, &np)) {
+ if (error = nfs_nget(ap->a_dvp->v_mount, fhp, &np)) {
m_freem(mrep);
return (error);
}
m_freem(mrep);
return (error);
}
m_freem(mrep);
return (error);
}
m_freem(mrep);
return (error);
}
- cnp->cn_flags |= SAVENAME;
+ ap->a_cnp->cn_flags |= SAVENAME;
return (0);
}
if (!bcmp(np->n_fh.fh_bytes, (caddr_t)fhp, NFSX_FH)) {
return (0);
}
if (!bcmp(np->n_fh.fh_bytes, (caddr_t)fhp, NFSX_FH)) {
- VREF(dvp);
- newvp = dvp;
+ VREF(ap->a_dvp);
+ newvp = ap->a_dvp;
- if (error = nfs_nget(dvp->v_mount, fhp, &np)) {
+ if (error = nfs_nget(ap->a_dvp->v_mount, fhp, &np)) {
m_freem(mrep);
return (error);
}
m_freem(mrep);
return (error);
}
return (error);
}
m_freem(mrep);
return (error);
}
m_freem(mrep);
- *vpp = newvp;
- if (cnp->cn_nameiop != LOOKUP && (cnp->cn_flags&ISLASTCN))
- cnp->cn_flags |= SAVENAME;
- if ((cnp->cn_flags&MAKEENTRY) && (cnp->cn_nameiop != DELETE || !(cnp->cn_flags&ISLASTCN))) {
+ *ap->a_vpp = newvp;
+ if (ap->a_cnp->cn_nameiop != LOOKUP && (ap->a_cnp->cn_flags&ISLASTCN))
+ ap->a_cnp->cn_flags |= SAVENAME;
+ if ((ap->a_cnp->cn_flags&MAKEENTRY) && (ap->a_cnp->cn_nameiop != DELETE || !(ap->a_cnp->cn_flags&ISLASTCN))) {
if ((nmp->nm_flag & NFSMNT_NQNFS) == 0)
np->n_ctime = np->n_vattr.va_ctime.tv_sec;
else if (nqlflag && reqtime > time.tv_sec) {
if ((nmp->nm_flag & NFSMNT_NQNFS) == 0)
np->n_ctime = np->n_vattr.va_ctime.tv_sec;
else if (nqlflag && reqtime > time.tv_sec) {
else
np->n_tnext->n_tprev = np;
}
else
np->n_tnext->n_tprev = np;
}
- cache_enter(dvp, *vpp, cnp);
+ cache_enter(ap->a_dvp, *ap->a_vpp, ap->a_cnp);
-#undef dvp
-#undef vpp
-#undef cnp
int
nfs_read (ap)
struct vop_read_args *ap;
int
nfs_read (ap)
struct vop_read_args *ap;
-#define vp (ap->a_vp)
-#define uiop (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
- if (vp->v_type != VREG)
+ if (ap->a_vp->v_type != VREG)
- return (nfs_bioread(vp, uiop, ioflag, cred));
+ return (nfs_bioread(ap->a_vp, ap->a_uio, ap->a_ioflag, ap->a_cred));
-#undef vp
-#undef uiop
-#undef ioflag
-#undef cred
int
nfs_readlink (ap)
struct vop_readlink_args *ap;
int
nfs_readlink (ap)
struct vop_readlink_args *ap;
-#define vp (ap->a_vp)
-#define uiop (ap->a_uio)
-#define cred (ap->a_cred)
- if (vp->v_type != VLNK)
+ if (ap->a_vp->v_type != VLNK)
- return (nfs_bioread(vp, uiop, 0, cred));
+ return (nfs_bioread(ap->a_vp, ap->a_uio, 0, ap->a_cred));
-#undef vp
-#undef uiop
-#undef cred
int
nfs_mknod (ap)
struct vop_mknod_args *ap;
int
nfs_mknod (ap)
struct vop_mknod_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
{
USES_VOP_ABORTOP;
register struct nfsv2_sattr *sp;
{
USES_VOP_ABORTOP;
register struct nfsv2_sattr *sp;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
u_long rdev;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
u_long rdev;
- if (vap->va_type == VCHR || vap->va_type == VBLK)
- rdev = txdr_unsigned(vap->va_rdev);
+ if (ap->a_vap->va_type == VCHR || ap->a_vap->va_type == VBLK)
+ rdev = txdr_unsigned(ap->a_vap->va_rdev);
- else if (vap->va_type == VFIFO)
+ else if (ap->a_vap->va_type == VFIFO)
rdev = 0xffffffff;
#endif /* FIFO */
else {
rdev = 0xffffffff;
#endif /* FIFO */
else {
- VOP_ABORTOP(dvp, cnp);
- vput(dvp);
+ VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
+ vput(ap->a_dvp);
return (EOPNOTSUPP);
}
nfsstats.rpccnt[NFSPROC_CREATE]++;
return (EOPNOTSUPP);
}
nfsstats.rpccnt[NFSPROC_CREATE]++;
- nfsm_reqhead(dvp, NFSPROC_CREATE,
- NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(cnp->cn_namelen)+NFSX_SATTR);
- nfsm_fhtom(dvp);
- nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
+ nfsm_reqhead(ap->a_dvp, NFSPROC_CREATE,
+ NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(ap->a_cnp->cn_namelen)+NFSX_SATTR);
+ nfsm_fhtom(ap->a_dvp);
+ nfsm_strtom(ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen, NFS_MAXNAMLEN);
nfsm_build(sp, struct nfsv2_sattr *, NFSX_SATTR);
nfsm_build(sp, struct nfsv2_sattr *, NFSX_SATTR);
- sp->sa_mode = vtonfs_mode(vap->va_type, vap->va_mode);
- sp->sa_uid = txdr_unsigned(cnp->cn_cred->cr_uid);
- sp->sa_gid = txdr_unsigned(cnp->cn_cred->cr_gid);
+ sp->sa_mode = vtonfs_mode(ap->a_vap->va_type, ap->a_vap->va_mode);
+ sp->sa_uid = txdr_unsigned(ap->a_cnp->cn_cred->cr_uid);
+ sp->sa_gid = txdr_unsigned(ap->a_cnp->cn_cred->cr_gid);
sp->sa_size = rdev;
/* or should these be VNOVAL ?? */
sp->sa_size = rdev;
/* or should these be VNOVAL ?? */
- txdr_time(&vap->va_atime, &sp->sa_atime);
- txdr_time(&vap->va_mtime, &sp->sa_mtime);
- nfsm_request(dvp, NFSPROC_CREATE, cnp->cn_proc, cnp->cn_cred);
+ txdr_time(&ap->a_vap->va_atime, &sp->sa_atime);
+ txdr_time(&ap->a_vap->va_mtime, &sp->sa_mtime);
+ nfsm_request(ap->a_dvp, NFSPROC_CREATE, ap->a_cnp->cn_proc, ap->a_cnp->cn_cred);
- FREE(cnp->cn_pnbuf, M_NAMEI);
- VTONFS(dvp)->n_flag |= NMODIFIED;
- vrele(dvp);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ VTONFS(ap->a_dvp)->n_flag |= NMODIFIED;
+ vrele(ap->a_dvp);
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
/*
* nfs file create call
/*
* nfs file create call
int
nfs_create (ap)
struct vop_create_args *ap;
int
nfs_create (ap)
struct vop_create_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
{
register struct nfsv2_sattr *sp;
register u_long *tl;
{
register struct nfsv2_sattr *sp;
register u_long *tl;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
nfsstats.rpccnt[NFSPROC_CREATE]++;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
nfsstats.rpccnt[NFSPROC_CREATE]++;
- nfsm_reqhead(dvp, NFSPROC_CREATE,
- NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(cnp->cn_namelen)+NFSX_SATTR);
- nfsm_fhtom(dvp);
- nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
+ nfsm_reqhead(ap->a_dvp, NFSPROC_CREATE,
+ NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(ap->a_cnp->cn_namelen)+NFSX_SATTR);
+ nfsm_fhtom(ap->a_dvp);
+ nfsm_strtom(ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen, NFS_MAXNAMLEN);
nfsm_build(sp, struct nfsv2_sattr *, NFSX_SATTR);
nfsm_build(sp, struct nfsv2_sattr *, NFSX_SATTR);
- sp->sa_mode = vtonfs_mode(vap->va_type, vap->va_mode);
- sp->sa_uid = txdr_unsigned(cnp->cn_cred->cr_uid);
- sp->sa_gid = txdr_unsigned(cnp->cn_cred->cr_gid);
+ sp->sa_mode = vtonfs_mode(ap->a_vap->va_type, ap->a_vap->va_mode);
+ sp->sa_uid = txdr_unsigned(ap->a_cnp->cn_cred->cr_uid);
+ sp->sa_gid = txdr_unsigned(ap->a_cnp->cn_cred->cr_gid);
sp->sa_size = txdr_unsigned(0);
/* or should these be VNOVAL ?? */
sp->sa_size = txdr_unsigned(0);
/* or should these be VNOVAL ?? */
- txdr_time(&vap->va_atime, &sp->sa_atime);
- txdr_time(&vap->va_mtime, &sp->sa_mtime);
- nfsm_request(dvp, NFSPROC_CREATE, cnp->cn_proc, cnp->cn_cred);
- nfsm_mtofh(dvp, *vpp);
+ txdr_time(&ap->a_vap->va_atime, &sp->sa_atime);
+ txdr_time(&ap->a_vap->va_mtime, &sp->sa_mtime);
+ nfsm_request(ap->a_dvp, NFSPROC_CREATE, ap->a_cnp->cn_proc, ap->a_cnp->cn_cred);
+ nfsm_mtofh(ap->a_dvp, *ap->a_vpp);
- FREE(cnp->cn_pnbuf, M_NAMEI);
- VTONFS(dvp)->n_flag |= NMODIFIED;
- vrele(dvp);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ VTONFS(ap->a_dvp)->n_flag |= NMODIFIED;
+ vrele(ap->a_dvp);
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
/*
* nfs file remove call
/*
* nfs file remove call
int
nfs_remove (ap)
struct vop_remove_args *ap;
int
nfs_remove (ap)
struct vop_remove_args *ap;
-#define dvp (ap->a_dvp)
-#define vp (ap->a_vp)
-#define cnp (ap->a_cnp)
- register struct nfsnode *np = VTONFS(vp);
+ register struct nfsnode *np = VTONFS(ap->a_vp);
register u_long *tl;
register caddr_t cp;
register long t2;
register u_long *tl;
register caddr_t cp;
register long t2;
int error = 0;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
int error = 0;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
- if (vp->v_usecount > 1) {
+ if (ap->a_vp->v_usecount > 1) {
- error = nfs_sillyrename(dvp, vp, cnp);
+ error = nfs_sillyrename(ap->a_dvp, ap->a_vp, ap->a_cnp);
} else {
/*
* Purge the name cache so that the chance of a lookup for
} else {
/*
* Purge the name cache so that the chance of a lookup for
* that an I/O op returns ESTALE, but since you get this if
* another host removes the file..
*/
* that an I/O op returns ESTALE, but since you get this if
* another host removes the file..
*/
/*
* Throw away biocache buffers. Mainly to avoid
* unnecessary delayed writes.
*/
/*
* Throw away biocache buffers. Mainly to avoid
* unnecessary delayed writes.
*/
+ vinvalbuf(ap->a_vp, FALSE);
/* Do the rpc */
nfsstats.rpccnt[NFSPROC_REMOVE]++;
/* Do the rpc */
nfsstats.rpccnt[NFSPROC_REMOVE]++;
- nfsm_reqhead(dvp, NFSPROC_REMOVE,
- NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(cnp->cn_namelen));
- nfsm_fhtom(dvp);
- nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
- nfsm_request(dvp, NFSPROC_REMOVE, cnp->cn_proc, cnp->cn_cred);
+ nfsm_reqhead(ap->a_dvp, NFSPROC_REMOVE,
+ NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(ap->a_cnp->cn_namelen));
+ nfsm_fhtom(ap->a_dvp);
+ nfsm_strtom(ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen, NFS_MAXNAMLEN);
+ nfsm_request(ap->a_dvp, NFSPROC_REMOVE, ap->a_cnp->cn_proc, ap->a_cnp->cn_cred);
- FREE(cnp->cn_pnbuf, M_NAMEI);
- VTONFS(dvp)->n_flag |= NMODIFIED;
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ VTONFS(ap->a_dvp)->n_flag |= NMODIFIED;
/*
* Kludge City: If the first reply to the remove rpc is lost..
* the reply to the retransmitted request will be ENOENT
/*
* Kludge City: If the first reply to the remove rpc is lost..
* the reply to the retransmitted request will be ENOENT
error = 0;
}
np->n_attrstamp = 0;
error = 0;
}
np->n_attrstamp = 0;
- vrele(dvp);
- vrele(vp);
+ vrele(ap->a_dvp);
+ vrele(ap->a_vp);
-#undef dvp
-#undef vp
-#undef cnp
/*
* nfs file remove rpc called from nfs_inactive
/*
* nfs file remove rpc called from nfs_inactive
int
nfs_rename (ap)
struct vop_rename_args *ap;
int
nfs_rename (ap)
struct vop_rename_args *ap;
-#define fdvp (ap->a_fdvp)
-#define fvp (ap->a_fvp)
-#define fcnp (ap->a_fcnp)
-#define tdvp (ap->a_tdvp)
-#define tvp (ap->a_tvp)
-#define tcnp (ap->a_tcnp)
{
register u_long *tl;
register caddr_t cp;
{
register u_long *tl;
register caddr_t cp;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
nfsstats.rpccnt[NFSPROC_RENAME]++;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
nfsstats.rpccnt[NFSPROC_RENAME]++;
- nfsm_reqhead(fdvp, NFSPROC_RENAME,
- (NFSX_FH+NFSX_UNSIGNED)*2+nfsm_rndup(fcnp->cn_namelen)+
- nfsm_rndup(fcnp->cn_namelen)); /* or fcnp->cn_cred?*/
- nfsm_fhtom(fdvp);
- nfsm_strtom(fcnp->cn_nameptr, fcnp->cn_namelen, NFS_MAXNAMLEN);
- nfsm_fhtom(tdvp);
- nfsm_strtom(tcnp->cn_nameptr, tcnp->cn_namelen, NFS_MAXNAMLEN);
- nfsm_request(fdvp, NFSPROC_RENAME, tcnp->cn_proc, tcnp->cn_cred);
+ nfsm_reqhead(ap->a_fdvp, NFSPROC_RENAME,
+ (NFSX_FH+NFSX_UNSIGNED)*2+nfsm_rndup(ap->a_fcnp->cn_namelen)+
+ nfsm_rndup(ap->a_fcnp->cn_namelen)); /* or ap->a_fcnp->cn_cred?*/
+ nfsm_fhtom(ap->a_fdvp);
+ nfsm_strtom(ap->a_fcnp->cn_nameptr, ap->a_fcnp->cn_namelen, NFS_MAXNAMLEN);
+ nfsm_fhtom(ap->a_tdvp);
+ nfsm_strtom(ap->a_tcnp->cn_nameptr, ap->a_tcnp->cn_namelen, NFS_MAXNAMLEN);
+ nfsm_request(ap->a_fdvp, NFSPROC_RENAME, ap->a_tcnp->cn_proc, ap->a_tcnp->cn_cred);
- VTONFS(fdvp)->n_flag |= NMODIFIED;
- VTONFS(tdvp)->n_flag |= NMODIFIED;
- if (fvp->v_type == VDIR) {
- if (tvp != NULL && tvp->v_type == VDIR)
- cache_purge(tdvp);
- cache_purge(fdvp);
+ VTONFS(ap->a_fdvp)->n_flag |= NMODIFIED;
+ VTONFS(ap->a_tdvp)->n_flag |= NMODIFIED;
+ if (ap->a_fvp->v_type == VDIR) {
+ if (ap->a_tvp != NULL && ap->a_tvp->v_type == VDIR)
+ cache_purge(ap->a_tdvp);
+ cache_purge(ap->a_fdvp);
- if (tdvp == tvp)
- vrele(tdvp);
+ if (ap->a_tdvp == ap->a_tvp)
+ vrele(ap->a_tdvp);
- vput(tdvp);
- if (tvp)
- vput(tvp);
- vrele(fdvp);
- vrele(fvp);
+ vput(ap->a_tdvp);
+ if (ap->a_tvp)
+ vput(ap->a_tvp);
+ vrele(ap->a_fdvp);
+ vrele(ap->a_fvp);
/*
* Kludge: Map ENOENT => 0 assuming that it is a reply to a retry.
*/
/*
* Kludge: Map ENOENT => 0 assuming that it is a reply to a retry.
*/
error = 0;
return (error);
}
error = 0;
return (error);
}
-#undef fdvp
-#undef fvp
-#undef fcnp
-#undef tdvp
-#undef tvp
-#undef tcnp
/*
* nfs file rename rpc called from nfs_remove() above
/*
* nfs file rename rpc called from nfs_remove() above
int
nfs_link (ap)
struct vop_link_args *ap;
int
nfs_link (ap)
struct vop_link_args *ap;
-#define tdvp (ap->a_vp)
-#define vp (ap->a_tdvp)
-#define cnp (ap->a_cnp)
{
register u_long *tl;
register caddr_t cp;
{
register u_long *tl;
register caddr_t cp;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
nfsstats.rpccnt[NFSPROC_LINK]++;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
nfsstats.rpccnt[NFSPROC_LINK]++;
- nfsm_reqhead(vp, NFSPROC_LINK,
- NFSX_FH*2+NFSX_UNSIGNED+nfsm_rndup(cnp->cn_namelen));
- nfsm_fhtom(vp);
- nfsm_fhtom(tdvp);
- nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
- nfsm_request(vp, NFSPROC_LINK, cnp->cn_proc, cnp->cn_cred);
+ nfsm_reqhead(ap->a_tdvp, NFSPROC_LINK,
+ NFSX_FH*2+NFSX_UNSIGNED+nfsm_rndup(ap->a_cnp->cn_namelen));
+ nfsm_fhtom(ap->a_tdvp);
+ nfsm_fhtom(ap->a_vp);
+ nfsm_strtom(ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen, NFS_MAXNAMLEN);
+ nfsm_request(ap->a_tdvp, NFSPROC_LINK, ap->a_cnp->cn_proc, ap->a_cnp->cn_cred);
- FREE(cnp->cn_pnbuf, M_NAMEI);
- VTONFS(vp)->n_attrstamp = 0;
- VTONFS(tdvp)->n_flag |= NMODIFIED;
- vrele(tdvp);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ VTONFS(ap->a_tdvp)->n_attrstamp = 0;
+ VTONFS(ap->a_vp)->n_flag |= NMODIFIED;
+ vrele(ap->a_vp);
/*
* Kludge: Map EEXIST => 0 assuming that it is a reply to a retry.
*/
/*
* Kludge: Map EEXIST => 0 assuming that it is a reply to a retry.
*/
error = 0;
return (error);
}
error = 0;
return (error);
}
-#undef tdvp
-#undef vp
-#undef cnp
/*
* nfs symbolic link create call
/*
* nfs symbolic link create call
int
nfs_symlink (ap)
struct vop_symlink_args *ap;
int
nfs_symlink (ap)
struct vop_symlink_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
-#define nm (ap->a_target)
{
register struct nfsv2_sattr *sp;
register u_long *tl;
{
register struct nfsv2_sattr *sp;
register u_long *tl;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
nfsstats.rpccnt[NFSPROC_SYMLINK]++;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
nfsstats.rpccnt[NFSPROC_SYMLINK]++;
- slen = strlen(nm);
- nfsm_reqhead(dvp, NFSPROC_SYMLINK,
- NFSX_FH+2*NFSX_UNSIGNED+nfsm_rndup(cnp->cn_namelen)+nfsm_rndup(slen)+NFSX_SATTR);
- nfsm_fhtom(dvp);
- nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
- nfsm_strtom(nm, slen, NFS_MAXPATHLEN);
+ slen = strlen(ap->a_target);
+ nfsm_reqhead(ap->a_dvp, NFSPROC_SYMLINK,
+ NFSX_FH+2*NFSX_UNSIGNED+nfsm_rndup(ap->a_cnp->cn_namelen)+nfsm_rndup(slen)+NFSX_SATTR);
+ nfsm_fhtom(ap->a_dvp);
+ nfsm_strtom(ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen, NFS_MAXNAMLEN);
+ nfsm_strtom(ap->a_target, slen, NFS_MAXPATHLEN);
nfsm_build(sp, struct nfsv2_sattr *, NFSX_SATTR);
nfsm_build(sp, struct nfsv2_sattr *, NFSX_SATTR);
- sp->sa_mode = vtonfs_mode(VLNK, vap->va_mode);
- sp->sa_uid = txdr_unsigned(cnp->cn_cred->cr_uid);
- sp->sa_gid = txdr_unsigned(cnp->cn_cred->cr_gid);
+ sp->sa_mode = vtonfs_mode(VLNK, ap->a_vap->va_mode);
+ sp->sa_uid = txdr_unsigned(ap->a_cnp->cn_cred->cr_uid);
+ sp->sa_gid = txdr_unsigned(ap->a_cnp->cn_cred->cr_gid);
sp->sa_size = txdr_unsigned(VNOVAL);
sp->sa_size = txdr_unsigned(VNOVAL);
- txdr_time(&vap->va_atime, &sp->sa_atime); /* or VNOVAL ?? */
- txdr_time(&vap->va_mtime, &sp->sa_mtime); /* or VNOVAL ?? */
- nfsm_request(dvp, NFSPROC_SYMLINK, cnp->cn_proc, cnp->cn_cred);
+ txdr_time(&ap->a_vap->va_atime, &sp->sa_atime); /* or VNOVAL ?? */
+ txdr_time(&ap->a_vap->va_mtime, &sp->sa_mtime); /* or VNOVAL ?? */
+ nfsm_request(ap->a_dvp, NFSPROC_SYMLINK, ap->a_cnp->cn_proc, ap->a_cnp->cn_cred);
- FREE(cnp->cn_pnbuf, M_NAMEI);
- VTONFS(dvp)->n_flag |= NMODIFIED;
- vrele(dvp);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ VTONFS(ap->a_dvp)->n_flag |= NMODIFIED;
+ vrele(ap->a_dvp);
/*
* Kludge: Map EEXIST => 0 assuming that it is a reply to a retry.
*/
/*
* Kludge: Map EEXIST => 0 assuming that it is a reply to a retry.
*/
error = 0;
return (error);
}
error = 0;
return (error);
}
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
-#undef nm
int
nfs_mkdir (ap)
struct vop_mkdir_args *ap;
int
nfs_mkdir (ap)
struct vop_mkdir_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
{
register struct nfsv2_sattr *sp;
register u_long *tl;
{
register struct nfsv2_sattr *sp;
register u_long *tl;
int error = 0, firsttry = 1;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
int error = 0, firsttry = 1;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
+ len = ap->a_cnp->cn_namelen;
nfsstats.rpccnt[NFSPROC_MKDIR]++;
nfsstats.rpccnt[NFSPROC_MKDIR]++;
- nfsm_reqhead(dvp, NFSPROC_MKDIR,
+ nfsm_reqhead(ap->a_dvp, NFSPROC_MKDIR,
NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(len)+NFSX_SATTR);
NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(len)+NFSX_SATTR);
- nfsm_fhtom(dvp);
- nfsm_strtom(cnp->cn_nameptr, len, NFS_MAXNAMLEN);
+ nfsm_fhtom(ap->a_dvp);
+ nfsm_strtom(ap->a_cnp->cn_nameptr, len, NFS_MAXNAMLEN);
nfsm_build(sp, struct nfsv2_sattr *, NFSX_SATTR);
nfsm_build(sp, struct nfsv2_sattr *, NFSX_SATTR);
- sp->sa_mode = vtonfs_mode(VDIR, vap->va_mode);
- sp->sa_uid = txdr_unsigned(cnp->cn_cred->cr_uid);
- sp->sa_gid = txdr_unsigned(cnp->cn_cred->cr_gid);
+ sp->sa_mode = vtonfs_mode(VDIR, ap->a_vap->va_mode);
+ sp->sa_uid = txdr_unsigned(ap->a_cnp->cn_cred->cr_uid);
+ sp->sa_gid = txdr_unsigned(ap->a_cnp->cn_cred->cr_gid);
sp->sa_size = txdr_unsigned(VNOVAL);
sp->sa_size = txdr_unsigned(VNOVAL);
- txdr_time(&vap->va_atime, &sp->sa_atime); /* or VNOVAL ?? */
- txdr_time(&vap->va_mtime, &sp->sa_mtime); /* or VNOVAL ?? */
- nfsm_request(dvp, NFSPROC_MKDIR, cnp->cn_proc, cnp->cn_cred);
- nfsm_mtofh(dvp, *vpp);
+ txdr_time(&ap->a_vap->va_atime, &sp->sa_atime); /* or VNOVAL ?? */
+ txdr_time(&ap->a_vap->va_mtime, &sp->sa_mtime); /* or VNOVAL ?? */
+ nfsm_request(ap->a_dvp, NFSPROC_MKDIR, ap->a_cnp->cn_proc, ap->a_cnp->cn_cred);
+ nfsm_mtofh(ap->a_dvp, *ap->a_vpp);
- VTONFS(dvp)->n_flag |= NMODIFIED;
+ VTONFS(ap->a_dvp)->n_flag |= NMODIFIED;
/*
* Kludge: Map EEXIST => 0 assuming that you have a reply to a retry
* if we can succeed in looking up the directory.
/*
* Kludge: Map EEXIST => 0 assuming that you have a reply to a retry
* if we can succeed in looking up the directory.
firsttry = 0;
error = 0;
nfsstats.rpccnt[NFSPROC_LOOKUP]++;
firsttry = 0;
error = 0;
nfsstats.rpccnt[NFSPROC_LOOKUP]++;
- *vpp = NULL;
- nfsm_reqhead(dvp, NFSPROC_LOOKUP,
+ *ap->a_vpp = NULL;
+ nfsm_reqhead(ap->a_dvp, NFSPROC_LOOKUP,
NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(len));
NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(len));
- nfsm_fhtom(dvp);
- nfsm_strtom(cnp->cn_nameptr, len, NFS_MAXNAMLEN);
- nfsm_request(dvp, NFSPROC_LOOKUP, cnp->cn_proc, cnp->cn_cred);
- nfsm_mtofh(dvp, *vpp);
- if ((*vpp)->v_type != VDIR) {
- vput(*vpp);
+ nfsm_fhtom(ap->a_dvp);
+ nfsm_strtom(ap->a_cnp->cn_nameptr, len, NFS_MAXNAMLEN);
+ nfsm_request(ap->a_dvp, NFSPROC_LOOKUP, ap->a_cnp->cn_proc, ap->a_cnp->cn_cred);
+ nfsm_mtofh(ap->a_dvp, *ap->a_vpp);
+ if ((*ap->a_vpp)->v_type != VDIR) {
+ vput(*ap->a_vpp);
error = EEXIST;
}
m_freem(mrep);
}
error = EEXIST;
}
m_freem(mrep);
}
- FREE(cnp->cn_pnbuf, M_NAMEI);
- vrele(dvp);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ vrele(ap->a_dvp);
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
/*
* nfs remove directory call
/*
* nfs remove directory call
int
nfs_rmdir (ap)
struct vop_rmdir_args *ap;
int
nfs_rmdir (ap)
struct vop_rmdir_args *ap;
-#define dvp (ap->a_dvp)
-#define vp (ap->a_vp)
-#define cnp (ap->a_cnp)
{
register u_long *tl;
register caddr_t cp;
{
register u_long *tl;
register caddr_t cp;
int error = 0;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
int error = 0;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
- if (dvp == vp) {
- vrele(dvp);
- vrele(dvp);
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ if (ap->a_dvp == ap->a_vp) {
+ vrele(ap->a_dvp);
+ vrele(ap->a_dvp);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
return (EINVAL);
}
nfsstats.rpccnt[NFSPROC_RMDIR]++;
return (EINVAL);
}
nfsstats.rpccnt[NFSPROC_RMDIR]++;
- nfsm_reqhead(dvp, NFSPROC_RMDIR,
- NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(cnp->cn_namelen));
- nfsm_fhtom(dvp);
- nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN);
- nfsm_request(dvp, NFSPROC_RMDIR, cnp->cn_proc, cnp->cn_cred);
+ nfsm_reqhead(ap->a_dvp, NFSPROC_RMDIR,
+ NFSX_FH+NFSX_UNSIGNED+nfsm_rndup(ap->a_cnp->cn_namelen));
+ nfsm_fhtom(ap->a_dvp);
+ nfsm_strtom(ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen, NFS_MAXNAMLEN);
+ nfsm_request(ap->a_dvp, NFSPROC_RMDIR, ap->a_cnp->cn_proc, ap->a_cnp->cn_cred);
- FREE(cnp->cn_pnbuf, M_NAMEI);
- VTONFS(dvp)->n_flag |= NMODIFIED;
- cache_purge(dvp);
- cache_purge(vp);
- vrele(vp);
- vrele(dvp);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ VTONFS(ap->a_dvp)->n_flag |= NMODIFIED;
+ cache_purge(ap->a_dvp);
+ cache_purge(ap->a_vp);
+ vrele(ap->a_vp);
+ vrele(ap->a_dvp);
/*
* Kludge: Map ENOENT => 0 assuming that you have a reply to a retry.
*/
/*
* Kludge: Map ENOENT => 0 assuming that you have a reply to a retry.
*/
error = 0;
return (error);
}
error = 0;
return (error);
}
-#undef dvp
-#undef vp
-#undef cnp
int
nfs_readdir (ap)
struct vop_readdir_args *ap;
int
nfs_readdir (ap)
struct vop_readdir_args *ap;
-#define vp (ap->a_vp)
-#define uiop (ap->a_uio)
-#define cred (ap->a_cred)
-#define eofflagp (ap->a_eofflagp)
- register struct nfsnode *np = VTONFS(vp);
+ register struct nfsnode *np = VTONFS(ap->a_vp);
int tresid, error;
struct vattr vattr;
int tresid, error;
struct vattr vattr;
- if (vp->v_type != VDIR)
+ if (ap->a_vp->v_type != VDIR)
return (EPERM);
/*
* First, check for hit on the EOF offset cache
*/
return (EPERM);
/*
* First, check for hit on the EOF offset cache
*/
- if (uiop->uio_offset != 0 && uiop->uio_offset == np->n_direofoffset &&
+ if (ap->a_uio->uio_offset != 0 && ap->a_uio->uio_offset == np->n_direofoffset &&
(np->n_flag & NMODIFIED) == 0) {
(np->n_flag & NMODIFIED) == 0) {
- if (VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NQNFS) {
- if (NQNFS_CKCACHABLE(vp, NQL_READ)) {
- *eofflagp = 1;
+ if (VFSTONFS(ap->a_vp->v_mount)->nm_flag & NFSMNT_NQNFS) {
+ if (NQNFS_CKCACHABLE(ap->a_vp, NQL_READ)) {
+ *ap->a_eofflagp = 1;
nfsstats.direofcache_hits++;
return (0);
}
nfsstats.direofcache_hits++;
return (0);
}
- } else if (VOP_GETATTR(vp, &vattr, cred, uiop->uio_procp) == 0 &&
+ } else if (VOP_GETATTR(ap->a_vp, &vattr, ap->a_cred, ap->a_uio->uio_procp) == 0 &&
np->n_mtime == vattr.va_mtime.tv_sec) {
np->n_mtime == vattr.va_mtime.tv_sec) {
nfsstats.direofcache_hits++;
return (0);
}
nfsstats.direofcache_hits++;
return (0);
}
/*
* Call nfs_bioread() to do the real work.
*/
/*
* Call nfs_bioread() to do the real work.
*/
- tresid = uiop->uio_resid;
- error = nfs_bioread(vp, uiop, 0, cred);
+ tresid = ap->a_uio->uio_resid;
+ error = nfs_bioread(ap->a_vp, ap->a_uio, 0, ap->a_cred);
- if (!error && uiop->uio_resid == tresid) {
- *eofflagp = 1;
+ if (!error && ap->a_uio->uio_resid == tresid) {
+ *ap->a_eofflagp = 1;
nfsstats.direofcache_misses++;
} else
nfsstats.direofcache_misses++;
} else
-#undef vp
-#undef uiop
-#undef cred
-#undef eofflagp
int
nfs_bmap (ap)
struct vop_bmap_args *ap;
int
nfs_bmap (ap)
struct vop_bmap_args *ap;
-#define vp (ap->a_vp)
-#define bn (ap->a_bn)
-#define vpp (ap->a_vpp)
-#define bnp (ap->a_bnp)
- if (vpp != NULL)
- *vpp = vp;
- if (bnp != NULL)
- *bnp = bn * btodb(vp->v_mount->mnt_stat.f_iosize);
+ if (ap->a_vpp != NULL)
+ *ap->a_vpp = ap->a_vp;
+ if (ap->a_bnp != NULL)
+ *ap->a_bnp = ap->a_bn * btodb(ap->a_vp->v_mount->mnt_stat.f_iosize);
-#undef vp
-#undef bn
-#undef vpp
-#undef bnp
/*
* Strategy routine for phys. i/o
/*
* Strategy routine for phys. i/o
int
nfs_strategy (ap)
struct vop_strategy_args *ap;
int
nfs_strategy (ap)
struct vop_strategy_args *ap;
{
register struct buf *dp;
register int i;
{
register struct buf *dp;
register int i;
* Set b_proc == NULL for asynchronous ops, since these may still
* be hanging about after the process terminates.
*/
* Set b_proc == NULL for asynchronous ops, since these may still
* be hanging about after the process terminates.
*/
- if ((bp->b_flags & B_PHYS) == 0) {
- if (bp->b_flags & B_ASYNC)
- bp->b_proc = (struct proc *)0;
+ if ((ap->a_bp->b_flags & B_PHYS) == 0) {
+ if (ap->a_bp->b_flags & B_ASYNC)
+ ap->a_bp->b_proc = (struct proc *)0;
+ ap->a_bp->b_proc = curproc;
}
/*
* If the op is asynchronous and an i/o daemon is waiting
* queue the request, wake it up and wait for completion
* otherwise just do it ourselves.
*/
}
/*
* If the op is asynchronous and an i/o daemon is waiting
* queue the request, wake it up and wait for completion
* otherwise just do it ourselves.
*/
- if ((bp->b_flags & B_ASYNC) == 0 || nfs_numasync == 0)
- return (nfs_doio(bp));
+ if ((ap->a_bp->b_flags & B_ASYNC) == 0 || nfs_numasync == 0)
+ return (nfs_doio(ap->a_bp));
for (i = 0; i < NFS_MAXASYNCDAEMON; i++) {
if (nfs_iodwant[i]) {
dp = &nfs_bqueue;
if (dp->b_actf == NULL) {
for (i = 0; i < NFS_MAXASYNCDAEMON; i++) {
if (nfs_iodwant[i]) {
dp = &nfs_bqueue;
if (dp->b_actf == NULL) {
- dp->b_actl = bp;
- bp->b_actf = dp;
+ dp->b_actl = ap->a_bp;
+ ap->a_bp->b_actf = dp;
- dp->b_actf->b_actl = bp;
- bp->b_actf = dp->b_actf;
+ dp->b_actf->b_actl = ap->a_bp;
+ ap->a_bp->b_actf = dp->b_actf;
- dp->b_actf = bp;
- bp->b_actl = dp;
+ dp->b_actf = ap->a_bp;
+ ap->a_bp->b_actl = dp;
fnd++;
wakeup((caddr_t)&nfs_iodwant[i]);
break;
}
}
if (!fnd)
fnd++;
wakeup((caddr_t)&nfs_iodwant[i]);
break;
}
}
if (!fnd)
+ error = nfs_doio(ap->a_bp);
/*
* Fun and games with i/o
/*
* Fun and games with i/o
int
nfs_mmap (ap)
struct vop_mmap_args *ap;
int
nfs_mmap (ap)
struct vop_mmap_args *ap;
-#define vp (ap->a_vp)
-#define fflags (ap->a_fflags)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef fflags
-#undef cred
-#undef p
/*
* Flush all the blocks associated with a vnode.
/*
* Flush all the blocks associated with a vnode.
int
nfs_fsync (ap)
struct vop_fsync_args *ap;
int
nfs_fsync (ap)
struct vop_fsync_args *ap;
-#define vp (ap->a_vp)
-#define fflags (ap->a_fflags)
-#define cred (ap->a_cred)
-#define waitfor (ap->a_waitfor)
-#define p (ap->a_p)
- register struct nfsnode *np = VTONFS(vp);
+ register struct nfsnode *np = VTONFS(ap->a_vp);
int error = 0;
if (np->n_flag & NMODIFIED) {
np->n_flag &= ~NMODIFIED;
int error = 0;
if (np->n_flag & NMODIFIED) {
np->n_flag &= ~NMODIFIED;
- vflushbuf(vp, waitfor == MNT_WAIT ? B_SYNC : 0);
+ vflushbuf(ap->a_vp, ap->a_waitfor == MNT_WAIT ? B_SYNC : 0);
}
if (!error && (np->n_flag & NWRITEERR))
error = np->n_error;
return (error);
}
}
if (!error && (np->n_flag & NWRITEERR))
error = np->n_error;
return (error);
}
-#undef vp
-#undef fflags
-#undef cred
-#undef waitfor
-#undef p
/*
* NFS advisory byte-level locks.
/*
* NFS advisory byte-level locks.
int
nfs_advlock (ap)
struct vop_advlock_args *ap;
int
nfs_advlock (ap)
struct vop_advlock_args *ap;
-#define vp (ap->a_vp)
-#define id (ap->a_id)
-#define op (ap->a_op)
-#define fl (ap->a_fl)
-#define flags (ap->a_flags)
-#undef vp
-#undef id
-#undef op
-#undef fl
-#undef flags
/*
* Print out the contents of an nfsnode.
/*
* Print out the contents of an nfsnode.
int
nfs_print (ap)
struct vop_print_args *ap;
int
nfs_print (ap)
struct vop_print_args *ap;
- register struct nfsnode *np = VTONFS(vp);
+ register struct nfsnode *np = VTONFS(ap->a_vp);
printf("tag VT_NFS, fileid %d fsid 0x%x",
np->n_vattr.va_fileid, np->n_vattr.va_fsid);
#ifdef FIFO
printf("tag VT_NFS, fileid %d fsid 0x%x",
np->n_vattr.va_fileid, np->n_vattr.va_fsid);
#ifdef FIFO
- if (vp->v_type == VFIFO)
- fifo_printinfo(vp);
+ if (ap->a_vp->v_type == VFIFO)
+ fifo_printinfo(ap->a_vp);
#endif /* FIFO */
printf("\n");
}
#endif /* FIFO */
printf("\n");
}
/*
* NFS directory offset lookup.
/*
* NFS directory offset lookup.
int
nfs_blkatoff (ap)
struct vop_blkatoff_args *ap;
int
nfs_blkatoff (ap)
struct vop_blkatoff_args *ap;
-#define vp (ap->a_vp)
-#define offset (ap->a_offset)
-#define res (ap->a_res)
-#define bpp (ap->a_bpp)
-#undef vp
-#undef offset
-#undef res
-#undef bpp
/*
* NFS flat namespace lookup.
/*
* NFS flat namespace lookup.
int
nfs_vget (ap)
struct vop_vget_args *ap;
int
nfs_vget (ap)
struct vop_vget_args *ap;
-#define mp (ap->a_mp)
-#define ino (ap->a_ino)
-#define vpp (ap->a_vpp)
-#undef mp
-#undef ino
-#undef vpp
/*
* NFS flat namespace allocation.
/*
* NFS flat namespace allocation.
int
nfs_valloc (ap)
struct vop_valloc_args *ap;
int
nfs_valloc (ap)
struct vop_valloc_args *ap;
-#define pvp (ap->a_pvp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define vpp (ap->a_vpp)
-#undef pvp
-#undef mode
-#undef cred
-#undef vpp
/*
* NFS flat namespace free.
/*
* NFS flat namespace free.
int
nfs_vfree (ap)
struct vop_vfree_args *ap;
int
nfs_vfree (ap)
struct vop_vfree_args *ap;
-#define pvp (ap->a_pvp)
-#define ino (ap->a_ino)
-#define mode (ap->a_mode)
-#undef pvp
-#undef ino
-#undef mode
/*
* NFS file truncation.
/*
* NFS file truncation.
int
nfs_truncate (ap)
struct vop_truncate_args *ap;
int
nfs_truncate (ap)
struct vop_truncate_args *ap;
-#define vp (ap->a_vp)
-#define length (ap->a_length)
-#define flags (ap->a_flags)
-#define cred (ap->a_cred)
{
/* Use nfs_setattr */
printf("nfs_truncate: need to implement!!");
return (EOPNOTSUPP);
}
{
/* Use nfs_setattr */
printf("nfs_truncate: need to implement!!");
return (EOPNOTSUPP);
}
-#undef vp
-#undef length
-#undef flags
-#undef cred
int
nfs_update (ap)
struct vop_update_args *ap;
int
nfs_update (ap)
struct vop_update_args *ap;
-#define vp (ap->a_vp)
-#define ta (ap->a_ta)
-#define tm (ap->a_tm)
-#define waitfor (ap->a_waitfor)
{
/* Use nfs_setattr */
printf("nfs_update: need to implement!!");
return (EOPNOTSUPP);
}
{
/* Use nfs_setattr */
printf("nfs_update: need to implement!!");
return (EOPNOTSUPP);
}
-#undef vp
-#undef ta
-#undef tm
-#undef waitfor
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ffs_alloc.c 7.35 (Berkeley) %G%
+ * @(#)ffs_alloc.c 7.36 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
*/
ffs_valloc (ap)
struct vop_valloc_args *ap;
*/
ffs_valloc (ap)
struct vop_valloc_args *ap;
-#define pvp (ap->a_pvp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define vpp (ap->a_vpp)
{
USES_VOP_VFREE;
USES_VOP_VGET;
{
USES_VOP_VFREE;
USES_VOP_VGET;
ino_t ino, ipref;
int cg, error;
ino_t ino, ipref;
int cg, error;
- *vpp = NULL;
- pip = VTOI(pvp);
+ *ap->a_vpp = NULL;
+ pip = VTOI(ap->a_pvp);
fs = pip->i_fs;
if (fs->fs_cstotal.cs_nifree == 0)
goto noinodes;
fs = pip->i_fs;
if (fs->fs_cstotal.cs_nifree == 0)
goto noinodes;
- if ((mode & IFMT) == IFDIR)
+ if ((ap->a_mode & IFMT) == IFDIR)
ipref = ffs_dirpref(fs);
else
ipref = pip->i_number;
if (ipref >= fs->fs_ncg * fs->fs_ipg)
ipref = 0;
cg = itog(fs, ipref);
ipref = ffs_dirpref(fs);
else
ipref = pip->i_number;
if (ipref >= fs->fs_ncg * fs->fs_ipg)
ipref = 0;
cg = itog(fs, ipref);
- ino = (ino_t)ffs_hashalloc(pip, cg, (long)ipref, mode, ffs_ialloccg);
+ ino = (ino_t)ffs_hashalloc(pip, cg, (long)ipref, ap->a_mode, ffs_ialloccg);
if (ino == 0)
goto noinodes;
if (ino == 0)
goto noinodes;
- error = FFS_VGET(pvp->v_mount, ino, vpp);
+ error = FFS_VGET(ap->a_pvp->v_mount, ino, ap->a_vpp);
- VOP_VFREE(pvp, ino, mode);
+ VOP_VFREE(ap->a_pvp, ino, ap->a_mode);
- printf("mode = 0%o, inum = %d, fs = %s\n",
+ printf("ap->a_mode = 0%o, inum = %d, fs = %s\n",
ip->i_mode, ip->i_number, fs->fs_fsmnt);
panic("ffs_valloc: dup alloc");
}
ip->i_mode, ip->i_number, fs->fs_fsmnt);
panic("ffs_valloc: dup alloc");
}
ip->i_gen = nextgennumber;
return (0);
noinodes:
ip->i_gen = nextgennumber;
return (0);
noinodes:
- ffs_fserr(fs, cred->cr_uid, "out of inodes");
+ ffs_fserr(fs, ap->a_cred->cr_uid, "out of inodes");
uprintf("\n%s: create/symlink failed, no inodes free\n", fs->fs_fsmnt);
return (ENOSPC);
}
uprintf("\n%s: create/symlink failed, no inodes free\n", fs->fs_fsmnt);
return (ENOSPC);
}
-#undef pvp
-#undef mode
-#undef cred
-#undef vpp
/*
* Find a cylinder to place a directory.
/*
* Find a cylinder to place a directory.
int
ffs_vfree (ap)
struct vop_vfree_args *ap;
int
ffs_vfree (ap)
struct vop_vfree_args *ap;
-#define pvp (ap->a_pvp)
-#define ino (ap->a_ino)
-#define mode (ap->a_mode)
{
register struct fs *fs;
register struct cg *cgp;
{
register struct fs *fs;
register struct cg *cgp;
struct buf *bp;
int error, cg;
struct buf *bp;
int error, cg;
- if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg)
- panic("ifree: range: dev = 0x%x, ino = %d, fs = %s\n",
- pip->i_dev, ino, fs->fs_fsmnt);
- cg = itog(fs, ino);
+ if ((u_int)ap->a_ino >= fs->fs_ipg * fs->fs_ncg)
+ panic("ifree: range: dev = 0x%x, ap->a_ino = %d, fs = %s\n",
+ pip->i_dev, ap->a_ino, fs->fs_fsmnt);
+ cg = itog(fs, ap->a_ino);
#ifdef SECSIZE
bp = bread(ip->i_dev, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
fs->fs_dbsize);
#ifdef SECSIZE
bp = bread(ip->i_dev, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
fs->fs_dbsize);
return (0);
}
cgp->cg_time = time.tv_sec;
return (0);
}
cgp->cg_time = time.tv_sec;
- ino %= fs->fs_ipg;
- if (isclr(cg_inosused(cgp), ino)) {
- printf("dev = 0x%x, ino = %d, fs = %s\n",
- pip->i_dev, ino, fs->fs_fsmnt);
+ ap->a_ino %= fs->fs_ipg;
+ if (isclr(cg_inosused(cgp), ap->a_ino)) {
+ printf("dev = 0x%x, ap->a_ino = %d, fs = %s\n",
+ pip->i_dev, ap->a_ino, fs->fs_fsmnt);
if (fs->fs_ronly == 0)
panic("ifree: freeing free inode");
}
if (fs->fs_ronly == 0)
panic("ifree: freeing free inode");
}
- clrbit(cg_inosused(cgp), ino);
- if (ino < cgp->cg_irotor)
- cgp->cg_irotor = ino;
+ clrbit(cg_inosused(cgp), ap->a_ino);
+ if (ap->a_ino < cgp->cg_irotor)
+ cgp->cg_irotor = ap->a_ino;
cgp->cg_cs.cs_nifree++;
fs->fs_cstotal.cs_nifree++;
fs->fs_cs(fs, cg).cs_nifree++;
cgp->cg_cs.cs_nifree++;
fs->fs_cstotal.cs_nifree++;
fs->fs_cs(fs, cg).cs_nifree++;
- if ((mode & IFMT) == IFDIR) {
+ if ((ap->a_mode & IFMT) == IFDIR) {
cgp->cg_cs.cs_ndir--;
fs->fs_cstotal.cs_ndir--;
fs->fs_cs(fs, cg).cs_ndir--;
cgp->cg_cs.cs_ndir--;
fs->fs_cstotal.cs_ndir--;
fs->fs_cs(fs, cg).cs_ndir--;
bdwrite(bp);
return (0);
}
bdwrite(bp);
return (0);
}
-#undef pvp
-#undef ino
-#undef mode
/*
* Find a block of the specified size in the specified cylinder group.
/*
* Find a block of the specified size in the specified cylinder group.
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ffs_balloc.c 7.19 (Berkeley) %G%
+ * @(#)ffs_balloc.c 7.20 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
ffs_bmap (ap)
struct vop_bmap_args *ap;
int
ffs_bmap (ap)
struct vop_bmap_args *ap;
-#define vp (ap->a_vp)
-#define bn (ap->a_bn)
-#define vpp (ap->a_vpp)
-#define bnp (ap->a_bnp)
{
register struct inode *ip;
register struct fs *fs;
{
register struct inode *ip;
register struct fs *fs;
* Check for underlying vnode requests and ensure that logical
* to physical mapping is requested.
*/
* Check for underlying vnode requests and ensure that logical
* to physical mapping is requested.
*/
- ip = VTOI(vp);
- if (vpp != NULL)
- *vpp = ip->i_devvp;
- if (bnp == NULL)
+ ip = VTOI(ap->a_vp);
+ if (ap->a_vpp != NULL)
+ *ap->a_vpp = ip->i_devvp;
+ if (ap->a_bnp == NULL)
return (EFBIG);
fs = ip->i_fs;
/*
* The first NDADDR blocks are direct blocks
*/
return (EFBIG);
fs = ip->i_fs;
/*
* The first NDADDR blocks are direct blocks
*/
- if (bn < NDADDR) {
- nb = ip->i_db[bn];
+ if (ap->a_bn < NDADDR) {
+ nb = ip->i_db[ap->a_bn];
+ *ap->a_bnp = (daddr_t)-1;
- *bnp = fsbtodb(fs, nb);
+ *ap->a_bnp = fsbtodb(fs, nb);
return (0);
}
/*
* Determine the number of levels of indirection.
*/
sh = 1;
return (0);
}
/*
* Determine the number of levels of indirection.
*/
sh = 1;
for (j = NIADDR; j > 0; j--) {
sh *= NINDIR(fs);
for (j = NIADDR; j > 0; j--) {
sh *= NINDIR(fs);
}
if (j == 0)
return (EFBIG);
}
if (j == 0)
return (EFBIG);
*/
nb = ip->i_ib[NIADDR - j];
if (nb == 0) {
*/
nb = ip->i_ib[NIADDR - j];
if (nb == 0) {
+ *ap->a_bnp = (daddr_t)-1;
return (0);
}
for (; j <= NIADDR; j++) {
return (0);
}
for (; j <= NIADDR; j++) {
}
bap = bp->b_un.b_daddr;
sh /= NINDIR(fs);
}
bap = bp->b_un.b_daddr;
sh /= NINDIR(fs);
- i = (bn / sh) % NINDIR(fs);
+ i = (ap->a_bn / sh) % NINDIR(fs);
nb = bap[i];
if (nb == 0) {
nb = bap[i];
if (nb == 0) {
+ *ap->a_bnp = (daddr_t)-1;
brelse(bp);
return (0);
}
brelse(bp);
}
brelse(bp);
return (0);
}
brelse(bp);
}
- *bnp = fsbtodb(fs, nb);
+ *ap->a_bnp = fsbtodb(fs, nb);
-#undef vp
-#undef bn
-#undef vpp
-#undef bnp
/*
* Balloc defines the structure of file system storage
/*
* Balloc defines the structure of file system storage
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ffs_inode.c 7.51 (Berkeley) %G%
+ * @(#)ffs_inode.c 7.52 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
*/
ffs_vget (ap)
struct vop_vget_args *ap;
*/
ffs_vget (ap)
struct vop_vget_args *ap;
-#define mntp (ap->a_mp)
-#define ino (ap->a_ino)
-#define vpp (ap->a_vpp)
{
register struct fs *fs;
register struct inode *ip;
{
register struct fs *fs;
register struct inode *ip;
dev_t dev;
int i, type, error;
dev_t dev;
int i, type, error;
+ ump = VFSTOUFS(ap->a_mp);
- if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
+ if ((*ap->a_vpp = ufs_ihashget(dev, ap->a_ino)) != NULL)
return (0);
/* Allocate a new vnode/inode. */
return (0);
/* Allocate a new vnode/inode. */
- if (error = getnewvnode(VT_UFS, mntp, ffs_vnodeop_p, &vp)) {
- *vpp = NULL;
+ if (error = getnewvnode(VT_UFS, ap->a_mp, ffs_vnodeop_p, &vp)) {
+ *ap->a_vpp = NULL;
return (error);
}
type = ump->um_devvp->v_tag == VT_MFS ? M_MFSNODE : M_FFSNODE; /* XXX */
return (error);
}
type = ump->um_devvp->v_tag == VT_MFS ? M_MFSNODE : M_FFSNODE; /* XXX */
ip->i_lockf = 0;
ip->i_fs = fs = ump->um_fs;
ip->i_dev = dev;
ip->i_lockf = 0;
ip->i_fs = fs = ump->um_fs;
ip->i_dev = dev;
+ ip->i_number = ap->a_ino;
#ifdef QUOTA
for (i = 0; i < MAXQUOTAS; i++)
ip->i_dquot[i] = NODQUOT;
#ifdef QUOTA
for (i = 0; i < MAXQUOTAS; i++)
ip->i_dquot[i] = NODQUOT;
ufs_ihashins(ip);
/* Read in the disk contents for the inode, copy into the inode. */
ufs_ihashins(ip);
/* Read in the disk contents for the inode, copy into the inode. */
- if (error = bread(ump->um_devvp, fsbtodb(fs, itod(fs, ino)),
+ if (error = bread(ump->um_devvp, fsbtodb(fs, itod(fs, ap->a_ino)),
(int)fs->fs_bsize, NOCRED, &bp)) {
/*
* The inode does not contain anything useful, so it would
(int)fs->fs_bsize, NOCRED, &bp)) {
/*
* The inode does not contain anything useful, so it would
/* Unlock and discard unneeded inode. */
ufs_iput(ip);
brelse(bp);
/* Unlock and discard unneeded inode. */
ufs_iput(ip);
brelse(bp);
return (error);
}
dp = bp->b_un.b_dino;
return (error);
}
dp = bp->b_un.b_dino;
+ dp += itoo(fs, ap->a_ino);
ip->i_din = *dp;
brelse(bp);
ip->i_din = *dp;
brelse(bp);
* Initialize the vnode from the inode, check for aliases.
* Note that the underlying vnode may have changed.
*/
* Initialize the vnode from the inode, check for aliases.
* Note that the underlying vnode may have changed.
*/
- if (error = ufs_vinit(mntp, ffs_specop_p, FFS_FIFOOPS, &vp)) {
+ if (error = ufs_vinit(ap->a_mp, ffs_specop_p, FFS_FIFOOPS, &vp)) {
ip->i_uid = ip->i_din.di_ouid;
ip->i_gid = ip->i_din.di_ogid;
ip->i_uid = ip->i_din.di_ouid;
ip->i_gid = ip->i_din.di_ogid;
-#undef mntp
-#undef ino
-#undef vpp
/*
* Update the access, modified, and inode change times as specified
/*
* Update the access, modified, and inode change times as specified
int
ffs_update (ap)
struct vop_update_args *ap;
int
ffs_update (ap)
struct vop_update_args *ap;
-#define vp (ap->a_vp)
-#define ta (ap->a_ta)
-#define tm (ap->a_tm)
-#define waitfor (ap->a_waitfor)
{
struct buf *bp;
struct inode *ip;
struct dinode *dp;
register struct fs *fs;
{
struct buf *bp;
struct inode *ip;
struct dinode *dp;
register struct fs *fs;
- if (vp->v_mount->mnt_flag & MNT_RDONLY)
+ if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY)
if ((ip->i_flag & (IUPD|IACC|ICHG|IMOD)) == 0)
return (0);
if (ip->i_flag&IACC)
if ((ip->i_flag & (IUPD|IACC|ICHG|IMOD)) == 0)
return (0);
if (ip->i_flag&IACC)
- ip->i_atime.tv_sec = ta->tv_sec;
+ ip->i_atime.tv_sec = ap->a_ta->tv_sec;
- ip->i_mtime.tv_sec = tm->tv_sec;
+ ip->i_mtime.tv_sec = ap->a_tm->tv_sec;
INCRQUAD(ip->i_modrev);
}
if (ip->i_flag&ICHG)
INCRQUAD(ip->i_modrev);
}
if (ip->i_flag&ICHG)
}
dp = bp->b_un.b_dino + itoo(fs, ip->i_number);
*dp = ip->i_din;
}
dp = bp->b_un.b_dino + itoo(fs, ip->i_number);
*dp = ip->i_din;
return (bwrite(bp));
else {
bdwrite(bp);
return (0);
}
}
return (bwrite(bp));
else {
bdwrite(bp);
return (0);
}
}
-#undef vp
-#undef ta
-#undef tm
-#undef waitfor
#define SINGLE 0 /* index of single indirect block */
#define DOUBLE 1 /* index of double indirect block */
#define SINGLE 0 /* index of single indirect block */
#define DOUBLE 1 /* index of double indirect block */
*/
ffs_truncate (ap)
struct vop_truncate_args *ap;
*/
ffs_truncate (ap)
struct vop_truncate_args *ap;
-#define ovp (ap->a_vp)
-#define length (ap->a_length)
-#define flags (ap->a_flags)
-#define cred (ap->a_cred)
{
USES_VOP_UPDATE;
register daddr_t lastblock;
{
USES_VOP_UPDATE;
register daddr_t lastblock;
struct inode tip;
off_t osize;
struct inode tip;
off_t osize;
- vnode_pager_setsize(ovp, (u_long)length);
- oip = VTOI(ovp);
- if (oip->i_size <= length) {
+ vnode_pager_setsize(ap->a_vp, (u_long)ap->a_length);
+ oip = VTOI(ap->a_vp);
+ if (oip->i_size <= ap->a_length) {
oip->i_flag |= ICHG|IUPD;
oip->i_flag |= ICHG|IUPD;
- error = VOP_UPDATE(ovp, &time, &time, 1);
+ error = VOP_UPDATE(ap->a_vp, &time, &time, 1);
* the file is truncated to 0.
*/
fs = oip->i_fs;
* the file is truncated to 0.
*/
fs = oip->i_fs;
- lastblock = lblkno(fs, length + fs->fs_bsize - 1) - 1;
+ lastblock = lblkno(fs, ap->a_length + fs->fs_bsize - 1) - 1;
lastiblock[SINGLE] = lastblock - NDADDR;
lastiblock[DOUBLE] = lastiblock[SINGLE] - NINDIR(fs);
lastiblock[TRIPLE] = lastiblock[DOUBLE] - NINDIR(fs) * NINDIR(fs);
lastiblock[SINGLE] = lastblock - NDADDR;
lastiblock[DOUBLE] = lastiblock[SINGLE] - NINDIR(fs);
lastiblock[TRIPLE] = lastiblock[DOUBLE] - NINDIR(fs) * NINDIR(fs);
* of subsequent file growth.
*/
osize = oip->i_size;
* of subsequent file growth.
*/
osize = oip->i_size;
- offset = blkoff(fs, length);
+ offset = blkoff(fs, ap->a_length);
+ oip->i_size = ap->a_length;
- lbn = lblkno(fs, length);
+ lbn = lblkno(fs, ap->a_length);
+ if (ap->a_flags & IO_SYNC)
aflags |= B_SYNC;
#ifdef QUOTA
if (error = getinoquota(oip))
return (error);
#endif
aflags |= B_SYNC;
#ifdef QUOTA
if (error = getinoquota(oip))
return (error);
#endif
- if (error = ffs_balloc(oip, lbn, offset, cred, &bp, aflags))
+ if (error = ffs_balloc(oip, lbn, offset, ap->a_cred, &bp, aflags))
+ oip->i_size = ap->a_length;
size = blksize(fs, oip, lbn);
size = blksize(fs, oip, lbn);
- (void) vnode_pager_uncache(ovp);
+ (void) vnode_pager_uncache(ap->a_vp);
bzero(bp->b_un.b_addr + offset, (unsigned)(size - offset));
allocbuf(bp, size);
bzero(bp->b_un.b_addr + offset, (unsigned)(size - offset));
allocbuf(bp, size);
+ if (ap->a_flags & IO_SYNC)
bwrite(bp);
else
bdwrite(bp);
bwrite(bp);
else
bdwrite(bp);
for (i = NDADDR - 1; i > lastblock; i--)
oip->i_db[i] = 0;
oip->i_flag |= ICHG|IUPD;
for (i = NDADDR - 1; i > lastblock; i--)
oip->i_db[i] = 0;
oip->i_flag |= ICHG|IUPD;
- vinvalbuf(ovp, (length > 0));
- allerror = VOP_UPDATE(ovp, &time, &time, MNT_WAIT);
+ vinvalbuf(ap->a_vp, (ap->a_length > 0));
+ allerror = VOP_UPDATE(ap->a_vp, &time, &time, MNT_WAIT);
/*
* Indirect blocks first.
/*
* Indirect blocks first.
* back as old block size minus new block size.
*/
oldspace = blksize(fs, ip, lastblock);
* back as old block size minus new block size.
*/
oldspace = blksize(fs, ip, lastblock);
+ ip->i_size = ap->a_length;
newspace = blksize(fs, ip, lastblock);
if (newspace == 0)
panic("itrunc: newspace");
newspace = blksize(fs, ip, lastblock);
if (newspace == 0)
panic("itrunc: newspace");
#endif
return (allerror);
}
#endif
return (allerror);
}
-#undef ovp
-#undef length
-#undef flags
-#undef cred
/*
* Release blocks associated with the inode ip and stored in the indirect
/*
* Release blocks associated with the inode ip and stored in the indirect
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ffs_subr.c 7.19 (Berkeley) %G%
+ * @(#)ffs_subr.c 7.20 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
ffs_blkatoff (ap)
struct vop_blkatoff_args *ap;
int
ffs_blkatoff (ap)
struct vop_blkatoff_args *ap;
-#define vp (ap->a_vp)
-#define offset (ap->a_offset)
-#define res (ap->a_res)
-#define bpp (ap->a_bpp)
{
struct inode *ip;
register struct fs *fs;
{
struct inode *ip;
register struct fs *fs;
daddr_t lbn;
int bsize, error;
daddr_t lbn;
int bsize, error;
- lbn = lblkno(fs, offset);
+ lbn = lblkno(fs, ap->a_offset);
bsize = blksize(fs, ip, lbn);
bsize = blksize(fs, ip, lbn);
- *bpp = NULL;
- if (error = bread(vp, lbn, bsize, NOCRED, &bp)) {
+ *ap->a_bpp = NULL;
+ if (error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp)) {
brelse(bp);
return (error);
}
brelse(bp);
return (error);
}
- if (res)
- *res = bp->b_un.b_addr + blkoff(fs, offset);
- *bpp = bp;
+ if (ap->a_res)
+ *ap->a_res = bp->b_un.b_addr + blkoff(fs, ap->a_offset);
+ *ap->a_bpp = bp;
-#undef vp
-#undef offset
-#undef res
-#undef bpp
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ffs_vnops.c 7.77 (Berkeley) %G%
+ * @(#)ffs_vnops.c 7.78 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
/* ARGSUSED */
ffs_read (ap)
struct vop_read_args *ap;
/* ARGSUSED */
ffs_read (ap)
struct vop_read_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
register struct fs *fs;
struct buf *bp;
daddr_t lbn, bn, rablock;
register struct fs *fs;
struct buf *bp;
daddr_t lbn, bn, rablock;
#ifdef DIAGNOSTIC
int type;
#ifdef DIAGNOSTIC
int type;
- if (uio->uio_rw != UIO_READ)
+ if (ap->a_uio->uio_rw != UIO_READ)
panic("ffs_read mode");
type = ip->i_mode & IFMT;
if (type != IFDIR && type != IFREG && type != IFLNK)
panic("ffs_read type");
#endif
panic("ffs_read mode");
type = ip->i_mode & IFMT;
if (type != IFDIR && type != IFREG && type != IFLNK)
panic("ffs_read type");
#endif
- if (uio->uio_resid == 0)
+ if (ap->a_uio->uio_resid == 0)
- if (uio->uio_offset < 0)
+ if (ap->a_uio->uio_offset < 0)
return (EINVAL);
ip->i_flag |= IACC;
fs = ip->i_fs;
do {
return (EINVAL);
ip->i_flag |= IACC;
fs = ip->i_fs;
do {
- lbn = lblkno(fs, uio->uio_offset);
- on = blkoff(fs, uio->uio_offset);
- n = MIN((unsigned)(fs->fs_bsize - on), uio->uio_resid);
- diff = ip->i_size - uio->uio_offset;
+ lbn = lblkno(fs, ap->a_uio->uio_offset);
+ on = blkoff(fs, ap->a_uio->uio_offset);
+ n = MIN((unsigned)(fs->fs_bsize - on), ap->a_uio->uio_resid);
+ diff = ip->i_size - ap->a_uio->uio_offset;
if (diff <= 0)
return (0);
if (diff < n)
n = diff;
size = blksize(fs, ip, lbn);
rablock = lbn + 1;
if (diff <= 0)
return (0);
if (diff < n)
n = diff;
size = blksize(fs, ip, lbn);
rablock = lbn + 1;
- if (vp->v_lastr + 1 == lbn &&
+ if (ap->a_vp->v_lastr + 1 == lbn &&
lblktosize(fs, rablock) < ip->i_size) {
rasize = blksize(fs, ip, rablock);
lblktosize(fs, rablock) < ip->i_size) {
rasize = blksize(fs, ip, rablock);
- error = breadn(vp, lbn, size, &rablock,
+ error = breadn(ap->a_vp, lbn, size, &rablock,
&rasize, 1, NOCRED, &bp);
} else
&rasize, 1, NOCRED, &bp);
} else
- error = bread(vp, lbn, size, NOCRED, &bp);
- vp->v_lastr = lbn;
+ error = bread(ap->a_vp, lbn, size, NOCRED, &bp);
+ ap->a_vp->v_lastr = lbn;
n = MIN(n, size - bp->b_resid);
if (error) {
brelse(bp);
return (error);
}
n = MIN(n, size - bp->b_resid);
if (error) {
brelse(bp);
return (error);
}
- error = uiomove(bp->b_un.b_addr + on, (int)n, uio);
- if (n + on == fs->fs_bsize || uio->uio_offset == ip->i_size)
+ error = uiomove(bp->b_un.b_addr + on, (int)n, ap->a_uio);
+ if (n + on == fs->fs_bsize || ap->a_uio->uio_offset == ip->i_size)
bp->b_flags |= B_AGE;
brelse(bp);
bp->b_flags |= B_AGE;
brelse(bp);
- } while (error == 0 && uio->uio_resid > 0 && n != 0);
+ } while (error == 0 && ap->a_uio->uio_resid > 0 && n != 0);
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Vnode op for writing.
*/
ffs_write (ap)
struct vop_write_args *ap;
/*
* Vnode op for writing.
*/
ffs_write (ap)
struct vop_write_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
- struct proc *p = uio->uio_procp;
- register struct inode *ip = VTOI(vp);
+ struct proc *p = ap->a_uio->uio_procp;
+ register struct inode *ip = VTOI(ap->a_vp);
register struct fs *fs;
struct buf *bp;
daddr_t lbn, bn;
register struct fs *fs;
struct buf *bp;
daddr_t lbn, bn;
int size, resid, error = 0;
#ifdef DIAGNOSTIC
int size, resid, error = 0;
#ifdef DIAGNOSTIC
- if (uio->uio_rw != UIO_WRITE)
+ if (ap->a_uio->uio_rw != UIO_WRITE)
panic("ffs_write mode");
#endif
panic("ffs_write mode");
#endif
+ switch (ap->a_vp->v_type) {
- if (ioflag & IO_APPEND)
- uio->uio_offset = ip->i_size;
+ if (ap->a_ioflag & IO_APPEND)
+ ap->a_uio->uio_offset = ip->i_size;
/* fall through */
case VLNK:
break;
case VDIR:
/* fall through */
case VLNK:
break;
case VDIR:
- if ((ioflag & IO_SYNC) == 0)
+ if ((ap->a_ioflag & IO_SYNC) == 0)
panic("ffs_write nonsync dir write");
break;
default:
panic("ffs_write type");
}
panic("ffs_write nonsync dir write");
break;
default:
panic("ffs_write type");
}
- if (uio->uio_offset < 0)
+ if (ap->a_uio->uio_offset < 0)
- if (uio->uio_resid == 0)
+ if (ap->a_uio->uio_resid == 0)
return (0);
/*
* Maybe this should be above the vnode op call, but so long as
* file servers have no limits, i don't think it matters
*/
return (0);
/*
* Maybe this should be above the vnode op call, but so long as
* file servers have no limits, i don't think it matters
*/
- if (vp->v_type == VREG && p &&
- uio->uio_offset + uio->uio_resid >
+ if (ap->a_vp->v_type == VREG && p &&
+ ap->a_uio->uio_offset + ap->a_uio->uio_resid >
p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
psignal(p, SIGXFSZ);
return (EFBIG);
}
p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
psignal(p, SIGXFSZ);
return (EFBIG);
}
- resid = uio->uio_resid;
+ resid = ap->a_uio->uio_resid;
osize = ip->i_size;
fs = ip->i_fs;
flags = 0;
osize = ip->i_size;
fs = ip->i_fs;
flags = 0;
+ if (ap->a_ioflag & IO_SYNC)
- lbn = lblkno(fs, uio->uio_offset);
- on = blkoff(fs, uio->uio_offset);
- n = MIN((unsigned)(fs->fs_bsize - on), uio->uio_resid);
+ lbn = lblkno(fs, ap->a_uio->uio_offset);
+ on = blkoff(fs, ap->a_uio->uio_offset);
+ n = MIN((unsigned)(fs->fs_bsize - on), ap->a_uio->uio_resid);
if (n < fs->fs_bsize)
flags |= B_CLRBUF;
else
flags &= ~B_CLRBUF;
if (n < fs->fs_bsize)
flags |= B_CLRBUF;
else
flags &= ~B_CLRBUF;
- if (error = ffs_balloc(ip, lbn, on + n, cred, &bp, flags))
+ if (error = ffs_balloc(ip, lbn, on + n, ap->a_cred, &bp, flags))
- if (uio->uio_offset + n > ip->i_size) {
- ip->i_size = uio->uio_offset + n;
- vnode_pager_setsize(vp, (u_long)ip->i_size);
+ if (ap->a_uio->uio_offset + n > ip->i_size) {
+ ip->i_size = ap->a_uio->uio_offset + n;
+ vnode_pager_setsize(ap->a_vp, (u_long)ip->i_size);
}
size = blksize(fs, ip, lbn);
}
size = blksize(fs, ip, lbn);
- (void) vnode_pager_uncache(vp);
+ (void) vnode_pager_uncache(ap->a_vp);
n = MIN(n, size - bp->b_resid);
n = MIN(n, size - bp->b_resid);
- error = uiomove(bp->b_un.b_addr + on, n, uio);
- if (ioflag & IO_SYNC)
+ error = uiomove(bp->b_un.b_addr + on, n, ap->a_uio);
+ if (ap->a_ioflag & IO_SYNC)
(void) bwrite(bp);
else if (n + on == fs->fs_bsize) {
bp->b_flags |= B_AGE;
(void) bwrite(bp);
else if (n + on == fs->fs_bsize) {
bp->b_flags |= B_AGE;
} else
bdwrite(bp);
ip->i_flag |= IUPD|ICHG;
} else
bdwrite(bp);
ip->i_flag |= IUPD|ICHG;
+ if (ap->a_cred->cr_uid != 0)
ip->i_mode &= ~(ISUID|ISGID);
ip->i_mode &= ~(ISUID|ISGID);
- } while (error == 0 && uio->uio_resid > 0 && n != 0);
- if (error && (ioflag & IO_UNIT)) {
- (void)VOP_TRUNCATE(vp, osize, ioflag & IO_SYNC, cred);
- uio->uio_offset -= resid - uio->uio_resid;
- uio->uio_resid = resid;
+ } while (error == 0 && ap->a_uio->uio_resid > 0 && n != 0);
+ if (error && (ap->a_ioflag & IO_UNIT)) {
+ (void)VOP_TRUNCATE(ap->a_vp, osize, ap->a_ioflag & IO_SYNC, ap->a_cred);
+ ap->a_uio->uio_offset -= resid - ap->a_uio->uio_resid;
+ ap->a_uio->uio_resid = resid;
- if (!error && (ioflag & IO_SYNC))
- error = VOP_UPDATE(vp, &time, &time, 1);
+ if (!error && (ap->a_ioflag & IO_SYNC))
+ error = VOP_UPDATE(ap->a_vp, &time, &time, 1);
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
int
ffs_fsync (ap)
struct vop_fsync_args *ap;
int
ffs_fsync (ap)
struct vop_fsync_args *ap;
-#define vp (ap->a_vp)
-#define fflags (ap->a_fflags)
-#define cred (ap->a_cred)
-#define waitfor (ap->a_waitfor)
-#define p (ap->a_p)
- struct inode *ip = VTOI(vp);
+ struct inode *ip = VTOI(ap->a_vp);
+ if (ap->a_fflags & FWRITE)
- vflushbuf(vp, waitfor == MNT_WAIT ? B_SYNC : 0);
- return (VOP_UPDATE(vp, &time, &time, waitfor == MNT_WAIT));
+ vflushbuf(ap->a_vp, ap->a_waitfor == MNT_WAIT ? B_SYNC : 0);
+ return (VOP_UPDATE(ap->a_vp, &time, &time, ap->a_waitfor == MNT_WAIT));
-#undef vp
-#undef fflags
-#undef cred
-#undef waitfor
-#undef p
/*
* Last reference to an inode, write the inode out and if necessary,
/*
* Last reference to an inode, write the inode out and if necessary,
int
ffs_inactive (ap)
struct vop_inactive_args *ap;
int
ffs_inactive (ap)
struct vop_inactive_args *ap;
-#define vp (ap->a_vp)
-#define p (ap->a_p)
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
int mode, error;
extern int prtactive;
int mode, error;
extern int prtactive;
- if (prtactive && vp->v_usecount != 0)
- vprint("ffs_inactive: pushing active", vp);
+ if (prtactive && ap->a_vp->v_usecount != 0)
+ vprint("ffs_inactive: pushing active", ap->a_vp);
/* Get rid of inodes related to stale file handles. */
/* Get rid of inodes related to stale file handles. */
- if ((vp->v_flag & VXLOCK) == 0)
- vgone(vp);
+ if ((ap->a_vp->v_flag & VXLOCK) == 0)
+ vgone(ap->a_vp);
return (0);
}
error = 0;
ILOCK(ip);
return (0);
}
error = 0;
ILOCK(ip);
- if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
+ if (ip->i_nlink <= 0 && (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
#ifdef QUOTA
if (!getinoquota(ip))
(void)chkiq(ip, -1, NOCRED, 0);
#endif
#ifdef QUOTA
if (!getinoquota(ip))
(void)chkiq(ip, -1, NOCRED, 0);
#endif
- error = VOP_TRUNCATE(vp, (off_t)0, 0, NOCRED);
+ error = VOP_TRUNCATE(ap->a_vp, (off_t)0, 0, NOCRED);
mode = ip->i_mode;
ip->i_mode = 0;
ip->i_rdev = 0;
ip->i_flag |= IUPD|ICHG;
mode = ip->i_mode;
ip->i_mode = 0;
ip->i_rdev = 0;
ip->i_flag |= IUPD|ICHG;
- VOP_VFREE(vp, ip->i_number, mode);
+ VOP_VFREE(ap->a_vp, ip->i_number, mode);
}
if (ip->i_flag&(IUPD|IACC|ICHG|IMOD))
}
if (ip->i_flag&(IUPD|IACC|ICHG|IMOD))
- VOP_UPDATE(vp, &time, &time, 0);
+ VOP_UPDATE(ap->a_vp, &time, &time, 0);
IUNLOCK(ip);
ip->i_flag = 0;
/*
* If we are done with the inode, reclaim it
* so that it can be reused immediately.
*/
IUNLOCK(ip);
ip->i_flag = 0;
/*
* If we are done with the inode, reclaim it
* so that it can be reused immediately.
*/
- if (vp->v_usecount == 0 && ip->i_mode == 0)
- vgone(vp);
+ if (ap->a_vp->v_usecount == 0 && ip->i_mode == 0)
+ vgone(ap->a_vp);
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_inode.c 7.45 (Berkeley) %G%
+ * @(#)ufs_inode.c 7.46 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
ufs_reclaim (ap)
struct vop_reclaim_args *ap;
int
ufs_reclaim (ap)
struct vop_reclaim_args *ap;
{
register struct inode *ip;
int i, type;
{
register struct inode *ip;
int i, type;
- if (prtactive && vp->v_usecount != 0)
- vprint("ufs_reclaim: pushing active", vp);
+ if (prtactive && ap->a_vp->v_usecount != 0)
+ vprint("ufs_reclaim: pushing active", ap->a_vp);
/*
* Remove the inode from its hash chain.
*/
/*
* Remove the inode from its hash chain.
*/
remque(ip);
/*
* Purge old data structures associated with the inode.
*/
remque(ip);
/*
* Purge old data structures associated with the inode.
*/
if (ip->i_devvp) {
vrele(ip->i_devvp);
ip->i_devvp = 0;
if (ip->i_devvp) {
vrele(ip->i_devvp);
ip->i_devvp = 0;
#ifdef QUOTA
for (i = 0; i < MAXQUOTAS; i++) {
if (ip->i_dquot[i] != NODQUOT) {
#ifdef QUOTA
for (i = 0; i < MAXQUOTAS; i++) {
if (ip->i_dquot[i] != NODQUOT) {
- dqrele(vp, ip->i_dquot[i]);
+ dqrele(ap->a_vp, ip->i_dquot[i]);
ip->i_dquot[i] = NODQUOT;
}
}
#endif
ip->i_dquot[i] = NODQUOT;
}
}
#endif
- switch (vp->v_mount->mnt_stat.f_type) {
+ switch (ap->a_vp->v_mount->mnt_stat.f_type) {
case MOUNT_UFS:
type = M_FFSNODE;
break;
case MOUNT_UFS:
type = M_FFSNODE;
break;
default:
panic("ufs_reclaim: not ufs file");
}
default:
panic("ufs_reclaim: not ufs file");
}
- FREE(vp->v_data, type);
- vp->v_data = NULL;
+ FREE(ap->a_vp->v_data, type);
+ ap->a_vp->v_data = NULL;
/*
* Lock an inode. If its already locked, set the WANT bit and sleep.
/*
* Lock an inode. If its already locked, set the WANT bit and sleep.
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_lookup.c 7.45 (Berkeley) %G%
+ * @(#)ufs_lookup.c 7.46 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
ufs_lookup (ap)
struct vop_lookup_args *ap;
int
ufs_lookup (ap)
struct vop_lookup_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
{
USES_VOP_ACCESS;
USES_VOP_BLKATOFF;
{
USES_VOP_ACCESS;
USES_VOP_BLKATOFF;
int lockparent; /* 1 => lockparent flag is set */
int wantparent; /* 1 => wantparent or lockparent flag */
int error;
int lockparent; /* 1 => lockparent flag is set */
int wantparent; /* 1 => wantparent or lockparent flag */
int error;
- struct vnode *vdp = dvp; /* saved for one special case */
+ struct vnode *vdp = ap->a_dvp; /* saved for one special case */
bp = NULL;
slotoffset = -1;
bp = NULL;
slotoffset = -1;
- *vpp = NULL;
- dp = VTOI(dvp);
- lockparent = cnp->cn_flags & LOCKPARENT;
- wantparent = cnp->cn_flags & (LOCKPARENT|WANTPARENT);
+ *ap->a_vpp = NULL;
+ dp = VTOI(ap->a_dvp);
+ lockparent = ap->a_cnp->cn_flags & LOCKPARENT;
+ wantparent = ap->a_cnp->cn_flags & (LOCKPARENT|WANTPARENT);
/*
* Check accessiblity of directory.
*/
if ((dp->i_mode & IFMT) != IFDIR)
return (ENOTDIR);
/*
* Check accessiblity of directory.
*/
if ((dp->i_mode & IFMT) != IFDIR)
return (ENOTDIR);
- if (error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, cnp->cn_proc))
+ if (error = VOP_ACCESS(ap->a_dvp, VEXEC, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc))
* check the name cache to see if the directory/name pair
* we are looking for is known already.
*/
* check the name cache to see if the directory/name pair
* we are looking for is known already.
*/
- if (error = cache_lookup(dvp, vpp, cnp)) {
+ if (error = cache_lookup(ap->a_dvp, ap->a_vpp, ap->a_cnp)) {
int vpid; /* capability number of vnode */
if (error == ENOENT)
return (error);
#ifdef PARANOID
int vpid; /* capability number of vnode */
if (error == ENOENT)
return (error);
#ifdef PARANOID
- if (dvp == ndp->ni_rdir && (cnp->cn_flags & ISDOTDOT))
+ if (ap->a_dvp == ndp->ni_rdir && (ap->a_cnp->cn_flags & ISDOTDOT))
panic("ufs_lookup: .. through root");
#endif
/*
panic("ufs_lookup: .. through root");
#endif
/*
*/
/*
* The borrowing of variables
*/
/*
* The borrowing of variables
- * here is somewhat confusing. Usually, dvp/dp
+ * here is somewhat confusing. Usually, ap->a_dvp/dp
* is the directory being searched.
* Here it's the target returned from the cache.
*/
pdp = dp;
* is the directory being searched.
* Here it's the target returned from the cache.
*/
pdp = dp;
- dp = VTOI(*vpp);
- dvp = *vpp;
- vpid = dvp->v_id;
+ dp = VTOI(*ap->a_vpp);
+ ap->a_dvp = *ap->a_vpp;
+ vpid = ap->a_dvp->v_id;
if (pdp == dp) { /* lookup on "." */
if (pdp == dp) { /* lookup on "." */
- } else if (cnp->cn_flags & ISDOTDOT) {
+ } else if (ap->a_cnp->cn_flags & ISDOTDOT) {
- error = vget(dvp);
- if (!error && lockparent && (cnp->cn_flags & ISLASTCN))
+ error = vget(ap->a_dvp);
+ if (!error && lockparent && (ap->a_cnp->cn_flags & ISLASTCN))
- error = vget(dvp);
- if (!lockparent || error || !(cnp->cn_flags & ISLASTCN))
+ error = vget(ap->a_dvp);
+ if (!lockparent || error || !(ap->a_cnp->cn_flags & ISLASTCN))
* while we were waiting for the lock.
*/
if (!error) {
* while we were waiting for the lock.
*/
if (!error) {
+ if (vpid == ap->a_dvp->v_id)
return (0);
ufs_iput(dp);
if (lockparent && pdp != dp &&
return (0);
ufs_iput(dp);
if (lockparent && pdp != dp &&
- (cnp->cn_flags & ISLASTCN))
+ (ap->a_cnp->cn_flags & ISLASTCN))
IUNLOCK(pdp);
}
ILOCK(pdp);
dp = pdp;
IUNLOCK(pdp);
}
ILOCK(pdp);
dp = pdp;
- dvp = ITOV(dp);
- *vpp = NULL;
+ ap->a_dvp = ITOV(dp);
+ *ap->a_vpp = NULL;
*/
slotstatus = FOUND;
slotfreespace = slotsize = slotneeded = 0;
*/
slotstatus = FOUND;
slotfreespace = slotsize = slotneeded = 0;
- if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) &&
- (cnp->cn_flags & ISLASTCN)) {
+ if ((ap->a_cnp->cn_nameiop == CREATE || ap->a_cnp->cn_nameiop == RENAME) &&
+ (ap->a_cnp->cn_flags & ISLASTCN)) {
slotstatus = NONE;
slotneeded = (sizeof(struct direct) - MAXNAMLEN +
slotstatus = NONE;
slotneeded = (sizeof(struct direct) - MAXNAMLEN +
- cnp->cn_namelen + 3) &~ 3;
+ ap->a_cnp->cn_namelen + 3) &~ 3;
* profiling time and hence has been removed in the interest
* of simplicity.
*/
* profiling time and hence has been removed in the interest
* of simplicity.
*/
- bmask = VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
- if (cnp->cn_nameiop != LOOKUP || dp->i_diroff == 0 ||
+ bmask = VFSTOUFS(ap->a_dvp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
+ if (ap->a_cnp->cn_nameiop != LOOKUP || dp->i_diroff == 0 ||
dp->i_diroff > dp->i_size) {
entryoffsetinblock = 0;
dp->i_offset = 0;
dp->i_diroff > dp->i_size) {
entryoffsetinblock = 0;
dp->i_offset = 0;
} else {
dp->i_offset = dp->i_diroff;
if ((entryoffsetinblock = dp->i_offset & bmask) &&
} else {
dp->i_offset = dp->i_diroff;
if ((entryoffsetinblock = dp->i_offset & bmask) &&
- (error = VOP_BLKATOFF(dvp, (off_t)dp->i_offset, NULL, &bp)))
+ (error = VOP_BLKATOFF(ap->a_dvp, (off_t)dp->i_offset, NULL, &bp)))
return (error);
numdirpasses = 2;
nchstats.ncs_2passes++;
return (error);
numdirpasses = 2;
nchstats.ncs_2passes++;
if (bp != NULL)
brelse(bp);
if (error =
if (bp != NULL)
brelse(bp);
if (error =
- VOP_BLKATOFF(dvp, (off_t)dp->i_offset, NULL, &bp))
+ VOP_BLKATOFF(ap->a_dvp, (off_t)dp->i_offset, NULL, &bp))
return (error);
entryoffsetinblock = 0;
}
return (error);
entryoffsetinblock = 0;
}
* Check for a name match.
*/
if (ep->d_ino) {
* Check for a name match.
*/
if (ep->d_ino) {
- if (ep->d_namlen == cnp->cn_namelen &&
- !bcmp(cnp->cn_nameptr, ep->d_name,
+ if (ep->d_namlen == ap->a_cnp->cn_namelen &&
+ !bcmp(ap->a_cnp->cn_nameptr, ep->d_name,
(unsigned)ep->d_namlen)) {
/*
* Save directory entry's inode number and
(unsigned)ep->d_namlen)) {
/*
* Save directory entry's inode number and
* directory has not been removed, then can consider
* allowing file to be created.
*/
* directory has not been removed, then can consider
* allowing file to be created.
*/
- if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) &&
- (cnp->cn_flags & ISLASTCN) && dp->i_nlink != 0) {
+ if ((ap->a_cnp->cn_nameiop == CREATE || ap->a_cnp->cn_nameiop == RENAME) &&
+ (ap->a_cnp->cn_flags & ISLASTCN) && dp->i_nlink != 0) {
/*
* Access for write is interpreted as allowing
* creation of files in the directory.
*/
/*
* Access for write is interpreted as allowing
* creation of files in the directory.
*/
- if (error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_proc))
+ if (error = VOP_ACCESS(ap->a_dvp, VWRITE, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc))
return (error);
/*
* Return an indication of where the new directory
return (error);
/*
* Return an indication of where the new directory
* NB - if the directory is unlocked, then this
* information cannot be used.
*/
* NB - if the directory is unlocked, then this
* information cannot be used.
*/
- cnp->cn_flags |= SAVENAME;
+ ap->a_cnp->cn_flags |= SAVENAME;
if (!lockparent)
IUNLOCK(dp);
return (EJUSTRETURN);
if (!lockparent)
IUNLOCK(dp);
return (EJUSTRETURN);
/*
* Insert name into cache (as non-existent) if appropriate.
*/
/*
* Insert name into cache (as non-existent) if appropriate.
*/
- if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE)
- cache_enter(dvp, *vpp, cnp);
+ if ((ap->a_cnp->cn_flags & MAKEENTRY) && ap->a_cnp->cn_nameiop != CREATE)
+ cache_enter(ap->a_dvp, *ap->a_vpp, ap->a_cnp);
* If the final component of path name, save information
* in the cache as to where the entry was found.
*/
* If the final component of path name, save information
* in the cache as to where the entry was found.
*/
- if ((cnp->cn_flags & ISLASTCN) && cnp->cn_nameiop == LOOKUP)
+ if ((ap->a_cnp->cn_flags & ISLASTCN) && ap->a_cnp->cn_nameiop == LOOKUP)
dp->i_diroff = dp->i_offset &~ (DIRBLKSIZ - 1);
/*
dp->i_diroff = dp->i_offset &~ (DIRBLKSIZ - 1);
/*
* the directory (in ndp->ni_dvp), otherwise we go
* on and lock the inode, being careful with ".".
*/
* the directory (in ndp->ni_dvp), otherwise we go
* on and lock the inode, being careful with ".".
*/
- if (cnp->cn_nameiop == DELETE && (cnp->cn_flags & ISLASTCN)) {
+ if (ap->a_cnp->cn_nameiop == DELETE && (ap->a_cnp->cn_flags & ISLASTCN)) {
/*
* Write access to directory required to delete files.
*/
/*
* Write access to directory required to delete files.
*/
- if (error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_proc))
+ if (error = VOP_ACCESS(ap->a_dvp, VWRITE, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc))
return (error);
/*
* Return pointer to current entry in dp->i_offset,
return (error);
/*
* Return pointer to current entry in dp->i_offset,
dp->i_count = dp->i_offset - prevoff;
if (dp->i_number == dp->i_ino) {
VREF(vdp);
dp->i_count = dp->i_offset - prevoff;
if (dp->i_number == dp->i_ino) {
VREF(vdp);
- if (error = VOP_VGET(dvp, dp->i_ino, &tdp))
+ if (error = VOP_VGET(ap->a_dvp, dp->i_ino, &tdp))
return (error);
/*
* If directory is "sticky", then user must own
return (error);
/*
* If directory is "sticky", then user must own
* implements append-only directories.
*/
if ((dp->i_mode & ISVTX) &&
* implements append-only directories.
*/
if ((dp->i_mode & ISVTX) &&
- cnp->cn_cred->cr_uid != 0 &&
- cnp->cn_cred->cr_uid != dp->i_uid &&
- VTOI(tdp)->i_uid != cnp->cn_cred->cr_uid) {
+ ap->a_cnp->cn_cred->cr_uid != 0 &&
+ ap->a_cnp->cn_cred->cr_uid != dp->i_uid &&
+ VTOI(tdp)->i_uid != ap->a_cnp->cn_cred->cr_uid) {
vput(tdp);
return (EPERM);
}
vput(tdp);
return (EPERM);
}
if (!lockparent)
IUNLOCK(dp);
return (0);
if (!lockparent)
IUNLOCK(dp);
return (0);
* Must get inode of directory entry to verify it's a
* regular file, or empty directory.
*/
* Must get inode of directory entry to verify it's a
* regular file, or empty directory.
*/
- if (cnp->cn_nameiop == RENAME && wantparent &&
- (cnp->cn_flags & ISLASTCN)) {
- if (error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_proc))
+ if (ap->a_cnp->cn_nameiop == RENAME && wantparent &&
+ (ap->a_cnp->cn_flags & ISLASTCN)) {
+ if (error = VOP_ACCESS(ap->a_dvp, VWRITE, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc))
return (error);
/*
* Careful about locking second inode.
return (error);
/*
* Careful about locking second inode.
*/
if (dp->i_number == dp->i_ino)
return (EISDIR);
*/
if (dp->i_number == dp->i_ino)
return (EISDIR);
- if (error = VOP_VGET(dvp, dp->i_ino, &tdp))
+ if (error = VOP_VGET(ap->a_dvp, dp->i_ino, &tdp))
- *vpp = tdp;
- cnp->cn_flags |= SAVENAME;
+ *ap->a_vpp = tdp;
+ ap->a_cnp->cn_flags |= SAVENAME;
if (!lockparent)
IUNLOCK(dp);
return (0);
if (!lockparent)
IUNLOCK(dp);
return (0);
* that point backwards in the directory structure.
*/
pdp = dp;
* that point backwards in the directory structure.
*/
pdp = dp;
- if (cnp->cn_flags & ISDOTDOT) {
+ if (ap->a_cnp->cn_flags & ISDOTDOT) {
IUNLOCK(pdp); /* race to get the inode */
IUNLOCK(pdp); /* race to get the inode */
- if (error = VOP_VGET(dvp, dp->i_ino, &tdp)) {
+ if (error = VOP_VGET(ap->a_dvp, dp->i_ino, &tdp)) {
ILOCK(pdp);
return (error);
}
ILOCK(pdp);
return (error);
}
- if (lockparent && (cnp->cn_flags & ISLASTCN))
+ if (lockparent && (ap->a_cnp->cn_flags & ISLASTCN))
} else if (dp->i_number == dp->i_ino) {
} else if (dp->i_number == dp->i_ino) {
- VREF(dvp); /* we want ourself, ie "." */
- *vpp = dvp;
+ VREF(ap->a_dvp); /* we want ourself, ie "." */
+ *ap->a_vpp = ap->a_dvp;
- if (error = VOP_VGET(dvp, dp->i_ino, &tdp))
+ if (error = VOP_VGET(ap->a_dvp, dp->i_ino, &tdp))
- if (!lockparent || !(cnp->cn_flags & ISLASTCN))
+ if (!lockparent || !(ap->a_cnp->cn_flags & ISLASTCN))
}
/*
* Insert name into cache if appropriate.
*/
}
/*
* Insert name into cache if appropriate.
*/
- if (cnp->cn_flags & MAKEENTRY)
- cache_enter(dvp, *vpp, cnp);
+ if (ap->a_cnp->cn_flags & MAKEENTRY)
+ cache_enter(ap->a_dvp, *ap->a_vpp, ap->a_cnp);
-#undef dvp
-#undef vpp
-#undef cnp
void
ufs_dirbad(ip, offset, how)
void
ufs_dirbad(ip, offset, how)
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_vnops.c 7.90 (Berkeley) %G%
+ * @(#)ufs_vnops.c 7.91 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
ufs_create (ap)
struct vop_create_args *ap;
int
ufs_create (ap)
struct vop_create_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
- ufs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode), dvp, vpp, cnp))
+ 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);
}
return (error);
return (0);
}
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
int
ufs_mknod (ap)
struct vop_mknod_args *ap;
int
ufs_mknod (ap)
struct vop_mknod_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
{
register struct inode *ip;
int error;
if (error =
{
register struct inode *ip;
int error;
if (error =
- ufs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode), dvp, vpp, cnp))
+ ufs_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode), ap->a_dvp, ap->a_vpp, ap->a_cnp))
ip->i_flag |= IACC|IUPD|ICHG;
ip->i_flag |= IACC|IUPD|ICHG;
- if (vap->va_rdev != VNOVAL) {
+ if (ap->a_vap->va_rdev != VNOVAL) {
/*
* Want to be able to use this to make badblock
* inodes, so don't truncate the dev number.
*/
/*
* Want to be able to use this to make badblock
* inodes, so don't truncate the dev number.
*/
- ip->i_rdev = vap->va_rdev;
+ ip->i_rdev = ap->a_vap->va_rdev;
}
/*
* Remove inode so that it will be reloaded by iget and
* checked to see if it is an alias of an existing entry
* in the inode cache.
*/
}
/*
* Remove inode so that it will be reloaded by iget and
* checked to see if it is an alias of an existing entry
* in the inode cache.
*/
- vput(*vpp);
- (*vpp)->v_type = VNON;
- vgone(*vpp);
- *vpp = 0;
+ vput(*ap->a_vpp);
+ (*ap->a_vpp)->v_type = VNON;
+ vgone(*ap->a_vpp);
+ *ap->a_vpp = 0;
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
int
ufs_open (ap)
struct vop_open_args *ap;
int
ufs_open (ap)
struct vop_open_args *ap;
-#define vp (ap->a_vp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef mode
-#undef cred
-#undef p
int
ufs_close (ap)
struct vop_close_args *ap;
int
ufs_close (ap)
struct vop_close_args *ap;
-#define vp (ap->a_vp)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
register struct inode *ip;
{
register struct inode *ip;
- ip = VTOI(vp);
- if (vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
+ ip = VTOI(ap->a_vp);
+ if (ap->a_vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
ITIMES(ip, &time, &time);
return (0);
}
ITIMES(ip, &time, &time);
return (0);
}
-#undef vp
-#undef fflag
-#undef cred
-#undef p
/*
* Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
/*
* Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
int
ufs_access (ap)
struct vop_access_args *ap;
int
ufs_access (ap)
struct vop_access_args *ap;
-#define vp (ap->a_vp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
register gid_t *gp;
int i, error;
#ifdef DIAGNOSTIC
register gid_t *gp;
int i, error;
#ifdef DIAGNOSTIC
- if (!VOP_ISLOCKED(vp)) {
- vprint("ufs_access: not locked", vp);
+ if (!VOP_ISLOCKED(ap->a_vp)) {
+ vprint("ufs_access: not locked", ap->a_vp);
panic("ufs_access: not locked");
}
#endif
#ifdef QUOTA
panic("ufs_access: not locked");
}
#endif
#ifdef QUOTA
- if (mode & VWRITE) {
- switch (vp->v_type) {
+ if (ap->a_mode & VWRITE) {
+ switch (ap->a_vp->v_type) {
case VREG: case VDIR: case VLNK:
if (error = getinoquota(ip))
return (error);
case VREG: case VDIR: case VLNK:
if (error = getinoquota(ip))
return (error);
/*
* If you're the super-user, you always get access.
*/
/*
* If you're the super-user, you always get access.
*/
+ if (ap->a_cred->cr_uid == 0)
return (0);
/*
* Access check is based on only one of owner, group, public.
* If not owner, then check group. If not a member of the
* group, then check public access.
*/
return (0);
/*
* Access check is based on only one of owner, group, public.
* If not owner, then check group. If not a member of the
* group, then check public access.
*/
- if (cred->cr_uid != ip->i_uid) {
- mode >>= 3;
- gp = cred->cr_groups;
- for (i = 0; i < cred->cr_ngroups; i++, gp++)
+ if (ap->a_cred->cr_uid != ip->i_uid) {
+ ap->a_mode >>= 3;
+ gp = ap->a_cred->cr_groups;
+ for (i = 0; i < ap->a_cred->cr_ngroups; i++, gp++)
if (ip->i_gid == *gp)
goto found;
if (ip->i_gid == *gp)
goto found;
- if ((ip->i_mode & mode) != 0)
+ if ((ip->i_mode & ap->a_mode) != 0)
return (0);
return (EACCES);
}
return (0);
return (EACCES);
}
-#undef vp
-#undef mode
-#undef cred
-#undef p
/* ARGSUSED */
int
ufs_getattr (ap)
struct vop_getattr_args *ap;
/* ARGSUSED */
int
ufs_getattr (ap)
struct vop_getattr_args *ap;
-#define vp (ap->a_vp)
-#define vap (ap->a_vap)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
register struct inode *ip;
{
register struct inode *ip;
ITIMES(ip, &time, &time);
/*
* Copy from inode table
*/
ITIMES(ip, &time, &time);
/*
* Copy from inode table
*/
- vap->va_fsid = ip->i_dev;
- vap->va_fileid = ip->i_number;
- vap->va_mode = ip->i_mode & ~IFMT;
- vap->va_nlink = ip->i_nlink;
- vap->va_uid = ip->i_uid;
- vap->va_gid = ip->i_gid;
- vap->va_rdev = (dev_t)ip->i_rdev;
+ ap->a_vap->va_fsid = ip->i_dev;
+ ap->a_vap->va_fileid = ip->i_number;
+ ap->a_vap->va_mode = ip->i_mode & ~IFMT;
+ ap->a_vap->va_nlink = ip->i_nlink;
+ ap->a_vap->va_uid = ip->i_uid;
+ ap->a_vap->va_gid = ip->i_gid;
+ ap->a_vap->va_rdev = (dev_t)ip->i_rdev;
- vap->va_size = ip->i_size;
- vap->va_size_rsv = 0;
+ ap->a_vap->va_size = ip->i_size;
+ ap->a_vap->va_size_rsv = 0;
- vap->va_qsize = ip->i_din.di_qsize;
+ ap->a_vap->va_qsize = ip->i_din.di_qsize;
- vap->va_atime = ip->i_atime;
- vap->va_mtime = ip->i_mtime;
- vap->va_ctime = ip->i_ctime;
- vap->va_flags = ip->i_flags;
- vap->va_gen = ip->i_gen;
+ ap->a_vap->va_atime = ip->i_atime;
+ ap->a_vap->va_mtime = ip->i_mtime;
+ ap->a_vap->va_ctime = ip->i_ctime;
+ ap->a_vap->va_flags = ip->i_flags;
+ ap->a_vap->va_gen = ip->i_gen;
/* this doesn't belong here */
/* this doesn't belong here */
- if (vp->v_type == VBLK)
- vap->va_blocksize = BLKDEV_IOSIZE;
- else if (vp->v_type == VCHR)
- vap->va_blocksize = MAXBSIZE;
+ if (ap->a_vp->v_type == VBLK)
+ ap->a_vap->va_blocksize = BLKDEV_IOSIZE;
+ else if (ap->a_vp->v_type == VCHR)
+ ap->a_vap->va_blocksize = MAXBSIZE;
- vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize;
- vap->va_bytes = dbtob(ip->i_blocks);
+ ap->a_vap->va_blocksize = ap->a_vp->v_mount->mnt_stat.f_iosize;
+ ap->a_vap->va_bytes = dbtob(ip->i_blocks);
+ ap->a_vap->va_bytes_rsv = 0;
- vap->va_type = vp->v_type;
- vap->va_filerev = ip->i_modrev;
+ ap->a_vap->va_type = ap->a_vp->v_type;
+ ap->a_vap->va_filerev = ip->i_modrev;
-#undef vp
-#undef vap
-#undef cred
-#undef p
/*
* Set attribute vnode op. called from several syscalls
/*
* Set attribute vnode op. called from several syscalls
int
ufs_setattr (ap)
struct vop_setattr_args *ap;
int
ufs_setattr (ap)
struct vop_setattr_args *ap;
-#define vp (ap->a_vp)
-#define vap (ap->a_vap)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
/*
* Check for unsettable attributes.
*/
/*
* Check for unsettable attributes.
*/
- if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) ||
- (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) ||
- (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) ||
- ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) {
+ if ((ap->a_vap->va_type != VNON) || (ap->a_vap->va_nlink != VNOVAL) ||
+ (ap->a_vap->va_fsid != VNOVAL) || (ap->a_vap->va_fileid != VNOVAL) ||
+ (ap->a_vap->va_blocksize != VNOVAL) || (ap->a_vap->va_rdev != VNOVAL) ||
+ ((int)ap->a_vap->va_bytes != VNOVAL) || (ap->a_vap->va_gen != VNOVAL)) {
return (EINVAL);
}
/*
* Go through the fields and update iff not VNOVAL.
*/
return (EINVAL);
}
/*
* 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 (ap->a_vap->va_uid != (uid_t)VNOVAL || ap->a_vap->va_gid != (gid_t)VNOVAL)
+ if (error = ufs_chown(ap->a_vp, ap->a_vap->va_uid, ap->a_vap->va_gid, ap->a_cred, ap->a_p))
- if (vap->va_size != VNOVAL) {
- if (vp->v_type == VDIR)
+ if (ap->a_vap->va_size != VNOVAL) {
+ if (ap->a_vp->v_type == VDIR)
- if (error = VOP_TRUNCATE(vp, vap->va_size, 0, cred))
+ if (error = VOP_TRUNCATE(ap->a_vp, ap->a_vap->va_size, 0, ap->a_cred))
- ip = VTOI(vp);
- 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)))
+ ip = VTOI(ap->a_vp);
+ if (ap->a_vap->va_atime.tv_sec != VNOVAL || ap->a_vap->va_mtime.tv_sec != VNOVAL) {
+ if (ap->a_cred->cr_uid != ip->i_uid &&
+ (error = suser(ap->a_cred, &ap->a_p->p_acflag)))
- if (vap->va_atime.tv_sec != VNOVAL)
+ if (ap->a_vap->va_atime.tv_sec != VNOVAL)
- if (vap->va_mtime.tv_sec != VNOVAL)
+ if (ap->a_vap->va_mtime.tv_sec != VNOVAL)
ip->i_flag |= IUPD;
ip->i_flag |= ICHG;
ip->i_flag |= IUPD;
ip->i_flag |= ICHG;
- if (error = VOP_UPDATE(vp, &vap->va_atime, &vap->va_mtime, 1))
+ if (error = VOP_UPDATE(ap->a_vp, &ap->a_vap->va_atime, &ap->a_vap->va_mtime, 1))
return (error);
}
error = 0;
return (error);
}
error = 0;
- if (vap->va_mode != (mode_t)VNOVAL)
- error = ufs_chmod(vp, (int)vap->va_mode, cred, p);
- if (vap->va_flags != VNOVAL) {
- if (cred->cr_uid != ip->i_uid &&
- (error = suser(cred, &p->p_acflag)))
+ if (ap->a_vap->va_mode != (mode_t)VNOVAL)
+ error = ufs_chmod(ap->a_vp, (int)ap->a_vap->va_mode, ap->a_cred, ap->a_p);
+ if (ap->a_vap->va_flags != VNOVAL) {
+ if (ap->a_cred->cr_uid != ip->i_uid &&
+ (error = suser(ap->a_cred, &ap->a_p->p_acflag)))
- if (cred->cr_uid == 0) {
- ip->i_flags = vap->va_flags;
+ if (ap->a_cred->cr_uid == 0) {
+ ip->i_flags = ap->a_vap->va_flags;
} else {
ip->i_flags &= 0xffff0000;
} else {
ip->i_flags &= 0xffff0000;
- ip->i_flags |= (vap->va_flags & 0xffff);
+ ip->i_flags |= (ap->a_vap->va_flags & 0xffff);
}
ip->i_flag |= ICHG;
}
return (error);
}
}
ip->i_flag |= ICHG;
}
return (error);
}
-#undef vp
-#undef vap
-#undef cred
-#undef p
/*
* Change the mode on a file.
/*
* Change the mode on a file.
int
ufs_ioctl (ap)
struct vop_ioctl_args *ap;
int
ufs_ioctl (ap)
struct vop_ioctl_args *ap;
-#define vp (ap->a_vp)
-#define com (ap->a_command)
-#define data (ap->a_data)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef com
-#undef data
-#undef fflag
-#undef cred
-#undef p
/* ARGSUSED */
int
ufs_select (ap)
struct vop_select_args *ap;
/* ARGSUSED */
int
ufs_select (ap)
struct vop_select_args *ap;
-#define vp (ap->a_vp)
-#define which (ap->a_which)
-#define fflags (ap->a_fflags)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef which
-#undef fflags
-#undef cred
-#undef p
int
ufs_mmap (ap)
struct vop_mmap_args *ap;
int
ufs_mmap (ap)
struct vop_mmap_args *ap;
-#define vp (ap->a_vp)
-#define fflags (ap->a_fflags)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef fflags
-#undef cred
-#undef p
int
ufs_seek (ap)
struct vop_seek_args *ap;
int
ufs_seek (ap)
struct vop_seek_args *ap;
-#define vp (ap->a_vp)
-#define oldoff (ap->a_oldoff)
-#define newoff (ap->a_newoff)
-#define cred (ap->a_cred)
-#undef vp
-#undef oldoff
-#undef newoff
-#undef cred
int
ufs_remove (ap)
struct vop_remove_args *ap;
int
ufs_remove (ap)
struct vop_remove_args *ap;
-#define dvp (ap->a_dvp)
-#define vp (ap->a_vp)
-#define cnp (ap->a_cnp)
{
register struct inode *ip, *dp;
int error;
{
register struct inode *ip, *dp;
int error;
- ip = VTOI(vp);
- dp = VTOI(dvp);
- error = ufs_dirremove(dvp, cnp);
+ ip = VTOI(ap->a_vp);
+ dp = VTOI(ap->a_dvp);
+ error = ufs_dirremove(ap->a_dvp, ap->a_cnp);
if (!error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
if (!error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
ufs_iput(dp);
return (error);
}
ufs_iput(dp);
return (error);
}
-#undef dvp
-#undef vp
-#undef cnp
int
ufs_link (ap)
struct vop_link_args *ap;
int
ufs_link (ap)
struct vop_link_args *ap;
-#define tdvp (ap->a_vp)
-#define vp (ap->a_tdvp)
-#define cnp (ap->a_cnp)
{
USES_VOP_UPDATE;
register struct inode *ip;
int error;
#ifdef DIAGNOSTIC
{
USES_VOP_UPDATE;
register struct inode *ip;
int error;
#ifdef DIAGNOSTIC
- if ((cnp->cn_flags & HASBUF) == 0)
+ if ((ap->a_cnp->cn_flags & HASBUF) == 0)
panic("ufs_link: no name");
#endif
panic("ufs_link: no name");
#endif
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
- free(cnp->cn_pnbuf, M_NAMEI);
+ free(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ if (ap->a_vp != ap->a_tdvp)
ILOCK(ip);
ip->i_nlink++;
ip->i_flag |= ICHG;
ILOCK(ip);
ip->i_nlink++;
ip->i_flag |= ICHG;
- error = VOP_UPDATE(vp, &time, &time, 1);
+ error = VOP_UPDATE(ap->a_tdvp, &time, &time, 1);
- error = ufs_direnter(ip, tdvp, cnp);
- if (tdvp != vp)
+ error = ufs_direnter(ip, ap->a_vp, ap->a_cnp);
+ if (ap->a_vp != ap->a_tdvp)
- FREE(cnp->cn_pnbuf, M_NAMEI);
- vput(tdvp);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ vput(ap->a_vp);
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
}
return (error);
}
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
}
return (error);
}
-#undef tdvp
-#undef vp
-#undef cnp
int
ufs_rename (ap)
struct vop_rename_args *ap;
int
ufs_rename (ap)
struct vop_rename_args *ap;
-#define fdvp (ap->a_fdvp)
-#define fvp (ap->a_fvp)
-#define fcnp (ap->a_fcnp)
-#define tdvp (ap->a_tdvp)
-#define tvp (ap->a_tvp)
-#define tcnp (ap->a_tcnp)
{
USES_VOP_ABORTOP;
USES_VOP_ACCESS;
{
USES_VOP_ABORTOP;
USES_VOP_ACCESS;
int fdvpneedsrele = 1, tdvpneedsrele = 1;
#ifdef DIAGNOSTIC
int fdvpneedsrele = 1, tdvpneedsrele = 1;
#ifdef DIAGNOSTIC
- if ((tcnp->cn_flags & HASBUF) == 0 ||
- (fcnp->cn_flags & HASBUF) == 0)
+ if ((ap->a_tcnp->cn_flags & HASBUF) == 0 ||
+ (ap->a_fcnp->cn_flags & HASBUF) == 0)
panic("ufs_rename: no name");
#endif
panic("ufs_rename: no name");
#endif
- dp = VTOI(fdvp);
- ip = VTOI(fvp);
+ dp = VTOI(ap->a_fdvp);
+ ip = VTOI(ap->a_fvp);
/*
* Check if just deleting a link name.
*/
/*
* Check if just deleting a link name.
*/
- if (fvp == tvp) {
- VOP_ABORTOP(tdvp, tcnp);
- vput(tdvp);
- vput(tvp);
- vrele(fdvp);
+ if (ap->a_fvp == ap->a_tvp) {
+ VOP_ABORTOP(ap->a_tdvp, ap->a_tcnp);
+ vput(ap->a_tdvp);
+ vput(ap->a_tvp);
+ vrele(ap->a_fdvp);
if ((ip->i_mode&IFMT) == IFDIR) {
if ((ip->i_mode&IFMT) == IFDIR) {
- VOP_ABORTOP(fdvp, fcnp);
- vrele(fvp);
+ VOP_ABORTOP(ap->a_fdvp, ap->a_fcnp);
+ vrele(ap->a_fvp);
return (EINVAL);
}
doingdirectory = 0;
return (EINVAL);
}
doingdirectory = 0;
/*
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/
/*
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/
- if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
- dp == ip || (fcnp->cn_flags&ISDOTDOT) || (ip->i_flag & IRENAME)) {
- VOP_ABORTOP(tdvp, tcnp);
- vput(tdvp);
- if (tvp)
- vput(tvp);
- VOP_ABORTOP(fdvp, fcnp);
- vrele(fdvp);
- vput(fvp);
+ if ((ap->a_fcnp->cn_namelen == 1 && ap->a_fcnp->cn_nameptr[0] == '.') ||
+ dp == ip || (ap->a_fcnp->cn_flags&ISDOTDOT) || (ip->i_flag & IRENAME)) {
+ VOP_ABORTOP(ap->a_tdvp, ap->a_tcnp);
+ vput(ap->a_tdvp);
+ if (ap->a_tvp)
+ vput(ap->a_tvp);
+ VOP_ABORTOP(ap->a_fdvp, ap->a_fcnp);
+ vrele(ap->a_fdvp);
+ vput(ap->a_fvp);
return (EINVAL);
}
ip->i_flag |= IRENAME;
oldparent = dp->i_number;
doingdirectory++;
}
return (EINVAL);
}
ip->i_flag |= IRENAME;
oldparent = dp->i_number;
doingdirectory++;
}
/*
* 1) Bump link count while we're moving stuff
/*
* 1) Bump link count while we're moving stuff
*/
ip->i_nlink++;
ip->i_flag |= ICHG;
*/
ip->i_nlink++;
ip->i_flag |= ICHG;
- error = VOP_UPDATE(fvp, &time, &time, 1);
+ error = VOP_UPDATE(ap->a_fvp, &time, &time, 1);
IUNLOCK(ip);
/*
* When the target exists, both the directory
* and target vnodes are returned locked.
*/
IUNLOCK(ip);
/*
* When the target exists, both the directory
* and target vnodes are returned locked.
*/
- if (tvp)
- xp = VTOI(tvp);
+ if (ap->a_tvp)
+ xp = VTOI(ap->a_tvp);
/*
* If ".." must be changed (ie the directory gets a new
* parent) then the source directory must not be in the
/*
* If ".." must be changed (ie the directory gets a new
* parent) then the source directory must not be in the
if (oldparent != dp->i_number)
newparent = dp->i_number;
if (doingdirectory && newparent) {
if (oldparent != dp->i_number)
newparent = dp->i_number;
if (doingdirectory && newparent) {
- VOP_LOCK(fvp);
- error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc);
- VOP_UNLOCK(fvp);
+ VOP_LOCK(ap->a_fvp);
+ error = VOP_ACCESS(ap->a_fvp, VWRITE, ap->a_tcnp->cn_cred, ap->a_tcnp->cn_proc);
+ VOP_UNLOCK(ap->a_fvp);
if (error)
goto bad;
if (xp != NULL)
ufs_iput(xp);
if (error)
goto bad;
if (xp != NULL)
ufs_iput(xp);
- if (error = ufs_checkpath(ip, dp, tcnp->cn_cred))
+ if (error = ufs_checkpath(ip, dp, ap->a_tcnp->cn_cred))
- if ((tcnp->cn_flags & SAVESTART) == 0)
+ if ((ap->a_tcnp->cn_flags & SAVESTART) == 0)
panic("ufs_rename: lost to startdir");
p->p_spare[1]--;
panic("ufs_rename: lost to startdir");
p->p_spare[1]--;
- if (error = relookup(tdvp, &tvp, tcnp))
+ if (error = relookup(ap->a_tdvp, &ap->a_tvp, ap->a_tcnp))
- if (tvp)
- xp = VTOI(tvp);
+ if (ap->a_tvp)
+ xp = VTOI(ap->a_tvp);
}
/*
* 2) If target doesn't exist, link the target
}
/*
* 2) If target doesn't exist, link the target
if (error = VOP_UPDATE(ITOV(dp), &time, &time, 1))
goto bad;
}
if (error = VOP_UPDATE(ITOV(dp), &time, &time, 1))
goto bad;
}
- if (error = ufs_direnter(ip, tdvp, tcnp)) {
+ if (error = ufs_direnter(ip, ap->a_tdvp, ap->a_tcnp)) {
if (doingdirectory && newparent) {
dp->i_nlink--;
dp->i_flag |= ICHG;
if (doingdirectory && newparent) {
dp->i_nlink--;
dp->i_flag |= ICHG;
* otherwise the destination may not be changed (except by
* root). This implements append-only directories.
*/
* otherwise the destination may not be changed (except by
* root). This implements append-only directories.
*/
- if ((dp->i_mode & ISVTX) && tcnp->cn_cred->cr_uid != 0 &&
- tcnp->cn_cred->cr_uid != dp->i_uid &&
- xp->i_uid != tcnp->cn_cred->cr_uid) {
+ if ((dp->i_mode & ISVTX) && ap->a_tcnp->cn_cred->cr_uid != 0 &&
+ ap->a_tcnp->cn_cred->cr_uid != dp->i_uid &&
+ xp->i_uid != ap->a_tcnp->cn_cred->cr_uid) {
error = EPERM;
goto bad;
}
error = EPERM;
goto bad;
}
* (both directories, or both not directories).
*/
if ((xp->i_mode&IFMT) == IFDIR) {
* (both directories, or both not directories).
*/
if ((xp->i_mode&IFMT) == IFDIR) {
- if (!ufs_dirempty(xp, dp->i_number, tcnp->cn_cred) ||
+ if (!ufs_dirempty(xp, dp->i_number, ap->a_tcnp->cn_cred) ||
xp->i_nlink > 2) {
error = ENOTEMPTY;
goto bad;
xp->i_nlink > 2) {
error = ENOTEMPTY;
goto bad;
error = EISDIR;
goto bad;
}
error = EISDIR;
goto bad;
}
- if (error = ufs_dirrewrite(dp, ip, tcnp))
+ if (error = ufs_dirrewrite(dp, ip, ap->a_tcnp))
goto bad;
/*
* If the target directory is in the same
goto bad;
/*
* If the target directory is in the same
if (--xp->i_nlink != 0)
panic("rename: linked directory");
error = VOP_TRUNCATE(ITOV(xp), (off_t)0, IO_SYNC,
if (--xp->i_nlink != 0)
panic("rename: linked directory");
error = VOP_TRUNCATE(ITOV(xp), (off_t)0, IO_SYNC,
}
xp->i_flag |= ICHG;
ufs_iput(xp);
}
xp->i_flag |= ICHG;
ufs_iput(xp);
* 3) Unlink the source.
*/
unlinkit:
* 3) Unlink the source.
*/
unlinkit:
- fcnp->cn_flags &= ~MODMASK;
- fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
- if ((fcnp->cn_flags & SAVESTART) == 0)
+ ap->a_fcnp->cn_flags &= ~MODMASK;
+ ap->a_fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
+ if ((ap->a_fcnp->cn_flags & SAVESTART) == 0)
panic("ufs_rename: lost from startdir");
p->p_spare[1]--;
panic("ufs_rename: lost from startdir");
p->p_spare[1]--;
- (void) relookup(fdvp, &fvp, fcnp);
- if (fvp != NULL) {
- xp = VTOI(fvp);
- dp = VTOI(fdvp);
+ (void) relookup(ap->a_fdvp, &ap->a_fvp, ap->a_fcnp);
+ if (ap->a_fvp != NULL) {
+ xp = VTOI(ap->a_fvp);
+ dp = VTOI(ap->a_fdvp);
} else {
/*
* From name has disappeared.
} else {
/*
* From name has disappeared.
error = vn_rdwr(UIO_READ, ITOV(xp), (caddr_t)&dirbuf,
sizeof (struct dirtemplate), (off_t)0,
UIO_SYSSPACE, IO_NODELOCKED,
error = vn_rdwr(UIO_READ, ITOV(xp), (caddr_t)&dirbuf,
sizeof (struct dirtemplate), (off_t)0,
UIO_SYSSPACE, IO_NODELOCKED,
- tcnp->cn_cred, (int *)0, (struct proc *)0);
+ ap->a_tcnp->cn_cred, (int *)0, (struct proc *)0);
if (error == 0) {
if (dirbuf.dotdot_namlen != 2 ||
dirbuf.dotdot_name[0] != '.' ||
if (error == 0) {
if (dirbuf.dotdot_namlen != 2 ||
dirbuf.dotdot_name[0] != '.' ||
sizeof (struct dirtemplate),
(off_t)0, UIO_SYSSPACE,
IO_NODELOCKED|IO_SYNC,
sizeof (struct dirtemplate),
(off_t)0, UIO_SYSSPACE,
IO_NODELOCKED|IO_SYNC,
- tcnp->cn_cred, (int *)0,
+ ap->a_tcnp->cn_cred, (int *)0,
(struct proc *)0);
cache_purge(ITOV(dp));
}
}
}
(struct proc *)0);
cache_purge(ITOV(dp));
}
}
}
- error = ufs_dirremove(fdvp, fcnp);
+ error = ufs_dirremove(ap->a_fdvp, ap->a_fcnp);
if (!error) {
xp->i_nlink--;
xp->i_flag |= ICHG;
if (!error) {
xp->i_nlink--;
xp->i_flag |= ICHG;
vrele(ITOV(ip));
return (error);
}
vrele(ITOV(ip));
return (error);
}
-#undef fdvp
-#undef fvp
-#undef fcnp
-#undef tdvp
-#undef tvp
-#undef tcnp
/*
* A virgin directory (no blushing please).
/*
* A virgin directory (no blushing please).
int
ufs_mkdir (ap)
struct vop_mkdir_args *ap;
int
ufs_mkdir (ap)
struct vop_mkdir_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
int dmode;
#ifdef DIAGNOSTIC
int dmode;
#ifdef DIAGNOSTIC
- if ((cnp->cn_flags & HASBUF) == 0)
+ if ((ap->a_cnp->cn_flags & HASBUF) == 0)
panic("ufs_mkdir: no name");
#endif
panic("ufs_mkdir: no name");
#endif
if ((nlink_t)dp->i_nlink >= LINK_MAX) {
if ((nlink_t)dp->i_nlink >= LINK_MAX) {
- free(cnp->cn_pnbuf, M_NAMEI);
+ free(ap->a_cnp->cn_pnbuf, M_NAMEI);
ufs_iput(dp);
return (EMLINK);
}
ufs_iput(dp);
return (EMLINK);
}
- dmode = vap->va_mode&0777;
+ dmode = ap->a_vap->va_mode&0777;
dmode |= IFDIR;
/*
* Must simulate part of maknode here to acquire the inode, but
* not have it entered in the parent directory. The entry is made
* later after writing "." and ".." entries.
*/
dmode |= IFDIR;
/*
* Must simulate part of maknode here to acquire the inode, 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)) {
- free(cnp->cn_pnbuf, M_NAMEI);
+ if (error = VOP_VALLOC(ap->a_dvp, dmode, ap->a_cnp->cn_cred, &tvp)) {
+ free(ap->a_cnp->cn_pnbuf, M_NAMEI);
ufs_iput(dp);
return (error);
}
ip = VTOI(tvp);
ufs_iput(dp);
return (error);
}
ip = VTOI(tvp);
- ip->i_uid = cnp->cn_cred->cr_uid;
+ ip->i_uid = ap->a_cnp->cn_cred->cr_uid;
ip->i_gid = dp->i_gid;
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
ip->i_gid = dp->i_gid;
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
- (error = chkiq(ip, 1, cnp->cn_cred, 0))) {
- free(cnp->cn_pnbuf, M_NAMEI);
+ (error = chkiq(ip, 1, ap->a_cnp->cn_cred, 0))) {
+ free(ap->a_cnp->cn_pnbuf, M_NAMEI);
VOP_VFREE(tvp, ip->i_number, dmode);
ufs_iput(ip);
ufs_iput(dp);
VOP_VFREE(tvp, ip->i_number, dmode);
ufs_iput(ip);
ufs_iput(dp);
dirtemplate.dotdot_ino = dp->i_number;
error = vn_rdwr(UIO_WRITE, ITOV(ip), (caddr_t)&dirtemplate,
sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE,
dirtemplate.dotdot_ino = dp->i_number;
error = vn_rdwr(UIO_WRITE, ITOV(ip), (caddr_t)&dirtemplate,
sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE,
- IO_NODELOCKED|IO_SYNC, cnp->cn_cred, (int *)0, (struct proc *)0);
+ IO_NODELOCKED|IO_SYNC, ap->a_cnp->cn_cred, (int *)0, (struct proc *)0);
if (error) {
dp->i_nlink--;
dp->i_flag |= ICHG;
goto bad;
}
if (error) {
dp->i_nlink--;
dp->i_flag |= ICHG;
goto bad;
}
- if (DIRBLKSIZ > VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_bsize)
+ if (DIRBLKSIZ > VFSTOUFS(ap->a_dvp->v_mount)->um_mountp->mnt_stat.f_bsize)
panic("ufs_mkdir: blksize"); /* XXX should grow with balloc() */
else {
ip->i_size = DIRBLKSIZ;
panic("ufs_mkdir: blksize"); /* XXX should grow with balloc() */
else {
ip->i_size = DIRBLKSIZ;
}
/* Directory set up, now install it's entry in the parent directory. */
}
/* Directory set up, now install it's entry in the parent directory. */
- if (error = ufs_direnter(ip, dvp, cnp)) {
+ if (error = ufs_direnter(ip, ap->a_dvp, ap->a_cnp)) {
dp->i_nlink--;
dp->i_flag |= ICHG;
}
dp->i_nlink--;
dp->i_flag |= ICHG;
}
ip->i_flag |= ICHG;
ufs_iput(ip);
} else
ip->i_flag |= ICHG;
ufs_iput(ip);
} else
- *vpp = ITOV(ip);
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ *ap->a_vpp = ITOV(ip);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
ufs_iput(dp);
return (error);
}
ufs_iput(dp);
return (error);
}
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
int
ufs_rmdir (ap)
struct vop_rmdir_args *ap;
int
ufs_rmdir (ap)
struct vop_rmdir_args *ap;
-#define dvp (ap->a_dvp)
-#define vp (ap->a_vp)
-#define cnp (ap->a_cnp)
{
USES_VOP_TRUNCATE;
register struct inode *ip, *dp;
int error;
{
USES_VOP_TRUNCATE;
register struct inode *ip, *dp;
int error;
- ip = VTOI(vp);
- dp = VTOI(dvp);
+ ip = VTOI(ap->a_vp);
+ dp = VTOI(ap->a_dvp);
/*
* No rmdir "." please.
*/
if (dp == ip) {
/*
* No rmdir "." please.
*/
if (dp == ip) {
ufs_iput(ip);
return (EINVAL);
}
ufs_iput(ip);
return (EINVAL);
}
*/
error = 0;
if (ip->i_nlink != 2 ||
*/
error = 0;
if (ip->i_nlink != 2 ||
- !ufs_dirempty(ip, dp->i_number, cnp->cn_cred)) {
+ !ufs_dirempty(ip, dp->i_number, ap->a_cnp->cn_cred)) {
error = ENOTEMPTY;
goto out;
}
error = ENOTEMPTY;
goto out;
}
* inode. If we crash in between, the directory
* will be reattached to lost+found,
*/
* inode. If we crash in between, the directory
* will be reattached to lost+found,
*/
- if (error = ufs_dirremove(dvp, cnp))
+ if (error = ufs_dirremove(ap->a_dvp, ap->a_cnp))
goto out;
dp->i_nlink--;
dp->i_flag |= ICHG;
goto out;
dp->i_nlink--;
dp->i_flag |= ICHG;
+ cache_purge(ap->a_dvp);
/*
* Truncate inode. The only stuff left
* in the directory is "." and "..". The
/*
* Truncate inode. The only stuff left
* in the directory is "." and "..". The
* worry about them later.
*/
ip->i_nlink -= 2;
* worry about them later.
*/
ip->i_nlink -= 2;
- error = VOP_TRUNCATE(vp, (off_t)0, IO_SYNC, cnp->cn_cred);
+ error = VOP_TRUNCATE(ap->a_vp, (off_t)0, IO_SYNC, ap->a_cnp->cn_cred);
cache_purge(ITOV(ip));
out:
cache_purge(ITOV(ip));
out:
ufs_iput(dp);
ufs_iput(ip);
return (error);
}
ufs_iput(dp);
ufs_iput(ip);
return (error);
}
-#undef dvp
-#undef vp
-#undef cnp
/*
* symlink -- make a symbolic link
/*
* symlink -- make a symbolic link
int
ufs_symlink (ap)
struct vop_symlink_args *ap;
int
ufs_symlink (ap)
struct vop_symlink_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
-#define target (ap->a_target)
- if (error = ufs_makeinode(IFLNK | vap->va_mode, dvp, vpp, cnp))
+ if (error = ufs_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp, ap->a_vpp, ap->a_cnp))
- error = vn_rdwr(UIO_WRITE, *vpp, target, strlen(target), (off_t)0,
- UIO_SYSSPACE, IO_NODELOCKED, cnp->cn_cred, (int *)0,
+ error = vn_rdwr(UIO_WRITE, *ap->a_vpp, ap->a_target, strlen(ap->a_target), (off_t)0,
+ UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred, (int *)0,
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
-#undef target
/*
* Vnode op for reading directories.
/*
* Vnode op for reading directories.
int
ufs_readdir (ap)
struct vop_readdir_args *ap;
int
ufs_readdir (ap)
struct vop_readdir_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define cred (ap->a_cred)
-#define eofflagp (ap->a_eofflagp)
{
USES_VOP_READ;
int count, lost, error;
{
USES_VOP_READ;
int count, lost, error;
- count = uio->uio_resid;
+ count = ap->a_uio->uio_resid;
count &= ~(DIRBLKSIZ - 1);
count &= ~(DIRBLKSIZ - 1);
- lost = uio->uio_resid - count;
- if (count < DIRBLKSIZ || (uio->uio_offset & (DIRBLKSIZ -1)))
+ lost = ap->a_uio->uio_resid - count;
+ if (count < DIRBLKSIZ || (ap->a_uio->uio_offset & (DIRBLKSIZ -1)))
- uio->uio_resid = count;
- uio->uio_iov->iov_len = count;
- error = VOP_READ(vp, uio, 0, cred);
- uio->uio_resid += lost;
- if ((VTOI(vp)->i_size - uio->uio_offset) <= 0)
- *eofflagp = 1;
+ ap->a_uio->uio_resid = count;
+ ap->a_uio->uio_iov->iov_len = count;
+ error = VOP_READ(ap->a_vp, ap->a_uio, 0, ap->a_cred);
+ ap->a_uio->uio_resid += lost;
+ if ((VTOI(ap->a_vp)->i_size - ap->a_uio->uio_offset) <= 0)
+ *ap->a_eofflagp = 1;
-#undef vp
-#undef uio
-#undef cred
-#undef eofflagp
/*
* Return target name of a symbolic link
/*
* Return target name of a symbolic link
int
ufs_readlink (ap)
struct vop_readlink_args *ap;
int
ufs_readlink (ap)
struct vop_readlink_args *ap;
-#define vp (ap->a_vp)
-#define uiop (ap->a_uio)
-#define cred (ap->a_cred)
- return (VOP_READ(vp, uiop, 0, cred));
+ return (VOP_READ(ap->a_vp, ap->a_uio, 0, ap->a_cred));
-#undef vp
-#undef uiop
-#undef cred
/*
* Ufs abort op, called after namei() when a CREATE/DELETE isn't actually
/*
* Ufs abort op, called after namei() when a CREATE/DELETE isn't actually
int
ufs_abortop (ap)
struct vop_abortop_args *ap;
int
ufs_abortop (ap)
struct vop_abortop_args *ap;
-#define dvp (ap->a_dvp)
-#define cnp (ap->a_cnp)
- if ((cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
int
ufs_lock (ap)
struct vop_lock_args *ap;
int
ufs_lock (ap)
struct vop_lock_args *ap;
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
int
ufs_unlock (ap)
struct vop_unlock_args *ap;
int
ufs_unlock (ap)
struct vop_unlock_args *ap;
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
if (!(ip->i_flag & ILOCKED))
panic("ufs_unlock NOT LOCKED");
IUNLOCK(ip);
return (0);
}
if (!(ip->i_flag & ILOCKED))
panic("ufs_unlock NOT LOCKED");
IUNLOCK(ip);
return (0);
}
/*
* Check for a locked inode.
/*
* Check for a locked inode.
int
ufs_islocked (ap)
struct vop_islocked_args *ap;
int
ufs_islocked (ap)
struct vop_islocked_args *ap;
- if (VTOI(vp)->i_flag & ILOCKED)
+ if (VTOI(ap->a_vp)->i_flag & ILOCKED)
return (1);
return (0);
}
return (1);
return (0);
}
/*
* Calculate the logical to physical mapping if not done already,
/*
* Calculate the logical to physical mapping if not done already,
int
ufs_strategy (ap)
struct vop_strategy_args *ap;
int
ufs_strategy (ap)
struct vop_strategy_args *ap;
{
USES_VOP_BMAP;
register struct inode *ip;
struct vnode *vp;
int error;
{
USES_VOP_BMAP;
register struct inode *ip;
struct vnode *vp;
int error;
- ip = VTOI(bp->b_vp);
- if (bp->b_vp->v_type == VBLK || bp->b_vp->v_type == VCHR)
+ ip = VTOI(ap->a_bp->b_vp);
+ if (ap->a_bp->b_vp->v_type == VBLK || ap->a_bp->b_vp->v_type == VCHR)
panic("ufs_strategy: spec");
panic("ufs_strategy: spec");
- if (bp->b_blkno == bp->b_lblkno) {
+ if (ap->a_bp->b_blkno == ap->a_bp->b_lblkno) {
- VOP_BMAP(bp->b_vp, bp->b_lblkno, NULL, &bp->b_blkno)) {
- bp->b_error = error;
- bp->b_flags |= B_ERROR;
- biodone(bp);
+ VOP_BMAP(ap->a_bp->b_vp, ap->a_bp->b_lblkno, NULL, &ap->a_bp->b_blkno)) {
+ ap->a_bp->b_error = error;
+ ap->a_bp->b_flags |= B_ERROR;
+ biodone(ap->a_bp);
- if ((long)bp->b_blkno == -1)
- clrbuf(bp);
+ if ((long)ap->a_bp->b_blkno == -1)
+ clrbuf(ap->a_bp);
- if ((long)bp->b_blkno == -1) {
- biodone(bp);
+ if ((long)ap->a_bp->b_blkno == -1) {
+ biodone(ap->a_bp);
return (0);
}
vp = ip->i_devvp;
return (0);
}
vp = ip->i_devvp;
- bp->b_dev = vp->v_rdev;
+ ap->a_bp->b_dev = vp->v_rdev;
VOCALL (vp->v_op, VOFFSET(vop_strategy), ap);
return (0);
}
VOCALL (vp->v_op, VOFFSET(vop_strategy), ap);
return (0);
}
/*
* Print out the contents of an inode.
/*
* Print out the contents of an inode.
int
ufs_print (ap)
struct vop_print_args *ap;
int
ufs_print (ap)
struct vop_print_args *ap;
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
printf("tag VT_UFS, ino %d, on dev %d, %d", ip->i_number,
major(ip->i_dev), minor(ip->i_dev));
#ifdef FIFO
printf("tag VT_UFS, ino %d, on dev %d, %d", ip->i_number,
major(ip->i_dev), minor(ip->i_dev));
#ifdef FIFO
- if (vp->v_type == VFIFO)
- fifo_printinfo(vp);
+ if (ap->a_vp->v_type == VFIFO)
+ fifo_printinfo(ap->a_vp);
#endif /* FIFO */
printf("%s\n", (ip->i_flag & ILOCKED) ? " (LOCKED)" : "");
if (ip->i_lockholder == 0)
#endif /* FIFO */
printf("%s\n", (ip->i_flag & ILOCKED) ? " (LOCKED)" : "");
if (ip->i_lockholder == 0)
printf("\n");
return (0);
}
printf("\n");
return (0);
}
/*
* Read wrapper for special devices.
/*
* Read wrapper for special devices.
int
ufsspec_read (ap)
struct vop_read_args *ap;
int
ufsspec_read (ap)
struct vop_read_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
extern int (**spec_vnodeop_p)();
/*
* Set access flag.
*/
{
extern int (**spec_vnodeop_p)();
/*
* Set access flag.
*/
- VTOI(vp)->i_flag |= IACC;
+ VTOI(ap->a_vp)->i_flag |= IACC;
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_read), ap));
}
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_read), ap));
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Write wrapper for special devices.
/*
* Write wrapper for special devices.
int
ufsspec_write (ap)
struct vop_write_args *ap;
int
ufsspec_write (ap)
struct vop_write_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
extern int (**spec_vnodeop_p)();
/*
* Set update and change flags.
*/
{
extern int (**spec_vnodeop_p)();
/*
* Set update and change flags.
*/
- VTOI(vp)->i_flag |= IUPD|ICHG;
+ VTOI(ap->a_vp)->i_flag |= IUPD|ICHG;
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_write), ap));
}
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_write), ap));
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Close wrapper for special devices.
/*
* Close wrapper for special devices.
int
ufsspec_close (ap)
struct vop_close_args *ap;
int
ufsspec_close (ap)
struct vop_close_args *ap;
-#define vp (ap->a_vp)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
extern int (**spec_vnodeop_p)();
{
extern int (**spec_vnodeop_p)();
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
- if (vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
+ if (ap->a_vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
ITIMES(ip, &time, &time);
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_close), ap));
}
ITIMES(ip, &time, &time);
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_close), ap));
}
-#undef vp
-#undef fflag
-#undef cred
-#undef p
int
ufsfifo_read (ap)
struct vop_read_args *ap;
int
ufsfifo_read (ap)
struct vop_read_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
extern int (**fifo_vnodeop_p)();
/*
* Set access flag.
*/
{
extern int (**fifo_vnodeop_p)();
/*
* Set access flag.
*/
- VTOI(vp)->i_flag |= IACC;
+ VTOI(ap->a_vp)->i_flag |= IACC;
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_read), ap));
}
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_read), ap));
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Write wrapper for fifo's.
/*
* Write wrapper for fifo's.
int
ufsfifo_write (ap)
struct vop_write_args *ap;
int
ufsfifo_write (ap)
struct vop_write_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
extern int (**fifo_vnodeop_p)();
/*
* Set update and change flags.
*/
{
extern int (**fifo_vnodeop_p)();
/*
* Set update and change flags.
*/
- VTOI(vp)->i_flag |= IUPD|ICHG;
+ VTOI(ap->a_vp)->i_flag |= IUPD|ICHG;
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_write), ap));
}
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_write), ap));
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Close wrapper for fifo's.
/*
* Close wrapper for fifo's.
*/
ufsfifo_close (ap)
struct vop_close_args *ap;
*/
ufsfifo_close (ap)
struct vop_close_args *ap;
-#define vp (ap->a_vp)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
extern int (**fifo_vnodeop_p)();
{
extern int (**fifo_vnodeop_p)();
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
- if (vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
+ if (ap->a_vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
ITIMES(ip, &time, &time);
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_close), ap));
}
ITIMES(ip, &time, &time);
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_close), ap));
}
-#undef vp
-#undef fflag
-#undef cred
-#undef p
int
ufs_advlock (ap)
struct vop_advlock_args *ap;
int
ufs_advlock (ap)
struct vop_advlock_args *ap;
-#define vp (ap->a_vp)
-#define id (ap->a_id)
-#define op (ap->a_op)
-#define fl (ap->a_fl)
-#define flags (ap->a_flags)
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
register struct lockf *lock;
off_t start, end;
int error;
register struct lockf *lock;
off_t start, end;
int error;
* Avoid the common case of unlocking when inode has no locks.
*/
if (ip->i_lockf == (struct lockf *)0) {
* Avoid the common case of unlocking when inode has no locks.
*/
if (ip->i_lockf == (struct lockf *)0) {
- if (op != F_SETLK) {
- fl->l_type = F_UNLCK;
+ if (ap->a_op != F_SETLK) {
+ ap->a_fl->l_type = F_UNLCK;
return (0);
}
}
/*
* Convert the flock structure into a start and end.
*/
return (0);
}
}
/*
* Convert the flock structure into a start and end.
*/
- switch (fl->l_whence) {
+ switch (ap->a_fl->l_whence) {
case SEEK_SET:
case SEEK_CUR:
case SEEK_SET:
case SEEK_CUR:
* Caller is responsible for adding any necessary offset
* when SEEK_CUR is used.
*/
* Caller is responsible for adding any necessary offset
* when SEEK_CUR is used.
*/
+ start = ap->a_fl->l_start;
- start = ip->i_size + fl->l_start;
+ start = ip->i_size + ap->a_fl->l_start;
}
if (start < 0)
return (EINVAL);
}
if (start < 0)
return (EINVAL);
+ if (ap->a_fl->l_len == 0)
- end = start + fl->l_len - 1;
+ end = start + ap->a_fl->l_len - 1;
/*
* Create the lockf structure
*/
MALLOC(lock, struct lockf *, sizeof *lock, M_LOCKF, M_WAITOK);
lock->lf_start = start;
lock->lf_end = end;
/*
* Create the lockf structure
*/
MALLOC(lock, struct lockf *, sizeof *lock, M_LOCKF, M_WAITOK);
lock->lf_start = start;
lock->lf_end = end;
+ lock->lf_id = ap->a_id;
- lock->lf_type = fl->l_type;
+ lock->lf_type = ap->a_fl->l_type;
lock->lf_next = (struct lockf *)0;
lock->lf_block = (struct lockf *)0;
lock->lf_next = (struct lockf *)0;
lock->lf_block = (struct lockf *)0;
- lock->lf_flags = flags;
+ lock->lf_flags = ap->a_flags;
/*
* Do the requested operation.
*/
/*
* Do the requested operation.
*/
case F_SETLK:
return (lf_setlock(lock));
case F_SETLK:
return (lf_setlock(lock));
return (error);
case F_GETLK:
return (error);
case F_GETLK:
- error = lf_getlock(lock, fl);
+ error = lf_getlock(lock, ap->a_fl);
FREE(lock, M_LOCKF);
return (error);
FREE(lock, M_LOCKF);
return (error);
-#undef vp
-#undef id
-#undef op
-#undef fl
-#undef flags
/*
* Initialize the vnode associated with a new inode, handle aliased
/*
* Initialize the vnode associated with a new inode, handle aliased
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)lfs_alloc.c 7.44 (Berkeley) %G%
+ * @(#)lfs_alloc.c 7.45 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
lfs_valloc (ap)
struct vop_valloc_args *ap;
int
lfs_valloc (ap)
struct vop_valloc_args *ap;
-#define pvp (ap->a_pvp)
-#define notused (ap->a_mode)
-#define cred (ap->a_cred)
-#define vpp (ap->a_vpp)
{
struct lfs *fs;
struct buf *bp;
{
struct lfs *fs;
struct buf *bp;
printf("lfs_valloc\n");
#endif
/* Get the head of the freelist. */
printf("lfs_valloc\n");
#endif
/* Get the head of the freelist. */
+ fs = VTOI(ap->a_pvp)->i_lfs;
new_ino = fs->lfs_free;
#ifdef ALLOCPRINT
printf("lfs_ialloc: allocate inode %d\n", new_ino);
new_ino = fs->lfs_free;
#ifdef ALLOCPRINT
printf("lfs_ialloc: allocate inode %d\n", new_ino);
if (!bp) {
uprintf("\n%s: no inodes left\n", fs->lfs_fsmnt);
log(LOG_ERR, "uid %d on %s: out of inodes\n",
if (!bp) {
uprintf("\n%s: no inodes left\n", fs->lfs_fsmnt);
log(LOG_ERR, "uid %d on %s: out of inodes\n",
- cred->cr_uid, fs->lfs_fsmnt);
+ ap->a_cred->cr_uid, fs->lfs_fsmnt);
return (ENOSPC);
}
i = (blkno - fs->lfs_segtabsz - fs->lfs_cleansz) *
return (ENOSPC);
}
i = (blkno - fs->lfs_segtabsz - fs->lfs_cleansz) *
}
/* Create a vnode to associate with the inode. */
}
/* Create a vnode to associate with the inode. */
- if (error = lfs_vcreate(pvp->v_mount, new_ino, &vp))
+ if (error = lfs_vcreate(ap->a_pvp->v_mount, new_ino, &vp))
ip = VTOI(vp);
VREF(ip->i_devvp);
ip = VTOI(vp);
VREF(ip->i_devvp);
++fs->lfs_nfiles;
return (0);
}
++fs->lfs_nfiles;
return (0);
}
-#undef pvp
-#undef notused
-#undef cred
-#undef vpp
/* Create a new vnode/inode pair and initialize what fields we can. */
int
/* Create a new vnode/inode pair and initialize what fields we can. */
int
int
lfs_vfree (ap)
struct vop_vfree_args *ap;
int
lfs_vfree (ap)
struct vop_vfree_args *ap;
-#define vp (ap->a_pvp)
-#define notused1 (ap->a_ino)
-#define notused2 (ap->a_mode)
{
SEGUSE *sup;
struct buf *bp;
{
SEGUSE *sup;
struct buf *bp;
daddr_t old_iaddr;
ino_t ino;
daddr_t old_iaddr;
ino_t ino;
#ifdef VERBOSE
printf("lfs_vfree: free %d\n", ip->i_number);
#endif
#ifdef VERBOSE
printf("lfs_vfree: free %d\n", ip->i_number);
#endif
--fs->lfs_nfiles;
return (0);
}
--fs->lfs_nfiles;
return (0);
}
-#undef vp
-#undef notused1
-#undef notused2
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)lfs_balloc.c 7.29 (Berkeley) %G%
+ * @(#)lfs_balloc.c 7.30 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
lfs_bmap (ap)
struct vop_bmap_args *ap;
int
lfs_bmap (ap)
struct vop_bmap_args *ap;
-#define vp (ap->a_vp)
-#define bn (ap->a_bn)
-#define vpp (ap->a_vpp)
-#define bnp (ap->a_bnp)
{
#ifdef VERBOSE
printf("lfs_bmap\n");
{
#ifdef VERBOSE
printf("lfs_bmap\n");
* Check for underlying vnode requests and ensure that logical
* to physical mapping is requested.
*/
* Check for underlying vnode requests and ensure that logical
* to physical mapping is requested.
*/
- if (vpp != NULL)
- *vpp = VTOI(vp)->i_devvp;
- if (bnp == NULL)
+ if (ap->a_vpp != NULL)
+ *ap->a_vpp = VTOI(ap->a_vp)->i_devvp;
+ if (ap->a_bnp == NULL)
- return (lfs_bmaparray(vp, bn, bnp, NULL, NULL));
+ return (lfs_bmaparray(ap->a_vp, ap->a_bn, ap->a_bnp, NULL, NULL));
-#undef vp
-#undef bn
-#undef vpp
-#undef bnp
/*
* LFS has a different version of bmap from FFS because of a naming conflict.
/*
* LFS has a different version of bmap from FFS because of a naming conflict.
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)lfs_bio.c 7.9 (Berkeley) %G%
+ * @(#)lfs_bio.c 7.10 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
lfs_bwrite (ap)
struct vop_bwrite_args *ap;
int
lfs_bwrite (ap)
struct vop_bwrite_args *ap;
* getnewbuf() would try to reclaim the buffers using bawrite, which
* isn't going to work.
*/
* getnewbuf() would try to reclaim the buffers using bawrite, which
* isn't going to work.
*/
- if (!(bp->b_flags & B_LOCKED)) {
+ if (!(ap->a_bp->b_flags & B_LOCKED)) {
- bp->b_flags |= B_DELWRI | B_LOCKED;
- bp->b_flags &= ~(B_READ | B_DONE | B_ERROR);
+ ap->a_bp->b_flags |= B_DELWRI | B_LOCKED;
+ ap->a_bp->b_flags &= ~(B_READ | B_DONE | B_ERROR);
s = splbio();
#define PMAP_BUG_FIX_HACK
#ifdef PMAP_BUG_FIX_HACK
if (((struct ufsmount *)
s = splbio();
#define PMAP_BUG_FIX_HACK
#ifdef PMAP_BUG_FIX_HACK
if (((struct ufsmount *)
- (bp->b_vp->v_mount->mnt_data))->um_lfs->lfs_ivnode !=
- bp->b_vp)
+ (ap->a_bp->b_vp->v_mount->mnt_data))->um_lfs->lfs_ivnode !=
+ ap->a_bp->b_vp)
- reassignbuf(bp, bp->b_vp);
+ reassignbuf(ap->a_bp, ap->a_bp->b_vp);
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)lfs_inode.c 7.64 (Berkeley) %G%
+ * @(#)lfs_inode.c 7.65 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
lfs_vget (ap)
struct vop_vget_args *ap;
int
lfs_vget (ap)
struct vop_vget_args *ap;
-#define mntp (ap->a_mp)
-#define ino (ap->a_ino)
-#define vpp (ap->a_vpp)
{
register struct lfs *fs;
register struct inode *ip;
{
register struct lfs *fs;
register struct inode *ip;
#ifdef VERBOSE
printf("lfs_vget\n");
#endif
#ifdef VERBOSE
printf("lfs_vget\n");
#endif
+ ump = VFSTOUFS(ap->a_mp);
- if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
+ if ((*ap->a_vpp = ufs_ihashget(dev, ap->a_ino)) != NULL)
return (0);
/* Translate the inode number to a disk address. */
fs = ump->um_lfs;
return (0);
/* Translate the inode number to a disk address. */
fs = ump->um_lfs;
- if (ino == LFS_IFILE_INUM)
+ if (ap->a_ino == LFS_IFILE_INUM)
daddr = fs->lfs_idaddr;
else {
daddr = fs->lfs_idaddr;
else {
- LFS_IENTRY(ifp, fs, ino, bp);
+ LFS_IENTRY(ifp, fs, ap->a_ino, bp);
daddr = ifp->if_daddr;
brelse(bp);
if (daddr == LFS_UNUSED_DADDR)
daddr = ifp->if_daddr;
brelse(bp);
if (daddr == LFS_UNUSED_DADDR)
}
/* Allocate new vnode/inode. */
}
/* Allocate new vnode/inode. */
- if (error = lfs_vcreate(mntp, ino, &vp)) {
- *vpp = NULL;
+ if (error = lfs_vcreate(ap->a_mp, ap->a_ino, &vp)) {
+ *ap->a_vpp = NULL;
/* Unlock and discard unneeded inode. */
ufs_iput(ip);
brelse(bp);
/* Unlock and discard unneeded inode. */
ufs_iput(ip);
brelse(bp);
- ip->i_din = *lfs_ifind(fs, ino, bp->b_un.b_dino);
+ ip->i_din = *lfs_ifind(fs, ap->a_ino, bp->b_un.b_dino);
brelse(bp);
/*
* Initialize the vnode from the inode, check for aliases. In all
* cases re-init ip, the underlying vnode/inode may have changed.
*/
brelse(bp);
/*
* Initialize the vnode from the inode, check for aliases. In all
* cases re-init ip, the underlying vnode/inode may have changed.
*/
- if (error = ufs_vinit(mntp, lfs_specop_p, LFS_FIFOOPS, &vp)) {
+ if (error = ufs_vinit(ap->a_mp, lfs_specop_p, LFS_FIFOOPS, &vp)) {
*/
ip->i_devvp = ump->um_devvp;
VREF(ip->i_devvp);
*/
ip->i_devvp = ump->um_devvp;
VREF(ip->i_devvp);
-#undef mntp
-#undef ino
-#undef vpp
/* Search a block for a specific dinode. */
static struct dinode *
/* Search a block for a specific dinode. */
static struct dinode *
int
lfs_update (ap)
struct vop_update_args *ap;
int
lfs_update (ap)
struct vop_update_args *ap;
-#define vp (ap->a_vp)
-#define ta (ap->a_ta)
-#define tm (ap->a_tm)
-#define waitfor (ap->a_waitfor)
{
struct inode *ip;
#ifdef VERBOSE
printf("lfs_update\n");
#endif
{
struct inode *ip;
#ifdef VERBOSE
printf("lfs_update\n");
#endif
- if (vp->v_mount->mnt_flag & MNT_RDONLY)
+ if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY)
if ((ip->i_flag & (IUPD|IACC|ICHG|IMOD)) == 0)
return (0);
if (ip->i_flag&IACC)
if ((ip->i_flag & (IUPD|IACC|ICHG|IMOD)) == 0)
return (0);
if (ip->i_flag&IACC)
- ip->i_atime.tv_sec = ta->tv_sec;
+ ip->i_atime.tv_sec = ap->a_ta->tv_sec;
- ip->i_mtime.tv_sec = tm->tv_sec;
+ ip->i_mtime.tv_sec = ap->a_tm->tv_sec;
INCRQUAD((ip)->i_modrev);
}
if (ip->i_flag&ICHG)
INCRQUAD((ip)->i_modrev);
}
if (ip->i_flag&ICHG)
ip->i_flag &= ~(IUPD|IACC|ICHG|IMOD);
/* Push back the vnode and any dirty blocks it may have. */
ip->i_flag &= ~(IUPD|IACC|ICHG|IMOD);
/* Push back the vnode and any dirty blocks it may have. */
- return (waitfor ? lfs_vflush(vp) : 0);
+ return (ap->a_waitfor ? lfs_vflush(ap->a_vp) : 0);
-#undef vp
-#undef ta
-#undef tm
-#undef waitfor
/* Update segment usage information when removing a block. */
#define UPDATE_SEGUSE \
/* Update segment usage information when removing a block. */
#define UPDATE_SEGUSE \
int
lfs_truncate (ap)
struct vop_truncate_args *ap;
int
lfs_truncate (ap)
struct vop_truncate_args *ap;
-#define vp (ap->a_vp)
-#define length (ap->a_length)
-#define flags (ap->a_flags)
-#define cred (ap->a_cred)
{
USES_VOP_UPDATE;
register INDIR *inp;
{
USES_VOP_UPDATE;
register INDIR *inp;
#ifdef VERBOSE
printf("lfs_truncate\n");
#endif
#ifdef VERBOSE
printf("lfs_truncate\n");
#endif
- vnode_pager_setsize(vp, (u_long)length);
+ vnode_pager_setsize(ap->a_vp, (u_long)ap->a_length);
fs = ip->i_lfs;
/* If truncating the file to 0, update the version number. */
fs = ip->i_lfs;
/* If truncating the file to 0, update the version number. */
+ if (ap->a_length == 0) {
LFS_IENTRY(ifp, fs, ip->i_number, bp);
++ifp->if_version;
LFS_UBWRITE(bp);
}
LFS_IENTRY(ifp, fs, ip->i_number, bp);
++ifp->if_version;
LFS_UBWRITE(bp);
}
- /* If length is larger than the file, just update the times. */
- if (ip->i_size <= length) {
+ /* If ap->a_length is larger than the file, just update the times. */
+ if (ip->i_size <= ap->a_length) {
- return (VOP_UPDATE(vp, &time, &time, 1));
+ return (VOP_UPDATE(ap->a_vp, &time, &time, 1));
* blocks (if any) which we want to keep. Lastblock is 0 when the
* file is truncated to 0.
*/
* blocks (if any) which we want to keep. Lastblock is 0 when the
* file is truncated to 0.
*/
- lastblock = lblkno(fs, length + fs->lfs_bsize - 1);
+ lastblock = lblkno(fs, ap->a_length + fs->lfs_bsize - 1);
olastblock = lblkno(fs, ip->i_size + fs->lfs_bsize - 1) - 1;
/*
olastblock = lblkno(fs, ip->i_size + fs->lfs_bsize - 1) - 1;
/*
* of the file must be zero'ed in case it ever become accessable again
* because of subsequent file growth.
*/
* of the file must be zero'ed in case it ever become accessable again
* because of subsequent file growth.
*/
- offset = blkoff(fs, length);
+ offset = blkoff(fs, ap->a_length);
+ ip->i_size = ap->a_length;
- lbn = lblkno(fs, length);
+ lbn = lblkno(fs, ap->a_length);
#ifdef QUOTA
if (error = getinoquota(ip))
return (error);
#endif
#ifdef QUOTA
if (error = getinoquota(ip))
return (error);
#endif
- if (error = bread(vp, lbn, fs->lfs_bsize, NOCRED, &bp))
+ if (error = bread(ap->a_vp, lbn, fs->lfs_bsize, NOCRED, &bp))
+ ip->i_size = ap->a_length;
- (void)vnode_pager_uncache(vp);
+ (void)vnode_pager_uncache(ap->a_vp);
bzero(bp->b_un.b_addr + offset, (unsigned)(size - offset));
allocbuf(bp, size);
LFS_UBWRITE(bp);
bzero(bp->b_un.b_addr + offset, (unsigned)(size - offset));
allocbuf(bp, size);
LFS_UBWRITE(bp);
lastseg = -1;
for (lbn = olastblock; lbn >= lastblock;) {
lastseg = -1;
for (lbn = olastblock; lbn >= lastblock;) {
- lfs_bmaparray(vp, lbn, &daddr, a, &depth);
+ lfs_bmaparray(ap->a_vp, lbn, &daddr, a, &depth);
if (lbn == olastblock)
for (i = NIADDR + 2; i--;)
a_end[i] = a[i];
if (lbn == olastblock)
for (i = NIADDR + 2; i--;)
a_end[i] = a[i];
* bread will create one just so we can free
* it.
*/
* bread will create one just so we can free
* it.
*/
inp->in_lbn, fs->lfs_bsize, NOCRED, &bp))
panic("lfs_truncate: bread bno %d",
inp->in_lbn);
inp->in_lbn, fs->lfs_bsize, NOCRED, &bp))
panic("lfs_truncate: bread bno %d",
inp->in_lbn);
if (ip->i_blocks < 0)
ip->i_blocks = 0;
ip->i_flag |= ICHG|IUPD;
if (ip->i_blocks < 0)
ip->i_blocks = 0;
ip->i_flag |= ICHG|IUPD;
- (void)vinvalbuf(vp, length > 0);
- error = VOP_UPDATE(vp, &time, &time, MNT_WAIT);
+ (void)vinvalbuf(ap->a_vp, ap->a_length > 0);
+ error = VOP_UPDATE(ap->a_vp, &time, &time, MNT_WAIT);
-#undef vp
-#undef length
-#undef flags
-#undef cred
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)lfs_subr.c 7.10 (Berkeley) %G%
+ * @(#)lfs_subr.c 7.11 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
lfs_blkatoff (ap)
struct vop_blkatoff_args *ap;
int
lfs_blkatoff (ap)
struct vop_blkatoff_args *ap;
-#define vp (ap->a_vp)
-#define offset (ap->a_offset)
-#define res (ap->a_res)
-#define bpp (ap->a_bpp)
{
register struct lfs *fs;
struct inode *ip;
{
register struct lfs *fs;
struct inode *ip;
daddr_t lbn;
int bsize, error;
daddr_t lbn;
int bsize, error;
- lbn = lblkno(fs, offset);
+ lbn = lblkno(fs, ap->a_offset);
- *bpp = NULL;
- if (error = bread(vp, lbn, bsize, NOCRED, &bp)) {
+ *ap->a_bpp = NULL;
+ if (error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp)) {
brelse(bp);
return (error);
}
brelse(bp);
return (error);
}
- if (res)
- *res = bp->b_un.b_addr + blkoff(fs, offset);
- *bpp = bp;
+ if (ap->a_res)
+ *ap->a_res = bp->b_un.b_addr + blkoff(fs, ap->a_offset);
+ *ap->a_bpp = bp;
-#undef vp
-#undef offset
-#undef res
-#undef bpp
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)lfs_vnops.c 7.81 (Berkeley) %G%
+ * @(#)lfs_vnops.c 7.82 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
/* ARGSUSED */
lfs_read (ap)
struct vop_read_args *ap;
/* ARGSUSED */
lfs_read (ap)
struct vop_read_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
register struct lfs *fs; /* LFS */
struct buf *bp;
daddr_t lbn, bn, rablock;
register struct lfs *fs; /* LFS */
struct buf *bp;
daddr_t lbn, bn, rablock;
printf("lfs_read: ino %d\n", ip->i_number);
#endif
#ifdef DIAGNOSTIC
printf("lfs_read: ino %d\n", ip->i_number);
#endif
#ifdef DIAGNOSTIC
- if (uio->uio_rw != UIO_READ)
+ if (ap->a_uio->uio_rw != UIO_READ)
panic("ufs_read mode");
type = ip->i_mode & IFMT;
if (type != IFDIR && type != IFREG && type != IFLNK)
panic("ufs_read type");
#endif
panic("ufs_read mode");
type = ip->i_mode & IFMT;
if (type != IFDIR && type != IFREG && type != IFLNK)
panic("ufs_read type");
#endif
- if (uio->uio_resid == 0)
+ if (ap->a_uio->uio_resid == 0)
- if (uio->uio_offset < 0)
+ if (ap->a_uio->uio_offset < 0)
return (EINVAL);
ip->i_flag |= IACC;
fs = ip->i_lfs; /* LFS */
do {
return (EINVAL);
ip->i_flag |= IACC;
fs = ip->i_lfs; /* LFS */
do {
- lbn = lblkno(fs, uio->uio_offset);
- on = blkoff(fs, uio->uio_offset);
- n = MIN((unsigned)(fs->lfs_bsize - on), uio->uio_resid);
- diff = ip->i_size - uio->uio_offset;
+ lbn = lblkno(fs, ap->a_uio->uio_offset);
+ on = blkoff(fs, ap->a_uio->uio_offset);
+ n = MIN((unsigned)(fs->lfs_bsize - on), ap->a_uio->uio_resid);
+ diff = ip->i_size - ap->a_uio->uio_offset;
if (diff <= 0)
return (0);
if (diff < n)
n = diff;
size = blksize(fs); /* LFS */
rablock = lbn + 1;
if (diff <= 0)
return (0);
if (diff < n)
n = diff;
size = blksize(fs); /* LFS */
rablock = lbn + 1;
- if (vp->v_lastr + 1 == lbn &&
+ if (ap->a_vp->v_lastr + 1 == lbn &&
lblktosize(fs, rablock) < ip->i_size)
error = breadn(ITOV(ip), lbn, size, &rablock,
&size, 1, NOCRED, &bp);
else
error = bread(ITOV(ip), lbn, size, NOCRED, &bp);
lblktosize(fs, rablock) < ip->i_size)
error = breadn(ITOV(ip), lbn, size, &rablock,
&size, 1, NOCRED, &bp);
else
error = bread(ITOV(ip), lbn, size, NOCRED, &bp);
+ ap->a_vp->v_lastr = lbn;
n = MIN(n, size - bp->b_resid);
if (error) {
brelse(bp);
return (error);
}
n = MIN(n, size - bp->b_resid);
if (error) {
brelse(bp);
return (error);
}
- error = uiomove(bp->b_un.b_addr + on, (int)n, uio);
- if (n + on == fs->lfs_bsize || uio->uio_offset == ip->i_size)
+ error = uiomove(bp->b_un.b_addr + on, (int)n, ap->a_uio);
+ if (n + on == fs->lfs_bsize || ap->a_uio->uio_offset == ip->i_size)
bp->b_flags |= B_AGE;
brelse(bp);
bp->b_flags |= B_AGE;
brelse(bp);
- } while (error == 0 && uio->uio_resid > 0 && n != 0);
+ } while (error == 0 && ap->a_uio->uio_resid > 0 && n != 0);
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Vnode op for writing.
*/
lfs_write (ap)
struct vop_write_args *ap;
/*
* Vnode op for writing.
*/
lfs_write (ap)
struct vop_write_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
- struct proc *p = uio->uio_procp;
- register struct inode *ip = VTOI(vp);
+ struct proc *p = ap->a_uio->uio_procp;
+ register struct inode *ip = VTOI(ap->a_vp);
register struct lfs *fs;
struct buf *bp;
daddr_t lbn;
register struct lfs *fs;
struct buf *bp;
daddr_t lbn;
printf("lfs_write ino %d\n", ip->i_number);
#endif
#ifdef DIAGNOSTIC
printf("lfs_write ino %d\n", ip->i_number);
#endif
#ifdef DIAGNOSTIC
- if (uio->uio_rw != UIO_WRITE)
+ if (ap->a_uio->uio_rw != UIO_WRITE)
panic("lfs_write mode");
#endif
panic("lfs_write mode");
#endif
+ switch (ap->a_vp->v_type) {
- if (ioflag & IO_APPEND)
- uio->uio_offset = ip->i_size;
+ if (ap->a_ioflag & IO_APPEND)
+ ap->a_uio->uio_offset = ip->i_size;
/* fall through */
case VLNK:
break;
case VDIR:
/* XXX This may not be correct for LFS. */
/* fall through */
case VLNK:
break;
case VDIR:
/* XXX This may not be correct for LFS. */
- if ((ioflag & IO_SYNC) == 0)
+ if ((ap->a_ioflag & IO_SYNC) == 0)
panic("lfs_write nonsync dir write");
break;
default:
panic("lfs_write type");
}
panic("lfs_write nonsync dir write");
break;
default:
panic("lfs_write type");
}
- if (uio->uio_offset < 0)
+ if (ap->a_uio->uio_offset < 0)
- if (uio->uio_resid == 0)
+ if (ap->a_uio->uio_resid == 0)
return (0);
/*
* Maybe this should be above the vnode op call, but so long as
* file servers have no limits, i don't think it matters
*/
return (0);
/*
* Maybe this should be above the vnode op call, but so long as
* file servers have no limits, i don't think it matters
*/
- if (vp->v_type == VREG && p &&
- uio->uio_offset + uio->uio_resid >
+ if (ap->a_vp->v_type == VREG && p &&
+ ap->a_uio->uio_offset + ap->a_uio->uio_resid >
p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
psignal(p, SIGXFSZ);
return (EFBIG);
}
p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
psignal(p, SIGXFSZ);
return (EFBIG);
}
- resid = uio->uio_resid;
+ resid = ap->a_uio->uio_resid;
osize = ip->i_size;
fs = ip->i_lfs; /* LFS */
flags = 0;
#ifdef NOTLFS
osize = ip->i_size;
fs = ip->i_lfs; /* LFS */
flags = 0;
#ifdef NOTLFS
+ if (ap->a_ioflag & IO_SYNC)
flags = B_SYNC;
#endif
do {
flags = B_SYNC;
#endif
do {
- lbn = lblkno(fs, uio->uio_offset);
- on = blkoff(fs, uio->uio_offset);
- n = MIN((unsigned)(fs->lfs_bsize - on), uio->uio_resid);
- if (error = lfs_balloc(vp, n, lbn, &bp))
+ lbn = lblkno(fs, ap->a_uio->uio_offset);
+ on = blkoff(fs, ap->a_uio->uio_offset);
+ n = MIN((unsigned)(fs->lfs_bsize - on), ap->a_uio->uio_resid);
+ if (error = lfs_balloc(ap->a_vp, n, lbn, &bp))
- if (uio->uio_offset + n > ip->i_size) {
- ip->i_size = uio->uio_offset + n;
- vnode_pager_setsize(vp, (u_long)ip->i_size);
+ if (ap->a_uio->uio_offset + n > ip->i_size) {
+ ip->i_size = ap->a_uio->uio_offset + n;
+ vnode_pager_setsize(ap->a_vp, (u_long)ip->i_size);
- (void) vnode_pager_uncache(vp);
+ (void) vnode_pager_uncache(ap->a_vp);
n = MIN(n, size - bp->b_resid);
n = MIN(n, size - bp->b_resid);
- error = uiomove(bp->b_un.b_addr + on, n, uio);
+ error = uiomove(bp->b_un.b_addr + on, n, ap->a_uio);
+ if (ap->a_ioflag & IO_SYNC)
(void) bwrite(bp);
else if (n + on == fs->fs_bsize) {
bp->b_flags |= B_AGE;
(void) bwrite(bp);
else if (n + on == fs->fs_bsize) {
bp->b_flags |= B_AGE;
/* XXX This doesn't handle IO_SYNC. */
LFS_UBWRITE(bp);
#endif
/* XXX This doesn't handle IO_SYNC. */
LFS_UBWRITE(bp);
#endif
+ if (ap->a_cred->cr_uid != 0)
ip->i_mode &= ~(ISUID|ISGID);
ip->i_mode &= ~(ISUID|ISGID);
- } while (error == 0 && uio->uio_resid > 0 && n != 0);
- if (error && (ioflag & IO_UNIT)) {
- (void)VOP_TRUNCATE(vp, osize, ioflag & IO_SYNC, cred);
- uio->uio_offset -= resid - uio->uio_resid;
- uio->uio_resid = resid;
+ } while (error == 0 && ap->a_uio->uio_resid > 0 && n != 0);
+ if (error && (ap->a_ioflag & IO_UNIT)) {
+ (void)VOP_TRUNCATE(ap->a_vp, osize, ap->a_ioflag & IO_SYNC, ap->a_cred);
+ ap->a_uio->uio_offset -= resid - ap->a_uio->uio_resid;
+ ap->a_uio->uio_resid = resid;
- if (!error && (ioflag & IO_SYNC))
- error = VOP_UPDATE(vp, &time, &time, 1);
+ if (!error && (ap->a_ioflag & IO_SYNC))
+ error = VOP_UPDATE(ap->a_vp, &time, &time, 1);
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/* ARGSUSED */
lfs_fsync (ap)
struct vop_fsync_args *ap;
/* ARGSUSED */
lfs_fsync (ap)
struct vop_fsync_args *ap;
-#define vp (ap->a_vp)
-#define fflags (ap->a_fflags)
-#define cred (ap->a_cred)
-#define waitfor (ap->a_waitfor)
-#define p (ap->a_p)
{
USES_VOP_UPDATE;
struct inode *ip;
{
USES_VOP_UPDATE;
struct inode *ip;
#ifdef VERBOSE
printf("lfs_fsync\n");
#endif
#ifdef VERBOSE
printf("lfs_fsync\n");
#endif
- ip = VTOI(vp);
- if (fflags & FWRITE)
+ ip = VTOI(ap->a_vp);
+ if (ap->a_fflags & FWRITE)
- return (VOP_UPDATE(vp, &time, &time, waitfor == MNT_WAIT));
+ return (VOP_UPDATE(ap->a_vp, &time, &time, ap->a_waitfor == MNT_WAIT));
-#undef vp
-#undef fflags
-#undef cred
-#undef waitfor
-#undef p
/*
* Last reference to an inode, write the inode out and if necessary,
/*
* Last reference to an inode, write the inode out and if necessary,
int
lfs_inactive (ap)
struct vop_inactive_args *ap;
int
lfs_inactive (ap)
struct vop_inactive_args *ap;
-#define vp (ap->a_vp)
-#define p (ap->a_p)
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
#ifdef VERBOSE
printf("lfs_inactive\n");
#endif
#ifdef VERBOSE
printf("lfs_inactive\n");
#endif
- if (prtactive && vp->v_usecount != 0)
- vprint("lfs_inactive: pushing active", vp);
+ if (prtactive && ap->a_vp->v_usecount != 0)
+ vprint("lfs_inactive: pushing active", ap->a_vp);
/* Get rid of inodes related to stale file handles. */
/* Get rid of inodes related to stale file handles. */
- if ((vp->v_flag & VXLOCK) == 0)
- vgone(vp);
+ if ((ap->a_vp->v_flag & VXLOCK) == 0)
+ vgone(ap->a_vp);
return (0);
}
error = 0;
ILOCK(ip);
return (0);
}
error = 0;
ILOCK(ip);
- if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
+ if (ip->i_nlink <= 0 && (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
#ifdef QUOTA
if (!getinoquota(ip))
(void)chkiq(ip, -1, NOCRED, 0);
#endif
#ifdef QUOTA
if (!getinoquota(ip))
(void)chkiq(ip, -1, NOCRED, 0);
#endif
- error = VOP_TRUNCATE(vp, (off_t)0, 0, NOCRED);
+ error = VOP_TRUNCATE(ap->a_vp, (off_t)0, 0, NOCRED);
mode = ip->i_mode;
ip->i_mode = 0;
ip->i_rdev = 0;
ip->i_flag |= IUPD|ICHG;
mode = ip->i_mode;
ip->i_mode = 0;
ip->i_rdev = 0;
ip->i_flag |= IUPD|ICHG;
- VOP_VFREE(vp, ip->i_number, mode);
+ VOP_VFREE(ap->a_vp, ip->i_number, mode);
}
if (ip->i_flag&(IUPD|IACC|ICHG|IMOD))
}
if (ip->i_flag&(IUPD|IACC|ICHG|IMOD))
- VOP_UPDATE(vp, &time, &time, 0);
+ VOP_UPDATE(ap->a_vp, &time, &time, 0);
IUNLOCK(ip);
ip->i_flag = 0;
/*
* If we are done with the inode, reclaim it
* so that it can be reused immediately.
*/
IUNLOCK(ip);
ip->i_flag = 0;
/*
* If we are done with the inode, reclaim it
* so that it can be reused immediately.
*/
- if (vp->v_usecount == 0 && ip->i_mode == 0)
- vgone(vp);
+ if (ap->a_vp->v_usecount == 0 && ip->i_mode == 0)
+ vgone(ap->a_vp);
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)mfs_vnops.c 7.31 (Berkeley) %G%
+ * @(#)mfs_vnops.c 7.32 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
mfs_open (ap)
struct vop_open_args *ap;
int
mfs_open (ap)
struct vop_open_args *ap;
-#define vp (ap->a_vp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
- if (vp->v_type != VBLK) {
+ if (ap->a_vp->v_type != VBLK) {
panic("mfs_ioctl not VBLK");
/* NOTREACHED */
}
return (0);
}
panic("mfs_ioctl not VBLK");
/* NOTREACHED */
}
return (0);
}
-#undef vp
-#undef mode
-#undef cred
-#undef p
int
mfs_ioctl (ap)
struct vop_ioctl_args *ap;
int
mfs_ioctl (ap)
struct vop_ioctl_args *ap;
-#define vp (ap->a_vp)
-#define com (ap->a_command)
-#define data (ap->a_data)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef com
-#undef data
-#undef fflag
-#undef cred
-#undef p
/*
* Pass I/O requests to the memory filesystem process.
/*
* Pass I/O requests to the memory filesystem process.
int
mfs_strategy (ap)
struct vop_strategy_args *ap;
int
mfs_strategy (ap)
struct vop_strategy_args *ap;
{
register struct mfsnode *mfsp;
struct vnode *vp;
struct proc *p = curproc; /* XXX */
{
register struct mfsnode *mfsp;
struct vnode *vp;
struct proc *p = curproc; /* XXX */
- if (vfinddev(bp->b_dev, VBLK, &vp) || vp->v_usecount == 0)
+ if (vfinddev(ap->a_bp->b_dev, VBLK, &vp) || vp->v_usecount == 0)
panic("mfs_strategy: bad dev");
mfsp = VTOMFS(vp);
/* check for mini-root access */
if (mfsp->mfs_pid == 0) {
caddr_t base;
panic("mfs_strategy: bad dev");
mfsp = VTOMFS(vp);
/* check for mini-root access */
if (mfsp->mfs_pid == 0) {
caddr_t base;
- base = mfsp->mfs_baseoff + (bp->b_blkno << DEV_BSHIFT);
- if (bp->b_flags & B_READ)
- bcopy(base, bp->b_un.b_addr, bp->b_bcount);
+ base = mfsp->mfs_baseoff + (ap->a_bp->b_blkno << DEV_BSHIFT);
+ if (ap->a_bp->b_flags & B_READ)
+ bcopy(base, ap->a_bp->b_un.b_addr, ap->a_bp->b_bcount);
- bcopy(bp->b_un.b_addr, base, bp->b_bcount);
- biodone(bp);
+ bcopy(ap->a_bp->b_un.b_addr, base, ap->a_bp->b_bcount);
+ biodone(ap->a_bp);
} else if (mfsp->mfs_pid == p->p_pid) {
} else if (mfsp->mfs_pid == p->p_pid) {
- mfs_doio(bp, mfsp->mfs_baseoff);
+ mfs_doio(ap->a_bp, mfsp->mfs_baseoff);
- bp->av_forw = mfsp->mfs_buflist;
- mfsp->mfs_buflist = bp;
+ ap->a_bp->av_forw = mfsp->mfs_buflist;
+ mfsp->mfs_buflist = ap->a_bp;
wakeup((caddr_t)vp);
}
return (0);
}
wakeup((caddr_t)vp);
}
return (0);
}
#if defined(vax) || defined(tahoe)
/*
#if defined(vax) || defined(tahoe)
/*
int
mfs_bmap (ap)
struct vop_bmap_args *ap;
int
mfs_bmap (ap)
struct vop_bmap_args *ap;
-#define vp (ap->a_vp)
-#define bn (ap->a_bn)
-#define vpp (ap->a_vpp)
-#define bnp (ap->a_bnp)
- if (vpp != NULL)
- *vpp = vp;
- if (bnp != NULL)
- *bnp = bn;
+ if (ap->a_vpp != NULL)
+ *ap->a_vpp = ap->a_vp;
+ if (ap->a_bnp != NULL)
+ *ap->a_bnp = ap->a_bn;
-#undef vp
-#undef bn
-#undef vpp
-#undef bnp
/*
* Memory filesystem close routine
/*
* Memory filesystem close routine
int
mfs_close (ap)
struct vop_close_args *ap;
int
mfs_close (ap)
struct vop_close_args *ap;
-#define vp (ap->a_vp)
-#define flag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
- register struct mfsnode *mfsp = VTOMFS(vp);
+ register struct mfsnode *mfsp = VTOMFS(ap->a_vp);
register struct buf *bp;
/*
register struct buf *bp;
/*
* we must invalidate any in core blocks, so that
* we can, free up its vnode.
*/
* we must invalidate any in core blocks, so that
* we can, free up its vnode.
*/
- vflushbuf(vp, 0);
- if (vinvalbuf(vp, 1))
+ vflushbuf(ap->a_vp, 0);
+ if (vinvalbuf(ap->a_vp, 1))
return (0);
/*
* There should be no way to have any more uses of this
* vnode, so if we find any other uses, it is a panic.
*/
return (0);
/*
* There should be no way to have any more uses of this
* vnode, so if we find any other uses, it is a panic.
*/
- if (vp->v_usecount > 1)
- printf("mfs_close: ref count %d > 1\n", vp->v_usecount);
- if (vp->v_usecount > 1 || mfsp->mfs_buflist)
+ if (ap->a_vp->v_usecount > 1)
+ printf("mfs_close: ref count %d > 1\n", ap->a_vp->v_usecount);
+ if (ap->a_vp->v_usecount > 1 || mfsp->mfs_buflist)
panic("mfs_close");
/*
* Send a request to the filesystem server to exit.
*/
mfsp->mfs_buflist = (struct buf *)(-1);
panic("mfs_close");
/*
* Send a request to the filesystem server to exit.
*/
mfsp->mfs_buflist = (struct buf *)(-1);
+ wakeup((caddr_t)ap->a_vp);
-#undef vp
-#undef flag
-#undef cred
-#undef p
/*
* Memory filesystem inactive routine
/*
* Memory filesystem inactive routine
int
mfs_inactive (ap)
struct vop_inactive_args *ap;
int
mfs_inactive (ap)
struct vop_inactive_args *ap;
-#define vp (ap->a_vp)
-#define p (ap->a_p)
- register struct mfsnode *mfsp = VTOMFS(vp);
+ register struct mfsnode *mfsp = VTOMFS(ap->a_vp);
if (mfsp->mfs_buflist && mfsp->mfs_buflist != (struct buf *)(-1))
panic("mfs_inactive: not inactive (mfs_buflist %x)",
mfsp->mfs_buflist);
return (0);
}
if (mfsp->mfs_buflist && mfsp->mfs_buflist != (struct buf *)(-1))
panic("mfs_inactive: not inactive (mfs_buflist %x)",
mfsp->mfs_buflist);
return (0);
}
/*
* Reclaim a memory filesystem devvp so that it can be reused.
/*
* Reclaim a memory filesystem devvp so that it can be reused.
int
mfs_reclaim (ap)
struct vop_reclaim_args *ap;
int
mfs_reclaim (ap)
struct vop_reclaim_args *ap;
- FREE(vp->v_data, M_MFSNODE);
- vp->v_data = NULL;
+ FREE(ap->a_vp->v_data, M_MFSNODE);
+ ap->a_vp->v_data = NULL;
/*
* Print out the contents of an mfsnode.
/*
* Print out the contents of an mfsnode.
int
mfs_print (ap)
struct vop_print_args *ap;
int
mfs_print (ap)
struct vop_print_args *ap;
- register struct mfsnode *mfsp = VTOMFS(vp);
+ register struct mfsnode *mfsp = VTOMFS(ap->a_vp);
printf("tag VT_MFS, pid %d, base %d, size %d\n", mfsp->mfs_pid,
mfsp->mfs_baseoff, mfsp->mfs_size);
return (0);
}
printf("tag VT_MFS, pid %d, base %d, size %d\n", mfsp->mfs_pid,
mfsp->mfs_baseoff, mfsp->mfs_size);
return (0);
}
/*
* Block device bad operation
/*
* Block device bad operation
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_inode.c 7.45 (Berkeley) %G%
+ * @(#)ufs_inode.c 7.46 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
ufs_reclaim (ap)
struct vop_reclaim_args *ap;
int
ufs_reclaim (ap)
struct vop_reclaim_args *ap;
{
register struct inode *ip;
int i, type;
{
register struct inode *ip;
int i, type;
- if (prtactive && vp->v_usecount != 0)
- vprint("ufs_reclaim: pushing active", vp);
+ if (prtactive && ap->a_vp->v_usecount != 0)
+ vprint("ufs_reclaim: pushing active", ap->a_vp);
/*
* Remove the inode from its hash chain.
*/
/*
* Remove the inode from its hash chain.
*/
remque(ip);
/*
* Purge old data structures associated with the inode.
*/
remque(ip);
/*
* Purge old data structures associated with the inode.
*/
if (ip->i_devvp) {
vrele(ip->i_devvp);
ip->i_devvp = 0;
if (ip->i_devvp) {
vrele(ip->i_devvp);
ip->i_devvp = 0;
#ifdef QUOTA
for (i = 0; i < MAXQUOTAS; i++) {
if (ip->i_dquot[i] != NODQUOT) {
#ifdef QUOTA
for (i = 0; i < MAXQUOTAS; i++) {
if (ip->i_dquot[i] != NODQUOT) {
- dqrele(vp, ip->i_dquot[i]);
+ dqrele(ap->a_vp, ip->i_dquot[i]);
ip->i_dquot[i] = NODQUOT;
}
}
#endif
ip->i_dquot[i] = NODQUOT;
}
}
#endif
- switch (vp->v_mount->mnt_stat.f_type) {
+ switch (ap->a_vp->v_mount->mnt_stat.f_type) {
case MOUNT_UFS:
type = M_FFSNODE;
break;
case MOUNT_UFS:
type = M_FFSNODE;
break;
default:
panic("ufs_reclaim: not ufs file");
}
default:
panic("ufs_reclaim: not ufs file");
}
- FREE(vp->v_data, type);
- vp->v_data = NULL;
+ FREE(ap->a_vp->v_data, type);
+ ap->a_vp->v_data = NULL;
/*
* Lock an inode. If its already locked, set the WANT bit and sleep.
/*
* Lock an inode. If its already locked, set the WANT bit and sleep.
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_lookup.c 7.45 (Berkeley) %G%
+ * @(#)ufs_lookup.c 7.46 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
ufs_lookup (ap)
struct vop_lookup_args *ap;
int
ufs_lookup (ap)
struct vop_lookup_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
{
USES_VOP_ACCESS;
USES_VOP_BLKATOFF;
{
USES_VOP_ACCESS;
USES_VOP_BLKATOFF;
int lockparent; /* 1 => lockparent flag is set */
int wantparent; /* 1 => wantparent or lockparent flag */
int error;
int lockparent; /* 1 => lockparent flag is set */
int wantparent; /* 1 => wantparent or lockparent flag */
int error;
- struct vnode *vdp = dvp; /* saved for one special case */
+ struct vnode *vdp = ap->a_dvp; /* saved for one special case */
bp = NULL;
slotoffset = -1;
bp = NULL;
slotoffset = -1;
- *vpp = NULL;
- dp = VTOI(dvp);
- lockparent = cnp->cn_flags & LOCKPARENT;
- wantparent = cnp->cn_flags & (LOCKPARENT|WANTPARENT);
+ *ap->a_vpp = NULL;
+ dp = VTOI(ap->a_dvp);
+ lockparent = ap->a_cnp->cn_flags & LOCKPARENT;
+ wantparent = ap->a_cnp->cn_flags & (LOCKPARENT|WANTPARENT);
/*
* Check accessiblity of directory.
*/
if ((dp->i_mode & IFMT) != IFDIR)
return (ENOTDIR);
/*
* Check accessiblity of directory.
*/
if ((dp->i_mode & IFMT) != IFDIR)
return (ENOTDIR);
- if (error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, cnp->cn_proc))
+ if (error = VOP_ACCESS(ap->a_dvp, VEXEC, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc))
* check the name cache to see if the directory/name pair
* we are looking for is known already.
*/
* check the name cache to see if the directory/name pair
* we are looking for is known already.
*/
- if (error = cache_lookup(dvp, vpp, cnp)) {
+ if (error = cache_lookup(ap->a_dvp, ap->a_vpp, ap->a_cnp)) {
int vpid; /* capability number of vnode */
if (error == ENOENT)
return (error);
#ifdef PARANOID
int vpid; /* capability number of vnode */
if (error == ENOENT)
return (error);
#ifdef PARANOID
- if (dvp == ndp->ni_rdir && (cnp->cn_flags & ISDOTDOT))
+ if (ap->a_dvp == ndp->ni_rdir && (ap->a_cnp->cn_flags & ISDOTDOT))
panic("ufs_lookup: .. through root");
#endif
/*
panic("ufs_lookup: .. through root");
#endif
/*
*/
/*
* The borrowing of variables
*/
/*
* The borrowing of variables
- * here is somewhat confusing. Usually, dvp/dp
+ * here is somewhat confusing. Usually, ap->a_dvp/dp
* is the directory being searched.
* Here it's the target returned from the cache.
*/
pdp = dp;
* is the directory being searched.
* Here it's the target returned from the cache.
*/
pdp = dp;
- dp = VTOI(*vpp);
- dvp = *vpp;
- vpid = dvp->v_id;
+ dp = VTOI(*ap->a_vpp);
+ ap->a_dvp = *ap->a_vpp;
+ vpid = ap->a_dvp->v_id;
if (pdp == dp) { /* lookup on "." */
if (pdp == dp) { /* lookup on "." */
- } else if (cnp->cn_flags & ISDOTDOT) {
+ } else if (ap->a_cnp->cn_flags & ISDOTDOT) {
- error = vget(dvp);
- if (!error && lockparent && (cnp->cn_flags & ISLASTCN))
+ error = vget(ap->a_dvp);
+ if (!error && lockparent && (ap->a_cnp->cn_flags & ISLASTCN))
- error = vget(dvp);
- if (!lockparent || error || !(cnp->cn_flags & ISLASTCN))
+ error = vget(ap->a_dvp);
+ if (!lockparent || error || !(ap->a_cnp->cn_flags & ISLASTCN))
* while we were waiting for the lock.
*/
if (!error) {
* while we were waiting for the lock.
*/
if (!error) {
+ if (vpid == ap->a_dvp->v_id)
return (0);
ufs_iput(dp);
if (lockparent && pdp != dp &&
return (0);
ufs_iput(dp);
if (lockparent && pdp != dp &&
- (cnp->cn_flags & ISLASTCN))
+ (ap->a_cnp->cn_flags & ISLASTCN))
IUNLOCK(pdp);
}
ILOCK(pdp);
dp = pdp;
IUNLOCK(pdp);
}
ILOCK(pdp);
dp = pdp;
- dvp = ITOV(dp);
- *vpp = NULL;
+ ap->a_dvp = ITOV(dp);
+ *ap->a_vpp = NULL;
*/
slotstatus = FOUND;
slotfreespace = slotsize = slotneeded = 0;
*/
slotstatus = FOUND;
slotfreespace = slotsize = slotneeded = 0;
- if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) &&
- (cnp->cn_flags & ISLASTCN)) {
+ if ((ap->a_cnp->cn_nameiop == CREATE || ap->a_cnp->cn_nameiop == RENAME) &&
+ (ap->a_cnp->cn_flags & ISLASTCN)) {
slotstatus = NONE;
slotneeded = (sizeof(struct direct) - MAXNAMLEN +
slotstatus = NONE;
slotneeded = (sizeof(struct direct) - MAXNAMLEN +
- cnp->cn_namelen + 3) &~ 3;
+ ap->a_cnp->cn_namelen + 3) &~ 3;
* profiling time and hence has been removed in the interest
* of simplicity.
*/
* profiling time and hence has been removed in the interest
* of simplicity.
*/
- bmask = VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
- if (cnp->cn_nameiop != LOOKUP || dp->i_diroff == 0 ||
+ bmask = VFSTOUFS(ap->a_dvp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
+ if (ap->a_cnp->cn_nameiop != LOOKUP || dp->i_diroff == 0 ||
dp->i_diroff > dp->i_size) {
entryoffsetinblock = 0;
dp->i_offset = 0;
dp->i_diroff > dp->i_size) {
entryoffsetinblock = 0;
dp->i_offset = 0;
} else {
dp->i_offset = dp->i_diroff;
if ((entryoffsetinblock = dp->i_offset & bmask) &&
} else {
dp->i_offset = dp->i_diroff;
if ((entryoffsetinblock = dp->i_offset & bmask) &&
- (error = VOP_BLKATOFF(dvp, (off_t)dp->i_offset, NULL, &bp)))
+ (error = VOP_BLKATOFF(ap->a_dvp, (off_t)dp->i_offset, NULL, &bp)))
return (error);
numdirpasses = 2;
nchstats.ncs_2passes++;
return (error);
numdirpasses = 2;
nchstats.ncs_2passes++;
if (bp != NULL)
brelse(bp);
if (error =
if (bp != NULL)
brelse(bp);
if (error =
- VOP_BLKATOFF(dvp, (off_t)dp->i_offset, NULL, &bp))
+ VOP_BLKATOFF(ap->a_dvp, (off_t)dp->i_offset, NULL, &bp))
return (error);
entryoffsetinblock = 0;
}
return (error);
entryoffsetinblock = 0;
}
* Check for a name match.
*/
if (ep->d_ino) {
* Check for a name match.
*/
if (ep->d_ino) {
- if (ep->d_namlen == cnp->cn_namelen &&
- !bcmp(cnp->cn_nameptr, ep->d_name,
+ if (ep->d_namlen == ap->a_cnp->cn_namelen &&
+ !bcmp(ap->a_cnp->cn_nameptr, ep->d_name,
(unsigned)ep->d_namlen)) {
/*
* Save directory entry's inode number and
(unsigned)ep->d_namlen)) {
/*
* Save directory entry's inode number and
* directory has not been removed, then can consider
* allowing file to be created.
*/
* directory has not been removed, then can consider
* allowing file to be created.
*/
- if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) &&
- (cnp->cn_flags & ISLASTCN) && dp->i_nlink != 0) {
+ if ((ap->a_cnp->cn_nameiop == CREATE || ap->a_cnp->cn_nameiop == RENAME) &&
+ (ap->a_cnp->cn_flags & ISLASTCN) && dp->i_nlink != 0) {
/*
* Access for write is interpreted as allowing
* creation of files in the directory.
*/
/*
* Access for write is interpreted as allowing
* creation of files in the directory.
*/
- if (error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_proc))
+ if (error = VOP_ACCESS(ap->a_dvp, VWRITE, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc))
return (error);
/*
* Return an indication of where the new directory
return (error);
/*
* Return an indication of where the new directory
* NB - if the directory is unlocked, then this
* information cannot be used.
*/
* NB - if the directory is unlocked, then this
* information cannot be used.
*/
- cnp->cn_flags |= SAVENAME;
+ ap->a_cnp->cn_flags |= SAVENAME;
if (!lockparent)
IUNLOCK(dp);
return (EJUSTRETURN);
if (!lockparent)
IUNLOCK(dp);
return (EJUSTRETURN);
/*
* Insert name into cache (as non-existent) if appropriate.
*/
/*
* Insert name into cache (as non-existent) if appropriate.
*/
- if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE)
- cache_enter(dvp, *vpp, cnp);
+ if ((ap->a_cnp->cn_flags & MAKEENTRY) && ap->a_cnp->cn_nameiop != CREATE)
+ cache_enter(ap->a_dvp, *ap->a_vpp, ap->a_cnp);
* If the final component of path name, save information
* in the cache as to where the entry was found.
*/
* If the final component of path name, save information
* in the cache as to where the entry was found.
*/
- if ((cnp->cn_flags & ISLASTCN) && cnp->cn_nameiop == LOOKUP)
+ if ((ap->a_cnp->cn_flags & ISLASTCN) && ap->a_cnp->cn_nameiop == LOOKUP)
dp->i_diroff = dp->i_offset &~ (DIRBLKSIZ - 1);
/*
dp->i_diroff = dp->i_offset &~ (DIRBLKSIZ - 1);
/*
* the directory (in ndp->ni_dvp), otherwise we go
* on and lock the inode, being careful with ".".
*/
* the directory (in ndp->ni_dvp), otherwise we go
* on and lock the inode, being careful with ".".
*/
- if (cnp->cn_nameiop == DELETE && (cnp->cn_flags & ISLASTCN)) {
+ if (ap->a_cnp->cn_nameiop == DELETE && (ap->a_cnp->cn_flags & ISLASTCN)) {
/*
* Write access to directory required to delete files.
*/
/*
* Write access to directory required to delete files.
*/
- if (error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_proc))
+ if (error = VOP_ACCESS(ap->a_dvp, VWRITE, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc))
return (error);
/*
* Return pointer to current entry in dp->i_offset,
return (error);
/*
* Return pointer to current entry in dp->i_offset,
dp->i_count = dp->i_offset - prevoff;
if (dp->i_number == dp->i_ino) {
VREF(vdp);
dp->i_count = dp->i_offset - prevoff;
if (dp->i_number == dp->i_ino) {
VREF(vdp);
- if (error = VOP_VGET(dvp, dp->i_ino, &tdp))
+ if (error = VOP_VGET(ap->a_dvp, dp->i_ino, &tdp))
return (error);
/*
* If directory is "sticky", then user must own
return (error);
/*
* If directory is "sticky", then user must own
* implements append-only directories.
*/
if ((dp->i_mode & ISVTX) &&
* implements append-only directories.
*/
if ((dp->i_mode & ISVTX) &&
- cnp->cn_cred->cr_uid != 0 &&
- cnp->cn_cred->cr_uid != dp->i_uid &&
- VTOI(tdp)->i_uid != cnp->cn_cred->cr_uid) {
+ ap->a_cnp->cn_cred->cr_uid != 0 &&
+ ap->a_cnp->cn_cred->cr_uid != dp->i_uid &&
+ VTOI(tdp)->i_uid != ap->a_cnp->cn_cred->cr_uid) {
vput(tdp);
return (EPERM);
}
vput(tdp);
return (EPERM);
}
if (!lockparent)
IUNLOCK(dp);
return (0);
if (!lockparent)
IUNLOCK(dp);
return (0);
* Must get inode of directory entry to verify it's a
* regular file, or empty directory.
*/
* Must get inode of directory entry to verify it's a
* regular file, or empty directory.
*/
- if (cnp->cn_nameiop == RENAME && wantparent &&
- (cnp->cn_flags & ISLASTCN)) {
- if (error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_proc))
+ if (ap->a_cnp->cn_nameiop == RENAME && wantparent &&
+ (ap->a_cnp->cn_flags & ISLASTCN)) {
+ if (error = VOP_ACCESS(ap->a_dvp, VWRITE, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc))
return (error);
/*
* Careful about locking second inode.
return (error);
/*
* Careful about locking second inode.
*/
if (dp->i_number == dp->i_ino)
return (EISDIR);
*/
if (dp->i_number == dp->i_ino)
return (EISDIR);
- if (error = VOP_VGET(dvp, dp->i_ino, &tdp))
+ if (error = VOP_VGET(ap->a_dvp, dp->i_ino, &tdp))
- *vpp = tdp;
- cnp->cn_flags |= SAVENAME;
+ *ap->a_vpp = tdp;
+ ap->a_cnp->cn_flags |= SAVENAME;
if (!lockparent)
IUNLOCK(dp);
return (0);
if (!lockparent)
IUNLOCK(dp);
return (0);
* that point backwards in the directory structure.
*/
pdp = dp;
* that point backwards in the directory structure.
*/
pdp = dp;
- if (cnp->cn_flags & ISDOTDOT) {
+ if (ap->a_cnp->cn_flags & ISDOTDOT) {
IUNLOCK(pdp); /* race to get the inode */
IUNLOCK(pdp); /* race to get the inode */
- if (error = VOP_VGET(dvp, dp->i_ino, &tdp)) {
+ if (error = VOP_VGET(ap->a_dvp, dp->i_ino, &tdp)) {
ILOCK(pdp);
return (error);
}
ILOCK(pdp);
return (error);
}
- if (lockparent && (cnp->cn_flags & ISLASTCN))
+ if (lockparent && (ap->a_cnp->cn_flags & ISLASTCN))
} else if (dp->i_number == dp->i_ino) {
} else if (dp->i_number == dp->i_ino) {
- VREF(dvp); /* we want ourself, ie "." */
- *vpp = dvp;
+ VREF(ap->a_dvp); /* we want ourself, ie "." */
+ *ap->a_vpp = ap->a_dvp;
- if (error = VOP_VGET(dvp, dp->i_ino, &tdp))
+ if (error = VOP_VGET(ap->a_dvp, dp->i_ino, &tdp))
- if (!lockparent || !(cnp->cn_flags & ISLASTCN))
+ if (!lockparent || !(ap->a_cnp->cn_flags & ISLASTCN))
}
/*
* Insert name into cache if appropriate.
*/
}
/*
* Insert name into cache if appropriate.
*/
- if (cnp->cn_flags & MAKEENTRY)
- cache_enter(dvp, *vpp, cnp);
+ if (ap->a_cnp->cn_flags & MAKEENTRY)
+ cache_enter(ap->a_dvp, *ap->a_vpp, ap->a_cnp);
-#undef dvp
-#undef vpp
-#undef cnp
void
ufs_dirbad(ip, offset, how)
void
ufs_dirbad(ip, offset, how)
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_vnops.c 7.90 (Berkeley) %G%
+ * @(#)ufs_vnops.c 7.91 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
int
ufs_create (ap)
struct vop_create_args *ap;
int
ufs_create (ap)
struct vop_create_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
- ufs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode), dvp, vpp, cnp))
+ 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);
}
return (error);
return (0);
}
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
int
ufs_mknod (ap)
struct vop_mknod_args *ap;
int
ufs_mknod (ap)
struct vop_mknod_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
{
register struct inode *ip;
int error;
if (error =
{
register struct inode *ip;
int error;
if (error =
- ufs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode), dvp, vpp, cnp))
+ ufs_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode), ap->a_dvp, ap->a_vpp, ap->a_cnp))
ip->i_flag |= IACC|IUPD|ICHG;
ip->i_flag |= IACC|IUPD|ICHG;
- if (vap->va_rdev != VNOVAL) {
+ if (ap->a_vap->va_rdev != VNOVAL) {
/*
* Want to be able to use this to make badblock
* inodes, so don't truncate the dev number.
*/
/*
* Want to be able to use this to make badblock
* inodes, so don't truncate the dev number.
*/
- ip->i_rdev = vap->va_rdev;
+ ip->i_rdev = ap->a_vap->va_rdev;
}
/*
* Remove inode so that it will be reloaded by iget and
* checked to see if it is an alias of an existing entry
* in the inode cache.
*/
}
/*
* Remove inode so that it will be reloaded by iget and
* checked to see if it is an alias of an existing entry
* in the inode cache.
*/
- vput(*vpp);
- (*vpp)->v_type = VNON;
- vgone(*vpp);
- *vpp = 0;
+ vput(*ap->a_vpp);
+ (*ap->a_vpp)->v_type = VNON;
+ vgone(*ap->a_vpp);
+ *ap->a_vpp = 0;
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
int
ufs_open (ap)
struct vop_open_args *ap;
int
ufs_open (ap)
struct vop_open_args *ap;
-#define vp (ap->a_vp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef mode
-#undef cred
-#undef p
int
ufs_close (ap)
struct vop_close_args *ap;
int
ufs_close (ap)
struct vop_close_args *ap;
-#define vp (ap->a_vp)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
register struct inode *ip;
{
register struct inode *ip;
- ip = VTOI(vp);
- if (vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
+ ip = VTOI(ap->a_vp);
+ if (ap->a_vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
ITIMES(ip, &time, &time);
return (0);
}
ITIMES(ip, &time, &time);
return (0);
}
-#undef vp
-#undef fflag
-#undef cred
-#undef p
/*
* Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
/*
* Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
int
ufs_access (ap)
struct vop_access_args *ap;
int
ufs_access (ap)
struct vop_access_args *ap;
-#define vp (ap->a_vp)
-#define mode (ap->a_mode)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
register gid_t *gp;
int i, error;
#ifdef DIAGNOSTIC
register gid_t *gp;
int i, error;
#ifdef DIAGNOSTIC
- if (!VOP_ISLOCKED(vp)) {
- vprint("ufs_access: not locked", vp);
+ if (!VOP_ISLOCKED(ap->a_vp)) {
+ vprint("ufs_access: not locked", ap->a_vp);
panic("ufs_access: not locked");
}
#endif
#ifdef QUOTA
panic("ufs_access: not locked");
}
#endif
#ifdef QUOTA
- if (mode & VWRITE) {
- switch (vp->v_type) {
+ if (ap->a_mode & VWRITE) {
+ switch (ap->a_vp->v_type) {
case VREG: case VDIR: case VLNK:
if (error = getinoquota(ip))
return (error);
case VREG: case VDIR: case VLNK:
if (error = getinoquota(ip))
return (error);
/*
* If you're the super-user, you always get access.
*/
/*
* If you're the super-user, you always get access.
*/
+ if (ap->a_cred->cr_uid == 0)
return (0);
/*
* Access check is based on only one of owner, group, public.
* If not owner, then check group. If not a member of the
* group, then check public access.
*/
return (0);
/*
* Access check is based on only one of owner, group, public.
* If not owner, then check group. If not a member of the
* group, then check public access.
*/
- if (cred->cr_uid != ip->i_uid) {
- mode >>= 3;
- gp = cred->cr_groups;
- for (i = 0; i < cred->cr_ngroups; i++, gp++)
+ if (ap->a_cred->cr_uid != ip->i_uid) {
+ ap->a_mode >>= 3;
+ gp = ap->a_cred->cr_groups;
+ for (i = 0; i < ap->a_cred->cr_ngroups; i++, gp++)
if (ip->i_gid == *gp)
goto found;
if (ip->i_gid == *gp)
goto found;
- if ((ip->i_mode & mode) != 0)
+ if ((ip->i_mode & ap->a_mode) != 0)
return (0);
return (EACCES);
}
return (0);
return (EACCES);
}
-#undef vp
-#undef mode
-#undef cred
-#undef p
/* ARGSUSED */
int
ufs_getattr (ap)
struct vop_getattr_args *ap;
/* ARGSUSED */
int
ufs_getattr (ap)
struct vop_getattr_args *ap;
-#define vp (ap->a_vp)
-#define vap (ap->a_vap)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
register struct inode *ip;
{
register struct inode *ip;
ITIMES(ip, &time, &time);
/*
* Copy from inode table
*/
ITIMES(ip, &time, &time);
/*
* Copy from inode table
*/
- vap->va_fsid = ip->i_dev;
- vap->va_fileid = ip->i_number;
- vap->va_mode = ip->i_mode & ~IFMT;
- vap->va_nlink = ip->i_nlink;
- vap->va_uid = ip->i_uid;
- vap->va_gid = ip->i_gid;
- vap->va_rdev = (dev_t)ip->i_rdev;
+ ap->a_vap->va_fsid = ip->i_dev;
+ ap->a_vap->va_fileid = ip->i_number;
+ ap->a_vap->va_mode = ip->i_mode & ~IFMT;
+ ap->a_vap->va_nlink = ip->i_nlink;
+ ap->a_vap->va_uid = ip->i_uid;
+ ap->a_vap->va_gid = ip->i_gid;
+ ap->a_vap->va_rdev = (dev_t)ip->i_rdev;
- vap->va_size = ip->i_size;
- vap->va_size_rsv = 0;
+ ap->a_vap->va_size = ip->i_size;
+ ap->a_vap->va_size_rsv = 0;
- vap->va_qsize = ip->i_din.di_qsize;
+ ap->a_vap->va_qsize = ip->i_din.di_qsize;
- vap->va_atime = ip->i_atime;
- vap->va_mtime = ip->i_mtime;
- vap->va_ctime = ip->i_ctime;
- vap->va_flags = ip->i_flags;
- vap->va_gen = ip->i_gen;
+ ap->a_vap->va_atime = ip->i_atime;
+ ap->a_vap->va_mtime = ip->i_mtime;
+ ap->a_vap->va_ctime = ip->i_ctime;
+ ap->a_vap->va_flags = ip->i_flags;
+ ap->a_vap->va_gen = ip->i_gen;
/* this doesn't belong here */
/* this doesn't belong here */
- if (vp->v_type == VBLK)
- vap->va_blocksize = BLKDEV_IOSIZE;
- else if (vp->v_type == VCHR)
- vap->va_blocksize = MAXBSIZE;
+ if (ap->a_vp->v_type == VBLK)
+ ap->a_vap->va_blocksize = BLKDEV_IOSIZE;
+ else if (ap->a_vp->v_type == VCHR)
+ ap->a_vap->va_blocksize = MAXBSIZE;
- vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize;
- vap->va_bytes = dbtob(ip->i_blocks);
+ ap->a_vap->va_blocksize = ap->a_vp->v_mount->mnt_stat.f_iosize;
+ ap->a_vap->va_bytes = dbtob(ip->i_blocks);
+ ap->a_vap->va_bytes_rsv = 0;
- vap->va_type = vp->v_type;
- vap->va_filerev = ip->i_modrev;
+ ap->a_vap->va_type = ap->a_vp->v_type;
+ ap->a_vap->va_filerev = ip->i_modrev;
-#undef vp
-#undef vap
-#undef cred
-#undef p
/*
* Set attribute vnode op. called from several syscalls
/*
* Set attribute vnode op. called from several syscalls
int
ufs_setattr (ap)
struct vop_setattr_args *ap;
int
ufs_setattr (ap)
struct vop_setattr_args *ap;
-#define vp (ap->a_vp)
-#define vap (ap->a_vap)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
/*
* Check for unsettable attributes.
*/
/*
* Check for unsettable attributes.
*/
- if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) ||
- (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) ||
- (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) ||
- ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) {
+ if ((ap->a_vap->va_type != VNON) || (ap->a_vap->va_nlink != VNOVAL) ||
+ (ap->a_vap->va_fsid != VNOVAL) || (ap->a_vap->va_fileid != VNOVAL) ||
+ (ap->a_vap->va_blocksize != VNOVAL) || (ap->a_vap->va_rdev != VNOVAL) ||
+ ((int)ap->a_vap->va_bytes != VNOVAL) || (ap->a_vap->va_gen != VNOVAL)) {
return (EINVAL);
}
/*
* Go through the fields and update iff not VNOVAL.
*/
return (EINVAL);
}
/*
* 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 (ap->a_vap->va_uid != (uid_t)VNOVAL || ap->a_vap->va_gid != (gid_t)VNOVAL)
+ if (error = ufs_chown(ap->a_vp, ap->a_vap->va_uid, ap->a_vap->va_gid, ap->a_cred, ap->a_p))
- if (vap->va_size != VNOVAL) {
- if (vp->v_type == VDIR)
+ if (ap->a_vap->va_size != VNOVAL) {
+ if (ap->a_vp->v_type == VDIR)
- if (error = VOP_TRUNCATE(vp, vap->va_size, 0, cred))
+ if (error = VOP_TRUNCATE(ap->a_vp, ap->a_vap->va_size, 0, ap->a_cred))
- ip = VTOI(vp);
- 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)))
+ ip = VTOI(ap->a_vp);
+ if (ap->a_vap->va_atime.tv_sec != VNOVAL || ap->a_vap->va_mtime.tv_sec != VNOVAL) {
+ if (ap->a_cred->cr_uid != ip->i_uid &&
+ (error = suser(ap->a_cred, &ap->a_p->p_acflag)))
- if (vap->va_atime.tv_sec != VNOVAL)
+ if (ap->a_vap->va_atime.tv_sec != VNOVAL)
- if (vap->va_mtime.tv_sec != VNOVAL)
+ if (ap->a_vap->va_mtime.tv_sec != VNOVAL)
ip->i_flag |= IUPD;
ip->i_flag |= ICHG;
ip->i_flag |= IUPD;
ip->i_flag |= ICHG;
- if (error = VOP_UPDATE(vp, &vap->va_atime, &vap->va_mtime, 1))
+ if (error = VOP_UPDATE(ap->a_vp, &ap->a_vap->va_atime, &ap->a_vap->va_mtime, 1))
return (error);
}
error = 0;
return (error);
}
error = 0;
- if (vap->va_mode != (mode_t)VNOVAL)
- error = ufs_chmod(vp, (int)vap->va_mode, cred, p);
- if (vap->va_flags != VNOVAL) {
- if (cred->cr_uid != ip->i_uid &&
- (error = suser(cred, &p->p_acflag)))
+ if (ap->a_vap->va_mode != (mode_t)VNOVAL)
+ error = ufs_chmod(ap->a_vp, (int)ap->a_vap->va_mode, ap->a_cred, ap->a_p);
+ if (ap->a_vap->va_flags != VNOVAL) {
+ if (ap->a_cred->cr_uid != ip->i_uid &&
+ (error = suser(ap->a_cred, &ap->a_p->p_acflag)))
- if (cred->cr_uid == 0) {
- ip->i_flags = vap->va_flags;
+ if (ap->a_cred->cr_uid == 0) {
+ ip->i_flags = ap->a_vap->va_flags;
} else {
ip->i_flags &= 0xffff0000;
} else {
ip->i_flags &= 0xffff0000;
- ip->i_flags |= (vap->va_flags & 0xffff);
+ ip->i_flags |= (ap->a_vap->va_flags & 0xffff);
}
ip->i_flag |= ICHG;
}
return (error);
}
}
ip->i_flag |= ICHG;
}
return (error);
}
-#undef vp
-#undef vap
-#undef cred
-#undef p
/*
* Change the mode on a file.
/*
* Change the mode on a file.
int
ufs_ioctl (ap)
struct vop_ioctl_args *ap;
int
ufs_ioctl (ap)
struct vop_ioctl_args *ap;
-#define vp (ap->a_vp)
-#define com (ap->a_command)
-#define data (ap->a_data)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef com
-#undef data
-#undef fflag
-#undef cred
-#undef p
/* ARGSUSED */
int
ufs_select (ap)
struct vop_select_args *ap;
/* ARGSUSED */
int
ufs_select (ap)
struct vop_select_args *ap;
-#define vp (ap->a_vp)
-#define which (ap->a_which)
-#define fflags (ap->a_fflags)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef which
-#undef fflags
-#undef cred
-#undef p
int
ufs_mmap (ap)
struct vop_mmap_args *ap;
int
ufs_mmap (ap)
struct vop_mmap_args *ap;
-#define vp (ap->a_vp)
-#define fflags (ap->a_fflags)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
-#undef vp
-#undef fflags
-#undef cred
-#undef p
int
ufs_seek (ap)
struct vop_seek_args *ap;
int
ufs_seek (ap)
struct vop_seek_args *ap;
-#define vp (ap->a_vp)
-#define oldoff (ap->a_oldoff)
-#define newoff (ap->a_newoff)
-#define cred (ap->a_cred)
-#undef vp
-#undef oldoff
-#undef newoff
-#undef cred
int
ufs_remove (ap)
struct vop_remove_args *ap;
int
ufs_remove (ap)
struct vop_remove_args *ap;
-#define dvp (ap->a_dvp)
-#define vp (ap->a_vp)
-#define cnp (ap->a_cnp)
{
register struct inode *ip, *dp;
int error;
{
register struct inode *ip, *dp;
int error;
- ip = VTOI(vp);
- dp = VTOI(dvp);
- error = ufs_dirremove(dvp, cnp);
+ ip = VTOI(ap->a_vp);
+ dp = VTOI(ap->a_dvp);
+ error = ufs_dirremove(ap->a_dvp, ap->a_cnp);
if (!error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
if (!error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
ufs_iput(dp);
return (error);
}
ufs_iput(dp);
return (error);
}
-#undef dvp
-#undef vp
-#undef cnp
int
ufs_link (ap)
struct vop_link_args *ap;
int
ufs_link (ap)
struct vop_link_args *ap;
-#define tdvp (ap->a_vp)
-#define vp (ap->a_tdvp)
-#define cnp (ap->a_cnp)
{
USES_VOP_UPDATE;
register struct inode *ip;
int error;
#ifdef DIAGNOSTIC
{
USES_VOP_UPDATE;
register struct inode *ip;
int error;
#ifdef DIAGNOSTIC
- if ((cnp->cn_flags & HASBUF) == 0)
+ if ((ap->a_cnp->cn_flags & HASBUF) == 0)
panic("ufs_link: no name");
#endif
panic("ufs_link: no name");
#endif
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
- free(cnp->cn_pnbuf, M_NAMEI);
+ free(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ if (ap->a_vp != ap->a_tdvp)
ILOCK(ip);
ip->i_nlink++;
ip->i_flag |= ICHG;
ILOCK(ip);
ip->i_nlink++;
ip->i_flag |= ICHG;
- error = VOP_UPDATE(vp, &time, &time, 1);
+ error = VOP_UPDATE(ap->a_tdvp, &time, &time, 1);
- error = ufs_direnter(ip, tdvp, cnp);
- if (tdvp != vp)
+ error = ufs_direnter(ip, ap->a_vp, ap->a_cnp);
+ if (ap->a_vp != ap->a_tdvp)
- FREE(cnp->cn_pnbuf, M_NAMEI);
- vput(tdvp);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
+ vput(ap->a_vp);
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
}
return (error);
}
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
}
return (error);
}
-#undef tdvp
-#undef vp
-#undef cnp
int
ufs_rename (ap)
struct vop_rename_args *ap;
int
ufs_rename (ap)
struct vop_rename_args *ap;
-#define fdvp (ap->a_fdvp)
-#define fvp (ap->a_fvp)
-#define fcnp (ap->a_fcnp)
-#define tdvp (ap->a_tdvp)
-#define tvp (ap->a_tvp)
-#define tcnp (ap->a_tcnp)
{
USES_VOP_ABORTOP;
USES_VOP_ACCESS;
{
USES_VOP_ABORTOP;
USES_VOP_ACCESS;
int fdvpneedsrele = 1, tdvpneedsrele = 1;
#ifdef DIAGNOSTIC
int fdvpneedsrele = 1, tdvpneedsrele = 1;
#ifdef DIAGNOSTIC
- if ((tcnp->cn_flags & HASBUF) == 0 ||
- (fcnp->cn_flags & HASBUF) == 0)
+ if ((ap->a_tcnp->cn_flags & HASBUF) == 0 ||
+ (ap->a_fcnp->cn_flags & HASBUF) == 0)
panic("ufs_rename: no name");
#endif
panic("ufs_rename: no name");
#endif
- dp = VTOI(fdvp);
- ip = VTOI(fvp);
+ dp = VTOI(ap->a_fdvp);
+ ip = VTOI(ap->a_fvp);
/*
* Check if just deleting a link name.
*/
/*
* Check if just deleting a link name.
*/
- if (fvp == tvp) {
- VOP_ABORTOP(tdvp, tcnp);
- vput(tdvp);
- vput(tvp);
- vrele(fdvp);
+ if (ap->a_fvp == ap->a_tvp) {
+ VOP_ABORTOP(ap->a_tdvp, ap->a_tcnp);
+ vput(ap->a_tdvp);
+ vput(ap->a_tvp);
+ vrele(ap->a_fdvp);
if ((ip->i_mode&IFMT) == IFDIR) {
if ((ip->i_mode&IFMT) == IFDIR) {
- VOP_ABORTOP(fdvp, fcnp);
- vrele(fvp);
+ VOP_ABORTOP(ap->a_fdvp, ap->a_fcnp);
+ vrele(ap->a_fvp);
return (EINVAL);
}
doingdirectory = 0;
return (EINVAL);
}
doingdirectory = 0;
/*
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/
/*
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/
- if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
- dp == ip || (fcnp->cn_flags&ISDOTDOT) || (ip->i_flag & IRENAME)) {
- VOP_ABORTOP(tdvp, tcnp);
- vput(tdvp);
- if (tvp)
- vput(tvp);
- VOP_ABORTOP(fdvp, fcnp);
- vrele(fdvp);
- vput(fvp);
+ if ((ap->a_fcnp->cn_namelen == 1 && ap->a_fcnp->cn_nameptr[0] == '.') ||
+ dp == ip || (ap->a_fcnp->cn_flags&ISDOTDOT) || (ip->i_flag & IRENAME)) {
+ VOP_ABORTOP(ap->a_tdvp, ap->a_tcnp);
+ vput(ap->a_tdvp);
+ if (ap->a_tvp)
+ vput(ap->a_tvp);
+ VOP_ABORTOP(ap->a_fdvp, ap->a_fcnp);
+ vrele(ap->a_fdvp);
+ vput(ap->a_fvp);
return (EINVAL);
}
ip->i_flag |= IRENAME;
oldparent = dp->i_number;
doingdirectory++;
}
return (EINVAL);
}
ip->i_flag |= IRENAME;
oldparent = dp->i_number;
doingdirectory++;
}
/*
* 1) Bump link count while we're moving stuff
/*
* 1) Bump link count while we're moving stuff
*/
ip->i_nlink++;
ip->i_flag |= ICHG;
*/
ip->i_nlink++;
ip->i_flag |= ICHG;
- error = VOP_UPDATE(fvp, &time, &time, 1);
+ error = VOP_UPDATE(ap->a_fvp, &time, &time, 1);
IUNLOCK(ip);
/*
* When the target exists, both the directory
* and target vnodes are returned locked.
*/
IUNLOCK(ip);
/*
* When the target exists, both the directory
* and target vnodes are returned locked.
*/
- if (tvp)
- xp = VTOI(tvp);
+ if (ap->a_tvp)
+ xp = VTOI(ap->a_tvp);
/*
* If ".." must be changed (ie the directory gets a new
* parent) then the source directory must not be in the
/*
* If ".." must be changed (ie the directory gets a new
* parent) then the source directory must not be in the
if (oldparent != dp->i_number)
newparent = dp->i_number;
if (doingdirectory && newparent) {
if (oldparent != dp->i_number)
newparent = dp->i_number;
if (doingdirectory && newparent) {
- VOP_LOCK(fvp);
- error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc);
- VOP_UNLOCK(fvp);
+ VOP_LOCK(ap->a_fvp);
+ error = VOP_ACCESS(ap->a_fvp, VWRITE, ap->a_tcnp->cn_cred, ap->a_tcnp->cn_proc);
+ VOP_UNLOCK(ap->a_fvp);
if (error)
goto bad;
if (xp != NULL)
ufs_iput(xp);
if (error)
goto bad;
if (xp != NULL)
ufs_iput(xp);
- if (error = ufs_checkpath(ip, dp, tcnp->cn_cred))
+ if (error = ufs_checkpath(ip, dp, ap->a_tcnp->cn_cred))
- if ((tcnp->cn_flags & SAVESTART) == 0)
+ if ((ap->a_tcnp->cn_flags & SAVESTART) == 0)
panic("ufs_rename: lost to startdir");
p->p_spare[1]--;
panic("ufs_rename: lost to startdir");
p->p_spare[1]--;
- if (error = relookup(tdvp, &tvp, tcnp))
+ if (error = relookup(ap->a_tdvp, &ap->a_tvp, ap->a_tcnp))
- if (tvp)
- xp = VTOI(tvp);
+ if (ap->a_tvp)
+ xp = VTOI(ap->a_tvp);
}
/*
* 2) If target doesn't exist, link the target
}
/*
* 2) If target doesn't exist, link the target
if (error = VOP_UPDATE(ITOV(dp), &time, &time, 1))
goto bad;
}
if (error = VOP_UPDATE(ITOV(dp), &time, &time, 1))
goto bad;
}
- if (error = ufs_direnter(ip, tdvp, tcnp)) {
+ if (error = ufs_direnter(ip, ap->a_tdvp, ap->a_tcnp)) {
if (doingdirectory && newparent) {
dp->i_nlink--;
dp->i_flag |= ICHG;
if (doingdirectory && newparent) {
dp->i_nlink--;
dp->i_flag |= ICHG;
* otherwise the destination may not be changed (except by
* root). This implements append-only directories.
*/
* otherwise the destination may not be changed (except by
* root). This implements append-only directories.
*/
- if ((dp->i_mode & ISVTX) && tcnp->cn_cred->cr_uid != 0 &&
- tcnp->cn_cred->cr_uid != dp->i_uid &&
- xp->i_uid != tcnp->cn_cred->cr_uid) {
+ if ((dp->i_mode & ISVTX) && ap->a_tcnp->cn_cred->cr_uid != 0 &&
+ ap->a_tcnp->cn_cred->cr_uid != dp->i_uid &&
+ xp->i_uid != ap->a_tcnp->cn_cred->cr_uid) {
error = EPERM;
goto bad;
}
error = EPERM;
goto bad;
}
* (both directories, or both not directories).
*/
if ((xp->i_mode&IFMT) == IFDIR) {
* (both directories, or both not directories).
*/
if ((xp->i_mode&IFMT) == IFDIR) {
- if (!ufs_dirempty(xp, dp->i_number, tcnp->cn_cred) ||
+ if (!ufs_dirempty(xp, dp->i_number, ap->a_tcnp->cn_cred) ||
xp->i_nlink > 2) {
error = ENOTEMPTY;
goto bad;
xp->i_nlink > 2) {
error = ENOTEMPTY;
goto bad;
error = EISDIR;
goto bad;
}
error = EISDIR;
goto bad;
}
- if (error = ufs_dirrewrite(dp, ip, tcnp))
+ if (error = ufs_dirrewrite(dp, ip, ap->a_tcnp))
goto bad;
/*
* If the target directory is in the same
goto bad;
/*
* If the target directory is in the same
if (--xp->i_nlink != 0)
panic("rename: linked directory");
error = VOP_TRUNCATE(ITOV(xp), (off_t)0, IO_SYNC,
if (--xp->i_nlink != 0)
panic("rename: linked directory");
error = VOP_TRUNCATE(ITOV(xp), (off_t)0, IO_SYNC,
}
xp->i_flag |= ICHG;
ufs_iput(xp);
}
xp->i_flag |= ICHG;
ufs_iput(xp);
* 3) Unlink the source.
*/
unlinkit:
* 3) Unlink the source.
*/
unlinkit:
- fcnp->cn_flags &= ~MODMASK;
- fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
- if ((fcnp->cn_flags & SAVESTART) == 0)
+ ap->a_fcnp->cn_flags &= ~MODMASK;
+ ap->a_fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
+ if ((ap->a_fcnp->cn_flags & SAVESTART) == 0)
panic("ufs_rename: lost from startdir");
p->p_spare[1]--;
panic("ufs_rename: lost from startdir");
p->p_spare[1]--;
- (void) relookup(fdvp, &fvp, fcnp);
- if (fvp != NULL) {
- xp = VTOI(fvp);
- dp = VTOI(fdvp);
+ (void) relookup(ap->a_fdvp, &ap->a_fvp, ap->a_fcnp);
+ if (ap->a_fvp != NULL) {
+ xp = VTOI(ap->a_fvp);
+ dp = VTOI(ap->a_fdvp);
} else {
/*
* From name has disappeared.
} else {
/*
* From name has disappeared.
error = vn_rdwr(UIO_READ, ITOV(xp), (caddr_t)&dirbuf,
sizeof (struct dirtemplate), (off_t)0,
UIO_SYSSPACE, IO_NODELOCKED,
error = vn_rdwr(UIO_READ, ITOV(xp), (caddr_t)&dirbuf,
sizeof (struct dirtemplate), (off_t)0,
UIO_SYSSPACE, IO_NODELOCKED,
- tcnp->cn_cred, (int *)0, (struct proc *)0);
+ ap->a_tcnp->cn_cred, (int *)0, (struct proc *)0);
if (error == 0) {
if (dirbuf.dotdot_namlen != 2 ||
dirbuf.dotdot_name[0] != '.' ||
if (error == 0) {
if (dirbuf.dotdot_namlen != 2 ||
dirbuf.dotdot_name[0] != '.' ||
sizeof (struct dirtemplate),
(off_t)0, UIO_SYSSPACE,
IO_NODELOCKED|IO_SYNC,
sizeof (struct dirtemplate),
(off_t)0, UIO_SYSSPACE,
IO_NODELOCKED|IO_SYNC,
- tcnp->cn_cred, (int *)0,
+ ap->a_tcnp->cn_cred, (int *)0,
(struct proc *)0);
cache_purge(ITOV(dp));
}
}
}
(struct proc *)0);
cache_purge(ITOV(dp));
}
}
}
- error = ufs_dirremove(fdvp, fcnp);
+ error = ufs_dirremove(ap->a_fdvp, ap->a_fcnp);
if (!error) {
xp->i_nlink--;
xp->i_flag |= ICHG;
if (!error) {
xp->i_nlink--;
xp->i_flag |= ICHG;
vrele(ITOV(ip));
return (error);
}
vrele(ITOV(ip));
return (error);
}
-#undef fdvp
-#undef fvp
-#undef fcnp
-#undef tdvp
-#undef tvp
-#undef tcnp
/*
* A virgin directory (no blushing please).
/*
* A virgin directory (no blushing please).
int
ufs_mkdir (ap)
struct vop_mkdir_args *ap;
int
ufs_mkdir (ap)
struct vop_mkdir_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
{
USES_VOP_TRUNCATE;
USES_VOP_UPDATE;
int dmode;
#ifdef DIAGNOSTIC
int dmode;
#ifdef DIAGNOSTIC
- if ((cnp->cn_flags & HASBUF) == 0)
+ if ((ap->a_cnp->cn_flags & HASBUF) == 0)
panic("ufs_mkdir: no name");
#endif
panic("ufs_mkdir: no name");
#endif
if ((nlink_t)dp->i_nlink >= LINK_MAX) {
if ((nlink_t)dp->i_nlink >= LINK_MAX) {
- free(cnp->cn_pnbuf, M_NAMEI);
+ free(ap->a_cnp->cn_pnbuf, M_NAMEI);
ufs_iput(dp);
return (EMLINK);
}
ufs_iput(dp);
return (EMLINK);
}
- dmode = vap->va_mode&0777;
+ dmode = ap->a_vap->va_mode&0777;
dmode |= IFDIR;
/*
* Must simulate part of maknode here to acquire the inode, but
* not have it entered in the parent directory. The entry is made
* later after writing "." and ".." entries.
*/
dmode |= IFDIR;
/*
* Must simulate part of maknode here to acquire the inode, 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)) {
- free(cnp->cn_pnbuf, M_NAMEI);
+ if (error = VOP_VALLOC(ap->a_dvp, dmode, ap->a_cnp->cn_cred, &tvp)) {
+ free(ap->a_cnp->cn_pnbuf, M_NAMEI);
ufs_iput(dp);
return (error);
}
ip = VTOI(tvp);
ufs_iput(dp);
return (error);
}
ip = VTOI(tvp);
- ip->i_uid = cnp->cn_cred->cr_uid;
+ ip->i_uid = ap->a_cnp->cn_cred->cr_uid;
ip->i_gid = dp->i_gid;
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
ip->i_gid = dp->i_gid;
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
- (error = chkiq(ip, 1, cnp->cn_cred, 0))) {
- free(cnp->cn_pnbuf, M_NAMEI);
+ (error = chkiq(ip, 1, ap->a_cnp->cn_cred, 0))) {
+ free(ap->a_cnp->cn_pnbuf, M_NAMEI);
VOP_VFREE(tvp, ip->i_number, dmode);
ufs_iput(ip);
ufs_iput(dp);
VOP_VFREE(tvp, ip->i_number, dmode);
ufs_iput(ip);
ufs_iput(dp);
dirtemplate.dotdot_ino = dp->i_number;
error = vn_rdwr(UIO_WRITE, ITOV(ip), (caddr_t)&dirtemplate,
sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE,
dirtemplate.dotdot_ino = dp->i_number;
error = vn_rdwr(UIO_WRITE, ITOV(ip), (caddr_t)&dirtemplate,
sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE,
- IO_NODELOCKED|IO_SYNC, cnp->cn_cred, (int *)0, (struct proc *)0);
+ IO_NODELOCKED|IO_SYNC, ap->a_cnp->cn_cred, (int *)0, (struct proc *)0);
if (error) {
dp->i_nlink--;
dp->i_flag |= ICHG;
goto bad;
}
if (error) {
dp->i_nlink--;
dp->i_flag |= ICHG;
goto bad;
}
- if (DIRBLKSIZ > VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_bsize)
+ if (DIRBLKSIZ > VFSTOUFS(ap->a_dvp->v_mount)->um_mountp->mnt_stat.f_bsize)
panic("ufs_mkdir: blksize"); /* XXX should grow with balloc() */
else {
ip->i_size = DIRBLKSIZ;
panic("ufs_mkdir: blksize"); /* XXX should grow with balloc() */
else {
ip->i_size = DIRBLKSIZ;
}
/* Directory set up, now install it's entry in the parent directory. */
}
/* Directory set up, now install it's entry in the parent directory. */
- if (error = ufs_direnter(ip, dvp, cnp)) {
+ if (error = ufs_direnter(ip, ap->a_dvp, ap->a_cnp)) {
dp->i_nlink--;
dp->i_flag |= ICHG;
}
dp->i_nlink--;
dp->i_flag |= ICHG;
}
ip->i_flag |= ICHG;
ufs_iput(ip);
} else
ip->i_flag |= ICHG;
ufs_iput(ip);
} else
- *vpp = ITOV(ip);
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ *ap->a_vpp = ITOV(ip);
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
ufs_iput(dp);
return (error);
}
ufs_iput(dp);
return (error);
}
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
int
ufs_rmdir (ap)
struct vop_rmdir_args *ap;
int
ufs_rmdir (ap)
struct vop_rmdir_args *ap;
-#define dvp (ap->a_dvp)
-#define vp (ap->a_vp)
-#define cnp (ap->a_cnp)
{
USES_VOP_TRUNCATE;
register struct inode *ip, *dp;
int error;
{
USES_VOP_TRUNCATE;
register struct inode *ip, *dp;
int error;
- ip = VTOI(vp);
- dp = VTOI(dvp);
+ ip = VTOI(ap->a_vp);
+ dp = VTOI(ap->a_dvp);
/*
* No rmdir "." please.
*/
if (dp == ip) {
/*
* No rmdir "." please.
*/
if (dp == ip) {
ufs_iput(ip);
return (EINVAL);
}
ufs_iput(ip);
return (EINVAL);
}
*/
error = 0;
if (ip->i_nlink != 2 ||
*/
error = 0;
if (ip->i_nlink != 2 ||
- !ufs_dirempty(ip, dp->i_number, cnp->cn_cred)) {
+ !ufs_dirempty(ip, dp->i_number, ap->a_cnp->cn_cred)) {
error = ENOTEMPTY;
goto out;
}
error = ENOTEMPTY;
goto out;
}
* inode. If we crash in between, the directory
* will be reattached to lost+found,
*/
* inode. If we crash in between, the directory
* will be reattached to lost+found,
*/
- if (error = ufs_dirremove(dvp, cnp))
+ if (error = ufs_dirremove(ap->a_dvp, ap->a_cnp))
goto out;
dp->i_nlink--;
dp->i_flag |= ICHG;
goto out;
dp->i_nlink--;
dp->i_flag |= ICHG;
+ cache_purge(ap->a_dvp);
/*
* Truncate inode. The only stuff left
* in the directory is "." and "..". The
/*
* Truncate inode. The only stuff left
* in the directory is "." and "..". The
* worry about them later.
*/
ip->i_nlink -= 2;
* worry about them later.
*/
ip->i_nlink -= 2;
- error = VOP_TRUNCATE(vp, (off_t)0, IO_SYNC, cnp->cn_cred);
+ error = VOP_TRUNCATE(ap->a_vp, (off_t)0, IO_SYNC, ap->a_cnp->cn_cred);
cache_purge(ITOV(ip));
out:
cache_purge(ITOV(ip));
out:
ufs_iput(dp);
ufs_iput(ip);
return (error);
}
ufs_iput(dp);
ufs_iput(ip);
return (error);
}
-#undef dvp
-#undef vp
-#undef cnp
/*
* symlink -- make a symbolic link
/*
* symlink -- make a symbolic link
int
ufs_symlink (ap)
struct vop_symlink_args *ap;
int
ufs_symlink (ap)
struct vop_symlink_args *ap;
-#define dvp (ap->a_dvp)
-#define vpp (ap->a_vpp)
-#define cnp (ap->a_cnp)
-#define vap (ap->a_vap)
-#define target (ap->a_target)
- if (error = ufs_makeinode(IFLNK | vap->va_mode, dvp, vpp, cnp))
+ if (error = ufs_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp, ap->a_vpp, ap->a_cnp))
- error = vn_rdwr(UIO_WRITE, *vpp, target, strlen(target), (off_t)0,
- UIO_SYSSPACE, IO_NODELOCKED, cnp->cn_cred, (int *)0,
+ error = vn_rdwr(UIO_WRITE, *ap->a_vpp, ap->a_target, strlen(ap->a_target), (off_t)0,
+ UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred, (int *)0,
-#undef dvp
-#undef vpp
-#undef cnp
-#undef vap
-#undef target
/*
* Vnode op for reading directories.
/*
* Vnode op for reading directories.
int
ufs_readdir (ap)
struct vop_readdir_args *ap;
int
ufs_readdir (ap)
struct vop_readdir_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define cred (ap->a_cred)
-#define eofflagp (ap->a_eofflagp)
{
USES_VOP_READ;
int count, lost, error;
{
USES_VOP_READ;
int count, lost, error;
- count = uio->uio_resid;
+ count = ap->a_uio->uio_resid;
count &= ~(DIRBLKSIZ - 1);
count &= ~(DIRBLKSIZ - 1);
- lost = uio->uio_resid - count;
- if (count < DIRBLKSIZ || (uio->uio_offset & (DIRBLKSIZ -1)))
+ lost = ap->a_uio->uio_resid - count;
+ if (count < DIRBLKSIZ || (ap->a_uio->uio_offset & (DIRBLKSIZ -1)))
- uio->uio_resid = count;
- uio->uio_iov->iov_len = count;
- error = VOP_READ(vp, uio, 0, cred);
- uio->uio_resid += lost;
- if ((VTOI(vp)->i_size - uio->uio_offset) <= 0)
- *eofflagp = 1;
+ ap->a_uio->uio_resid = count;
+ ap->a_uio->uio_iov->iov_len = count;
+ error = VOP_READ(ap->a_vp, ap->a_uio, 0, ap->a_cred);
+ ap->a_uio->uio_resid += lost;
+ if ((VTOI(ap->a_vp)->i_size - ap->a_uio->uio_offset) <= 0)
+ *ap->a_eofflagp = 1;
-#undef vp
-#undef uio
-#undef cred
-#undef eofflagp
/*
* Return target name of a symbolic link
/*
* Return target name of a symbolic link
int
ufs_readlink (ap)
struct vop_readlink_args *ap;
int
ufs_readlink (ap)
struct vop_readlink_args *ap;
-#define vp (ap->a_vp)
-#define uiop (ap->a_uio)
-#define cred (ap->a_cred)
- return (VOP_READ(vp, uiop, 0, cred));
+ return (VOP_READ(ap->a_vp, ap->a_uio, 0, ap->a_cred));
-#undef vp
-#undef uiop
-#undef cred
/*
* Ufs abort op, called after namei() when a CREATE/DELETE isn't actually
/*
* Ufs abort op, called after namei() when a CREATE/DELETE isn't actually
int
ufs_abortop (ap)
struct vop_abortop_args *ap;
int
ufs_abortop (ap)
struct vop_abortop_args *ap;
-#define dvp (ap->a_dvp)
-#define cnp (ap->a_cnp)
- if ((cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
+ FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
int
ufs_lock (ap)
struct vop_lock_args *ap;
int
ufs_lock (ap)
struct vop_lock_args *ap;
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
int
ufs_unlock (ap)
struct vop_unlock_args *ap;
int
ufs_unlock (ap)
struct vop_unlock_args *ap;
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
if (!(ip->i_flag & ILOCKED))
panic("ufs_unlock NOT LOCKED");
IUNLOCK(ip);
return (0);
}
if (!(ip->i_flag & ILOCKED))
panic("ufs_unlock NOT LOCKED");
IUNLOCK(ip);
return (0);
}
/*
* Check for a locked inode.
/*
* Check for a locked inode.
int
ufs_islocked (ap)
struct vop_islocked_args *ap;
int
ufs_islocked (ap)
struct vop_islocked_args *ap;
- if (VTOI(vp)->i_flag & ILOCKED)
+ if (VTOI(ap->a_vp)->i_flag & ILOCKED)
return (1);
return (0);
}
return (1);
return (0);
}
/*
* Calculate the logical to physical mapping if not done already,
/*
* Calculate the logical to physical mapping if not done already,
int
ufs_strategy (ap)
struct vop_strategy_args *ap;
int
ufs_strategy (ap)
struct vop_strategy_args *ap;
{
USES_VOP_BMAP;
register struct inode *ip;
struct vnode *vp;
int error;
{
USES_VOP_BMAP;
register struct inode *ip;
struct vnode *vp;
int error;
- ip = VTOI(bp->b_vp);
- if (bp->b_vp->v_type == VBLK || bp->b_vp->v_type == VCHR)
+ ip = VTOI(ap->a_bp->b_vp);
+ if (ap->a_bp->b_vp->v_type == VBLK || ap->a_bp->b_vp->v_type == VCHR)
panic("ufs_strategy: spec");
panic("ufs_strategy: spec");
- if (bp->b_blkno == bp->b_lblkno) {
+ if (ap->a_bp->b_blkno == ap->a_bp->b_lblkno) {
- VOP_BMAP(bp->b_vp, bp->b_lblkno, NULL, &bp->b_blkno)) {
- bp->b_error = error;
- bp->b_flags |= B_ERROR;
- biodone(bp);
+ VOP_BMAP(ap->a_bp->b_vp, ap->a_bp->b_lblkno, NULL, &ap->a_bp->b_blkno)) {
+ ap->a_bp->b_error = error;
+ ap->a_bp->b_flags |= B_ERROR;
+ biodone(ap->a_bp);
- if ((long)bp->b_blkno == -1)
- clrbuf(bp);
+ if ((long)ap->a_bp->b_blkno == -1)
+ clrbuf(ap->a_bp);
- if ((long)bp->b_blkno == -1) {
- biodone(bp);
+ if ((long)ap->a_bp->b_blkno == -1) {
+ biodone(ap->a_bp);
return (0);
}
vp = ip->i_devvp;
return (0);
}
vp = ip->i_devvp;
- bp->b_dev = vp->v_rdev;
+ ap->a_bp->b_dev = vp->v_rdev;
VOCALL (vp->v_op, VOFFSET(vop_strategy), ap);
return (0);
}
VOCALL (vp->v_op, VOFFSET(vop_strategy), ap);
return (0);
}
/*
* Print out the contents of an inode.
/*
* Print out the contents of an inode.
int
ufs_print (ap)
struct vop_print_args *ap;
int
ufs_print (ap)
struct vop_print_args *ap;
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
printf("tag VT_UFS, ino %d, on dev %d, %d", ip->i_number,
major(ip->i_dev), minor(ip->i_dev));
#ifdef FIFO
printf("tag VT_UFS, ino %d, on dev %d, %d", ip->i_number,
major(ip->i_dev), minor(ip->i_dev));
#ifdef FIFO
- if (vp->v_type == VFIFO)
- fifo_printinfo(vp);
+ if (ap->a_vp->v_type == VFIFO)
+ fifo_printinfo(ap->a_vp);
#endif /* FIFO */
printf("%s\n", (ip->i_flag & ILOCKED) ? " (LOCKED)" : "");
if (ip->i_lockholder == 0)
#endif /* FIFO */
printf("%s\n", (ip->i_flag & ILOCKED) ? " (LOCKED)" : "");
if (ip->i_lockholder == 0)
printf("\n");
return (0);
}
printf("\n");
return (0);
}
/*
* Read wrapper for special devices.
/*
* Read wrapper for special devices.
int
ufsspec_read (ap)
struct vop_read_args *ap;
int
ufsspec_read (ap)
struct vop_read_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
extern int (**spec_vnodeop_p)();
/*
* Set access flag.
*/
{
extern int (**spec_vnodeop_p)();
/*
* Set access flag.
*/
- VTOI(vp)->i_flag |= IACC;
+ VTOI(ap->a_vp)->i_flag |= IACC;
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_read), ap));
}
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_read), ap));
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Write wrapper for special devices.
/*
* Write wrapper for special devices.
int
ufsspec_write (ap)
struct vop_write_args *ap;
int
ufsspec_write (ap)
struct vop_write_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
extern int (**spec_vnodeop_p)();
/*
* Set update and change flags.
*/
{
extern int (**spec_vnodeop_p)();
/*
* Set update and change flags.
*/
- VTOI(vp)->i_flag |= IUPD|ICHG;
+ VTOI(ap->a_vp)->i_flag |= IUPD|ICHG;
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_write), ap));
}
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_write), ap));
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Close wrapper for special devices.
/*
* Close wrapper for special devices.
int
ufsspec_close (ap)
struct vop_close_args *ap;
int
ufsspec_close (ap)
struct vop_close_args *ap;
-#define vp (ap->a_vp)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
extern int (**spec_vnodeop_p)();
{
extern int (**spec_vnodeop_p)();
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
- if (vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
+ if (ap->a_vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
ITIMES(ip, &time, &time);
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_close), ap));
}
ITIMES(ip, &time, &time);
return (VOCALL (spec_vnodeop_p, VOFFSET(vop_close), ap));
}
-#undef vp
-#undef fflag
-#undef cred
-#undef p
int
ufsfifo_read (ap)
struct vop_read_args *ap;
int
ufsfifo_read (ap)
struct vop_read_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
extern int (**fifo_vnodeop_p)();
/*
* Set access flag.
*/
{
extern int (**fifo_vnodeop_p)();
/*
* Set access flag.
*/
- VTOI(vp)->i_flag |= IACC;
+ VTOI(ap->a_vp)->i_flag |= IACC;
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_read), ap));
}
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_read), ap));
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Write wrapper for fifo's.
/*
* Write wrapper for fifo's.
int
ufsfifo_write (ap)
struct vop_write_args *ap;
int
ufsfifo_write (ap)
struct vop_write_args *ap;
-#define vp (ap->a_vp)
-#define uio (ap->a_uio)
-#define ioflag (ap->a_ioflag)
-#define cred (ap->a_cred)
{
extern int (**fifo_vnodeop_p)();
/*
* Set update and change flags.
*/
{
extern int (**fifo_vnodeop_p)();
/*
* Set update and change flags.
*/
- VTOI(vp)->i_flag |= IUPD|ICHG;
+ VTOI(ap->a_vp)->i_flag |= IUPD|ICHG;
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_write), ap));
}
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_write), ap));
}
-#undef vp
-#undef uio
-#undef ioflag
-#undef cred
/*
* Close wrapper for fifo's.
/*
* Close wrapper for fifo's.
*/
ufsfifo_close (ap)
struct vop_close_args *ap;
*/
ufsfifo_close (ap)
struct vop_close_args *ap;
-#define vp (ap->a_vp)
-#define fflag (ap->a_fflag)
-#define cred (ap->a_cred)
-#define p (ap->a_p)
{
extern int (**fifo_vnodeop_p)();
{
extern int (**fifo_vnodeop_p)();
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
- if (vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
+ if (ap->a_vp->v_usecount > 1 && !(ip->i_flag & ILOCKED))
ITIMES(ip, &time, &time);
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_close), ap));
}
ITIMES(ip, &time, &time);
return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_close), ap));
}
-#undef vp
-#undef fflag
-#undef cred
-#undef p
int
ufs_advlock (ap)
struct vop_advlock_args *ap;
int
ufs_advlock (ap)
struct vop_advlock_args *ap;
-#define vp (ap->a_vp)
-#define id (ap->a_id)
-#define op (ap->a_op)
-#define fl (ap->a_fl)
-#define flags (ap->a_flags)
- register struct inode *ip = VTOI(vp);
+ register struct inode *ip = VTOI(ap->a_vp);
register struct lockf *lock;
off_t start, end;
int error;
register struct lockf *lock;
off_t start, end;
int error;
* Avoid the common case of unlocking when inode has no locks.
*/
if (ip->i_lockf == (struct lockf *)0) {
* Avoid the common case of unlocking when inode has no locks.
*/
if (ip->i_lockf == (struct lockf *)0) {
- if (op != F_SETLK) {
- fl->l_type = F_UNLCK;
+ if (ap->a_op != F_SETLK) {
+ ap->a_fl->l_type = F_UNLCK;
return (0);
}
}
/*
* Convert the flock structure into a start and end.
*/
return (0);
}
}
/*
* Convert the flock structure into a start and end.
*/
- switch (fl->l_whence) {
+ switch (ap->a_fl->l_whence) {
case SEEK_SET:
case SEEK_CUR:
case SEEK_SET:
case SEEK_CUR:
* Caller is responsible for adding any necessary offset
* when SEEK_CUR is used.
*/
* Caller is responsible for adding any necessary offset
* when SEEK_CUR is used.
*/
+ start = ap->a_fl->l_start;
- start = ip->i_size + fl->l_start;
+ start = ip->i_size + ap->a_fl->l_start;
}
if (start < 0)
return (EINVAL);
}
if (start < 0)
return (EINVAL);
+ if (ap->a_fl->l_len == 0)
- end = start + fl->l_len - 1;
+ end = start + ap->a_fl->l_len - 1;
/*
* Create the lockf structure
*/
MALLOC(lock, struct lockf *, sizeof *lock, M_LOCKF, M_WAITOK);
lock->lf_start = start;
lock->lf_end = end;
/*
* Create the lockf structure
*/
MALLOC(lock, struct lockf *, sizeof *lock, M_LOCKF, M_WAITOK);
lock->lf_start = start;
lock->lf_end = end;
+ lock->lf_id = ap->a_id;
- lock->lf_type = fl->l_type;
+ lock->lf_type = ap->a_fl->l_type;
lock->lf_next = (struct lockf *)0;
lock->lf_block = (struct lockf *)0;
lock->lf_next = (struct lockf *)0;
lock->lf_block = (struct lockf *)0;
- lock->lf_flags = flags;
+ lock->lf_flags = ap->a_flags;
/*
* Do the requested operation.
*/
/*
* Do the requested operation.
*/
case F_SETLK:
return (lf_setlock(lock));
case F_SETLK:
return (lf_setlock(lock));
return (error);
case F_GETLK:
return (error);
case F_GETLK:
- error = lf_getlock(lock, fl);
+ error = lf_getlock(lock, ap->a_fl);
FREE(lock, M_LOCKF);
return (error);
FREE(lock, M_LOCKF);
return (error);
-#undef vp
-#undef id
-#undef op
-#undef fl
-#undef flags
/*
* Initialize the vnode associated with a new inode, handle aliased
/*
* Initialize the vnode associated with a new inode, handle aliased