Fri Jan 7 11:25:43 2011 UTC ()
regen: fix PARAMASK


(pooka)
diff -r1.13 -r1.14 src/sys/rump/include/rump/rump_namei.h
diff -r1.74 -r1.75 src/sys/sys/namei.h

cvs diff -r1.13 -r1.14 src/sys/rump/include/rump/rump_namei.h (switch to unified diff)

--- src/sys/rump/include/rump/rump_namei.h 2011/01/02 05:12:57 1.13
+++ src/sys/rump/include/rump/rump_namei.h 2011/01/07 11:25:43 1.14
@@ -1,42 +1,42 @@ @@ -1,42 +1,42 @@
1/* $NetBSD: rump_namei.h,v 1.13 2011/01/02 05:12:57 dholland Exp $ */ 1/* $NetBSD: rump_namei.h,v 1.14 2011/01/07 11:25:43 pooka Exp $ */
2 2
3 3
4/* 4/*
5 * WARNING: GENERATED FILE. DO NOT EDIT 5 * WARNING: GENERATED FILE. DO NOT EDIT
6 * (edit namei.src and run make namei in src/sys/sys) 6 * (edit namei.src and run make namei in src/sys/sys)
7 * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp  7 * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp
8 * from: NetBSD: namei.src,v 1.21 2011/01/02 05:12:33 dholland Exp  8 * from: NetBSD: namei.src,v 1.22 2011/01/07 11:25:10 pooka Exp
9 */ 9 */
10 10
11#ifndef _RUMP_RUMP_NAMEI_H_ 11#ifndef _RUMP_RUMP_NAMEI_H_
12#define _RUMP_RUMP_NAMEI_H_ 12#define _RUMP_RUMP_NAMEI_H_
13 13
14#define RUMP_NAMEI_LOOKUP 0 14#define RUMP_NAMEI_LOOKUP 0
15#define RUMP_NAMEI_CREATE 1 15#define RUMP_NAMEI_CREATE 1
16#define RUMP_NAMEI_DELETE 2 16#define RUMP_NAMEI_DELETE 2
17#define RUMP_NAMEI_RENAME 3 17#define RUMP_NAMEI_RENAME 3
18#define RUMP_NAMEI_OPMASK 3 18#define RUMP_NAMEI_OPMASK 3
19#define RUMP_NAMEI_LOCKLEAF 0x00000004 19#define RUMP_NAMEI_LOCKLEAF 0x00000004
20#define RUMP_NAMEI_LOCKPARENT 0x00000008 20#define RUMP_NAMEI_LOCKPARENT 0x00000008
21#define RUMP_NAMEI_TRYEMULROOT 0x00000010 21#define RUMP_NAMEI_TRYEMULROOT 0x00000010
22#define RUMP_NAMEI_NOCACHE 0x00000020 22#define RUMP_NAMEI_NOCACHE 0x00000020
23#define RUMP_NAMEI_FOLLOW 0x00000040 23#define RUMP_NAMEI_FOLLOW 0x00000040
24#define RUMP_NAMEI_NOFOLLOW 0x00000000 24#define RUMP_NAMEI_NOFOLLOW 0x00000000
25#define RUMP_NAMEI_EMULROOTSET 0x00000080 25#define RUMP_NAMEI_EMULROOTSET 0x00000080
26#define RUMP_NAMEI_NOCHROOT 0x01000000 26#define RUMP_NAMEI_NOCHROOT 0x01000000
27#define RUMP_NAMEI_MODMASK 0x010000fc 27#define RUMP_NAMEI_MODMASK 0x010000fc
28#define RUMP_NAMEI_NOCROSSMOUNT 0x0000100 28#define RUMP_NAMEI_NOCROSSMOUNT 0x0000100
29#define RUMP_NAMEI_RDONLY 0x0000200 29#define RUMP_NAMEI_RDONLY 0x0000200
30#define RUMP_NAMEI_ISDOTDOT 0x0002000 30#define RUMP_NAMEI_ISDOTDOT 0x0002000
31#define RUMP_NAMEI_MAKEENTRY 0x0004000 31#define RUMP_NAMEI_MAKEENTRY 0x0004000
32#define RUMP_NAMEI_ISLASTCN 0x0008000 32#define RUMP_NAMEI_ISLASTCN 0x0008000
33#define RUMP_NAMEI_ISSYMLINK 0x0010000 33#define RUMP_NAMEI_ISSYMLINK 0x0010000
34#define RUMP_NAMEI_ISWHITEOUT 0x0020000 34#define RUMP_NAMEI_ISWHITEOUT 0x0020000
35#define RUMP_NAMEI_DOWHITEOUT 0x0040000 35#define RUMP_NAMEI_DOWHITEOUT 0x0040000
36#define RUMP_NAMEI_REQUIREDIR 0x0080000 36#define RUMP_NAMEI_REQUIREDIR 0x0080000
37#define RUMP_NAMEI_CREATEDIR 0x0200000 37#define RUMP_NAMEI_CREATEDIR 0x0200000
38#define RUMP_NAMEI_INRENAME 0x0400000 38#define RUMP_NAMEI_INRENAME 0x0400000
39#define RUMP_NAMEI_INRELOOKUP 0x0800000 39#define RUMP_NAMEI_INRELOOKUP 0x0800000
40#define RUMP_NAMEI_PARAMASK 0x0efef00 40#define RUMP_NAMEI_PARAMASK 0x0efe300
41 41
42#endif /* _RUMP_RUMP_NAMEI_H_ */ 42#endif /* _RUMP_RUMP_NAMEI_H_ */

