From 51b234aac4b3959d6b3890d80927248c1d750e0b Mon Sep 17 00:00:00 2001 From: mpp Date: Wed, 12 Feb 1997 16:19:11 +0000 Subject: [PATCH] Make this compile again after the Lite2 merge. Call vget/VOP_UNLOCK with the correct number of arguments. Call vn_lock where appropriate. vfs_goneall is now replaced by VOP_REVOKE. Submitted by: bde --- sys/miscfs/devfs/devfs_tree.c | 8 +++++--- sys/miscfs/devfs/devfs_vfsops.c | 10 +++++----- sys/miscfs/devfs/devfs_vnops.c | 31 ++++++++++++++++--------------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/sys/miscfs/devfs/devfs_tree.c b/sys/miscfs/devfs/devfs_tree.c index 56b338e68d30..f9386f8e89c9 100644 --- a/sys/miscfs/devfs/devfs_tree.c +++ b/sys/miscfs/devfs/devfs_tree.c @@ -2,7 +2,7 @@ /* * Written by Julian Elischer (julian@DIALix.oz.au) * - * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.32 1996/10/28 11:36:02 phk Exp $ + * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.33 1996/11/21 07:18:57 julian Exp $ */ #include "opt_devfs.h" @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include /* defines dirent structure */ @@ -892,6 +893,7 @@ devfs_dntovn(dn_p dnp, struct vnode **vn_pp) { struct vnode *vn_p, *nvp; int error = 0; + struct proc *p = curproc; /* XXX */ vn_p = dnp->vn; DBPRINT(("dntovn ")); @@ -925,7 +927,7 @@ DBPRINT(("dntovn ")); } if(vn_p->v_type != VNON) { - vget(vn_p,1); /*XXX*/ + vget(vn_p, LK_EXCLUSIVE, p); *vn_pp = vn_p; return(0); } @@ -990,7 +992,7 @@ DBPRINT(("(New vnode)")); { error = EINVAL; } - VOP_LOCK(vn_p); + vn_lock(vn_p, LK_EXCLUSIVE | LK_RETRY, p); } return error; } diff --git a/sys/miscfs/devfs/devfs_vfsops.c b/sys/miscfs/devfs/devfs_vfsops.c index 39ba47317e75..a05a5fe42390 100644 --- a/sys/miscfs/devfs/devfs_vfsops.c +++ b/sys/miscfs/devfs/devfs_vfsops.c @@ -1,7 +1,7 @@ /* * Written by Julian Elischer (julian@DIALix.oz.au) * - * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vfsops.c,v 1.14 1996/09/10 08:27:35 bde Exp $ + * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vfsops.c,v 1.15 1996/11/21 07:18:58 julian Exp $ * * */ @@ -25,13 +25,13 @@ static int devfs_statfs( struct mount *mp, struct statfs *sbp, struct proc *p); static int mountdevfs( struct mount *mp, struct proc *p); static int -devfs_init(void) +devfs_init(struct vfsconf *vfsp) { /* * fill in the missing members on the "hidden" mount */ - dev_root->dnp->dvm->mount->mnt_op = vfssw[MOUNT_DEVFS]; - dev_root->dnp->dvm->mount->mnt_vfc = vfsconf[MOUNT_DEVFS]; + dev_root->dnp->dvm->mount->mnt_op = vfsp->vfc_vfsops; + dev_root->dnp->dvm->mount->mnt_vfc = vfsp; /* Mark a reference for the "invisible" blueprint mount */ dev_root->dnp->dvm->mount->mnt_vfc->vfc_refcount++; @@ -248,7 +248,7 @@ loop: if ( vp->v_dirtyblkhd.lh_first == NULL) continue; if (vp->v_type == VBLK) { - if (vget(vp, 1)) + if (vget(vp, LK_EXCLUSIVE, p)) goto loop; error = VOP_FSYNC(vp, cred, waitfor, p); printf("syncing device\n"); diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c index dae07c5f0ccd..1fcd61dc10ab 100644 --- a/sys/miscfs/devfs/devfs_vnops.c +++ b/sys/miscfs/devfs/devfs_vnops.c @@ -1,7 +1,7 @@ /* * Written by Julian Elischer (julian@DIALix.oz.au) * - * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.32 1996/10/28 11:36:06 phk Exp $ + * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.33 1996/11/21 07:18:59 julian Exp $ * * symlinks can wait 'til later. */ @@ -144,14 +144,14 @@ DBPRINT(("cached ")); VREF(*result_vnode); /* not a full vget() */ error = 0; } else if (flags & ISDOTDOT) {/* do a locking dance */ - VOP_UNLOCK(dir_vnode); + VOP_UNLOCK(dir_vnode, 0, p); error = vget(*result_vnode,1); if (!error && lockparent && (flags & ISLASTCN)) - VOP_LOCK(dir_vnode); + vn_lock(dir_vnode, LK_EXCLUSIVE | LK_RETRY, p); } else { error = vget(*result_vnode,1); if (!lockparent || error || !(flags & ISLASTCN)) - VOP_UNLOCK(dir_vnode); + VOP_UNLOCK(dir_vnode, 0, p); } /* * Check that the capability number did not change @@ -164,11 +164,11 @@ DBPRINT(("cached ")); if (lockparent && (dir_vnode != *result_vnode) && (flags & ISLASTCN)) - VOP_UNLOCK(dir_vnode); + VOP_UNLOCK(dir_vnode, 0, p); } else { /* we have an error */ } - if( error = VOP_LOCK(dir_vnode)) + if (error = vn_lock(dir_vnode, LK_EXCLUSIVE | LK_RETRY, p)) return error; *result_vnode = NULL; /* safe not sorry */ DBPRINT(("errr, maybe not cached ")); @@ -229,7 +229,7 @@ DBPRINT(("MKACCESS ")); */ cnp->cn_flags |= SAVENAME; /*XXX why? */ if (!lockparent) - VOP_UNLOCK(dir_vnode); + VOP_UNLOCK(dir_vnode, 0, p); return (EJUSTRETURN); } @@ -272,12 +272,12 @@ DBPRINT(("MKACCESS ")); cnp->cn_cred->cr_uid != 0 && cnp->cn_cred->cr_uid != dir_node->uid && cnp->cn_cred->cr_uid != new_node->uid) { - VOP_UNLOCK((*result_vnode)); + VOP_UNLOCK(*result_vnode, 0, p); return (EPERM); } #endif if (!lockparent) - VOP_UNLOCK(dir_vnode); + VOP_UNLOCK(dir_vnode, 0, p); return (0); } @@ -304,7 +304,7 @@ DBPRINT(("MKACCESS ")); /* hmm save the 'from' name (we need to delete it) */ cnp->cn_flags |= SAVENAME; if (!lockparent) - VOP_UNLOCK(dir_vnode); + VOP_UNLOCK(dir_vnode, 0, p); return (0); } @@ -329,17 +329,17 @@ DBPRINT(("MKACCESS ")); * that point backwards in the directory structure. */ if (flags & ISDOTDOT) { - VOP_UNLOCK(dir_vnode); /* race to get the node */ + VOP_UNLOCK(dir_vnode, 0, p); /* race to get the node */ devfs_dntovn(new_node,result_vnode); if (lockparent && (flags & ISLASTCN)) - VOP_LOCK(dir_vnode); + vn_lock(dir_vnode, LK_EXCLUSIVE | LK_RETRY, p); } else if (dir_node == new_node) { VREF(dir_vnode); /* we want ourself, ie "." */ *result_vnode = dir_vnode; } else { devfs_dntovn(new_node,result_vnode); if (!lockparent || (flags & ISLASTCN)) - VOP_UNLOCK(dir_vnode); + VOP_UNLOCK(dir_vnode, 0, p); } /* @@ -1097,6 +1097,7 @@ devfs_rename(struct vop_rename_args *ap) struct vnode *fdvp = ap->a_fdvp; struct componentname *tcnp = ap->a_tcnp; struct componentname *fcnp = ap->a_fcnp; + struct proc *p = fcnp->cn_proc; dn_p fp, fdp, tp, tdp; devnm_p fnp,tnp; int doingdirectory = 0; @@ -1287,7 +1288,7 @@ bad: vput(tvp); vput(tdvp); out: - if (VOP_LOCK(fvp) == 0) { + if (vn_lock(fvp, LK_EXCLUSIVE | LK_RETRY, p) == 0) { fp->links--; /* we added one earlier*/ vput(fvp); } else @@ -1720,7 +1721,7 @@ devfs_dropvnode(dn_p dnp) */ if((vn_p) && ( dnp->vn_id == vn_p->v_id) && (dnp == (dn_p)vn_p->v_data)) { - vgoneall(vn_p); + VOP_REVOKE(vn_p, REVOKEALL); } dnp->vn = NULL; /* be pedantic about this */ }