Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Rename lookup() to lookup_for_nfsd(), to make it clear just ...
details: https://anonhg.NetBSD.org/src/rev/d8be15821b59
branches: trunk
changeset: 747691:d8be15821b59
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Sep 27 17:19:07 2009 +0000
description:
Rename lookup() to lookup_for_nfsd(), to make it clear just whose
private backdoor entry point this is.
Also, clone the lookup_for_nfsd() entry point as
lookup_for_nfsd_index(), for use by a different call site in nfsd that
does different unclean things with nameidata.
diffstat:
share/man/man9/namei.9 | 59 +++++++++++++++++++++++++++++++++++++------------
sys/kern/vfs_lookup.c | 30 +++++++++++++++++++++----
sys/nfs/nfs_serv.c | 6 ++--
sys/nfs/nfs_srvsubs.c | 6 ++--
sys/sys/namei.src | 5 ++-
5 files changed, 78 insertions(+), 28 deletions(-)
diffs (230 lines):
diff -r 4ffbe69c0a89 -r d8be15821b59 share/man/man9/namei.9
--- a/share/man/man9/namei.9 Sun Sep 27 17:13:37 2009 +0000
+++ b/share/man/man9/namei.9 Sun Sep 27 17:19:07 2009 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: namei.9,v 1.21 2009/06/29 06:02:09 wiz Exp $
+.\" $NetBSD: namei.9,v 1.22 2009/09/27 17:19:07 dholland Exp $
.\"
.\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -32,7 +32,8 @@
.Os
.Sh NAME
.Nm namei ,
-.Nm lookup ,
+.Nm lookup_for_nfsd ,
+.Nm lookup_for_nfsd_index ,
.Nm relookup ,
.Nm NDINIT ,
.Nm namei_simple_kernel ,
@@ -45,7 +46,9 @@
.Ft int
.Fn namei "struct nameidata *ndp"
.Ft int
-.Fn lookup "struct nameidata *ndp"
+.Fn lookup_for_nfsd "struct nameidata *ndp"
+.Ft int
+.Fn lookup_for_nfsd_index "struct nameidata *ndp"
.Ft int
.Fn relookup "struct vnode *dvp" "struct vnode **vpp" \
"struct componentname *cnp"
@@ -249,21 +252,22 @@
occur at the end of the name translation process.
Symbolic links are always followed for all other pathname components
other than the last.
-.It Fn lookup "ndp"
-Search for a pathname.
-This is a very central and rather complicated routine.
.Pp
-The pathname is specified by
-.Em ndp-\*[Gt]ni_dirp
-and is of length
-.Em ndp-\*[Gt]ni_pathlen .
-The starting directory is taken from
-.Em ndp-\*[Gt]ni_startdir .
-The pathname is descended until done, or a symbolic link is
-encountered.
+Historically
+.Nm
+had a sub-function called
+.Fn lookup .
+This function processed a pathname until either running out of
+material or encountering a symbolic link.
+.Nm
+worked by first setting up the start directory
+.Em ndp-\*[Gt]ni_startdir
+and then calling
+.Fn lookup
+repeatedly.
.Pp
The semantics of
-.Fn lookup
+.Nm
are altered by the operation specified by
.Em ndp-\*[Gt]ni_cnd.cn_nameiop .
When
@@ -278,6 +282,31 @@
is returned locked in
.Em ndp-\*[Gt]ni_vp ,
otherwise it is returned unlocked.
+.Pp
+As of this writing the internal function
+.Fn do_lookup
+is comparable to the historic
+.Fn lookup
+but this code is slated for refactoring.
+.It Fn lookup_for_nfsd "ndp"
+This is a private entry point into
+.Nm
+used by the NFS server code.
+Its semantics are similar to the historic
+.Fn lookup
+function described above.
+It should not be used by new code.
+.It Fn lookup_for_nfsd_index "ndp"
+This is a (second) private entry point into
+.Nm
+used by the NFS server code.
+Its semantics are similar to the historic
+.Fn lookup
+function described above.
+It should not be used by new code.
+(For now it differs from the preceding private entry point in that it
+has a different call site with a different context and different
+custom initialization of what ought to be private namei state.)
.It Fn relookup "dvp" "vpp" "cnp"
Reacquire a path name component is a directory.
This is a quicker way to lookup a pathname component when the parent
diff -r 4ffbe69c0a89 -r d8be15821b59 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c Sun Sep 27 17:13:37 2009 +0000
+++ b/sys/kern/vfs_lookup.c Sun Sep 27 17:19:07 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_lookup.c,v 1.118 2009/08/09 07:27:54 dholland Exp $ */
+/* $NetBSD: vfs_lookup.c,v 1.119 2009/09/27 17:19:07 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.118 2009/08/09 07:27:54 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.119 2009/09/27 17:19:07 dholland Exp $");
#include "opt_magiclinks.h"
@@ -546,7 +546,7 @@
}
cnp->cn_nameptr = cnp->cn_pnbuf;
ndp->ni_startdir = state->namei_startdir;
- error = lookup(ndp);
+ error = do_lookup(state);
if (error != 0) {
/* XXX this should use namei_end() */
if (ndp->ni_dvp) {
@@ -1149,10 +1149,30 @@
}
/*
- * Externally visible interface used by nfsd (bletch, yuk, XXX)
+ * Externally visible interfaces used by nfsd (bletch, yuk, XXX)
+ *
+ * The "index" version differs from the "main" version in that it's
+ * called from a different place in a different context. For now I
+ * want to be able to shuffle code in from one call site without
+ * affecting the other.
*/
+
int
-lookup(struct nameidata *ndp)
+lookup_for_nfsd(struct nameidata *ndp)
+{
+ struct namei_state state;
+ int error;
+
+ /* For now at least we don't have to frob the state */
+ namei_init(&state, ndp);
+ error = do_lookup(&state);
+ namei_cleanup(&state);
+
+ return error;
+}
+
+int
+lookup_for_nfsd_index(struct nameidata *ndp)
{
struct namei_state state;
int error;
diff -r 4ffbe69c0a89 -r d8be15821b59 sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c Sun Sep 27 17:13:37 2009 +0000
+++ b/sys/nfs/nfs_serv.c Sun Sep 27 17:19:07 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_serv.c,v 1.146 2009/05/23 15:31:21 ad Exp $ */
+/* $NetBSD: nfs_serv.c,v 1.147 2009/09/27 17:19:07 dholland Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.146 2009/05/23 15:31:21 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.147 2009/09/27 17:19:07 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -429,7 +429,7 @@
nfs_pub.np_index;
ind.ni_startdir = nd.ni_vp;
VREF(ind.ni_startdir);
- error = lookup(&ind);
+ error = lookup_for_nfsd_index(&ind);
if (!error) {
/*
* Found an index file. Get rid of
diff -r 4ffbe69c0a89 -r d8be15821b59 sys/nfs/nfs_srvsubs.c
--- a/sys/nfs/nfs_srvsubs.c Sun Sep 27 17:13:37 2009 +0000
+++ b/sys/nfs/nfs_srvsubs.c Sun Sep 27 17:19:07 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_srvsubs.c,v 1.3 2009/05/04 06:05:19 yamt Exp $ */
+/* $NetBSD: nfs_srvsubs.c,v 1.4 2009/09/27 17:19:07 dholland Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_srvsubs.c,v 1.3 2009/05/04 06:05:19 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_srvsubs.c,v 1.4 2009/09/27 17:19:07 dholland Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -264,7 +264,7 @@
/*
* And call lookup() to do the real work
*/
- error = lookup(ndp);
+ error = lookup_for_nfsd(ndp);
if (error) {
if (ndp->ni_dvp) {
vput(ndp->ni_dvp);
diff -r 4ffbe69c0a89 -r d8be15821b59 sys/sys/namei.src
--- a/sys/sys/namei.src Sun Sep 27 17:13:37 2009 +0000
+++ b/sys/sys/namei.src Sun Sep 27 17:19:07 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: namei.src,v 1.11 2009/06/29 05:00:14 dholland Exp $ */
+/* $NetBSD: namei.src,v 1.12 2009/09/27 17:19:07 dholland Exp $ */
/*
* Copyright (c) 1985, 1989, 1991, 1993
@@ -228,7 +228,8 @@
int namei(struct nameidata *);
uint32_t namei_hash(const char *, const char **);
-int lookup(struct nameidata *);
+int lookup_for_nfsd(struct nameidata *);
+int lookup_for_nfsd_index(struct nameidata *);
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