cvs diff -r1.74 -r1.75 src/sys/sys/namei.h (switch to unified diff)

--- src/sys/sys/namei.h 2011/01/02 05:12:56 1.74
+++ src/sys/sys/namei.h 2011/01/07 11:25:43 1.75
@@ -1,331 +1,331 @@ @@ -1,331 +1,331 @@
1/* $NetBSD: namei.h,v 1.74 2011/01/02 05:12:56 dholland Exp $ */ 1/* $NetBSD: namei.h,v 1.75 2011/01/07 11:25:43 pooka Exp $ */
2 2
3 3
4/* 4/*
5 * WARNING: GENERATED FILE. DO NOT EDIT 5 * WARNING: GENERATED FILE. DO NOT EDIT
6 * (edit namei.src and run make namei in src/sys/sys) 6 * (edit namei.src and run make namei in src/sys/sys)
7 * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp  7 * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp
8 * from: NetBSD: namei.src,v 1.21 2011/01/02 05:12:33 dholland Exp  8 * from: NetBSD: namei.src,v 1.22 2011/01/07 11:25:10 pooka Exp
9 */ 9 */
10 10
11/* 11/*
12 * Copyright (c) 1985, 1989, 1991, 1993 12 * Copyright (c) 1985, 1989, 1991, 1993
13 * The Regents of the University of California. All rights reserved. 13 * The Regents of the University of California. All rights reserved.
14 * 14 *
15 * Redistribution and use in source and binary forms, with or without 15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions 16 * modification, are permitted provided that the following conditions
17 * are met: 17 * are met:
18 * 1. Redistributions of source code must retain the above copyright 18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer. 19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright 20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the 21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution. 22 * documentation and/or other materials provided with the distribution.
23 * 3. Neither the name of the University nor the names of its contributors 23 * 3. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software 24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission. 25 * without specific prior written permission.
26 * 26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE. 37 * SUCH DAMAGE.
38 * 38 *
39 * @(#)namei.h 8.5 (Berkeley) 8/20/94 39 * @(#)namei.h 8.5 (Berkeley) 8/20/94
40 */ 40 */
41 41
42#ifndef _SYS_NAMEI_H_ 42#ifndef _SYS_NAMEI_H_
43#define _SYS_NAMEI_H_ 43#define _SYS_NAMEI_H_
44 44
45#include <sys/queue.h> 45#include <sys/queue.h>
46#include <sys/mutex.h> 46#include <sys/mutex.h>
47 47
48#ifdef _KERNEL 48#ifdef _KERNEL
49#include <sys/kauth.h> 49#include <sys/kauth.h>
50 50
51/* 51/*
52 * Abstraction for a single pathname. 52 * Abstraction for a single pathname.
53 * 53 *
54 * This contains both the pathname string and (eventually) all 54 * This contains both the pathname string and (eventually) all
55 * metadata that determines how the path is to be interpreted. 55 * metadata that determines how the path is to be interpreted.
56 * It is an opaque structure; the implementation is in vfs_lookup.c. 56 * It is an opaque structure; the implementation is in vfs_lookup.c.
57 * 57 *
58 * To call namei, first set up a pathbuf with pathbuf_create or 58 * To call namei, first set up a pathbuf with pathbuf_create or
59 * pathbuf_copyin, then do NDINIT(), then call namei, then AFTER THE 59 * pathbuf_copyin, then do NDINIT(), then call namei, then AFTER THE
60 * STRUCT NAMEIDATA IS DEAD, call pathbuf_destroy. Don't destroy the 60 * STRUCT NAMEIDATA IS DEAD, call pathbuf_destroy. Don't destroy the
61 * pathbuf before you've finished using the nameidata, or mysterious 61 * pathbuf before you've finished using the nameidata, or mysterious
62 * bad things may happen. 62 * bad things may happen.
63 * 63 *
64 * pathbuf_assimilate is like pathbuf_create but assumes ownership of 64 * pathbuf_assimilate is like pathbuf_create but assumes ownership of
65 * the string buffer passed in, which MUST BE of size PATH_MAX and 65 * the string buffer passed in, which MUST BE of size PATH_MAX and
66 * have been allocated with PNBUF_GET(). This should only be used when 66 * have been allocated with PNBUF_GET(). This should only be used when
67 * absolutely necessary; e.g. nfsd uses it for loading paths from 67 * absolutely necessary; e.g. nfsd uses it for loading paths from
68 * mbufs. 68 * mbufs.
69 */ 69 */
70struct pathbuf; 70struct pathbuf;
71 71
72struct pathbuf *pathbuf_create(const char *path); 72struct pathbuf *pathbuf_create(const char *path);
73struct pathbuf *pathbuf_assimilate(char *path); 73struct pathbuf *pathbuf_assimilate(char *path);
74int pathbuf_copyin(const char *userpath, struct pathbuf **ret); 74int pathbuf_copyin(const char *userpath, struct pathbuf **ret);
75void pathbuf_destroy(struct pathbuf *); 75void pathbuf_destroy(struct pathbuf *);
76 76
77/* get a copy of the (current) path string */ 77/* get a copy of the (current) path string */
78void pathbuf_copystring(const struct pathbuf *, char *buf, size_t maxlen); 78void pathbuf_copystring(const struct pathbuf *, char *buf, size_t maxlen);
79 79
80/* hold a reference copy of the original path string */ 80/* hold a reference copy of the original path string */
81const char *pathbuf_stringcopy_get(struct pathbuf *); 81const char *pathbuf_stringcopy_get(struct pathbuf *);
82void pathbuf_stringcopy_put(struct pathbuf *, const char *); 82void pathbuf_stringcopy_put(struct pathbuf *, const char *);
83 83
84// XXX remove this 84// XXX remove this
85int pathbuf_maybe_copyin(const char *userpath, enum uio_seg seg, struct pathbuf **ret); 85int pathbuf_maybe_copyin(const char *userpath, enum uio_seg seg, struct pathbuf **ret);
86 86
87/* 87/*
88 * Encapsulation of namei parameters. 88 * Encapsulation of namei parameters.
89 */ 89 */
90struct nameidata { 90struct nameidata {
91 /* 91 /*
92 * Arguments to namei/lookup. 92 * Arguments to namei/lookup.
93 */ 93 */
94 struct pathbuf *ni_pathbuf; /* pathname container */ 94 struct pathbuf *ni_pathbuf; /* pathname container */
95 char *ni_pnbuf; /* extra pathname buffer ref (XXX) */ 95 char *ni_pnbuf; /* extra pathname buffer ref (XXX) */
96 /* 96 /*
97 * Arguments to lookup. 97 * Arguments to lookup.
98 */ 98 */
99 struct vnode *ni_rootdir; /* logical root directory */ 99 struct vnode *ni_rootdir; /* logical root directory */
100 struct vnode *ni_erootdir; /* emulation root directory */ 100 struct vnode *ni_erootdir; /* emulation root directory */
101 /* 101 /*
102 * Results: returned from/manipulated by lookup 102 * Results: returned from/manipulated by lookup
103 */ 103 */
104 struct vnode *ni_vp; /* vnode of result */ 104 struct vnode *ni_vp; /* vnode of result */
105 struct vnode *ni_dvp; /* vnode of intermediate directory */ 105 struct vnode *ni_dvp; /* vnode of intermediate directory */
106 /* 106 /*
107 * Shared between namei and lookup/commit routines. 107 * Shared between namei and lookup/commit routines.
108 */ 108 */
109 size_t ni_pathlen; /* remaining chars in path */ 109 size_t ni_pathlen; /* remaining chars in path */
110 const char *ni_next; /* next location in pathname */ 110 const char *ni_next; /* next location in pathname */
111 unsigned int ni_loopcnt; /* count of symlinks encountered */ 111 unsigned int ni_loopcnt; /* count of symlinks encountered */
112 /* 112 /*
113 * Lookup parameters: this structure describes the subset of 113 * Lookup parameters: this structure describes the subset of
114 * information from the nameidata structure that is passed 114 * information from the nameidata structure that is passed
115 * through the VOP interface. 115 * through the VOP interface.
116 */ 116 */
117 struct componentname { 117 struct componentname {
118 /* 118 /*
119 * Arguments to lookup. 119 * Arguments to lookup.
120 */ 120 */
121 uint32_t cn_nameiop; /* namei operation */ 121 uint32_t cn_nameiop; /* namei operation */
122 uint32_t cn_flags; /* flags to namei */ 122 uint32_t cn_flags; /* flags to namei */
123 kauth_cred_t cn_cred; /* credentials */ 123 kauth_cred_t cn_cred; /* credentials */
124 /* 124 /*
125 * Shared between lookup and commit routines. 125 * Shared between lookup and commit routines.
126 */ 126 */
127 const char *cn_nameptr; /* pointer to looked up name */ 127 const char *cn_nameptr; /* pointer to looked up name */
128 size_t cn_namelen; /* length of looked up comp */ 128 size_t cn_namelen; /* length of looked up comp */
129 u_long cn_hash; /* hash val of looked up name */ 129 u_long cn_hash; /* hash val of looked up name */
130 size_t cn_consume; /* chars to consume in lookup */ 130 size_t cn_consume; /* chars to consume in lookup */
131 } ni_cnd; 131 } ni_cnd;
132}; 132};
133 133
134/* 134/*
135 * namei operations 135 * namei operations
136 */ 136 */
137#define LOOKUP 0 /* perform name lookup only */ 137#define LOOKUP 0 /* perform name lookup only */
138#define CREATE 1 /* setup for file creation */ 138#define CREATE 1 /* setup for file creation */
139#define DELETE 2 /* setup for file deletion */ 139#define DELETE 2 /* setup for file deletion */
140#define RENAME 3 /* setup for file renaming */ 140#define RENAME 3 /* setup for file renaming */
141#define OPMASK 3 /* mask for operation */ 141#define OPMASK 3 /* mask for operation */
142/* 142/*
143 * namei operational modifier flags, stored in ni_cnd.cn_flags 143 * namei operational modifier flags, stored in ni_cnd.cn_flags
144 */ 144 */
145#define LOCKLEAF 0x00000004 /* lock inode on return */ 145#define LOCKLEAF 0x00000004 /* lock inode on return */
146#define LOCKPARENT 0x00000008 /* want parent vnode returned locked */ 146#define LOCKPARENT 0x00000008 /* want parent vnode returned locked */
147#define TRYEMULROOT 0x00000010 /* try relative to emulation root 147#define TRYEMULROOT 0x00000010 /* try relative to emulation root
148 first */ 148 first */
149#define NOCACHE 0x00000020 /* name must not be left in cache */ 149#define NOCACHE 0x00000020 /* name must not be left in cache */
150#define FOLLOW 0x00000040 /* follow symbolic links */ 150#define FOLLOW 0x00000040 /* follow symbolic links */
151#define NOFOLLOW 0x00000000 /* do not follow symbolic links 151#define NOFOLLOW 0x00000000 /* do not follow symbolic links
152 (pseudo) */ 152 (pseudo) */
153#define EMULROOTSET 0x00000080 /* emulation root already 153#define EMULROOTSET 0x00000080 /* emulation root already
154 in ni_erootdir */ 154 in ni_erootdir */
155#define NOCHROOT 0x01000000 /* no chroot on abs path lookups */ 155#define NOCHROOT 0x01000000 /* no chroot on abs path lookups */
156#define MODMASK 0x010000fc /* mask of operational modifiers */ 156#define MODMASK 0x010000fc /* mask of operational modifiers */
157/* 157/*
158 * Namei parameter descriptors. 158 * Namei parameter descriptors.
159 */ 159 */
160#define NOCROSSMOUNT 0x0000100 /* do not cross mount points */ 160#define NOCROSSMOUNT 0x0000100 /* do not cross mount points */
161#define RDONLY 0x0000200 /* lookup with read-only semantics */ 161#define RDONLY 0x0000200 /* lookup with read-only semantics */
162#define ISDOTDOT 0x0002000 /* current component name is .. */ 162#define ISDOTDOT 0x0002000 /* current component name is .. */
163#define MAKEENTRY 0x0004000 /* entry is to be added to name cache */ 163#define MAKEENTRY 0x0004000 /* entry is to be added to name cache */
164#define ISLASTCN 0x0008000 /* this is last component of pathname */ 164#define ISLASTCN 0x0008000 /* this is last component of pathname */
165#define ISSYMLINK 0x0010000 /* symlink needs interpretation */ 165#define ISSYMLINK 0x0010000 /* symlink needs interpretation */
166#define ISWHITEOUT 0x0020000 /* found whiteout */ 166#define ISWHITEOUT 0x0020000 /* found whiteout */
167#define DOWHITEOUT 0x0040000 /* do whiteouts */ 167#define DOWHITEOUT 0x0040000 /* do whiteouts */
168#define REQUIREDIR 0x0080000 /* must be a directory */ 168#define REQUIREDIR 0x0080000 /* must be a directory */
169#define CREATEDIR 0x0200000 /* trailing slashes are ok */ 169#define CREATEDIR 0x0200000 /* trailing slashes are ok */
170#define INRENAME 0x0400000 /* operation is a part of ``rename'' */ 170#define INRENAME 0x0400000 /* operation is a part of ``rename'' */
171#define INRELOOKUP 0x0800000 /* set while inside relookup() */ 171#define INRELOOKUP 0x0800000 /* set while inside relookup() */
172#define PARAMASK 0x0efef00 /* mask of parameter descriptors */ 172#define PARAMASK 0x0efe300 /* mask of parameter descriptors */
173 173
174/* 174/*
175 * Initialization of an nameidata structure. 175 * Initialization of an nameidata structure.
176 */ 176 */
177#define NDINIT(ndp, op, flags, pathbuf) { \ 177#define NDINIT(ndp, op, flags, pathbuf) { \
178 (ndp)->ni_cnd.cn_nameiop = op; \ 178 (ndp)->ni_cnd.cn_nameiop = op; \
179 (ndp)->ni_cnd.cn_flags = flags; \ 179 (ndp)->ni_cnd.cn_flags = flags; \
180 (ndp)->ni_pathbuf = pathbuf; \ 180 (ndp)->ni_pathbuf = pathbuf; \
181 (ndp)->ni_cnd.cn_cred = kauth_cred_get(); \ 181 (ndp)->ni_cnd.cn_cred = kauth_cred_get(); \
182} 182}
183#endif 183#endif
184 184
185/* 185/*
186 * This structure describes the elements in the cache of recent 186 * This structure describes the elements in the cache of recent
187 * names looked up by namei. NCHNAMLEN is sized to make structure 187 * names looked up by namei. NCHNAMLEN is sized to make structure
188 * size a power of two to optimize malloc's. Minimum reasonable 188 * size a power of two to optimize malloc's. Minimum reasonable
189 * size is 15. 189 * size is 15.
190 */ 190 */
191 191
192#define NCHNAMLEN 31 /* maximum name segment length we bother with */ 192#define NCHNAMLEN 31 /* maximum name segment length we bother with */
193 193
194/* 194/*
195 * Namecache entry. This structure is arranged so that frequently 195 * Namecache entry. This structure is arranged so that frequently
196 * accessed and mostly read-only data is toward the front, with 196 * accessed and mostly read-only data is toward the front, with
197 * infrequently accessed data and the lock towards the rear. The 197 * infrequently accessed data and the lock towards the rear. The
198 * lock is then more likely to be in a seperate cache line. 198 * lock is then more likely to be in a seperate cache line.
199 */ 199 */
200struct namecache { 200struct namecache {
201 LIST_ENTRY(namecache) nc_hash; /* hash chain */ 201 LIST_ENTRY(namecache) nc_hash; /* hash chain */
202 LIST_ENTRY(namecache) nc_vhash; /* directory hash chain */ 202 LIST_ENTRY(namecache) nc_vhash; /* directory hash chain */
203 struct vnode *nc_dvp; /* vnode of parent of name */ 203 struct vnode *nc_dvp; /* vnode of parent of name */
204 struct vnode *nc_vp; /* vnode the name refers to */ 204 struct vnode *nc_vp; /* vnode the name refers to */
205 int nc_flags; /* copy of componentname's ISWHITEOUT */ 205 int nc_flags; /* copy of componentname's ISWHITEOUT */
206 char nc_nlen; /* length of name */ 206 char nc_nlen; /* length of name */
207 char nc_name[NCHNAMLEN]; /* segment name */ 207 char nc_name[NCHNAMLEN]; /* segment name */
208 void *nc_gcqueue; /* queue for garbage collection */ 208 void *nc_gcqueue; /* queue for garbage collection */
209 TAILQ_ENTRY(namecache) nc_lru; /* psuedo-lru chain */ 209 TAILQ_ENTRY(namecache) nc_lru; /* psuedo-lru chain */
210 LIST_ENTRY(namecache) nc_dvlist; 210 LIST_ENTRY(namecache) nc_dvlist;
211 LIST_ENTRY(namecache) nc_vlist; 211 LIST_ENTRY(namecache) nc_vlist;
212 kmutex_t nc_lock; /* lock on this entry */ 212 kmutex_t nc_lock; /* lock on this entry */
213 int nc_hittime; /* last time scored a hit */ 213 int nc_hittime; /* last time scored a hit */
214}; 214};
215 215
216#ifdef _KERNEL 216#ifdef _KERNEL
217#include <sys/mallocvar.h> 217#include <sys/mallocvar.h>
218#include <sys/pool.h> 218#include <sys/pool.h>
219 219
220struct mount; 220struct mount;
221struct cpu_info; 221struct cpu_info;
222 222
223extern pool_cache_t pnbuf_cache; /* pathname buffer cache */ 223extern pool_cache_t pnbuf_cache; /* pathname buffer cache */
224 224
225#define PNBUF_GET() pool_cache_get(pnbuf_cache, PR_WAITOK) 225#define PNBUF_GET() pool_cache_get(pnbuf_cache, PR_WAITOK)
226#define PNBUF_PUT(pnb) pool_cache_put(pnbuf_cache, (pnb)) 226#define PNBUF_PUT(pnb) pool_cache_put(pnbuf_cache, (pnb))
227 227
228/* 228/*
229 * Typesafe flags for namei_simple. 229 * Typesafe flags for namei_simple.
230 * 230 *
231 * This encoding is not optimal but serves the important purpose of 231 * This encoding is not optimal but serves the important purpose of
232 * not being type-compatible with the regular namei flags. 232 * not being type-compatible with the regular namei flags.
233 */ 233 */
234struct namei_simple_flags_type; /* Opaque. */ 234struct namei_simple_flags_type; /* Opaque. */
235typedef const struct namei_simple_flags_type *namei_simple_flags_t; /* Gross. */ 235typedef const struct namei_simple_flags_type *namei_simple_flags_t; /* Gross. */
236extern const namei_simple_flags_t 236extern const namei_simple_flags_t
237 NSM_NOFOLLOW_NOEMULROOT, 237 NSM_NOFOLLOW_NOEMULROOT,
238 NSM_NOFOLLOW_TRYEMULROOT, 238 NSM_NOFOLLOW_TRYEMULROOT,
239 NSM_FOLLOW_NOEMULROOT, 239 NSM_FOLLOW_NOEMULROOT,
240 NSM_FOLLOW_TRYEMULROOT; 240 NSM_FOLLOW_TRYEMULROOT;
241 241
242/* 242/*
243 * namei_simple_* - the simple cases of namei, with no struct 243 * namei_simple_* - the simple cases of namei, with no struct
244 * nameidata involved. 244 * nameidata involved.
245 * 245 *
246 * namei_simple_kernel takes a kernel-space path as the first argument. 246 * namei_simple_kernel takes a kernel-space path as the first argument.
247 * namei_simple_user takes a user-space path as the first argument. 247 * namei_simple_user takes a user-space path as the first argument.
248 * 248 *
249 * A namei call can be converted to namei_simple_* if: 249 * A namei call can be converted to namei_simple_* if:
250 * - the second arg to NDINIT is LOOKUP; 250 * - the second arg to NDINIT is LOOKUP;
251 * - it does not need the parent vnode, nd.ni_dvp; 251 * - it does not need the parent vnode, nd.ni_dvp;
252 * - the only flags it uses are (NO)FOLLOW and TRYEMULROOT; 252 * - the only flags it uses are (NO)FOLLOW and TRYEMULROOT;
253 * - it does not do anything else gross with the contents of nd. 253 * - it does not do anything else gross with the contents of nd.
254 */ 254 */
255int namei_simple_kernel(const char *, namei_simple_flags_t, struct vnode **); 255int namei_simple_kernel(const char *, namei_simple_flags_t, struct vnode **);
256int namei_simple_user(const char *, namei_simple_flags_t, struct vnode **); 256int namei_simple_user(const char *, namei_simple_flags_t, struct vnode **);
257 257
258int namei(struct nameidata *); 258int namei(struct nameidata *);
259uint32_t namei_hash(const char *, const char **); 259uint32_t namei_hash(const char *, const char **);
260int lookup_for_nfsd(struct nameidata *, struct vnode *, int neverfollow); 260int lookup_for_nfsd(struct nameidata *, struct vnode *, int neverfollow);
261int lookup_for_nfsd_index(struct nameidata *, struct vnode *); 261int lookup_for_nfsd_index(struct nameidata *, struct vnode *);
262int relookup(struct vnode *, struct vnode **, struct componentname *, int); 262int relookup(struct vnode *, struct vnode **, struct componentname *, int);
263void cache_purge1(struct vnode *, const struct componentname *, int); 263void cache_purge1(struct vnode *, const struct componentname *, int);
264#define PURGE_PARENTS 1 264#define PURGE_PARENTS 1
265#define PURGE_CHILDREN 2 265#define PURGE_CHILDREN 2
266#define cache_purge(vp) cache_purge1((vp), NULL, PURGE_PARENTS|PURGE_CHILDREN) 266#define cache_purge(vp) cache_purge1((vp), NULL, PURGE_PARENTS|PURGE_CHILDREN)
267int cache_lookup(struct vnode *, struct vnode **, struct componentname *); 267int cache_lookup(struct vnode *, struct vnode **, struct componentname *);
268int cache_lookup_raw(struct vnode *, struct vnode **, 268int cache_lookup_raw(struct vnode *, struct vnode **,
269 struct componentname *); 269 struct componentname *);
270int cache_revlookup(struct vnode *, struct vnode **, char **, char *); 270int cache_revlookup(struct vnode *, struct vnode **, char **, char *);
271void cache_enter(struct vnode *, struct vnode *, struct componentname *); 271void cache_enter(struct vnode *, struct vnode *, struct componentname *);
272void nchinit(void); 272void nchinit(void);
273void nchreinit(void); 273void nchreinit(void);
274void cache_cpu_init(struct cpu_info *); 274void cache_cpu_init(struct cpu_info *);
275void cache_purgevfs(struct mount *); 275void cache_purgevfs(struct mount *);
276void namecache_print(struct vnode *, void (*)(const char *, ...)); 276void namecache_print(struct vnode *, void (*)(const char *, ...));
277 277
278#endif 278#endif
279 279
280/* 280/*
281 * Stats on usefulness of namei caches. 281 * Stats on usefulness of namei caches.
282 * XXX: should be 64-bit counters. 282 * XXX: should be 64-bit counters.
283 */ 283 */
284struct nchstats { 284struct nchstats {
285 long ncs_goodhits; /* hits that we can really use */ 285 long ncs_goodhits; /* hits that we can really use */
286 long ncs_neghits; /* negative hits that we can use */ 286 long ncs_neghits; /* negative hits that we can use */
287 long ncs_badhits; /* hits we must drop */ 287 long ncs_badhits; /* hits we must drop */
288 long ncs_falsehits; /* hits with id mismatch */ 288 long ncs_falsehits; /* hits with id mismatch */
289 long ncs_miss; /* misses */ 289 long ncs_miss; /* misses */
290 long ncs_long; /* long names that ignore cache */ 290 long ncs_long; /* long names that ignore cache */
291 long ncs_pass2; /* names found with passes == 2 */ 291 long ncs_pass2; /* names found with passes == 2 */
292 long ncs_2passes; /* number of times we attempt it */ 292 long ncs_2passes; /* number of times we attempt it */
293 long ncs_revhits; /* reverse-cache hits */ 293 long ncs_revhits; /* reverse-cache hits */
294 long ncs_revmiss; /* reverse-cache misses */ 294 long ncs_revmiss; /* reverse-cache misses */
295}; 295};
296 296
297#ifdef _KERNEL 297#ifdef _KERNEL
298extern struct nchstats nchstats; 298extern struct nchstats nchstats;
299#endif 299#endif
300/* #endif !_SYS_NAMEI_H_ (generated by gennameih.awk) */ 300/* #endif !_SYS_NAMEI_H_ (generated by gennameih.awk) */
301 301
302/* Definitions match above, but with NAMEI_ prefix */ 302/* Definitions match above, but with NAMEI_ prefix */
303#define NAMEI_LOOKUP 0 303#define NAMEI_LOOKUP 0
304#define NAMEI_CREATE 1 304#define NAMEI_CREATE 1
305#define NAMEI_DELETE 2 305#define NAMEI_DELETE 2
306#define NAMEI_RENAME 3 306#define NAMEI_RENAME 3
307#define NAMEI_OPMASK 3 307#define NAMEI_OPMASK 3
308#define NAMEI_LOCKLEAF 0x00000004 308#define NAMEI_LOCKLEAF 0x00000004
309#define NAMEI_LOCKPARENT 0x00000008 309#define NAMEI_LOCKPARENT 0x00000008
310#define NAMEI_TRYEMULROOT 0x00000010 310#define NAMEI_TRYEMULROOT 0x00000010
311#define NAMEI_NOCACHE 0x00000020 311#define NAMEI_NOCACHE 0x00000020
312#define NAMEI_FOLLOW 0x00000040 312#define NAMEI_FOLLOW 0x00000040
313#define NAMEI_NOFOLLOW 0x00000000 313#define NAMEI_NOFOLLOW 0x00000000
314#define NAMEI_EMULROOTSET 0x00000080 314#define NAMEI_EMULROOTSET 0x00000080
315#define NAMEI_NOCHROOT 0x01000000 315#define NAMEI_NOCHROOT 0x01000000
316#define NAMEI_MODMASK 0x010000fc 316#define NAMEI_MODMASK 0x010000fc
317#define NAMEI_NOCROSSMOUNT 0x0000100 317#define NAMEI_NOCROSSMOUNT 0x0000100
318#define NAMEI_RDONLY 0x0000200 318#define NAMEI_RDONLY 0x0000200
319#define NAMEI_ISDOTDOT 0x0002000 319#define NAMEI_ISDOTDOT 0x0002000
320#define NAMEI_MAKEENTRY 0x0004000 320#define NAMEI_MAKEENTRY 0x0004000
321#define NAMEI_ISLASTCN 0x0008000 321#define NAMEI_ISLASTCN 0x0008000
322#define NAMEI_ISSYMLINK 0x0010000 322#define NAMEI_ISSYMLINK 0x0010000
323#define NAMEI_ISWHITEOUT 0x0020000 323#define NAMEI_ISWHITEOUT 0x0020000
324#define NAMEI_DOWHITEOUT 0x0040000 324#define NAMEI_DOWHITEOUT 0x0040000
325#define NAMEI_REQUIREDIR 0x0080000 325#define NAMEI_REQUIREDIR 0x0080000
326#define NAMEI_CREATEDIR 0x0200000 326#define NAMEI_CREATEDIR 0x0200000
327#define NAMEI_INRENAME 0x0400000 327#define NAMEI_INRENAME 0x0400000
328#define NAMEI_INRELOOKUP 0x0800000 328#define NAMEI_INRELOOKUP 0x0800000
329#define NAMEI_PARAMASK 0x0efef00 329#define NAMEI_PARAMASK 0x0efe300
330 330
331#endif /* !_SYS_NAMEI_H_ */ 331#endif /* !_SYS_NAMEI_H_ */