Module Name: src Committed By: dholland Date: Tue Jun 29 22:39:21 UTC 2021
Modified Files: src/sys/fs/puffs: puffs_vnops.c src/sys/fs/union: union_vnops.c src/sys/fs/unionfs: unionfs_subr.c src/sys/kern: vfs_getcwd.c vfs_lookup.c src/sys/sys: namei.src Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/sys/fs/puffs/puffs_vnops.c cvs rdiff -u -r1.76 -r1.77 src/sys/fs/union/union_vnops.c cvs rdiff -u -r1.14 -r1.15 src/sys/fs/unionfs/unionfs_subr.c cvs rdiff -u -r1.60 -r1.61 src/sys/kern/vfs_getcwd.c cvs rdiff -u -r1.228 -r1.229 src/sys/kern/vfs_lookup.c cvs rdiff -u -r1.59 -r1.60 src/sys/sys/namei.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/fs/puffs/puffs_vnops.c diff -u src/sys/fs/puffs/puffs_vnops.c:1.218 src/sys/fs/puffs/puffs_vnops.c:1.219 --- src/sys/fs/puffs/puffs_vnops.c:1.218 Tue Jun 29 22:34:07 2021 +++ src/sys/fs/puffs/puffs_vnops.c Tue Jun 29 22:39:20 2021 @@ -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++; Index: src/sys/fs/union/union_vnops.c diff -u src/sys/fs/union/union_vnops.c:1.76 src/sys/fs/union/union_vnops.c:1.77 --- src/sys/fs/union/union_vnops.c:1.76 Tue Jun 29 22:38:46 2021 +++ src/sys/fs/union/union_vnops.c Tue Jun 29 22:39:20 2021 @@ -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) { Index: src/sys/fs/unionfs/unionfs_subr.c diff -u src/sys/fs/unionfs/unionfs_subr.c:1.14 src/sys/fs/unionfs/unionfs_subr.c:1.15 --- src/sys/fs/unionfs/unionfs_subr.c:1.14 Thu Jun 1 02:45:13 2017 +++ src/sys/fs/unionfs/unionfs_subr.c Tue Jun 29 22:39:20 2021 @@ -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. Index: src/sys/kern/vfs_getcwd.c diff -u src/sys/kern/vfs_getcwd.c:1.60 src/sys/kern/vfs_getcwd.c:1.61 --- src/sys/kern/vfs_getcwd.c:1.60 Sat May 16 18:31:50 2020 +++ src/sys/kern/vfs_getcwd.c Tue Jun 29 22:39:21 2021 @@ -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); Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.228 src/sys/kern/vfs_lookup.c:1.229 --- src/sys/kern/vfs_lookup.c:1.228 Tue Jun 29 22:34:08 2021 +++ src/sys/kern/vfs_lookup.c Tue Jun 29 22:39:21 2021 @@ -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; Index: src/sys/sys/namei.src diff -u src/sys/sys/namei.src:1.59 src/sys/sys/namei.src:1.60 --- src/sys/sys/namei.src:1.59 Wed Jun 16 01:51:57 2021 +++ src/sys/sys/namei.src Tue Jun 29 22:39:21 2021 @@ -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 */ }; /*