Source-Changes-HG archive

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

[src/trunk]: src/sys Define namei flag INRENAME and set it if a lookup operat...



details:   https://anonhg.NetBSD.org/src/rev/ca6f92bb9e8e
branches:  trunk
changeset: 750285:ca6f92bb9e8e
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Dec 23 01:09:24 2009 +0000

description:
Define namei flag INRENAME and set it if a lookup operation is part
of rename.  This helps with building better asserts for rename in
the DELETE lookup ... the RENAME lookup is quite obviously a part
of rename.

diffstat:

 sys/kern/vfs_syscalls.c |  8 ++++----
 sys/nfs/nfs_serv.c      |  9 +++++----
 sys/sys/namei.src       |  5 +++--
 3 files changed, 12 insertions(+), 10 deletions(-)

diffs (92 lines):

diff -r 4fb885b5c439 -r ca6f92bb9e8e sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Wed Dec 23 01:04:45 2009 +0000
+++ b/sys/kern/vfs_syscalls.c   Wed Dec 23 01:09:24 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.400 2009/12/19 20:28:27 martin Exp $        */
+/*     $NetBSD: vfs_syscalls.c,v 1.401 2009/12/23 01:09:24 pooka Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.400 2009/12/19 20:28:27 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.401 2009/12/23 01:09:24 pooka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -3264,7 +3264,7 @@
        uint32_t saveflag;
        int error;
 
-       NDINIT(&fromnd, DELETE, LOCKPARENT | SAVESTART | TRYEMULROOT,
+       NDINIT(&fromnd, DELETE, LOCKPARENT | SAVESTART | TRYEMULROOT | INRENAME,
            seg, from);
        if ((error = namei(&fromnd)) != 0)
                return (error);
@@ -3329,7 +3329,7 @@
 
        NDINIT(&tond, RENAME,
            LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART | TRYEMULROOT
-             | (fvp->v_type == VDIR ? CREATEDIR : 0),
+             | INRENAME | (fvp->v_type == VDIR ? CREATEDIR : 0),
            seg, to);
        if ((error = namei(&tond)) != 0) {
                VFS_RENAMELOCK_EXIT(fs);
diff -r 4fb885b5c439 -r ca6f92bb9e8e sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c        Wed Dec 23 01:04:45 2009 +0000
+++ b/sys/nfs/nfs_serv.c        Wed Dec 23 01:09:24 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_serv.c,v 1.148 2009/11/07 07:27:49 cegger Exp $    */
+/*     $NetBSD: nfs_serv.c,v 1.149 2009/12/23 01:09:25 pooka Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.148 2009/11/07 07:27:49 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.149 2009/12/23 01:09:25 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1863,7 +1863,7 @@
        saved_uid = kauth_cred_geteuid(cred);
        fromnd.ni_cnd.cn_cred = cred;
        fromnd.ni_cnd.cn_nameiop = DELETE;
-       fromnd.ni_cnd.cn_flags = LOCKPARENT | SAVESTART;
+       fromnd.ni_cnd.cn_flags = LOCKPARENT | SAVESTART | INRENAME;
        error = nfs_namei(&fromnd, &fnsfh, len, slp, nam, &md,
                &dpos, &fdirp, lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
        if (fdirp && v3) {
@@ -1934,7 +1934,8 @@
        kauth_cred_seteuid(cred, saved_uid);
        tond.ni_cnd.cn_cred = cred;
        tond.ni_cnd.cn_nameiop = RENAME;
-       tond.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART;
+       tond.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | NOCACHE |
+           SAVESTART | INRENAME;
        error = nfs_namei(&tond, &tnsfh, len2, slp, nam, &md,
                &dpos, &tdirp, lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
        if (tdirp && v3) {
diff -r 4fb885b5c439 -r ca6f92bb9e8e sys/sys/namei.src
--- a/sys/sys/namei.src Wed Dec 23 01:04:45 2009 +0000
+++ b/sys/sys/namei.src Wed Dec 23 01:09:24 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namei.src,v 1.13 2009/09/27 17:23:54 dholland Exp $    */
+/*     $NetBSD: namei.src,v 1.14 2009/12/23 01:09:24 pooka Exp $       */
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -139,7 +139,8 @@
 NAMEIFL        DOWHITEOUT      0x0040000       /* do whiteouts */
 NAMEIFL        REQUIREDIR      0x0080000       /* must be a directory */
 NAMEIFL        CREATEDIR       0x0200000       /* trailing slashes are ok */
-NAMEIFL        PARAMASK        0x02fff00       /* mask of parameter descriptors */
+NAMEIFL        INRENAME        0x0400000       /* operation is a part of ``rename'' */
+NAMEIFL        PARAMASK        0x06fff00       /* mask of parameter descriptors */
 
 /*
  * Initialization of an nameidata structure.



Home | Main Index | Thread Index | Old Index