Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Now remove cn_consume from struct componentname.



details:   https://anonhg.NetBSD.org/src/rev/234cccf5cf02
branches:  trunk
changeset: 379989:234cccf5cf02
user:      dholland <dholland%NetBSD.org@localhost>
date:      Tue Jun 29 22:39:20 2021 +0000

description:
Now remove cn_consume from struct componentname.

This change requires a kernel bump.

Note though that I'm not going to version the VOP_LOOKUP args
structure (or any other args structure) as code that doesn't touch
cn_consume doesn't need attention and code that does will fail on it
without further intervention.

diffstat:

 sys/fs/puffs/puffs_vnops.c    |  11 ++++++-----
 sys/fs/union/union_vnops.c    |  22 ++--------------------
 sys/fs/unionfs/unionfs_subr.c |   3 ---
 sys/kern/vfs_getcwd.c         |   5 ++---
 sys/kern/vfs_lookup.c         |  19 ++-----------------
 sys/sys/namei.src             |   3 +--
 6 files changed, 13 insertions(+), 50 deletions(-)

diffs (206 lines):

diff -r bed22c218d38 -r 234cccf5cf02 sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c        Tue Jun 29 22:38:46 2021 +0000
+++ b/sys/fs/puffs/puffs_vnops.c        Tue Jun 29 22:39:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_vnops.c,v 1.218 2021/06/29 22:34:07 dholland Exp $       */
+/*     $NetBSD: puffs_vnops.c,v 1.219 2021/06/29 22:39:20 dholland Exp $       */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.218 2021/06/29 22:34:07 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.219 2021/06/29 22:39:20 dholland Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -711,9 +711,10 @@ puffs_vnop_lookup(void *v)
        /* XXX */
        if ((lookup_msg->pvnr_cn.pkcn_flags & REQUIREDIR) == 0)
                cnp->cn_flags &= ~REQUIREDIR;
-       if (lookup_msg->pvnr_cn.pkcn_consume)
-               cnp->cn_consume = MIN(lookup_msg->pvnr_cn.pkcn_consume,
-                   strlen(cnp->cn_nameptr) - cnp->cn_namelen);
+       if (lookup_msg->pvnr_cn.pkcn_consume) {
+               printf("puffs: warning: ignoring cn_consume of %zu chars\n",
+                   lookup_msg->pvnr_cn.pkcn_consume);
+       }
 
        VPTOPP(vp)->pn_nlookup++;
 
