Abolish the SAVENAME and HASBUF flags. There is now always a buffer,

so the path in a struct componentname is now always valid during VOP
calls.
This commit is contained in:
dholland 2010-11-30 10:43:01 +00:00
parent fab6ef2374
commit 14402d0ff1
27 changed files with 66 additions and 217 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: coda_vnops.c,v 1.77 2010/11/30 10:29:57 dholland Exp $ */
/* $NetBSD: coda_vnops.c,v 1.78 2010/11/30 10:43:01 dholland Exp $ */
/*
*
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.77 2010/11/30 10:29:57 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.78 2010/11/30 10:43:01 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -997,23 +997,9 @@ coda_lookup(void *v)
&& (error == ENOENT))
{
error = EJUSTRETURN;
cnp->cn_flags |= SAVENAME;
*ap->a_vpp = NULL;
}
/*
* If we are removing, and we are at the last element, and we
* found it, then we need to keep the name around so that the
* removal will go ahead as planned.
* XXX Check against new lookup rules.
*/
if ((cnp->cn_nameiop == DELETE)
&& (cnp->cn_flags & ISLASTCN)
&& !error)
{
cnp->cn_flags |= SAVENAME;
}
/*
* If the lookup succeeded, we must generally lock the returned
* vnode. This could be a ., .., or normal lookup. See

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_misc.c,v 1.153 2010/11/30 10:29:58 dholland Exp $ */
/* $NetBSD: svr4_misc.c,v 1.154 2010/11/30 10:43:02 dholland Exp $ */
/*-
* Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.153 2010/11/30 10:29:58 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.154 2010/11/30 10:43:02 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1328,7 +1328,7 @@ svr4_sys_resolvepath(struct lwp *l, const struct svr4_sys_resolvepath_args *uap,
return ENOMEM;
}
NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME | TRYEMULROOT, pb);
NDINIT(&nd, LOOKUP, NOFOLLOW | TRYEMULROOT, pb);
if ((error = namei(&nd)) != 0) {
pathbuf_destroy(pb);
return error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_32_misc.c,v 1.72 2010/11/30 10:29:58 dholland Exp $ */
/* $NetBSD: svr4_32_misc.c,v 1.73 2010/11/30 10:43:02 dholland Exp $ */
/*-
* Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.72 2010/11/30 10:29:58 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.73 2010/11/30 10:43:02 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1333,7 +1333,7 @@ svr4_32_sys_resolvepath(struct lwp *l, const struct svr4_32_sys_resolvepath_args
return error;
}
NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME | TRYEMULROOT, pb);
NDINIT(&nd, LOOKUP, NOFOLLOW | TRYEMULROOT, pb);
if ((error = namei(&nd)) != 0) {
pathbuf_destroy(pb);
return error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: adlookup.c,v 1.14 2010/06/24 13:03:08 hannken Exp $ */
/* $NetBSD: adlookup.c,v 1.15 2010/11/30 10:43:02 dholland Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: adlookup.c,v 1.14 2010/06/24 13:03:08 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: adlookup.c,v 1.15 2010/11/30 10:43:02 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -205,7 +205,6 @@ adosfs_lookup(void *v)
#endif
return (error);
}
cnp->cn_nameiop |= SAVENAME;
#ifdef ADOSFS_DIAGNOSTIC
printf("EJUSTRETURN)");
#endif
@ -236,7 +235,6 @@ found:
*vpp = NULL;
return (error);
}
cnp->cn_flags |= SAVENAME;
nocache = 1;
}
if (vdp == *vpp)

View File

@ -1,4 +1,4 @@
/* $NetBSD: efs_vnops.c,v 1.22 2010/06/24 13:03:09 hannken Exp $ */
/* $NetBSD: efs_vnops.c,v 1.23 2010/11/30 10:43:02 dholland Exp $ */
/*
* Copyright (c) 2006 Stephen M. Rumble <rumble@ephemeral.org>
@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: efs_vnops.c,v 1.22 2010/06/24 13:03:09 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: efs_vnops.c,v 1.23 2010/11/30 10:43:02 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -111,7 +111,6 @@ efs_lookup(void *v)
cnp->cn_cred);
if (err)
return (err);
cnp->cn_flags |= SAVENAME;
return (EJUSTRETURN);
}
return (err);

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_lookup.c,v 1.22 2010/07/30 16:40:43 mlelstv Exp $ */
/* $NetBSD: msdosfs_lookup.c,v 1.23 2010/11/30 10:43:03 dholland Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.22 2010/07/30 16:40:43 mlelstv Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.23 2010/11/30 10:43:03 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -381,13 +381,10 @@ notfound:
* We return ni_vp == NULL to indicate that the entry
* does not currently exist; we leave a pointer to
* the (locked) directory inode in ndp->ni_dvp.
* The pathname buffer is saved so that the name
* can be obtained later.
*
* NB - if the directory is unlocked, then this
* information cannot be used.
*/
cnp->cn_flags |= SAVENAME;
return (EJUSTRETURN);
}
@ -513,7 +510,6 @@ foundroot:
if ((error = deget(pmp, cluster, blkoff, &tdp)) != 0)
return (error);
*vpp = DETOV(tdp);
cnp->cn_flags |= SAVENAME;
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vnops.c,v 1.69 2010/11/30 10:29:59 dholland Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.70 2010/11/30 10:43:03 dholland Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.69 2010/11/30 10:29:59 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.70 2010/11/30 10:43:03 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -138,10 +138,6 @@ msdosfs_create(void *v)
* use the absence of the owner write bit to make the file
* readonly.
*/
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & HASBUF) == 0)
panic("msdosfs_create: no name");
#endif
memset(&ndirent, 0, sizeof(ndirent));
if ((error = uniqdosname(pdep, cnp, ndirent.de_Name)) != 0)
goto bad;
@ -837,11 +833,6 @@ msdosfs_rename(void *v)
pmp = VFSTOMSDOSFS(fdvp->v_mount);
#ifdef DIAGNOSTIC
if ((tcnp->cn_flags & HASBUF) == 0 ||
(fcnp->cn_flags & HASBUF) == 0)
panic("msdosfs_rename: no name");
#endif
/*
* Check for cross-device rename.
*/
@ -1273,10 +1264,6 @@ msdosfs_mkdir(void *v)
* cluster. This will be written to an empty slot in the parent
* directory.
*/
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & HASBUF) == 0)
panic("msdosfs_mkdir: no name");
#endif
if ((error = uniqdosname(pdep, cnp, ndirent.de_Name)) != 0)
goto bad;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nilfs_vnops.c,v 1.8 2010/11/30 10:29:59 dholland Exp $ */
/* $NetBSD: nilfs_vnops.c,v 1.9 2010/11/30 10:43:03 dholland Exp $ */
/*
* Copyright (c) 2008, 2009 Reinoud Zandijk
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.8 2010/11/30 10:29:59 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.9 2010/11/30 10:43:03 dholland Exp $");
#endif /* not lint */
@ -732,8 +732,6 @@ nilfs_lookup(void *v)
if (!error) {
error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred);
if (!error) {
/* keep the component name */
cnp->cn_flags |= SAVENAME;
error = EJUSTRETURN;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_vnops.c,v 1.148 2010/11/30 10:29:59 dholland Exp $ */
/* $NetBSD: puffs_vnops.c,v 1.149 2010/11/30 10:43:03 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.148 2010/11/30 10:29:59 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.149 2010/11/30 10:43:03 dholland Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -541,7 +541,6 @@ puffs_vnop_lookup(void *v)
} else if ((cnp->cn_flags & ISLASTCN)
&& (cnp->cn_nameiop == CREATE
|| cnp->cn_nameiop == RENAME)) {
cnp->cn_flags |= SAVENAME;
error = EJUSTRETURN;
/* save negative cache entry */
@ -595,13 +594,6 @@ puffs_vnop_lookup(void *v)
cnp->cn_consume = MIN(lookup_msg->pvnr_cn.pkcn_consume,
strlen(cnp->cn_nameptr) - cnp->cn_namelen);
/*
* We need the name in remove and rmdir (well, rename too, but
* SAVESTART takes care of that)
*/
if (cnp->cn_nameiop == DELETE)
cnp->cn_flags |= SAVENAME;
out:
if (cnp->cn_flags & ISDOTDOT)
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_vnops.c,v 1.76 2010/11/30 10:30:00 dholland Exp $ */
/* $NetBSD: smbfs_vnops.c,v 1.77 2010/11/30 10:43:03 dholland Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.76 2010/11/30 10:30:00 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.77 2010/11/30 10:43:03 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1237,9 +1237,6 @@ smbfs_lookup(void *v)
&& vattr.va_ctime.tv_sec == VTOSMB(newvp)->n_ctime)
{
/* nfsstats.lookupcache_hits++; */
if (cnp->cn_nameiop != LOOKUP && islastcn)
cnp->cn_flags |= SAVENAME;
return (0);
}
@ -1292,7 +1289,6 @@ smbfs_lookup(void *v)
if (error)
return (error);
cnp->cn_flags |= SAVENAME;
return (EJUSTRETURN);
}
@ -1322,7 +1318,6 @@ smbfs_lookup(void *v)
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
if (error)
return (error);
cnp->cn_flags |= SAVENAME;
return (0);
}
@ -1353,9 +1348,6 @@ smbfs_lookup(void *v)
return error;
}
if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN))
cnp->cn_flags |= SAVENAME;
if ((cnp->cn_flags & MAKEENTRY)) {
KASSERT(error == 0);
if (cnp->cn_nameiop != DELETE || !islastcn) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysvbfs_vnops.c,v 1.34 2010/11/30 10:30:00 dholland Exp $ */
/* $NetBSD: sysvbfs_vnops.c,v 1.35 2010/11/30 10:43:04 dholland Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.34 2010/11/30 10:30:00 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.35 2010/11/30 10:43:04 dholland Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -78,7 +78,6 @@ sysvbfs_lookup(void *arg)
const char *name = cnp->cn_nameptr;
int namelen = cnp->cn_namelen;
int error;
bool islastcn = cnp->cn_flags & ISLASTCN;
DPRINTF("%s: %s op=%d %d\n", __func__, name, nameiop,
cnp->cn_flags);
@ -103,7 +102,6 @@ sysvbfs_lookup(void *arg)
}
if ((error = VOP_ACCESS(v, VWRITE, cnp->cn_cred)) != 0)
return error;
cnp->cn_flags |= SAVENAME;
return EJUSTRETURN;
}
@ -115,9 +113,6 @@ sysvbfs_lookup(void *arg)
*a->a_vpp = vpp;
}
if (cnp->cn_nameiop != LOOKUP && islastcn)
cnp->cn_flags |= SAVENAME;
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tmpfs_subr.c,v 1.60 2010/11/30 10:30:00 dholland Exp $ */
/* $NetBSD: tmpfs_subr.c,v 1.61 2010/11/30 10:43:04 dholland Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.60 2010/11/30 10:30:00 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.61 2010/11/30 10:43:04 dholland Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
@ -457,7 +457,6 @@ tmpfs_alloc_file(struct vnode *dvp, struct vnode **vpp, struct vattr *vap,
struct tmpfs_node *parent;
KASSERT(VOP_ISLOCKED(dvp));
KASSERT(cnp->cn_flags & HASBUF);
tmp = VFS_TO_TMPFS(dvp->v_mount);
dnode = VP_TO_TMPFS_DIR(dvp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: tmpfs_vnops.c,v 1.74 2010/11/30 10:30:00 dholland Exp $ */
/* $NetBSD: tmpfs_vnops.c,v 1.75 2010/11/30 10:43:04 dholland Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.74 2010/11/30 10:30:00 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.75 2010/11/30 10:43:04 dholland Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
@ -203,8 +203,6 @@ tmpfs_lookup(void *v)
if (error) {
goto out;
}
/* Keep the component name for future uses. */
cnp->cn_flags |= SAVENAME;
error = EJUSTRETURN;
} else {
error = ENOENT;
@ -252,7 +250,6 @@ tmpfs_lookup(void *v)
if (error) {
goto out;
}
cnp->cn_flags |= SAVENAME;
}
/* Allocate a new vnode on the matching entry. */
error = tmpfs_alloc_vp(dvp->v_mount, tnode, vpp);
@ -747,7 +744,6 @@ tmpfs_link(void *v)
struct tmpfs_node *node;
KASSERT(VOP_ISLOCKED(dvp));
KASSERT(cnp->cn_flags & HASBUF);
KASSERT(dvp != vp); /* XXX When can this be false? */
dnode = VP_TO_TMPFS_DIR(dvp);
@ -841,8 +837,6 @@ tmpfs_rename(void *v)
KASSERT(VOP_ISLOCKED(tdvp));
KASSERT(IMPLIES(tvp != NULL, VOP_ISLOCKED(tvp) == LK_EXCLUSIVE));
KASSERT(fcnp->cn_flags & HASBUF);
KASSERT(tcnp->cn_flags & HASBUF);
newname = NULL;
namelen = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: udf_vnops.c,v 1.60 2010/11/30 10:30:01 dholland Exp $ */
/* $NetBSD: udf_vnops.c,v 1.61 2010/11/30 10:43:04 dholland Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.60 2010/11/30 10:30:01 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.61 2010/11/30 10:43:04 dholland Exp $");
#endif /* not lint */
@ -762,8 +762,6 @@ udf_lookup(void *v)
if (!error) {
error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred);
if (!error) {
/* keep the component name */
cnp->cn_flags |= SAVENAME;
error = EJUSTRETURN;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: union_subr.c,v 1.40 2010/11/30 10:30:01 dholland Exp $ */
/* $NetBSD: union_subr.c,v 1.41 2010/11/30 10:43:04 dholland Exp $ */
/*
* Copyright (c) 1994
@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.40 2010/11/30 10:30:01 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.41 2010/11/30 10:43:04 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -806,7 +806,7 @@ union_relookup(
*pnbuf_ret = pnbuf;
cn->cn_nameiop = CREATE;
cn->cn_flags = (LOCKPARENT|HASBUF|SAVENAME|ISLASTCN);
cn->cn_flags = (LOCKPARENT|ISLASTCN);
if (um->um_op == UNMNT_ABOVE)
cn->cn_cred = cnp->cn_cred;
else
@ -965,7 +965,7 @@ union_vn_create(struct vnode **vpp, struct union_node *un, struct lwp *l)
pnbuf = PNBUF_GET();
memcpy(pnbuf, un->un_path, cn.cn_namelen+1);
cn.cn_nameiop = CREATE;
cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|ISLASTCN);
cn.cn_flags = (LOCKPARENT|ISLASTCN);
cn.cn_cred = l->l_cred;
cn.cn_nameptr = pnbuf;
cn.cn_hash = un->un_hash;

View File

@ -310,7 +310,7 @@ unionfs_relookup(struct vnode *dvp, struct vnode **vpp,
pnbuf[pathlen] = '\0';
cn->cn_nameiop = nameiop;
cn->cn_flags = (LOCKPARENT | LOCKLEAF | HASBUF | SAVENAME | ISLASTCN);
cn->cn_flags = (LOCKPARENT | LOCKLEAF | ISLASTCN);
cn->cn_cred = cnp->cn_cred;
cn->cn_nameptr = pnbuf;
@ -327,7 +327,6 @@ unionfs_relookup(struct vnode *dvp, struct vnode **vpp,
if ((error = relookup(dvp, vpp, cn))) {
PNBUF_PUT(pnbuf);
*pnbuf_ret = NULL;
cn->cn_flags &= ~HASBUF;
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
} else {
*pnbuf_ret = pnbuf;
@ -626,7 +625,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp,
pnbuf = PNBUF_GET();
memcpy(pnbuf, unp->un_path, cn.cn_namelen + 1);
cn.cn_nameiop = CREATE;
cn.cn_flags = (LOCKPARENT | LOCKLEAF | HASBUF | SAVENAME | ISLASTCN);
cn.cn_flags = (LOCKPARENT | LOCKLEAF | ISLASTCN);
cn.cn_cred = cred;
cn.cn_nameptr = pnbuf;
cn.cn_consume = 0;
@ -861,7 +860,7 @@ unionfs_check_rmdir(struct vnode *vp, kauth_cred_t cred)
cn.cn_namelen = dp->d_namlen;
cn.cn_nameptr = dp->d_name;
cn.cn_nameiop = LOOKUP;
cn.cn_flags = (LOCKPARENT | LOCKLEAF | SAVENAME | RDONLY | ISLASTCN);
cn.cn_flags = (LOCKPARENT | LOCKLEAF | RDONLY | ISLASTCN);
cn.cn_cred = cred;
cn.cn_consume = 0;
@ -882,7 +881,7 @@ unionfs_check_rmdir(struct vnode *vp, kauth_cred_t cred)
* If it has no exist/whiteout entry in upper,
* directory is not empty.
*/
cn.cn_flags = (LOCKPARENT | LOCKLEAF | SAVENAME | RDONLY | ISLASTCN);
cn.cn_flags = (LOCKPARENT | LOCKLEAF | RDONLY | ISLASTCN);
lookuperr = VOP_LOOKUP(uvp, &tvp, &cn);
if (!lookuperr)

View File

@ -49,6 +49,7 @@
#include <sys/namei.h>
#include <sys/sysctl.h>
#include <sys/vnode.h>
#include <sys/buf.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <sys/dirent.h>
@ -990,11 +991,6 @@ unionfs_rename(void *v)
rtvp = tvp;
needrelookup = 0;
#ifdef DIAGNOSTIC
if (!(fcnp->cn_flags & HASBUF) || !(tcnp->cn_flags & HASBUF))
panic("unionfs_rename: no name");
#endif
/* check for cross device rename */
if (fvp->v_mount != tdvp->v_mount ||
(tvp != NULLVP && fvp->v_mount != tvp->v_mount)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_exec.c,v 1.302 2010/11/30 10:30:02 dholland Exp $ */
/* $NetBSD: kern_exec.c,v 1.303 2010/11/30 10:43:05 dholland Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.302 2010/11/30 10:30:02 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.303 2010/11/30 10:43:05 dholland Exp $");
#include "opt_ktrace.h"
#include "opt_modular.h"
@ -285,7 +285,7 @@ check_exec(struct lwp *l, struct exec_package *epp, struct pathbuf *pb)
struct nameidata nd;
size_t resid;
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | SAVENAME | TRYEMULROOT, pb);
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
/* first get the vnode */
if ((error = namei(&nd)) != 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_lookup.c,v 1.124 2010/11/30 10:30:02 dholland Exp $ */
/* $NetBSD: vfs_lookup.c,v 1.125 2010/11/30 10:43:05 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.124 2010/11/30 10:30:02 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.125 2010/11/30 10:43:05 dholland Exp $");
#include "opt_magiclinks.h"
@ -445,7 +445,6 @@ namei_start1(struct namei_state *state)
panic("namei: flags contaminated with nameiops");
#endif
KASSERT((state->cnp->cn_flags & HASBUF) == 0);
/*
* The buffer for name translation shall be the one inside the
* pathbuf.

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfs_vnops.c,v 1.184 2010/11/30 10:30:02 dholland Exp $ */
/* $NetBSD: genfs_vnops.c,v 1.185 2010/11/30 10:43:05 dholland Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.184 2010/11/30 10:30:02 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.185 2010/11/30 10:43:05 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -188,7 +188,7 @@ genfs_eopnotsupp(void *v)
KASSERT(desc->vdesc_offset != VOP_ABORTOP_DESCOFFSET);
/*
* Free componentname that lookup potentially SAVENAMEd.
* Abort any componentname that lookup potentially left state in.
*
* As is logical, componentnames for VOP_RENAME are handled by
* the caller of VOP_RENAME. Yay, rename!

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vnops.c,v 1.286 2010/11/30 10:30:03 dholland Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.287 2010/11/30 10:43:05 dholland Exp $ */
/*
* Copyright (c) 1989, 1993
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.286 2010/11/30 10:30:03 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.287 2010/11/30 10:43:05 dholland Exp $");
#ifdef _KERNEL_OPT
#include "opt_nfs.h"
@ -800,8 +800,6 @@ nfs_lookup(void *v)
return EISDIR;
vref(dvp);
*vpp = dvp;
if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN))
cnp->cn_flags |= SAVENAME;
return 0;
}
@ -872,8 +870,6 @@ nfs_lookup(void *v)
if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred)
&& vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) {
nfsstats.lookupcache_hits++;
if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN))
cnp->cn_flags |= SAVENAME;
KASSERT(newvp->v_type != VNON);
return (0);
}
@ -894,7 +890,6 @@ dorpc:
if (v3 && cnp->cn_nameiop == CREATE &&
(flags & (ISLASTCN|ISDOTDOT)) == ISLASTCN &&
(dvp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
cnp->cn_flags |= SAVENAME;
return (EJUSTRETURN);
}
#endif /* 0 */
@ -939,7 +934,6 @@ dorpc:
nfsm_loadattr(newvp, (struct vattr *)0, 0);
*vpp = newvp;
m_freem(mrep);
cnp->cn_flags |= SAVENAME;
goto validate;
}
@ -1001,8 +995,6 @@ dorpc:
#endif
nfsm_loadattr(newvp, (struct vattr *)0, 0);
}
if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN))
cnp->cn_flags |= SAVENAME;
if ((cnp->cn_flags & MAKEENTRY) &&
(cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) {
nfs_cache_enter(dvp, newvp, cnp);
@ -1034,7 +1026,6 @@ noentry:
error = EROFS;
} else {
error = EJUSTRETURN;
cnp->cn_flags |= SAVENAME;
}
}
*vpp = NULL;
@ -1767,8 +1758,6 @@ nfs_remove(void *v)
struct vattr vattr;
#ifndef DIAGNOSTIC
if ((cnp->cn_flags & HASBUF) == 0)
panic("nfs_remove: no name");
if (vp->v_usecount < 1)
panic("nfs_remove: bad v_usecount");
#endif
@ -1889,11 +1878,6 @@ nfs_rename(void *v)
struct componentname *fcnp = ap->a_fcnp;
int error;
#ifndef DIAGNOSTIC
if ((tcnp->cn_flags & HASBUF) == 0 ||
(fcnp->cn_flags & HASBUF) == 0)
panic("nfs_rename: no name");
#endif
/* Check for cross-device rename */
if ((fvp->v_mount != tdvp->v_mount) ||
(tvp && (fvp->v_mount != tvp->v_mount))) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: namei.src,v 1.16 2010/11/30 10:29:57 dholland Exp $ */
/* $NetBSD: namei.src,v 1.17 2010/11/30 10:43:01 dholland Exp $ */
/*
* Copyright (c) 1985, 1989, 1991, 1993
@ -150,21 +150,13 @@ NAMEIFL MODMASK 0x010000fc /* mask of operational modifiers */
/*
* Namei parameter descriptors.
*
* SAVENAME may be set by either the callers of namei or by VOP_LOOKUP.
* If the caller of namei sets the flag (for example execve wants to
* know the name of the program that is being executed), then it must
* free the buffer. If VOP_LOOKUP sets the flag, then the buffer must
* be freed by either the commit routine or the VOP_ABORT routine.
* SAVESTART is set only by the callers of namei. It implies SAVENAME
* plus the addition of saving the parent directory that contains the
* name in ni_startdir. It allows repeated calls to lookup for the
* name being sought. The caller is responsible for releasing the
* buffer and for vrele'ing ni_startdir.
* SAVESTART is set only by the callers of namei. It implies saving
* the parent directory that contains the name in ni_startdir. It
* allows repeated calls to lookup for the name being sought. The
* caller is responsible for vrele'ing ni_startdir.
*/
NAMEIFL NOCROSSMOUNT 0x0000100 /* do not cross mount points */
NAMEIFL RDONLY 0x0000200 /* lookup with read-only semantics */
NAMEIFL HASBUF 0x0000400 /* has allocated pathname buffer */
NAMEIFL SAVENAME 0x0000800 /* save pathname buffer */
NAMEIFL SAVESTART 0x0001000 /* save starting directory */
NAMEIFL ISDOTDOT 0x0002000 /* current component name is .. */
NAMEIFL MAKEENTRY 0x0004000 /* entry is to be added to name cache */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_lookup.c,v 1.62 2010/06/24 13:03:18 hannken Exp $ */
/* $NetBSD: ext2fs_lookup.c,v 1.63 2010/11/30 10:43:06 dholland Exp $ */
/*
* Modified for NetBSD 1.2E
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.62 2010/06/24 13:03:18 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.63 2010/11/30 10:43:06 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -518,13 +518,10 @@ searchloop:
* We return ni_vp == NULL to indicate that the entry
* does not currently exist; we leave a pointer to
* the (locked) directory inode in ndp->ni_dvp.
* The pathname buffer is saved so that the name
* can be obtained later.
*
* NB - if the directory is unlocked, then this
* information cannot be used.
*/
cnp->cn_flags |= SAVENAME;
return (EJUSTRETURN);
}
/*
@ -636,7 +633,6 @@ found:
if (error)
return (error);
*vpp = tdp;
cnp->cn_flags |= SAVENAME;
return (0);
}
@ -756,10 +752,6 @@ ext2fs_direnter(struct inode *ip, struct vnode *dvp, struct componentname *cnp)
struct ufsmount *ump = VFSTOUFS(dvp->v_mount);
int dirblksiz = ump->um_dirblksiz;
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & SAVENAME) == 0)
panic("direnter: missing name");
#endif
dp = VTOI(dvp);
newdir.e2d_ino = h2fs32(ip->i_number);
newdir.e2d_namlen = cnp->cn_namelen;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_vnops.c,v 1.95 2010/11/30 10:30:03 dholland Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.96 2010/11/30 10:43:06 dholland Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.95 2010/11/30 10:30:03 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.96 2010/11/30 10:43:06 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -568,10 +568,6 @@ ext2fs_link(void *v)
struct inode *ip;
int error;
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & HASBUF) == 0)
panic("ext2fs_link: no name");
#endif
if (vp->v_type == VDIR) {
VOP_ABORTOP(dvp, cnp);
error = EISDIR;
@ -663,11 +659,6 @@ ext2fs_rename(void *v)
int error = 0;
u_char namlen;
#ifdef DIAGNOSTIC
if ((tcnp->cn_flags & HASBUF) == 0 ||
(fcnp->cn_flags & HASBUF) == 0)
panic("ext2fs_rename: no name");
#endif
/*
* Check for cross-device rename.
*/
@ -1060,10 +1051,6 @@ ext2fs_mkdir(void *v)
struct ext2fs_dirtemplate dirtemplate;
int error, dmode;
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & HASBUF) == 0)
panic("ext2fs_mkdir: no name");
#endif
if ((nlink_t)dp->i_e2fs_nlink >= LINK_MAX) {
error = EMLINK;
goto out;
@ -1425,10 +1412,6 @@ ext2fs_makeinode(int mode, struct vnode *dvp, struct vnode **vpp,
int error, ismember = 0;
pdir = VTOI(dvp);
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & HASBUF) == 0)
panic("ext2fs_makeinode: no name");
#endif
*vpp = NULL;
if ((mode & IFMT) == 0)
mode |= IFREG;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_lookup.c,v 1.105 2010/06/24 13:03:20 hannken Exp $ */
/* $NetBSD: ufs_lookup.c,v 1.106 2010/11/30 10:43:06 dholland Exp $ */
/*
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.105 2010/06/24 13:03:20 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.106 2010/11/30 10:43:06 dholland Exp $");
#ifdef _KERNEL_OPT
#include "opt_ffs.h"
@ -465,13 +465,10 @@ notfound:
* We return ni_vp == NULL to indicate that the entry
* does not currently exist; we leave a pointer to
* the (locked) directory inode in ndp->ni_dvp.
* The pathname buffer is saved so that the name
* can be obtained later.
*
* NB - if the directory is unlocked, then this
* information cannot be used.
*/
cnp->cn_flags |= SAVENAME;
error = EJUSTRETURN;
goto out;
}
@ -588,7 +585,6 @@ found:
if (error)
goto out;
*vpp = tdp;
cnp->cn_flags |= SAVENAME;
error = 0;
goto out;
}
@ -723,10 +719,6 @@ void
ufs_makedirentry(struct inode *ip, struct componentname *cnp,
struct direct *newdirp)
{
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & SAVENAME) == 0)
panic("makedirentry: missing name");
#endif
newdirp->d_ino = ip->i_number;
newdirp->d_namlen = cnp->cn_namelen;
memcpy(newdirp->d_name, cnp->cn_nameptr, (size_t)cnp->cn_namelen);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vnops.c,v 1.184 2010/11/30 10:30:04 dholland Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.185 2010/11/30 10:43:06 dholland Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.184 2010/11/30 10:30:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.185 2010/11/30 10:43:06 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -804,10 +804,7 @@ ufs_link(void *v)
dvp = ap->a_dvp;
vp = ap->a_vp;
cnp = ap->a_cnp;
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & HASBUF) == 0)
panic("ufs_link: no name");
#endif
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
if (vp->v_type == VDIR) {
VOP_ABORTOP(dvp, cnp);
@ -896,8 +893,6 @@ ufs_whiteout(void *v)
/* create a new directory whiteout */
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & SAVENAME) == 0)
panic("ufs_whiteout: missing name");
if (ump->um_maxsymlinklen <= 0)
panic("ufs_whiteout: old format filesystem");
#endif
@ -988,11 +983,6 @@ ufs_rename(void *v)
fcnp = ap->a_fcnp;
doingdirectory = oldparent = newparent = error = 0;
#ifdef DIAGNOSTIC
if ((tcnp->cn_flags & HASBUF) == 0 ||
(fcnp->cn_flags & HASBUF) == 0)
panic("ufs_rename: no name");
#endif
/*
* Check for cross-device rename.
*/
@ -1366,10 +1356,6 @@ ufs_mkdir(void *v)
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & HASBUF) == 0)
panic("ufs_mkdir: no name");
#endif
if ((nlink_t)dp->i_nlink >= LINK_MAX) {
error = EMLINK;
goto out;
@ -2177,10 +2163,7 @@ ufs_makeinode(int mode, struct vnode *dvp, struct vnode **vpp,
UFS_WAPBL_JUNLOCK_ASSERT(dvp->v_mount);
pdir = VTOI(dvp);
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & HASBUF) == 0)
panic("ufs_makeinode: no name");
#endif
if ((mode & IFMT) == 0)
mode |= IFREG;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_wapbl.c,v 1.10 2010/06/24 13:03:20 hannken Exp $ */
/* $NetBSD: ufs_wapbl.c,v 1.11 2010/11/30 10:43:06 dholland Exp $ */
/*-
* Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_wapbl.c,v 1.10 2010/06/24 13:03:20 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_wapbl.c,v 1.11 2010/11/30 10:43:06 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -178,11 +178,6 @@ wapbl_ufs_rename(void *v)
fcnp = ap->a_fcnp;
doingdirectory = oldparent = newparent = error = 0;
#ifdef DIAGNOSTIC
if ((tcnp->cn_flags & HASBUF) == 0 ||
(fcnp->cn_flags & HASBUF) == 0)
panic("ufs_rename: no name");
#endif
/*
* Check for cross-device rename.
*/