Module Name: src Committed By: dholland Date: Sun Jan 2 05:01:21 UTC 2011
Modified Files: src/sys/kern: vfs_lookup.c vfs_syscalls.c src/sys/nfs: nfs_serv.c src/sys/sys: namei.src Log Message: Remove unused nameidata field ni_startdir. To generate a diff of this commit: cvs rdiff -u -r1.127 -r1.128 src/sys/kern/vfs_lookup.c cvs rdiff -u -r1.410 -r1.411 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.152 -r1.153 src/sys/nfs/nfs_serv.c cvs rdiff -u -r1.17 -r1.18 src/sys/sys/namei.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.127 src/sys/kern/vfs_lookup.c:1.128 --- src/sys/kern/vfs_lookup.c:1.127 Mon Dec 20 00:12:46 2010 +++ src/sys/kern/vfs_lookup.c Sun Jan 2 05:01:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.127 2010/12/20 00:12:46 yamt Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.128 2011/01/02 05:01:20 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.127 2010/12/20 00:12:46 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.128 2011/01/02 05:01:20 dholland Exp $"); #include "opt_magiclinks.h" @@ -388,7 +388,7 @@ }; /* XXX reorder things to make this decl unnecessary */ -static int do_lookup(struct namei_state *state); +static int do_lookup(struct namei_state *state, struct vnode *startdir); /* @@ -708,8 +708,7 @@ return (ENOENT); } cnp->cn_nameptr = ndp->ni_pnbuf; - ndp->ni_startdir = state->namei_startdir; - error = do_lookup(state); + error = do_lookup(state, state->namei_startdir); if (error != 0) { /* XXX this should use namei_end() */ if (ndp->ni_dvp) { @@ -810,10 +809,10 @@ * This is a very central and rather complicated routine. * * The pathname is pointed to by ni_ptr and is of length ni_pathlen. - * The starting directory is taken from ni_startdir. The pathname is - * descended until done, or a symbolic link is encountered. The variable - * ni_more is clear if the path is completed; it is set to one if a - * symbolic link needing interpretation is encountered. + * The starting directory is passed in. The pathname is descended + * until done, or a symbolic link is encountered. The variable ni_more + * is clear if the path is completed; it is set to one if a symbolic + * link needing interpretation is encountered. * * The flag argument is LOOKUP, CREATE, RENAME, or DELETE depending on * whether the name is to be looked up, created, renamed, or deleted. @@ -846,7 +845,7 @@ * Begin lookup(). */ static int -lookup_start(struct namei_state *state) +lookup_start(struct namei_state *state, struct vnode *startdir) { const char *cp; /* pointer into pathname argument */ @@ -867,8 +866,7 @@ state->rdonly = cnp->cn_flags & RDONLY; ndp->ni_dvp = NULL; cnp->cn_flags &= ~ISSYMLINK; - state->dp = ndp->ni_startdir; - ndp->ni_startdir = NULLVP; + state->dp = startdir; /* * If we have a leading string of slashes, remove them, and just make @@ -1106,10 +1104,6 @@ * doesn't currently exist, leaving a pointer to the * (possibly locked) directory vnode in ndp->ni_dvp. */ - if (cnp->cn_flags & SAVESTART) { - ndp->ni_startdir = ndp->ni_dvp; - vref(ndp->ni_startdir); - } state->lookup_alldone = 1; return (0); } @@ -1167,7 +1161,7 @@ } static int -do_lookup(struct namei_state *state) +do_lookup(struct namei_state *state, struct vnode *startdir) { int error = 0; @@ -1176,7 +1170,7 @@ KASSERT(cnp == &ndp->ni_cnd); - error = lookup_start(state); + error = lookup_start(state, startdir); if (error) { goto bad; } @@ -1293,12 +1287,6 @@ } goto bad; } - if (ndp->ni_dvp != NULL) { - if (cnp->cn_flags & SAVESTART) { - ndp->ni_startdir = ndp->ni_dvp; - vref(ndp->ni_startdir); - } - } if ((cnp->cn_flags & LOCKLEAF) == 0) { VOP_UNLOCK(state->dp); } @@ -1342,13 +1330,12 @@ for (;;) { state.cnp->cn_nameptr = state.ndp->ni_pnbuf; - state.ndp->ni_startdir = dp; /* * END wodge of code from nfsd */ - error = do_lookup(&state); + error = do_lookup(&state, dp); if (error) { /* BEGIN from nfsd */ if (ndp->ni_dvp) { @@ -1452,16 +1439,18 @@ } int -lookup_for_nfsd_index(struct nameidata *ndp) +lookup_for_nfsd_index(struct nameidata *ndp, struct vnode *startdir) { struct namei_state state; int error; + vref(startdir); + ndp->ni_pnbuf = ndp->ni_pathbuf->pb_path; ndp->ni_cnd.cn_nameptr = ndp->ni_pnbuf; namei_init(&state, ndp); - error = do_lookup(&state); + error = do_lookup(&state, startdir); namei_cleanup(&state); return error; Index: src/sys/kern/vfs_syscalls.c diff -u src/sys/kern/vfs_syscalls.c:1.410 src/sys/kern/vfs_syscalls.c:1.411 --- src/sys/kern/vfs_syscalls.c:1.410 Tue Nov 30 10:30:02 2010 +++ src/sys/kern/vfs_syscalls.c Sun Jan 2 05:01:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.410 2010/11/30 10:30:02 dholland Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.411 2011/01/02 05:01:20 dholland Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.410 2010/11/30 10:30:02 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.411 2011/01/02 05:01:20 dholland Exp $"); #ifdef _KERNEL_OPT #include "opt_fileassoc.h" @@ -3598,10 +3598,7 @@ vrele(fromnd.ni_dvp); vrele(fvp); } - vrele(tond.ni_startdir); out1: - if (fromnd.ni_startdir) - vrele(fromnd.ni_startdir); pathbuf_destroy(frompb); pathbuf_destroy(topb); return (error == -1 ? 0 : error); Index: src/sys/nfs/nfs_serv.c diff -u src/sys/nfs/nfs_serv.c:1.152 src/sys/nfs/nfs_serv.c:1.153 --- src/sys/nfs/nfs_serv.c:1.152 Tue Nov 30 10:30:03 2010 +++ src/sys/nfs/nfs_serv.c Sun Jan 2 05:01:21 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_serv.c,v 1.152 2010/11/30 10:30:03 dholland Exp $ */ +/* $NetBSD: nfs_serv.c,v 1.153 2011/01/02 05:01:21 dholland Exp $ */ /* * Copyright (c) 1989, 1993 @@ -55,7 +55,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.152 2010/11/30 10:30:03 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.153 2011/01/02 05:01:21 dholland Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -430,9 +430,8 @@ ind.ni_pathlen = strlen(nfs_pub.np_index); ind.ni_pnbuf = NULL; ind.ni_cnd.cn_nameptr = NULL; - ind.ni_startdir = nd.ni_vp; - vref(ind.ni_startdir); - error = lookup_for_nfsd_index(&ind); + + error = lookup_for_nfsd_index(&ind, nd.ni_vp); if (!error) { /* * Found an index file. Get rid of @@ -441,7 +440,6 @@ if (dirp) vrele(dirp); dirp = nd.ni_vp; - vrele(nd.ni_startdir); ndp = &ind; } else error = 0; @@ -480,7 +478,6 @@ if (!error) error = VOP_GETATTR(vp, &va, cred); vput(vp); - vrele(ndp->ni_startdir); nfsm_reply(NFSX_SRVFH(&nsfh, v3) + NFSX_POSTOPORFATTR(v3) + NFSX_POSTOPATTR(v3)); if (error) { @@ -2082,7 +2079,6 @@ if (error == -1) error = 0; } - vrele(tond.ni_startdir); pathbuf_destroy(tond.ni_pathbuf); tond.ni_cnd.cn_nameiop = 0; out1: @@ -2100,7 +2096,6 @@ vrele(tdirp); tdirp = NULL; } - vrele(fromnd.ni_startdir); pathbuf_destroy(fromnd.ni_pathbuf); fromnd.ni_cnd.cn_nameiop = 0; localfs = NULL; @@ -2119,14 +2114,12 @@ vrele(tdirp); #endif if (tond.ni_cnd.cn_nameiop) { - vrele(tond.ni_startdir); pathbuf_destroy(tond.ni_pathbuf); } if (localfs) { VFS_RENAMELOCK_EXIT(localfs); } if (fromnd.ni_cnd.cn_nameiop) { - vrele(fromnd.ni_startdir); VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd); pathbuf_destroy(fromnd.ni_pathbuf); vrele(fromnd.ni_dvp); Index: src/sys/sys/namei.src diff -u src/sys/sys/namei.src:1.17 src/sys/sys/namei.src:1.18 --- src/sys/sys/namei.src:1.17 Tue Nov 30 10:43:01 2010 +++ src/sys/sys/namei.src Sun Jan 2 05:01:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: namei.src,v 1.17 2010/11/30 10:43:01 dholland Exp $ */ +/* $NetBSD: namei.src,v 1.18 2011/01/02 05:01:20 dholland Exp $ */ /* * Copyright (c) 1985, 1989, 1991, 1993 @@ -88,7 +88,6 @@ /* * Arguments to lookup. */ - struct vnode *ni_startdir; /* starting directory */ struct vnode *ni_rootdir; /* logical root directory */ struct vnode *ni_erootdir; /* emulation root directory */ /* @@ -256,7 +255,7 @@ int namei(struct nameidata *); uint32_t namei_hash(const char *, const char **); int lookup_for_nfsd(struct nameidata *, struct vnode *, int neverfollow); -int lookup_for_nfsd_index(struct nameidata *); +int lookup_for_nfsd_index(struct nameidata *, struct vnode *); int relookup(struct vnode *, struct vnode **, struct componentname *); void cache_purge1(struct vnode *, const struct componentname *, int); #define PURGE_PARENTS 1