Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Remove unused nameidata field ni_startdir.
details: https://anonhg.NetBSD.org/src/rev/8e19420dc006
branches: trunk
changeset: 760271:8e19420dc006
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Jan 02 05:01:20 2011 +0000
description:
Remove unused nameidata field ni_startdir.
diffstat:
sys/kern/vfs_lookup.c | 45 +++++++++++++++++----------------------------
sys/kern/vfs_syscalls.c | 7 ++-----
sys/nfs/nfs_serv.c | 15 ++++-----------
sys/sys/namei.src | 5 ++---
4 files changed, 25 insertions(+), 47 deletions(-)
diffs (281 lines):
diff -r 6bd69b5a956b -r 8e19420dc006 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c Sun Jan 02 04:41:24 2011 +0000
+++ b/sys/kern/vfs_lookup.c Sun Jan 02 05:01:20 2011 +0000
@@ -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;
diff -r 6bd69b5a956b -r 8e19420dc006 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c Sun Jan 02 04:41:24 2011 +0000
+++ b/sys/kern/vfs_syscalls.c Sun Jan 02 05:01:20 2011 +0000
@@ -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);
diff -r 6bd69b5a956b -r 8e19420dc006 sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c Sun Jan 02 04:41:24 2011 +0000
+++ b/sys/nfs/nfs_serv.c Sun Jan 02 05:01:20 2011 +0000
@@ -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);
diff -r 6bd69b5a956b -r 8e19420dc006 sys/sys/namei.src
--- a/sys/sys/namei.src Sun Jan 02 04:41:24 2011 +0000
+++ b/sys/sys/namei.src Sun Jan 02 05:01:20 2011 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index