]>
Commit | Line | Data |
---|---|---|
91447636 | 1 | /* |
b0d623f7 | 2 | * Copyright (c) 2000-2008 Apple Inc. All rights reserved. |
5d5c5d0d | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
91447636 | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
91447636 A |
27 | */ |
28 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
29 | /* | |
30 | * Copyright (c) 1989, 1993 | |
31 | * The Regents of the University of California. All rights reserved. | |
32 | * | |
33 | * Redistribution and use in source and binary forms, with or without | |
34 | * modification, are permitted provided that the following conditions | |
35 | * are met: | |
36 | * 1. Redistributions of source code must retain the above copyright | |
37 | * notice, this list of conditions and the following disclaimer. | |
38 | * 2. Redistributions in binary form must reproduce the above copyright | |
39 | * notice, this list of conditions and the following disclaimer in the | |
40 | * documentation and/or other materials provided with the distribution. | |
41 | * 3. All advertising materials mentioning features or use of this software | |
42 | * must display the following acknowledgement: | |
43 | * This product includes software developed by the University of | |
44 | * California, Berkeley and its contributors. | |
45 | * 4. Neither the name of the University nor the names of its contributors | |
46 | * may be used to endorse or promote products derived from this software | |
47 | * without specific prior written permission. | |
48 | * | |
49 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
50 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
51 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | |
60 | * | |
61 | * @(#)vnode.h 8.17 (Berkeley) 5/20/95 | |
62 | */ | |
2d21ac55 A |
63 | /* |
64 | * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce | |
65 | * support for mandatory and extensible security protections. This notice | |
66 | * is included in support of clause 2.2 (b) of the Apple Public License, | |
67 | * Version 2.0. | |
68 | */ | |
69 | ||
91447636 A |
70 | #ifndef _SYS_VNODE_INTERNAL_H_ |
71 | #define _SYS_VNODE_INTERNAL_H_ | |
72 | ||
91447636 A |
73 | #include <sys/appleapiopts.h> |
74 | #include <sys/cdefs.h> | |
75 | #include <sys/queue.h> | |
76 | #include <sys/lock.h> | |
77 | ||
78 | #include <sys/time.h> | |
79 | #include <sys/uio.h> | |
80 | ||
81 | #include <sys/vm.h> | |
82 | #include <sys/systm.h> | |
83 | #include <kern/locks.h> | |
84 | #include <vm/vm_kern.h> | |
85 | #include <sys/vnode.h> | |
86 | #include <sys/namei.h> | |
87 | #include <sys/vfs_context.h> | |
2d21ac55 | 88 | #include <sys/sysctl.h> |
91447636 A |
89 | |
90 | ||
91 | struct lockf; | |
2d21ac55 | 92 | struct label; |
91447636 A |
93 | |
94 | LIST_HEAD(buflists, buf); | |
95 | ||
96 | ||
97 | struct unsafe_fsnode { | |
98 | lck_mtx_t fsnodelock; | |
99 | int32_t fsnode_count; | |
100 | void * fsnodeowner; | |
101 | }; | |
102 | ||
103 | /* | |
104 | * Reading or writing any of these items requires holding the appropriate lock. | |
105 | * v_freelist is locked by the global vnode_list_lock | |
106 | * v_mntvnodes is locked by the mount_lock | |
107 | * v_nclinks and v_ncchildren are protected by the global name_cache_lock | |
108 | * v_cleanblkhd and v_dirtyblkhd and v_iterblkflags are locked via the global buf_mtxp | |
109 | * the rest of the structure is protected by the vnode_lock | |
110 | */ | |
111 | struct vnode { | |
112 | lck_mtx_t v_lock; /* vnode mutex */ | |
113 | TAILQ_ENTRY(vnode) v_freelist; /* vnode freelist */ | |
114 | TAILQ_ENTRY(vnode) v_mntvnodes; /* vnodes for mount point */ | |
115 | LIST_HEAD(, namecache) v_nclinks; /* name cache entries that name this vnode */ | |
116 | LIST_HEAD(, namecache) v_ncchildren; /* name cache entries that regard us as there parent */ | |
117 | vnode_t v_defer_reclaimlist; /* in case we have to defer the reclaim to avoid recursion */ | |
b0d623f7 A |
118 | uint32_t v_listflag; /* flags protected by the vnode_list_lock (see below) */ |
119 | uint32_t v_flag; /* vnode flags (see below) */ | |
120 | uint16_t v_lflag; /* vnode local and named ref flags */ | |
121 | uint8_t v_iterblkflags; /* buf iterator flags */ | |
122 | uint8_t v_references; /* number of times io_count has been granted */ | |
91447636 A |
123 | int32_t v_kusecount; /* count of in-kernel refs */ |
124 | int32_t v_usecount; /* reference count of users */ | |
125 | int32_t v_iocount; /* iocounters */ | |
126 | void * v_owner; /* act that owns the vnode */ | |
b0d623f7 A |
127 | uint16_t v_type; /* vnode type */ |
128 | uint16_t v_tag; /* type of underlying data */ | |
129 | uint32_t v_id; /* identity of vnode contents */ | |
91447636 A |
130 | union { |
131 | struct mount *vu_mountedhere;/* ptr to mounted vfs (VDIR) */ | |
132 | struct socket *vu_socket; /* unix ipc (VSOCK) */ | |
133 | struct specinfo *vu_specinfo; /* device (VCHR, VBLK) */ | |
134 | struct fifoinfo *vu_fifoinfo; /* fifo (VFIFO) */ | |
135 | struct ubc_info *vu_ubcinfo; /* valid for (VREG) */ | |
136 | } v_un; | |
137 | struct buflists v_cleanblkhd; /* clean blocklist head */ | |
138 | struct buflists v_dirtyblkhd; /* dirty blocklist head */ | |
b0d623f7 | 139 | struct klist v_knotes; /* knotes attached to this vnode */ |
2d21ac55 A |
140 | /* |
141 | * the following 4 fields are protected | |
142 | * by the name_cache_lock held in | |
143 | * excluive mode | |
144 | */ | |
145 | kauth_cred_t v_cred; /* last authorized credential */ | |
146 | kauth_action_t v_authorized_actions; /* current authorized actions for v_cred */ | |
147 | int v_cred_timestamp; /* determine if entry is stale for MNTK_AUTH_OPAQUE */ | |
148 | int v_nc_generation; /* changes when nodes are removed from the name cache */ | |
149 | /* | |
150 | * back to the vnode lock for protection | |
151 | */ | |
b0d623f7 A |
152 | int32_t v_numoutput; /* num of writes in progress */ |
153 | int32_t v_writecount; /* reference count of writers */ | |
2d21ac55 | 154 | const char *v_name; /* name component of the vnode */ |
91447636 | 155 | vnode_t v_parent; /* pointer to parent vnode */ |
91447636 | 156 | struct lockf *v_lockf; /* advisory lock list head */ |
b0d623f7 | 157 | #ifndef __LP64__ |
91447636 | 158 | struct unsafe_fsnode *v_unsafefs; /* pointer to struct used to lock */ |
b0d623f7 A |
159 | #else |
160 | int32_t v_reserved1; | |
161 | int32_t v_reserved2; | |
162 | #endif /* __LP64__ */ | |
91447636 | 163 | int (**v_op)(void *); /* vnode operations vector */ |
91447636 A |
164 | mount_t v_mount; /* ptr to vfs we are in */ |
165 | void * v_data; /* private data for fs */ | |
2d21ac55 A |
166 | #if CONFIG_MACF |
167 | struct label *v_label; /* MAC security label */ | |
168 | #endif | |
91447636 A |
169 | }; |
170 | ||
171 | #define v_mountedhere v_un.vu_mountedhere | |
172 | #define v_socket v_un.vu_socket | |
173 | #define v_specinfo v_un.vu_specinfo | |
174 | #define v_fifoinfo v_un.vu_fifoinfo | |
175 | #define v_ubcinfo v_un.vu_ubcinfo | |
176 | ||
177 | ||
178 | /* | |
179 | * v_iterblkflags | |
180 | */ | |
181 | #define VBI_ITER 0x1 | |
182 | #define VBI_ITERWANT 0x2 | |
183 | #define VBI_CLEAN 0x4 | |
184 | #define VBI_DIRTY 0x8 | |
185 | #define VBI_NEWBUF 0x10 | |
186 | ||
2d21ac55 A |
187 | /* |
188 | * v_listflag | |
189 | */ | |
190 | #define VLIST_RAGE 0x01 /* vnode is currently in the rapid age list */ | |
191 | #define VLIST_DEAD 0x02 /* vnode is currently in the dead list */ | |
91447636 A |
192 | |
193 | /* | |
194 | * v_lflags | |
195 | */ | |
196 | #define VL_SUSPENDED 0x0001 /* vnode is suspended */ | |
197 | #define VL_DRAIN 0x0002 /* vnode is being drained */ | |
b0d623f7 A |
198 | #define VL_TERMINATE 0x0004 /* vnode is in the process of being recycled */ |
199 | #define VL_TERMWANT 0x0008 /* there's a waiter for recycle finish (vnode_getiocount)*/ | |
200 | #define VL_DEAD 0x0010 /* vnode is dead, cleaned of filesystem-specific info */ | |
201 | #define VL_MARKTERM 0x0020 /* vnode should be recycled when no longer referenced */ | |
91447636 A |
202 | #define VL_MOUNTDEAD 0x0040 /* v_moutnedhere is dead */ |
203 | #define VL_NEEDINACTIVE 0x0080 /* delay VNOP_INACTIVE until iocount goes to 0 */ | |
204 | ||
2d21ac55 A |
205 | #define VL_LABEL 0x0100 /* vnode is marked for labeling */ |
206 | #define VL_LABELWAIT 0x0200 /* vnode is marked for labeling */ | |
207 | #define VL_LABELED 0x0400 /* vnode is labeled */ | |
208 | #define VL_LWARNED 0x0800 | |
b0d623f7 | 209 | #define VL_HASSTREAMS 0x1000 /* vnode has had at least one associated named stream vnode (may not have one any longer) */ |
2d21ac55 | 210 | |
91447636 A |
211 | #define VNAMED_UBC 0x2000 /* ubc named reference */ |
212 | #define VNAMED_MOUNT 0x4000 /* mount point named reference */ | |
213 | #define VNAMED_FSHASH 0x8000 /* FS hash named reference */ | |
214 | ||
91447636 A |
215 | /* |
216 | * v_flags | |
217 | */ | |
218 | #define VROOT 0x000001 /* root of its file system */ | |
219 | #define VTEXT 0x000002 /* vnode is a pure text prototype */ | |
220 | #define VSYSTEM 0x000004 /* vnode being used by kernel */ | |
221 | #define VISTTY 0x000008 /* vnode represents a tty */ | |
2d21ac55 A |
222 | #define VRAGE 0x000010 /* vnode is in rapid age state */ |
223 | #define VBDEVVP 0x000020 /* vnode created by bdevvp */ | |
224 | #define VDEVFLUSH 0x000040 /* device vnode after vflush */ | |
91447636 A |
225 | #define VMOUNT 0x000080 /* mount operation in progress */ |
226 | #define VBWAIT 0x000100 /* waiting for output to complete */ | |
b0d623f7 | 227 | /* Free slot here after removing VALIASED for radar #5971707 */ |
91447636 A |
228 | #define VNOCACHE_DATA 0x000400 /* don't keep data cached once it's been consumed */ |
229 | #define VSTANDARD 0x000800 /* vnode obtained from common pool */ | |
230 | #define VAGE 0x001000 /* Insert vnode at head of free list */ | |
231 | #define VRAOFF 0x002000 /* read ahead disabled */ | |
232 | #define VNCACHEABLE 0x004000 /* vnode is allowed to be put back in name cache */ | |
c910b4d9 | 233 | #if NAMEDSTREAMS |
b0d623f7 | 234 | #define VISSHADOW 0x008000 /* vnode is a shadow file */ |
c910b4d9 | 235 | #endif |
91447636 A |
236 | #define VSWAP 0x010000 /* vnode is being used as swapfile */ |
237 | #define VTHROTTLED 0x020000 /* writes or pageouts have been throttled */ | |
238 | /* wakeup tasks waiting when count falls below threshold */ | |
239 | #define VNOFLUSH 0x040000 /* don't vflush() if SKIPSYSTEM */ | |
240 | #define VLOCKLOCAL 0x080000 /* this vnode does adv locking in vfs */ | |
241 | #define VISHARDLINK 0x100000 /* hard link needs special processing on lookup and in volfs */ | |
2d21ac55 A |
242 | #define VISUNION 0x200000 /* union special processing */ |
243 | #if NAMEDSTREAMS | |
244 | #define VISNAMEDSTREAM 0x400000 /* vnode is a named stream (eg HFS resource fork) */ | |
245 | #endif | |
246 | #define VOPENEVT 0x800000 /* if process is P_CHECKOPENEVT, then or in the O_EVTONLY flag on open */ | |
91447636 A |
247 | |
248 | /* | |
249 | * Global vnode data. | |
250 | */ | |
251 | extern struct vnode *rootvnode; /* root (i.e. "/") vnode */ | |
252 | ||
253 | ||
254 | /* | |
255 | * Mods for exensibility. | |
256 | */ | |
257 | ||
258 | /* | |
259 | * Flags for vdesc_flags: | |
260 | */ | |
261 | #define VDESC_MAX_VPS 16 | |
262 | /* Low order 16 flag bits are reserved for willrele flags for vp arguments. */ | |
263 | #define VDESC_VP0_WILLRELE 0x0001 | |
264 | #define VDESC_VP1_WILLRELE 0x0002 | |
265 | #define VDESC_VP2_WILLRELE 0x0004 | |
266 | #define VDESC_VP3_WILLRELE 0x0008 | |
267 | #define VDESC_NOMAP_VPP 0x0100 | |
268 | #define VDESC_VPP_WILLRELE 0x0200 | |
269 | ||
270 | /* | |
271 | * VDESC_NO_OFFSET is used to identify the end of the offset list | |
272 | * and in places where no such field exists. | |
273 | */ | |
274 | #define VDESC_NO_OFFSET -1 | |
275 | ||
276 | /* | |
277 | * This structure describes the vnode operation taking place. | |
278 | */ | |
279 | struct vnodeop_desc { | |
280 | int vdesc_offset; /* offset in vector--first for speed */ | |
2d21ac55 | 281 | const char *vdesc_name; /* a readable name for debugging */ |
91447636 A |
282 | int vdesc_flags; /* VDESC_* flags */ |
283 | ||
284 | /* | |
285 | * These ops are used by bypass routines to map and locate arguments. | |
286 | * Creds and procs are not needed in bypass routines, but sometimes | |
287 | * they are useful to (for example) transport layers. | |
288 | * Nameidata is useful because it has a cred in it. | |
289 | */ | |
290 | int *vdesc_vp_offsets; /* list ended by VDESC_NO_OFFSET */ | |
291 | int vdesc_vpp_offset; /* return vpp location */ | |
292 | int vdesc_cred_offset; /* cred location, if any */ | |
293 | int vdesc_proc_offset; /* proc location, if any */ | |
294 | int vdesc_componentname_offset; /* if any */ | |
295 | int vdesc_context_offset; /* context location, if any */ | |
296 | /* | |
297 | * Finally, we've got a list of private data (about each operation) | |
298 | * for each transport layer. (Support to manage this list is not | |
299 | * yet part of BSD.) | |
300 | */ | |
301 | caddr_t *vdesc_transports; | |
302 | }; | |
303 | ||
304 | /* | |
305 | * A list of all the operation descs. | |
306 | */ | |
307 | extern struct vnodeop_desc *vnodeop_descs[]; | |
308 | ||
91447636 A |
309 | |
310 | /* | |
311 | * This macro is very helpful in defining those offsets in the vdesc struct. | |
312 | * | |
313 | * This is stolen from X11R4. I ingored all the fancy stuff for | |
314 | * Crays, so if you decide to port this to such a serious machine, | |
315 | * you might want to consult Intrisics.h's XtOffset{,Of,To}. | |
316 | */ | |
317 | #define VOPARG_OFFSET(p_type,field) \ | |
318 | ((int) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL))) | |
319 | #define VOPARG_OFFSETOF(s_type,field) \ | |
320 | VOPARG_OFFSET(s_type*,field) | |
321 | #define VOPARG_OFFSETTO(S_TYPE,S_OFFSET,STRUCT_P) \ | |
322 | ((S_TYPE)(((char*)(STRUCT_P))+(S_OFFSET))) | |
323 | ||
324 | ||
325 | ||
326 | /* | |
327 | * VOCALL calls an op given an ops vector. We break it out because BSD's | |
328 | * vclean changes the ops vector and then wants to call ops with the old | |
329 | * vector. | |
330 | */ | |
331 | #define VOCALL(OPSV,OFF,AP) (( *((OPSV)[(OFF)])) (AP)) | |
332 | ||
333 | /* | |
334 | * This call works for vnodes in the kernel. | |
335 | */ | |
336 | #define VCALL(VP,OFF,AP) VOCALL((VP)->v_op,(OFF),(AP)) | |
337 | #define VDESC(OP) (& __CONCAT(OP,_desc)) | |
338 | #define VOFFSET(OP) (VDESC(OP)->vdesc_offset) | |
339 | ||
0c530ab8 | 340 | struct ostat; |
91447636 | 341 | |
2d21ac55 | 342 | #define BUILDPATH_NO_FS_ENTER 0x1 /* Use cache values, do not enter file system */ |
b0d623f7 | 343 | #define BUILDPATH_CHECKACCESS 0x2 /* Check if parents have search rights */ |
2d21ac55 A |
344 | int build_path(vnode_t first_vp, char *buff, int buflen, int *outlen, int flags, vfs_context_t ctx); |
345 | ||
91447636 A |
346 | int bdevvp(dev_t dev, struct vnode **vpp); |
347 | void cvtstat(struct stat *st, struct ostat *ost); | |
348 | void vprint(const char *label, struct vnode *vp); | |
349 | ||
350 | ||
2d21ac55 | 351 | __private_extern__ int is_package_name(const char *name, int len); |
b0d623f7 | 352 | __private_extern__ int set_package_extensions_table(user_addr_t data, int nentries, int maxwidth); |
91447636 A |
353 | int vn_rdwr_64(enum uio_rw rw, struct vnode *vp, uint64_t base, |
354 | int64_t len, off_t offset, enum uio_seg segflg, | |
b0d623f7 | 355 | int ioflg, kauth_cred_t cred, int64_t *aresid, |
91447636 | 356 | struct proc *p); |
2d21ac55 A |
357 | #if CONFIG_MACF |
358 | int vn_setlabel (struct vnode *vp, struct label *intlabel, | |
359 | vfs_context_t context); | |
360 | #endif | |
91447636 | 361 | void fifo_printinfo(struct vnode *vp); |
91447636 A |
362 | int vn_open(struct nameidata *ndp, int fmode, int cmode); |
363 | int vn_open_modflags(struct nameidata *ndp, int *fmode, int cmode); | |
364 | int vn_open_auth(struct nameidata *ndp, int *fmode, struct vnode_attr *); | |
2d21ac55 | 365 | int vn_close(vnode_t, int flags, vfs_context_t ctx); |
91447636 | 366 | |
b0d623f7 A |
367 | void lock_vnode_and_post(vnode_t, int); |
368 | ||
369 | #define post_event_if_success(_vp, _error, _event) \ | |
370 | do { \ | |
371 | if (0 == (_error)) { \ | |
372 | lock_vnode_and_post((_vp), (_event)); \ | |
373 | } \ | |
374 | } while (0) | |
375 | ||
376 | ||
377 | ||
91447636 A |
378 | #define VN_CREATE_NOAUTH (1<<0) |
379 | #define VN_CREATE_NOINHERIT (1<<1) | |
2d21ac55 A |
380 | #define VN_CREATE_UNION (1<<2) |
381 | #define VN_CREATE_NOLABEL (1<<3) | |
91447636 A |
382 | errno_t vn_create(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, int flags, vfs_context_t); |
383 | ||
384 | ||
385 | int vn_getxattr(vnode_t, const char *, uio_t, size_t *, int, vfs_context_t); | |
386 | int vn_setxattr(vnode_t, const char *, uio_t, int, vfs_context_t); | |
387 | int vn_removexattr(vnode_t, const char *, int, vfs_context_t); | |
388 | int vn_listxattr(vnode_t, uio_t, size_t *, int, vfs_context_t); | |
389 | ||
2d21ac55 A |
390 | int default_getxattr(vnode_t, const char *, uio_t, size_t *, int, vfs_context_t); |
391 | int default_setxattr(vnode_t, const char *, uio_t, int, vfs_context_t); | |
392 | int default_removexattr(vnode_t, const char *, int, vfs_context_t); | |
393 | ||
b0d623f7 A |
394 | int check_appledouble_header(vnode_t, vfs_context_t); |
395 | ||
2d21ac55 A |
396 | #if NAMEDSTREAMS |
397 | errno_t vnode_getnamedstream(vnode_t, vnode_t *, const char *, enum nsoperation, int, vfs_context_t); | |
398 | errno_t vnode_makenamedstream(vnode_t, vnode_t *, const char *, int, vfs_context_t); | |
399 | errno_t vnode_removenamedstream(vnode_t, vnode_t, const char *, int, vfs_context_t); | |
400 | errno_t vnode_flushnamedstream(vnode_t vp, vnode_t svp, vfs_context_t context); | |
401 | errno_t vnode_relenamedstream(vnode_t vp, vnode_t svp, vfs_context_t context); | |
402 | #endif | |
403 | ||
2d21ac55 A |
404 | |
405 | void nchinit(void) __attribute__((section("__TEXT, initcode"))); | |
b0d623f7 | 406 | int resize_namecache(uint32_t newsize); |
0c530ab8 | 407 | void name_cache_lock_shared(void); |
91447636 A |
408 | void name_cache_lock(void); |
409 | void name_cache_unlock(void); | |
2d21ac55 | 410 | void cache_enter_with_gen(vnode_t dvp, vnode_t vp, struct componentname *cnp, int gen); |
b0d623f7 | 411 | const char *cache_enter_create(vnode_t dvp, vnode_t vp, struct componentname *cnp); |
91447636 | 412 | |
b0d623f7 | 413 | int vn_pathconf(vnode_t, int, int32_t *, vfs_context_t); |
91447636 | 414 | |
2d21ac55 A |
415 | #define vnode_lock_convert(v) lck_mtx_convert_spin(&(v)->v_lock) |
416 | ||
417 | void vnode_lock_spin(vnode_t); | |
418 | ||
419 | ||
91447636 A |
420 | void vnode_list_lock(void); |
421 | void vnode_list_unlock(void); | |
422 | int vnode_ref_ext(vnode_t, int); | |
423 | void vnode_rele_ext(vnode_t, int, int); | |
424 | void vnode_rele_internal(vnode_t, int, int, int); | |
593a1d5f A |
425 | #ifdef BSD_KERNEL_PRIVATE |
426 | int vnode_getalways(vnode_t); | |
b0d623f7 | 427 | int vget_internal(vnode_t, int, int); |
593a1d5f | 428 | #endif /* BSD_KERNEL_PRIVATE */ |
2d21ac55 | 429 | int vnode_get_locked(vnode_t); |
91447636 A |
430 | int vnode_put_locked(vnode_t); |
431 | ||
432 | int vnode_issock(vnode_t); | |
b0d623f7 | 433 | int vnode_isaliased(vnode_t); |
91447636 A |
434 | |
435 | void unlock_fsnode(vnode_t, int *); | |
436 | int lock_fsnode(vnode_t, int *); | |
437 | ||
438 | errno_t vnode_resume(vnode_t); | |
2d21ac55 A |
439 | errno_t vnode_suspend(vnode_t); |
440 | ||
91447636 A |
441 | |
442 | errno_t vnode_size(vnode_t, off_t *, vfs_context_t); | |
443 | errno_t vnode_setsize(vnode_t, off_t, int ioflag, vfs_context_t); | |
444 | int vnode_setattr_fallback(vnode_t vp, struct vnode_attr *vap, vfs_context_t ctx); | |
b0d623f7 | 445 | int vnode_isspec(vnode_t vp); |
91447636 | 446 | |
2d21ac55 A |
447 | void vn_setunionwait(vnode_t); |
448 | void vn_checkunionwait(vnode_t); | |
449 | void vn_clearunionwait(vnode_t, int); | |
450 | ||
91447636 A |
451 | void SPECHASH_LOCK(void); |
452 | void SPECHASH_UNLOCK(void); | |
453 | ||
2d21ac55 A |
454 | void vnode_authorize_init(void) __attribute__((section("__TEXT, initcode"))); |
455 | ||
b0d623f7 A |
456 | void vfsinit(void) __attribute__((section("__TEXT, initcode"))); |
457 | void vnode_lock(vnode_t); | |
458 | void vnode_unlock(vnode_t); | |
2d21ac55 A |
459 | |
460 | /* | |
461 | * XXX exported symbols; should be static | |
462 | */ | |
463 | void vfs_op_init(void) __attribute__((section("__TEXT, initcode"))); | |
464 | void vfs_opv_init(void) __attribute__((section("__TEXT, initcode"))); | |
b0d623f7 | 465 | int vfs_sysctl(int *name, uint32_t namelen, user_addr_t oldp, size_t *oldlenp, |
2d21ac55 A |
466 | user_addr_t newp, size_t newlen, struct proc *p); |
467 | int sysctl_vnode(struct sysctl_oid *oidp, void *arg1, int arg2, struct sysctl_req *req); | |
91447636 | 468 | |
b0d623f7 A |
469 | #ifdef BSD_KERNEL_PRIVATE |
470 | void vnode_knoteupdate(struct knote *kn); | |
471 | void vnode_setneedinactive(vnode_t); | |
472 | int vnode_hasnamedstreams(vnode_t); /* Does this vnode have associated named streams? */ | |
473 | #endif | |
474 | ||
91447636 | 475 | #endif /* !_SYS_VNODE_INTERNAL_H_ */ |