Module Name:    src
Committed By:   dholland
Date:           Mon Apr 11 02:13:22 UTC 2011

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

Log Message:
description:
state->namei_startdir has no further reason to exist.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 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.151 src/sys/kern/vfs_lookup.c:1.152
--- src/sys/kern/vfs_lookup.c:1.151	Mon Apr 11 02:13:10 2011
+++ src/sys/kern/vfs_lookup.c	Mon Apr 11 02:13:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.151 2011/04/11 02:13:10 dholland Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.152 2011/04/11 02:13:22 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.151 2011/04/11 02:13:10 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.152 2011/04/11 02:13:22 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -403,9 +403,6 @@
 	struct nameidata *ndp;
 	struct componentname *cnp;
 
-	/* used by the pieces of namei */
-	struct vnode *namei_startdir; /* The directory namei() starts from. */
-
 	/* used by the pieces of lookup */
 	int lookup_alldone;
 
@@ -427,8 +424,6 @@
 	state->cnp = &ndp->ni_cnd;
 	KASSERT((state->cnp->cn_flags & INRELOOKUP) == 0);
 
-	state->namei_startdir = NULL;
-
 	state->lookup_alldone = 0;
 
 	state->docache = 0;
@@ -460,8 +455,6 @@
 {
 	KASSERT(state->cnp == &state->ndp->ni_cnd);
 
-	//KASSERT(state->namei_startdir == NULL); 	// not yet
-
 	/* nothing for now */
 	(void)state;
 }
@@ -1044,7 +1037,7 @@
 	const char *cp;
 	int error;
 
-	error = namei_start(state, forcecwd, &state->namei_startdir);
+	error = namei_start(state, forcecwd, &searchdir);
 	if (error) {
 		return error;
 	}
@@ -1067,8 +1060,8 @@
 		 * If the directory we're on is unmounted, bail out.
 		 * XXX: should this also check if it's unlinked?
 		 */
-		if (state->namei_startdir->v_mount == NULL) {
-			vput(state->namei_startdir);
+		if (searchdir->v_mount == NULL) {
+			vput(searchdir);
 			return (ENOENT);
 		}
 
@@ -1081,7 +1074,6 @@
 
 		ndp->ni_dvp = NULL;
 		cnp->cn_flags &= ~ISSYMLINK;
-		searchdir = state->namei_startdir;
 
     dirloop:
 		/*
@@ -1173,10 +1165,16 @@
 			if (neverfollow) {
 				error = EINVAL;
 			} else {
-				state->namei_startdir = ndp->ni_dvp;
+				/*
+				 * dholland 20110410: if we're at a
+				 * union mount it might make sense to
+				 * use the top of the union stack here
+				 * rather than the layer we found the
+				 * symlink in. (FUTURE)
+				 */
 				error = namei_follow(state, inhibitmagic,
-						     state->namei_startdir,
-						     &state->namei_startdir);
+						     searchdir,
+						     &searchdir);
 			}
 			if (error) {
 				KASSERT(ndp->ni_dvp != ndp->ni_vp);

Reply via email to