diff options
author | jeff <jeff@FreeBSD.org> | 2005-03-29 13:09:42 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2005-03-29 13:09:42 +0000 |
commit | ca1e4c2fe08ddca6d8bb843c635cb05b2ccf61ae (patch) | |
tree | 92eb84a2d2d9af54ef213ce03aa350828627dfe2 | |
parent | 7d8081dca491f34620fcb86e26b6a1e24275de75 (diff) | |
download | FreeBSD-src-ca1e4c2fe08ddca6d8bb843c635cb05b2ccf61ae.zip FreeBSD-src-ca1e4c2fe08ddca6d8bb843c635cb05b2ccf61ae.tar.gz |
- Remove wantparent, it is no longer necessary. An assert in vfs_lookup.c
prevents any callers from doing a modifying op without
LOCKPARENT or WANTPARENT.
-rw-r--r-- | sys/fs/nwfs/nwfs_vnops.c | 7 | ||||
-rw-r--r-- | sys/fs/smbfs/smbfs_vnops.c | 7 | ||||
-rw-r--r-- | sys/gnu/ext2fs/ext2_lookup.c | 9 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_lookup.c | 9 | ||||
-rw-r--r-- | sys/nfs4client/nfs4_vnops.c | 5 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 5 |
6 files changed, 12 insertions, 30 deletions
diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c index be452da..e5780d2 100644 --- a/sys/fs/nwfs/nwfs_vnops.c +++ b/sys/fs/nwfs/nwfs_vnops.c @@ -836,7 +836,7 @@ nwfs_lookup(ap) struct nw_entry_info fattr, *fap; ncpfid fid; int nameiop=cnp->cn_nameiop, islastcn; - int wantparent, error = 0, notfound; + int error = 0, notfound; struct thread *td = cnp->cn_thread; char _name[cnp->cn_namelen+1]; bcopy(cnp->cn_nameptr, _name, cnp->cn_namelen); @@ -857,7 +857,6 @@ nwfs_lookup(ap) return (EROFS); if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td))) return (error); - wantparent = flags & (LOCKPARENT|WANTPARENT); nmp = VFSTONWFS(mp); dnp = VTONW(dvp); /* @@ -943,7 +942,7 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_vflag & VV_ROOT, (int)flags & ISDO return (notfound); /* hard error */ if (notfound) { /* entry not found */ /* Handle RENAME or CREATE case... */ - if ((nameiop == CREATE || nameiop == RENAME) && wantparent && islastcn) { + if ((nameiop == CREATE || nameiop == RENAME) && islastcn) { cnp->cn_flags |= SAVENAME; return (EJUSTRETURN); } @@ -966,7 +965,7 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_vflag & VV_ROOT, (int)flags & ISDO cnp->cn_flags |= SAVENAME; /* I free it later */ return (0); } - if (nameiop == RENAME && islastcn && wantparent) { + if (nameiop == RENAME && islastcn) { error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_thread); if (error) return (error); if (NWCMPF(&dnp->n_fid, &fid)) return EISDIR; diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index 3bdcfdb..b7f08fe 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -1076,7 +1076,7 @@ smbfs_lookup(ap) int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; int nmlen = cnp->cn_namelen; - int wantparent, error, islastcn, isdot; + int error, islastcn, isdot; int killit; SMBVDEBUG("\n"); @@ -1103,7 +1103,6 @@ smbfs_lookup(ap) return EROFS; if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) return error; - wantparent = flags & (LOCKPARENT|WANTPARENT); smp = VFSTOSMBFS(mp); dnp = VTOSMB(dvp); isdot = (nmlen == 1 && name[0] == '.'); @@ -1183,7 +1182,7 @@ smbfs_lookup(ap) /* * Handle RENAME or CREATE case... */ - if ((nameiop == CREATE || nameiop == RENAME) && wantparent && islastcn) { + if ((nameiop == CREATE || nameiop == RENAME) && islastcn) { error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, td); if (error) return error; @@ -1213,7 +1212,7 @@ smbfs_lookup(ap) cnp->cn_flags |= SAVENAME; return 0; } - if (nameiop == RENAME && islastcn && wantparent) { + if (nameiop == RENAME && islastcn) { error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, td); if (error) return error; diff --git a/sys/gnu/ext2fs/ext2_lookup.c b/sys/gnu/ext2fs/ext2_lookup.c index ec39d02..2b3481a 100644 --- a/sys/gnu/ext2fs/ext2_lookup.c +++ b/sys/gnu/ext2fs/ext2_lookup.c @@ -312,7 +312,6 @@ ext2_lookup(ap) struct vnode *tdp; /* returned by VFS_VGET */ doff_t enduseful; /* pointer past last used dir slot */ u_long bmask; /* block offset mask */ - int wantparent; /* 1 => wantparent flag */ int namlen, error; struct vnode **vpp = ap->a_vpp; struct componentname *cnp = ap->a_cnp; @@ -328,8 +327,6 @@ ext2_lookup(ap) *vpp = NULL; vdp = ap->a_dvp; dp = VTOI(vdp); - wantparent = flags & (LOCKPARENT|WANTPARENT); - /* * We now have a segment name to search for, and a directory to search. */ @@ -572,9 +569,6 @@ found: /* * If deleting, and at end of pathname, return * parameters which can be used to remove file. - * If the wantparent flag isn't set, we return only - * the directory (in ndp->ni_dvp), otherwise we go - * on and lock the inode, being careful with ".". */ if (nameiop == DELETE && (flags & ISLASTCN)) { /* @@ -623,8 +617,7 @@ found: * Must get inode of directory entry to verify it's a * regular file, or empty directory. */ - if (nameiop == RENAME && wantparent && - (flags & ISLASTCN)) { + if (nameiop == RENAME && (flags & ISLASTCN)) { if ((error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread)) != 0) return (error); /* diff --git a/sys/gnu/fs/ext2fs/ext2_lookup.c b/sys/gnu/fs/ext2fs/ext2_lookup.c index ec39d02..2b3481a 100644 --- a/sys/gnu/fs/ext2fs/ext2_lookup.c +++ b/sys/gnu/fs/ext2fs/ext2_lookup.c @@ -312,7 +312,6 @@ ext2_lookup(ap) struct vnode *tdp; /* returned by VFS_VGET */ doff_t enduseful; /* pointer past last used dir slot */ u_long bmask; /* block offset mask */ - int wantparent; /* 1 => wantparent flag */ int namlen, error; struct vnode **vpp = ap->a_vpp; struct componentname *cnp = ap->a_cnp; @@ -328,8 +327,6 @@ ext2_lookup(ap) *vpp = NULL; vdp = ap->a_dvp; dp = VTOI(vdp); - wantparent = flags & (LOCKPARENT|WANTPARENT); - /* * We now have a segment name to search for, and a directory to search. */ @@ -572,9 +569,6 @@ found: /* * If deleting, and at end of pathname, return * parameters which can be used to remove file. - * If the wantparent flag isn't set, we return only - * the directory (in ndp->ni_dvp), otherwise we go - * on and lock the inode, being careful with ".". */ if (nameiop == DELETE && (flags & ISLASTCN)) { /* @@ -623,8 +617,7 @@ found: * Must get inode of directory entry to verify it's a * regular file, or empty directory. */ - if (nameiop == RENAME && wantparent && - (flags & ISLASTCN)) { + if (nameiop == RENAME && (flags & ISLASTCN)) { if ((error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread)) != 0) return (error); /* diff --git a/sys/nfs4client/nfs4_vnops.c b/sys/nfs4client/nfs4_vnops.c index 8877a95..50947e0 100644 --- a/sys/nfs4client/nfs4_vnops.c +++ b/sys/nfs4client/nfs4_vnops.c @@ -937,7 +937,7 @@ nfs4_lookup(struct vop_lookup_args *ap) long len; nfsfh_t *fhp; struct nfsnode *np; - int wantparent, error = 0, fhsize; + int error = 0, fhsize; struct thread *td = cnp->cn_thread; struct nfs4_compound cp; struct nfs4_oparg_getattr ga, dga; @@ -950,7 +950,6 @@ nfs4_lookup(struct vop_lookup_args *ap) return (EROFS); if (dvp->v_type != VDIR) return (ENOTDIR); - wantparent = flags & (LOCKPARENT|WANTPARENT); nmp = VFSTONFS(dvp->v_mount); np = VTONFS(dvp); @@ -1030,7 +1029,7 @@ nfs4_lookup(struct vop_lookup_args *ap) /* * Handle RENAME case... */ - if (cnp->cn_nameiop == RENAME && wantparent && (flags & ISLASTCN)) { + if (cnp->cn_nameiop == RENAME && (flags & ISLASTCN)) { if (NFS_CMPFH(np, fhp, fhsize)) return (EISDIR); diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index b07a358..0b5109a 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -776,7 +776,7 @@ nfs_lookup(struct vop_lookup_args *ap) long len; nfsfh_t *fhp; struct nfsnode *np; - int wantparent, error = 0, attrflag, fhsize; + int error = 0, attrflag, fhsize; int v3 = NFS_ISV3(dvp); struct thread *td = cnp->cn_thread; @@ -786,7 +786,6 @@ nfs_lookup(struct vop_lookup_args *ap) return (EROFS); if (dvp->v_type != VDIR) return (ENOTDIR); - wantparent = flags & (LOCKPARENT|WANTPARENT); nmp = VFSTONFS(dvp->v_mount); np = VTONFS(dvp); if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) { @@ -836,7 +835,7 @@ nfs_lookup(struct vop_lookup_args *ap) /* * Handle RENAME case... */ - if (cnp->cn_nameiop == RENAME && wantparent && (flags & ISLASTCN)) { + if (cnp->cn_nameiop == RENAME && (flags & ISLASTCN)) { if (NFS_CMPFH(np, fhp, fhsize)) { m_freem(mrep); return (EISDIR); |