Module Name:    src
Committed By:   dholland
Date:           Mon Apr 11 02:17:28 UTC 2011

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

Log Message:
description:
Remove state->lookup_alldone. Don't need it any more; it's set
precisely when succeeding with a null result vnode and it now works to
just check for that case.

(also, when "error" is already 0 we don't need to assign another 0 to
it, even as a precaution.)


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 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.161 src/sys/kern/vfs_lookup.c:1.162
--- src/sys/kern/vfs_lookup.c:1.161	Mon Apr 11 02:17:14 2011
+++ src/sys/kern/vfs_lookup.c	Mon Apr 11 02:17:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.161 2011/04/11 02:17:14 dholland Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.162 2011/04/11 02:17:28 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.161 2011/04/11 02:17:14 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.162 2011/04/11 02:17:28 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -403,9 +403,6 @@
 	struct nameidata *ndp;
 	struct componentname *cnp;
 
-	/* used by the pieces of lookup */
-	int lookup_alldone;
-
 	int docache;			/* == 0 do not cache last component */
 	int rdonly;			/* lookup read-only flag bit */
 	int slashes;
@@ -424,8 +421,6 @@
 	state->cnp = &ndp->ni_cnd;
 	KASSERT((state->cnp->cn_flags & INRELOOKUP) == 0);
 
-	state->lookup_alldone = 0;
-
 	state->docache = 0;
 	state->rdonly = 0;
 	state->slashes = 0;
@@ -971,7 +966,6 @@
 		 * doesn't currently exist, leaving a pointer to the
 		 * (possibly locked) directory vnode as searchdir.
 		 */
-		state->lookup_alldone = 1;
 		*foundobj_ret = NULL;
 		return (0);
 	}
@@ -1072,8 +1066,6 @@
 		 * (currently, this may consume more than one)
 		 */
 
-		state->lookup_alldone = 0;
-
 		ndp->ni_dvp = NULL;
 		cnp->cn_flags &= ~ISSYMLINK;
 
@@ -1145,10 +1137,14 @@
 		KASSERT(ndp->ni_dvp == NULL);
 		ndp->ni_vp = foundobj;
 
-		// XXX ought to be able to avoid this case too
-		if (state->lookup_alldone) {
-			error = 0;
-			/* break out of main loop */
+		if (foundobj == NULL) {
+			/*
+			 * Success with no object returned means we're
+			 * creating something and it isn't already
+			 * there. Break out of the main loop now so
+			 * the code below doesn't have to test for
+			 * foundobj == NULL.
+			 */
 			break;
 		}
 
@@ -1435,7 +1431,6 @@
 	KASSERT(cnp == &ndp->ni_cnd);
 
 	cnp->cn_nameptr = ndp->ni_pnbuf;
-	state->lookup_alldone = 0;
 	state->docache = 1;
 	state->rdonly = cnp->cn_flags & RDONLY;
 	ndp->ni_dvp = NULL;
@@ -1470,9 +1465,8 @@
 		goto bad;
 	}
 	ndp->ni_vp = foundobj;
-	// XXX ought to be able to avoid this case too
-	if (state->lookup_alldone) {
-		/* this should NOT be "goto terminal;" */
+
+	if (foundobj == NULL) {
 		return 0;
 	}
 

Reply via email to