diff -r bed22c218d38 -r 234cccf5cf02 sys/fs/union/union_vnops.c
--- a/sys/fs/union/union_vnops.c        Tue Jun 29 22:38:46 2021 +0000
+++ b/sys/fs/union/union_vnops.c        Tue Jun 29 22:39:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_vnops.c,v 1.76 2021/06/29 22:38:46 dholland Exp $        */
+/*     $NetBSD: union_vnops.c,v 1.77 2021/06/29 22:39:20 dholland Exp $        */
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.76 2021/06/29 22:38:46 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.77 2021/06/29 22:39:20 dholland Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -358,12 +358,6 @@ start:
        if (upperdvp != NULLVP) {
                uerror = union_lookup1(um->um_uppervp, &upperdvp,
                                        &uppervp, cnp);
-               if (cnp->cn_consume != 0) {
-                       if (uppervp != upperdvp)
-                               VOP_UNLOCK(uppervp);
-                       *ap->a_vpp = uppervp;
-                       return (uerror);
-               }
                if (uerror == ENOENT || uerror == EJUSTRETURN) {
                        if (cnp->cn_flags & ISWHITEOUT) {
                                iswhiteout = 1;
@@ -415,18 +409,6 @@ start:
 
                if (lowervp != lowerdvp)
                        VOP_UNLOCK(lowerdvp);
-
-               if (cnp->cn_consume != 0) {
-                       if (uppervp != NULLVP) {
-                               if (uppervp == upperdvp)
-                                       vrele(uppervp);
-                               else
-                                       vput(uppervp);
-                               uppervp = NULLVP;
-                       }
-                       *ap->a_vpp = lowervp;
-                       return (lerror);
-               }
        } else {
                lerror = ENOENT;
                if ((cnp->cn_flags & ISDOTDOT) && dun->un_pvp != NULLVP) {
diff -r bed22c218d38 -r 234cccf5cf02 sys/fs/unionfs/unionfs_subr.c
--- a/sys/fs/unionfs/unionfs_subr.c     Tue Jun 29 22:38:46 2021 +0000
+++ b/sys/fs/unionfs/unionfs_subr.c     Tue Jun 29 22:39:20 2021 +0000
@@ -317,7 +317,6 @@ unionfs_relookup(struct vnode *dvp, stru
        cn->cn_cred = cnp->cn_cred;
 
        cn->cn_nameptr = pnbuf;
-       cn->cn_consume = cnp->cn_consume;
 
        if (nameiop == DELETE)
                cn->cn_flags |= (cnp->cn_flags & DOWHITEOUT);
@@ -629,7 +628,6 @@ unionfs_vn_create_on_upper(struct vnode 
        cn.cn_flags = (LOCKPARENT | LOCKLEAF | ISLASTCN);
        cn.cn_cred = cred;
        cn.cn_nameptr = pnbuf;
-       cn.cn_consume = 0;
 
        vref(udvp);
        if ((error = relookup(udvp, &vp, &cn, 0)) != 0)
@@ -860,7 +858,6 @@ unionfs_check_rmdir(struct vnode *vp, ka
                        cn.cn_nameiop = LOOKUP;
                        cn.cn_flags = (LOCKPARENT | LOCKLEAF | RDONLY | ISLASTCN);
                        cn.cn_cred = cred;
-                       cn.cn_consume = 0;
 
                        /*
                         * check entry in lower.
diff -r bed22c218d38 -r 234cccf5cf02 sys/kern/vfs_getcwd.c
--- a/sys/kern/vfs_getcwd.c     Tue Jun 29 22:38:46 2021 +0000
+++ b/sys/kern/vfs_getcwd.c     Tue Jun 29 22:39:20 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_getcwd.c,v 1.60 2020/05/16 18:31:50 christos Exp $ */
+/* $NetBSD: vfs_getcwd.c,v 1.61 2021/06/29 22:39:21 dholland Exp $ */
 
 /*-
  * Copyright (c) 1999, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_getcwd.c,v 1.60 2020/05/16 18:31:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_getcwd.c,v 1.61 2021/06/29 22:39:21 dholland Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -131,7 +131,6 @@ getcwd_scandir(struct vnode *lvp, struct
        cn.cn_cred = cred;
        cn.cn_nameptr = "..";
        cn.cn_namelen = 2;
-       cn.cn_consume = 0;
 
        /* At this point, lvp is locked  */
        error = VOP_LOOKUP(lvp, uvpp, &cn);
diff -r bed22c218d38 -r 234cccf5cf02 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Tue Jun 29 22:38:46 2021 +0000
+++ b/sys/kern/vfs_lookup.c     Tue Jun 29 22:39:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.228 2021/06/29 22:34:08 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.229 2021/06/29 22:39:21 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.228 2021/06/29 22:34:08 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.229 2021/06/29 22:39:21 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -845,7 +845,6 @@ lookup_parsepath(struct namei_state *sta
         * At this point, our only vnode state is that the search dir
         * is held.
         */
-       cnp->cn_consume = 0;
        error = VOP_PARSEPATH(searchdir, cnp->cn_nameptr, &cnp->cn_namelen);
        if (error) {
                return error;
@@ -1238,19 +1237,6 @@ unionlookup:
        printf("found\n");
 #endif /* NAMEI_DIAGNOSTIC */
 
-       /*
-        * Take into account any additional components consumed by the
-        * underlying filesystem.  This will include any trailing slashes after
-        * the last component consumed.
-        */
-       if (cnp->cn_consume > 0) {
-               ndp->ni_pathlen -= cnp->cn_consume - state->slashes;
-               ndp->ni_next += cnp->cn_consume - state->slashes;
-               cnp->cn_consume = 0;
-               if (ndp->ni_next[0] == '\0')
-                       cnp->cn_flags |= ISLASTCN;
-       }
-
        /* Unlock, unless the caller needs the parent locked. */
        if (searchdir != NULL) {
                KASSERT(searchdir_locked);
@@ -2059,7 +2045,6 @@ do_lookup_for_nfsd_index(struct namei_st
        state->rdonly = cnp->cn_flags & RDONLY;
        ndp->ni_dvp = NULL;
 
-       cnp->cn_consume = 0;
        error = VOP_PARSEPATH(startdir, cnp->cn_nameptr, &cnp->cn_namelen);
        if (error) {
                return error;
diff -r bed22c218d38 -r 234cccf5cf02 sys/sys/namei.src
--- a/sys/sys/namei.src Tue Jun 29 22:38:46 2021 +0000
+++ b/sys/sys/namei.src Tue Jun 29 22:39:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namei.src,v 1.59 2021/06/16 01:51:57 dholland Exp $    */
+/*     $NetBSD: namei.src,v 1.60 2021/06/29 22:39:21 dholland Exp $    */
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -94,7 +94,6 @@ struct componentname {
         */
        const char      *cn_nameptr;    /* pointer to looked up name */
        size_t          cn_namelen;     /* length of looked up comp */
-       size_t          cn_consume;     /* chars to consume in lookup */
 };
 
 /*



Home | Main Index | Thread Index | Old Index