Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern description:



details:   https://anonhg.NetBSD.org/src/rev/7fc33990a96b
branches:  trunk
changeset: 764076:7fc33990a96b
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 11 02:17:28 2011 +0000

description:
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.)

diffstat:

 sys/kern/vfs_lookup.c |  30 ++++++++++++------------------
 1 files changed, 12 insertions(+), 18 deletions(-)

diffs (93 lines):

diff -r 22e90509d761 -r 7fc33990a96b sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 11 02:17:14 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 11 02:17:28 2011 +0000
@@ -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;
        }
 



Home | Main Index | Thread Index | Old Index