Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Merge nfsd's cut&paste copy of namei with the maste...



details:   https://anonhg.NetBSD.org/src/rev/63c785a5c691
branches:  trunk
changeset: 764048:63c785a5c691
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 11 01:35:55 2011 +0000

description:
Merge nfsd's cut&paste copy of namei with the master one.

diffstat:

 sys/kern/vfs_lookup.c |  73 +++++++-------------------------------------------
 1 files changed, 11 insertions(+), 62 deletions(-)

diffs (109 lines):

diff -r 51f2221a4c81 -r 63c785a5c691 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 11 01:35:00 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 11 01:35:55 2011 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index