From 6fc0e64503d20c01c536c61ec00e3b0cf2c15df8 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 29 Sep 2003 18:52:16 +0000 Subject: [PATCH] Cleanup: get rid of the CNP_NOFOLLOW pseudo-flag. #define 0'd flags are a really bad idea. --- sys/emulation/linux/linux_stats.c | 6 +++--- sys/emulation/svr4/svr4_misc.c | 4 ++-- sys/kern/kern_acct.c | 4 ++-- sys/kern/kern_ktrace.c | 5 ++--- sys/kern/kern_sig.c | 4 ++-- sys/kern/uipc_usrreq.c | 5 ++--- sys/kern/vfs_syscalls.c | 18 ++++++++---------- sys/kern/vfs_vnops.c | 4 ++-- sys/sys/namei.h | 3 +-- sys/vfs/coda/coda_vnops.c | 4 ++-- sys/vfs/nfs/nfs_serv.c | 4 ++-- 11 files changed, 28 insertions(+), 33 deletions(-) diff --git a/sys/emulation/linux/linux_stats.c b/sys/emulation/linux/linux_stats.c index 39e53ba19f..53b7d2dd00 100644 --- a/sys/emulation/linux/linux_stats.c +++ b/sys/emulation/linux/linux_stats.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_stats.c,v 1.22.2.3 2001/11/05 19:08:23 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_stats.c,v 1.8 2003/09/23 05:03:51 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_stats.c,v 1.9 2003/09/29 18:52:09 dillon Exp $ */ #include @@ -137,7 +137,7 @@ linux_newlstat(struct linux_newlstat_args *args) printf(ARGS(newlstat, "%s, *"), args->path); #endif - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW | CNP_LOCKLEAF | CNP_NOOBJ, + NDINIT(&nd, NAMEI_LOOKUP, CNP_LOCKLEAF | CNP_NOOBJ, UIO_USERSPACE, args->path, td); error = namei(&nd); if (error) @@ -450,7 +450,7 @@ linux_lstat64(struct linux_lstat64_args *args) printf(ARGS(lstat64, "%s, *"), args->filename); #endif - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW | CNP_LOCKLEAF | CNP_NOOBJ, + NDINIT(&nd, NAMEI_LOOKUP, CNP_LOCKLEAF | CNP_NOOBJ, UIO_USERSPACE, args->filename, td); error = namei(&nd); if (error) diff --git a/sys/emulation/svr4/svr4_misc.c b/sys/emulation/svr4/svr4_misc.c index 7c12cf6209..20032bc876 100644 --- a/sys/emulation/svr4/svr4_misc.c +++ b/sys/emulation/svr4/svr4_misc.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_misc.c,v 1.13.2.7 2003/01/14 21:33:58 dillon Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_misc.c,v 1.17 2003/09/23 05:03:51 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_misc.c,v 1.18 2003/09/29 18:52:11 dillon Exp $ */ /* @@ -1656,7 +1656,7 @@ svr4_sys_resolvepath(struct svr4_sys_resolvepath_args *uap) retval = &uap->sysmsg_result; - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW | CNP_SAVENAME, UIO_USERSPACE, + NDINIT(&nd, NAMEI_LOOKUP, CNP_SAVENAME, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index fff72066eb..f0ae149c42 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -38,7 +38,7 @@ * * @(#)kern_acct.c 8.1 (Berkeley) 6/14/93 * $FreeBSD: src/sys/kern/kern_acct.c,v 1.23.2.1 2002/07/24 18:33:55 johan Exp $ - * $DragonFly: src/sys/kern/kern_acct.c,v 1.7 2003/09/23 05:03:51 dillon Exp $ + * $DragonFly: src/sys/kern/kern_acct.c,v 1.8 2003/09/29 18:52:06 dillon Exp $ */ #include @@ -130,7 +130,7 @@ acct(uap) * appending and make sure it's a 'normal'. */ if (SCARG(uap, path) != NULL) { - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW, UIO_USERSPACE, + NDINIT(&nd, NAMEI_LOOKUP, 0, UIO_USERSPACE, SCARG(uap, path), td); error = vn_open(&nd, FWRITE | O_APPEND, 0); if (error) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 7c070da7f3..b0b010668f 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -32,7 +32,7 @@ * * @(#)kern_ktrace.c 8.2 (Berkeley) 9/23/93 * $FreeBSD: src/sys/kern/kern_ktrace.c,v 1.35.2.6 2002/07/05 22:36:38 darrenr Exp $ - * $DragonFly: src/sys/kern/kern_ktrace.c,v 1.10 2003/09/23 05:03:51 dillon Exp $ + * $DragonFly: src/sys/kern/kern_ktrace.c,v 1.11 2003/09/29 18:52:06 dillon Exp $ */ #include "opt_ktrace.h" @@ -281,8 +281,7 @@ ktrace(struct ktrace_args *uap) /* * an operation which requires a file argument. */ - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW, UIO_USERSPACE, - uap->fname, td); + NDINIT(&nd, NAMEI_LOOKUP, 0, UIO_USERSPACE, uap->fname, td); error = vn_open(&nd, FREAD|FWRITE|O_NOFOLLOW, 0); if (error) { curp->p_traceflag &= ~KTRFAC_ACTIVE; diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 879774d554..589dd90859 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -37,7 +37,7 @@ * * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94 * $FreeBSD: src/sys/kern/kern_sig.c,v 1.72.2.17 2003/05/16 16:34:34 obrien Exp $ - * $DragonFly: src/sys/kern/kern_sig.c,v 1.19 2003/09/23 05:03:51 dillon Exp $ + * $DragonFly: src/sys/kern/kern_sig.c,v 1.20 2003/09/29 18:52:06 dillon Exp $ */ #include "opt_compat.h" @@ -1530,7 +1530,7 @@ coredump(struct proc *p) name = expand_name(p->p_comm, p->p_ucred->cr_uid, p->p_pid); if (name == NULL) return (EINVAL); - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW, UIO_SYSSPACE, name, td); + NDINIT(&nd, NAMEI_LOOKUP, 0, UIO_SYSSPACE, name, td); error = vn_open(&nd, O_CREAT | FWRITE | O_NOFOLLOW, S_IRUSR | S_IWUSR); free(name, M_TEMP); if (error) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index e22b187d52..3c731844cc 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -32,7 +32,7 @@ * * From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94 * $FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.54.2.10 2003/03/04 17:28:09 nectar Exp $ - * $DragonFly: src/sys/kern/uipc_usrreq.c,v 1.8 2003/09/23 05:03:51 dillon Exp $ + * $DragonFly: src/sys/kern/uipc_usrreq.c,v 1.9 2003/09/29 18:52:06 dillon Exp $ */ #include @@ -599,8 +599,7 @@ unp_bind(struct unpcb *unp, struct sockaddr *nam, struct thread *td) return EINVAL; strncpy(buf, soun->sun_path, namelen); buf[namelen] = 0; /* null-terminate the string */ - NDINIT(&nd, NAMEI_CREATE, CNP_NOFOLLOW | CNP_LOCKPARENT, - UIO_SYSSPACE, buf, td); + NDINIT(&nd, NAMEI_CREATE, CNP_LOCKPARENT, UIO_SYSSPACE, buf, td); /* SHOULD BE ABLE TO ADOPT EXISTING AND wakeup() ALA FIFO's */ error = namei(&nd); if (error) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index f8c76179af..c301d033f4 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -37,7 +37,7 @@ * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 * $FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.151.2.18 2003/04/04 20:35:58 tegge Exp $ - * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.18 2003/09/28 03:44:02 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.19 2003/09/29 18:52:06 dillon Exp $ */ /* For 4.3 integer FS ID compatibility */ @@ -1554,7 +1554,7 @@ olstat(struct olstat_args *uap) int error; struct nameidata nd; - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW | CNP_LOCKLEAF | CNP_NOOBJ, + NDINIT(&nd, NAMEI_LOOKUP, CNP_LOCKLEAF | CNP_NOOBJ, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); @@ -1640,7 +1640,7 @@ lstat(struct lstat_args *uap) struct stat sb; struct nameidata nd; - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW | CNP_LOCKLEAF | CNP_NOOBJ, + NDINIT(&nd, NAMEI_LOOKUP, CNP_LOCKLEAF | CNP_NOOBJ, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); @@ -1721,7 +1721,7 @@ nlstat(struct nlstat_args *uap) struct nstat nsb; struct nameidata nd; - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW | CNP_LOCKLEAF | CNP_NOOBJ, + NDINIT(&nd, NAMEI_LOOKUP, CNP_LOCKLEAF | CNP_NOOBJ, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); @@ -1776,7 +1776,7 @@ readlink(struct readlink_args *uap) int error; struct nameidata nd; - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW | CNP_LOCKLEAF | CNP_NOOBJ, + NDINIT(&nd, NAMEI_LOOKUP, CNP_LOCKLEAF | CNP_NOOBJ, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); @@ -1923,8 +1923,7 @@ lchmod(struct lchmod_args *uap) int error; struct nameidata nd; - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW, UIO_USERSPACE, - SCARG(uap, path), td); + NDINIT(&nd, NAMEI_LOOKUP, 0, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -2006,8 +2005,7 @@ lchown(struct lchown_args *uap) int error; struct nameidata nd; - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW, UIO_USERSPACE, - SCARG(uap, path), td); + NDINIT(&nd, NAMEI_LOOKUP, 0, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -2120,7 +2118,7 @@ lutimes(struct lutimes_args *uap) usrtvp = SCARG(uap, tptr); if ((error = getutimes(usrtvp, ts)) != 0) return (error); - NDINIT(&nd, NAMEI_LOOKUP, CNP_NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), td); + NDINIT(&nd, NAMEI_LOOKUP, 0, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 25599d7d18..e5146f15ad 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -37,7 +37,7 @@ * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/vfs_vnops.c,v 1.87.2.13 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_vnops.c,v 1.13 2003/09/23 05:03:51 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_vnops.c,v 1.14 2003/09/29 18:52:06 dillon Exp $ */ #include @@ -139,7 +139,7 @@ vn_open(ndp, fmode, cmode) } else { ndp->ni_cnd.cn_nameiop = NAMEI_LOOKUP; ndp->ni_cnd.cn_flags = CNP_LOCKLEAF | - ((fmode & O_NOFOLLOW) ? CNP_NOFOLLOW : CNP_FOLLOW); + ((fmode & O_NOFOLLOW) ? 0 : CNP_FOLLOW); error = namei(ndp); if (error) return (error); diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 44b08e7b87..525a60c0f3 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -32,7 +32,7 @@ * * @(#)namei.h 8.5 (Berkeley) 1/9/95 * $FreeBSD: src/sys/sys/namei.h,v 1.29.2.2 2001/09/30 21:12:54 luigi Exp $ - * $DragonFly: src/sys/sys/namei.h,v 1.6 2003/09/23 05:03:52 dillon Exp $ + * $DragonFly: src/sys/sys/namei.h,v 1.7 2003/09/29 18:52:08 dillon Exp $ */ #ifndef _SYS_NAMEI_H_ @@ -119,7 +119,6 @@ struct nameidata { #define CNP_NOCACHE 0x00000020 /* name must not be left in cache */ #define CNP_FOLLOW 0x00000040 /* follow symbolic links */ #define CNP_NOOBJ 0x00000080 /* don't create object */ -#define CNP_NOFOLLOW 0x00000000 /* do not follow symlinks (pseudo) */ #define CNP_MODMASK 0x000000fc /* mask of operational modifiers */ /* * Namei parameter descriptors. diff --git a/sys/vfs/coda/coda_vnops.c b/sys/vfs/coda/coda_vnops.c index 1f4ccd24bf..3e4bdee5ec 100644 --- a/sys/vfs/coda/coda_vnops.c +++ b/sys/vfs/coda/coda_vnops.c @@ -28,7 +28,7 @@ * * @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * $FreeBSD: src/sys/coda/coda_vnops.c,v 1.22.2.1 2001/06/29 16:26:22 shafeeq Exp $ - * $DragonFly: src/sys/vfs/coda/Attic/coda_vnops.c,v 1.10 2003/09/23 05:03:52 dillon Exp $ + * $DragonFly: src/sys/vfs/coda/Attic/coda_vnops.c,v 1.11 2003/09/29 18:52:12 dillon Exp $ * */ @@ -548,7 +548,7 @@ coda_ioctl(v) /* Should we use the name cache here? It would get it from lookupname sooner or later anyway, right? */ - NDINIT(&ndp, NAMEI_LOOKUP, (iap->follow ? CNP_FOLLOW : CNP_NOFOLLOW), UIO_USERSPACE, iap->path, td); + NDINIT(&ndp, NAMEI_LOOKUP, (iap->follow ? CNP_FOLLOW : 0), UIO_USERSPACE, iap->path, td); error = namei(&ndp); tvp = ndp.ni_vp; diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c index 4a44726016..5e68c0b0ab 100644 --- a/sys/vfs/nfs/nfs_serv.c +++ b/sys/vfs/nfs/nfs_serv.c @@ -35,7 +35,7 @@ * * @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95 * $FreeBSD: src/sys/nfs/nfs_serv.c,v 1.93.2.6 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.9 2003/09/23 05:03:53 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.10 2003/09/29 18:52:16 dillon Exp $ */ /* @@ -2583,7 +2583,7 @@ nfsrv_symlink(nfsd, slp, td, mrq) */ nd.ni_cnd.cn_nameiop = NAMEI_LOOKUP; nd.ni_cnd.cn_flags &= ~(CNP_LOCKPARENT | CNP_FOLLOW); - nd.ni_cnd.cn_flags |= (CNP_NOFOLLOW | CNP_LOCKLEAF); + nd.ni_cnd.cn_flags |= CNP_LOCKLEAF; nd.ni_cnd.cn_td = td; nd.ni_cnd.cn_cred = cred; -- 2.41.0