Module Name:    src
Committed By:   dholland
Date:           Mon Apr 11 01:35:55 UTC 2011

Modified Files:
        src/sys/kern: vfs_lookup.c

Log Message:
ZZmsg


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/kern/vfs_lookup.c

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.134 src/sys/kern/vfs_lookup.c:1.135
--- src/sys/kern/vfs_lookup.c:1.134	Mon Apr 11 01:35:00 2011
+++ src/sys/kern/vfs_lookup.c	Mon Apr 11 01:35:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.134 2011/04/11 01:35:00 dholland Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.135 2011/04/11 01:35:55 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.134 2011/04/11 01:35:00 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.135 2011/04/11 01:35:55 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -1372,72 +1372,21 @@
  * 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.
+ *
+ * It turns out that the "main" version was a cut and pasted copy of
+ * namei with a few changes; the "index" version on the other hand
+ * always takes a single component and is an elaborate form of calling
+ * VOP_LOOKUP once.
  */
 
-static int
-do_lookup_for_nfsd(struct namei_state *state, struct vnode *forcecwd,
-		   int neverfollow, int inhibitmagic)
-{
-	int error;
-
-	struct nameidata *ndp = state->ndp;
-	//struct componentname *cnp = state->cnp;
-
-	error = namei_start(state, forcecwd);
-	if (error) {
-		return error;
-	}
-
-    for (;;) {
-
-	error = do_lookup(state, state->namei_startdir);
-
-	if (error) {
-		if (ndp->ni_dvp) {
-			vput(ndp->ni_dvp);
-		}
-		return error;
-	}
-
-	/*
-	 * Check for encountering a symbolic link
-	 */
-	if (namei_atsymlink(state)) {
-		if (neverfollow) {
-			error = EINVAL;
-		} else {
-			error = namei_follow(state, inhibitmagic);
-		}
-		if (error) {
-			KASSERT(ndp->ni_dvp != ndp->ni_vp);
-			vput(state->ndp->ni_vp);
-			vput(state->ndp->ni_dvp);
-			state->ndp->ni_vp = NULL;
-			return error;
-		}
-	} else {
-		break;
-	}
-    }
-
-    if ((state->cnp->cn_flags & LOCKPARENT) == 0 && state->ndp->ni_dvp) {
-	    if (state->ndp->ni_dvp == state->ndp->ni_vp) {
-		    vrele(state->ndp->ni_dvp);
-	    } else {
-		    vput(state->ndp->ni_dvp);
-	    }
-    }
-    return (0);
-}
-
 int
-lookup_for_nfsd(struct nameidata *ndp, struct vnode *dp, int neverfollow)
+lookup_for_nfsd(struct nameidata *ndp, struct vnode *forcecwd, int neverfollow)
 {
 	struct namei_state state;
 	int error;
 
 	namei_init(&state, ndp);
-	error = do_lookup_for_nfsd(&state, dp, neverfollow, 1/*inhibitmagic*/);
+	error = do_namei(&state, forcecwd, neverfollow, 1/*inhibitmagic*/);
 	namei_cleanup(&state);
 
 	return error;
@@ -1450,8 +1399,8 @@
 	int error;
 
 	/*
-	 * Note: the name sent in here is not/should not be allowed to
-	 * contain a slash.
+	 * Note: the name sent in here (is not|should not be) allowed
+	 * to contain a slash.
 	 */
 
 	ndp->ni_pathlen = strlen(ndp->ni_pathbuf->pb_path) + 1;

Reply via email to