FreeBSD/Linux Kernel Cross Reference
sys/sys/vnode.h
1 /* $NetBSD: vnode.h,v 1.162 2006/11/21 02:37:20 simonb Exp $ */
2
3 /*
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)vnode.h 8.17 (Berkeley) 5/20/95
32 */
33
34 #ifndef _SYS_VNODE_H_
35 #define _SYS_VNODE_H_
36
37 #include <sys/event.h>
38 #include <sys/lock.h>
39 #include <sys/queue.h>
40
41 /* XXX: clean up includes later */
42 #include <uvm/uvm_param.h> /* XXX */
43 #include <uvm/uvm_pglist.h> /* XXX */
44 #include <uvm/uvm_object.h> /* XXX */
45 #include <uvm/uvm_extern.h> /* XXX */
46
47 struct namecache;
48 struct uvm_ractx;
49
50 /*
51 * The vnode is the focus of all file activity in UNIX. There is a
52 * unique vnode allocated for each active file, each current directory,
53 * each mounted-on file, text file, and the root.
54 */
55
56 /*
57 * Vnode types. VNON means no type.
58 */
59 enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
60
61 #define VNODE_TYPES \
62 "VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD"
63
64 /*
65 * Vnode tag types.
66 * These are for the benefit of external programs only (e.g., pstat)
67 * and should NEVER be inspected by the kernel.
68 */
69 enum vtagtype {
70 VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_MSDOSFS, VT_LFS, VT_LOFS,
71 VT_FDESC, VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS,
72 VT_AFS, VT_ISOFS, VT_UNION, VT_ADOSFS, VT_EXT2FS, VT_CODA,
73 VT_FILECORE, VT_NTFS, VT_VFS, VT_OVERLAY, VT_SMBFS, VT_PTYFS,
74 VT_TMPFS, VT_UDF, VT_SYSVBFS, VT_PUFFS
75 };
76
77 #define VNODE_TAGS \
78 "VT_NON", "VT_UFS", "VT_NFS", "VT_MFS", "VT_MSDOSFS", "VT_LFS", "VT_LOFS", \
79 "VT_FDESC", "VT_PORTAL", "VT_NULL", "VT_UMAP", "VT_KERNFS", "VT_PROCFS", \
80 "VT_AFS", "VT_ISOFS", "VT_UNION", "VT_ADOSFS", "VT_EXT2FS", "VT_CODA", \
81 "VT_FILECORE", "VT_NTFS", "VT_VFS", "VT_OVERLAY", "VT_SMBFS", "VT_PTYFS", \
82 "VT_TMPFS", "VT_UDF", "VT_SYSVBFS", "VT_PUFFS"
83
84 LIST_HEAD(buflists, buf);
85
86 /*
87 * Reading or writing any of these items requires holding the appropriate lock.
88 * v_freelist is locked by the global vnode_free_list simple lock.
89 * v_mntvnodes is locked by the global mntvnodes simple lock.
90 * v_flag, v_usecount, v_holdcount and v_writecount are
91 * locked by the v_interlock simple lock
92 *
93 * Each underlying filesystem allocates its own private area and hangs
94 * it from v_data.
95 */
96 struct vnode {
97 struct uvm_object v_uobj; /* the VM object */
98 #define v_usecount v_uobj.uo_refs
99 #define v_interlock v_uobj.vmobjlock
100 voff_t v_size; /* size of file */
101 int v_flag; /* flags */
102 int v_numoutput; /* number of pending writes */
103 long v_writecount; /* reference count of writers */
104 long v_holdcnt; /* page & buffer references */
105 struct mount *v_mount; /* ptr to vfs we are in */
106 int (**v_op)(void *); /* vnode operations vector */
107 TAILQ_ENTRY(vnode) v_freelist; /* vnode freelist */
108 TAILQ_ENTRY(vnode) v_mntvnodes; /* vnodes for mount point */
109 struct buflists v_cleanblkhd; /* clean blocklist head */
110 struct buflists v_dirtyblkhd; /* dirty blocklist head */
111 int v_synclist_slot; /* synclist slot index */
112 TAILQ_ENTRY(vnode) v_synclist; /* vnodes with dirty buffers */
113 LIST_HEAD(, namecache) v_dnclist; /* namecaches for children */
114 LIST_HEAD(, namecache) v_nclist; /* namecaches for our parent */
115 union {
116 struct mount *vu_mountedhere;/* ptr to mounted vfs (VDIR) */
117 struct socket *vu_socket; /* unix ipc (VSOCK) */
118 struct specinfo *vu_specinfo; /* device (VCHR, VBLK) */
119 struct fifoinfo *vu_fifoinfo; /* fifo (VFIFO) */
120 struct uvm_ractx *vu_ractx; /* read-ahead context (VREG) */
121 } v_un;
122 struct nqlease *v_lease; /* Soft reference to lease */
123 enum vtype v_type; /* vnode type */
124 enum vtagtype v_tag; /* type of underlying data */
125 struct lock v_lock; /* lock for this vnode */
126 struct lock *v_vnlock; /* pointer to lock */
127 void *v_data; /* private data for fs */
128 struct klist v_klist; /* knotes attached to vnode */
129 };
130 #define v_mountedhere v_un.vu_mountedhere
131 #define v_socket v_un.vu_socket
132 #define v_specinfo v_un.vu_specinfo
133 #define v_fifoinfo v_un.vu_fifoinfo
134 #define v_ractx v_un.vu_ractx
135
136 /*
137 * All vnode locking operations should use vp->v_vnlock. For leaf filesystems
138 * (such as ffs, lfs, msdosfs, etc), vp->v_vnlock = &vp->v_lock. For
139 * stacked filesystems, vp->v_vnlock may equal lowervp->v_vnlock.
140 *
141 * vp->v_vnlock may also be NULL, which indicates that a leaf node does not
142 * export a struct lock for vnode locking. Stacked filesystems (such as
143 * nullfs) must call the underlying fs for locking. See layerfs_ routines
144 * for examples.
145 *
146 * All filesystems must (pretend to) understand lockmanager flags.
147 */
148
149 /*
150 * Vnode flags.
151 */
152 #define VROOT 0x0001 /* root of its file system */
153 #define VTEXT 0x0002 /* vnode is a pure text prototype */
154 /* VSYSTEM only used to skip vflush()ing quota files */
155 #define VSYSTEM 0x0004 /* vnode being used by kernel */
156 /* VISTTY used when reading dead vnodes */
157 #define VISTTY 0x0008 /* vnode represents a tty */
158 #define VEXECMAP 0x0010 /* vnode might have PROT_EXEC mappings */
159 #define VWRITEMAP 0x0020 /* might have PROT_WRITE user mappings */
160 #define VWRITEMAPDIRTY 0x0040 /* might have dirty pages due to VWRITEMAP */
161 #define VLOCKSWORK 0x0080 /* FS supports locking discipline */
162 #define VXLOCK 0x0100 /* vnode is locked to change underlying type */
163 #define VXWANT 0x0200 /* process is waiting for vnode */
164 #define VBWAIT 0x0400 /* waiting for output to complete */
165 #define VALIASED 0x0800 /* vnode has an alias */
166 #define VDIROP 0x1000 /* LFS: vnode is involved in a directory op */
167 #define VLAYER 0x2000 /* vnode is on a layer filesystem */
168 #define VONWORKLST 0x4000 /* On syncer work-list */
169 #define VFREEING 0x8000 /* vnode is being freed */
170 #define VMAPPED 0x10000 /* vnode might have user mappings */
171
172 #define VNODE_FLAGBITS \
173 "\2\1ROOT\2TEXT\3SYSTEM\4ISTTY\5EXECMAP\6WRITEMAP\7WRITEMAPDIRTY" \
174 "\10LOCKSWORK\11XLOCK\12XWANT\13BWAIT\14ALIASED" \
175 "\15DIROP\16LAYER\17ONWORKLIST\20FREEING\21MAPPED"
176
177 #define VSIZENOTSET ((voff_t)-1)
178
179 /*
180 * Vnode attributes. A field value of VNOVAL represents a field whose value
181 * is unavailable (getattr) or which is not to be changed (setattr).
182 */
183 struct vattr {
184 enum vtype va_type; /* vnode type (for create) */
185 mode_t va_mode; /* files access mode and type */
186 nlink_t va_nlink; /* number of references to file */
187 uid_t va_uid; /* owner user id */
188 gid_t va_gid; /* owner group id */
189 long va_fsid; /* file system id (dev for now) */
190 ino_t va_fileid; /* file id */
191 u_quad_t va_size; /* file size in bytes */
192 long va_blocksize; /* blocksize preferred for i/o */
193 struct timespec va_atime; /* time of last access */
194 struct timespec va_mtime; /* time of last modification */
195 struct timespec va_ctime; /* time file changed */
196 struct timespec va_birthtime; /* time file created */
197 u_long va_gen; /* generation number of file */
198 u_long va_flags; /* flags defined for file */
199 dev_t va_rdev; /* device the special file represents */
200 u_quad_t va_bytes; /* bytes of disk space held by file */
201 u_quad_t va_filerev; /* file modification number */
202 u_int va_vaflags; /* operations flags, see below */
203 long va_spare; /* remain quad aligned */
204 };
205
206 /*
207 * Flags for va_vaflags.
208 */
209 #define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */
210 #define VA_EXCLUSIVE 0x02 /* exclusive create request */
211
212 #ifdef _KERNEL
213
214 /*
215 * Use a global lock for all v_numoutput updates.
216 * Define a convenience macro to increment by one.
217 * Note: the only place where v_numoutput is decremented is in vwakeup().
218 */
219 extern struct simplelock global_v_numoutput_slock;
220 #define V_INCR_NUMOUTPUT(vp) do { \
221 simple_lock(&global_v_numoutput_slock); \
222 (vp)->v_numoutput++; \
223 simple_unlock(&global_v_numoutput_slock); \
224 } while (/*CONSTCOND*/ 0)
225
226 /*
227 * Flags for ioflag.
228 */
229 #define IO_UNIT 0x00010 /* do I/O as atomic unit */
230 #define IO_APPEND 0x00020 /* append write to end */
231 #define IO_SYNC (0x04|IO_DSYNC) /* sync I/O file integrity completion */
232 #define IO_NODELOCKED 0x00080 /* underlying node already locked */
233 #define IO_NDELAY 0x00100 /* FNDELAY flag set in file table */
234 #define IO_DSYNC 0x00200 /* sync I/O data integrity completion */
235 #define IO_ALTSEMANTICS 0x00400 /* use alternate i/o semantics */
236 #define IO_NORMAL 0x00800 /* operate on regular data */
237 #define IO_EXT 0x01000 /* operate on extended attributes */
238 #define IO_DIRECT 0x02000 /* direct I/O hint */
239 #define IO_ADV_MASK 0x00003 /* access pattern hint */
240
241 #define IO_ADV_SHIFT 0
242 #define IO_ADV_ENCODE(adv) (((adv) << IO_ADV_SHIFT) & IO_ADV_MASK)
243 #define IO_ADV_DECODE(ioflag) (((ioflag) & IO_ADV_MASK) >> IO_ADV_SHIFT)
244
245 /*
246 * Modes.
247 */
248 #define VREAD 00004 /* read, write, execute permissions */
249 #define VWRITE 00002
250 #define VEXEC 00001
251
252 /*
253 * Token indicating no attribute value yet assigned.
254 */
255 #define VNOVAL (-1)
256
257 /*
258 * Convert between vnode types and inode formats (since POSIX.1
259 * defines mode word of stat structure in terms of inode formats).
260 */
261 extern const enum vtype iftovt_tab[];
262 extern const int vttoif_tab[];
263 #define IFTOVT(mode) (iftovt_tab[((mode) & S_IFMT) >> 12])
264 #define VTTOIF(indx) (vttoif_tab[(int)(indx)])
265 #define MAKEIMODE(indx, mode) (int)(VTTOIF(indx) | (mode))
266
267 /*
268 * Flags to various vnode functions.
269 */
270 #define SKIPSYSTEM 0x0001 /* vflush: skip vnodes marked VSYSTEM */
271 #define FORCECLOSE 0x0002 /* vflush: force file closeure */
272 #define WRITECLOSE 0x0004 /* vflush: only close writable files */
273 #define DOCLOSE 0x0008 /* vclean: close active files */
274 #define V_SAVE 0x0001 /* vinvalbuf: sync file first */
275 /* vn_start_write: */
276 #define V_WAIT 0x0001 /* sleep for suspend */
277 #define V_NOWAIT 0x0002 /* don't sleep for suspend */
278 #define V_SLEEPONLY 0x0004 /* just return after sleep */
279 #define V_PCATCH 0x0008 /* sleep with PCATCH set */
280 #define V_LOWER 0x0010 /* lower level operation */
281
282 /*
283 * Flags to various vnode operations.
284 */
285 #define REVOKEALL 0x0001 /* revoke: revoke all aliases */
286
287 #define FSYNC_WAIT 0x0001 /* fsync: wait for completion */
288 #define FSYNC_DATAONLY 0x0002 /* fsync: hint: sync file data only */
289 #define FSYNC_RECLAIM 0x0004 /* fsync: hint: vnode is being reclaimed */
290 #define FSYNC_LAZY 0x0008 /* fsync: lazy sync (trickle) */
291 #define FSYNC_CACHE 0x0100 /* fsync: flush disk caches too */
292
293 #define UPDATE_WAIT 0x0001 /* update: wait for completion */
294 #define UPDATE_DIROP 0x0002 /* update: hint to fs to wait or not */
295 #define UPDATE_CLOSE 0x0004 /* update: clean up on close */
296
297 #define HOLDRELE(vp) holdrele(vp)
298 #define VHOLD(vp) vhold(vp)
299 #define VREF(vp) vref(vp)
300 TAILQ_HEAD(freelst, vnode);
301 extern struct freelst vnode_hold_list; /* free vnodes referencing buffers */
302 extern struct freelst vnode_free_list; /* vnode free list */
303 extern struct simplelock vnode_free_list_slock;
304
305 void holdrelel(struct vnode *);
306 void vholdl(struct vnode *);
307 void vref(struct vnode *);
308
309 static __inline void holdrele(struct vnode *) __attribute__((__unused__));
310 static __inline void vhold(struct vnode *) __attribute__((__unused__));
311
312 #define VATTR_NULL(vap) vattr_null(vap)
313
314 /*
315 * decrease buf or page ref
316 */
317 static __inline void
318 holdrele(struct vnode *vp)
319 {
320
321 simple_lock(&vp->v_interlock);
322 holdrelel(vp);
323 simple_unlock(&vp->v_interlock);
324 }
325
326 /*
327 * increase buf or page ref
328 */
329 static __inline void
330 vhold(struct vnode *vp)
331 {
332
333 simple_lock(&vp->v_interlock);
334 vholdl(vp);
335 simple_unlock(&vp->v_interlock);
336 }
337
338 #define NULLVP ((struct vnode *)NULL)
339
340 #define VN_KNOTE(vp, b) KNOTE(&vp->v_klist, (b))
341
342 /*
343 * Global vnode data.
344 */
345 extern struct vnode *rootvnode; /* root (i.e. "/") vnode */
346 extern int desiredvnodes; /* number of vnodes desired */
347 extern long numvnodes; /* current number of vnodes */
348 extern time_t syncdelay; /* max time to delay syncing data */
349 extern time_t filedelay; /* time to delay syncing files */
350 extern time_t dirdelay; /* time to delay syncing directories */
351 extern time_t metadelay; /* time to delay syncing metadata */
352
353 /*
354 * Macro/function to check for client cache inconsistency w.r.t. leasing.
355 */
356 #define LEASE_READ 0x1 /* Check lease for readers */
357 #define LEASE_WRITE 0x2 /* Check lease for modifiers */
358
359 #endif /* _KERNEL */
360
361
362 /*
363 * Mods for exensibility.
364 */
365
366 /*
367 * Flags for vdesc_flags:
368 */
369 #define VDESC_MAX_VPS 8
370 /* Low order 16 flag bits are reserved for willrele flags for vp arguments. */
371 #define VDESC_VP0_WILLRELE 0x00000001
372 #define VDESC_VP1_WILLRELE 0x00000002
373 #define VDESC_VP2_WILLRELE 0x00000004
374 #define VDESC_VP3_WILLRELE 0x00000008
375 #define VDESC_VP0_WILLUNLOCK 0x00000100
376 #define VDESC_VP1_WILLUNLOCK 0x00000200
377 #define VDESC_VP2_WILLUNLOCK 0x00000400
378 #define VDESC_VP3_WILLUNLOCK 0x00000800
379 #define VDESC_VP0_WILLPUT 0x00000101
380 #define VDESC_VP1_WILLPUT 0x00000202
381 #define VDESC_VP2_WILLPUT 0x00000404
382 #define VDESC_VP3_WILLPUT 0x00000808
383 #define VDESC_NOMAP_VPP 0x00010000
384 #define VDESC_VPP_WILLRELE 0x00020000
385
386 /*
387 * VDESC_NO_OFFSET is used to identify the end of the offset list
388 * and in places where no such field exists.
389 */
390 #define VDESC_NO_OFFSET -1
391
392 /*
393 * This structure describes the vnode operation taking place.
394 */
395 struct vnodeop_desc {
396 int vdesc_offset; /* offset in vector--first for speed */
397 const char *vdesc_name; /* a readable name for debugging */
398 int vdesc_flags; /* VDESC_* flags */
399
400 /*
401 * These ops are used by bypass routines to map and locate arguments.
402 * Creds and procs are not needed in bypass routines, but sometimes
403 * they are useful to (for example) transport layers.
404 * Nameidata is useful because it has a cred in it.
405 */
406 const int *vdesc_vp_offsets; /* list ended by VDESC_NO_OFFSET */
407 int vdesc_vpp_offset; /* return vpp location */
408 int vdesc_cred_offset; /* cred location, if any */
409 int vdesc_proc_offset; /* proc location, if any */
410 int vdesc_componentname_offset; /* if any */
411 /*
412 * Finally, we've got a list of private data (about each operation)
413 * for each transport layer. (Support to manage this list is not
414 * yet part of BSD.)
415 */
416 caddr_t *vdesc_transports;
417 };
418
419 #ifdef _KERNEL
420 #include <sys/mallocvar.h>
421 MALLOC_DECLARE(M_CACHE);
422 MALLOC_DECLARE(M_VNODE);
423
424 /*
425 * A list of all the operation descs.
426 */
427 extern struct vnodeop_desc *vnodeop_descs[];
428
429 /*
430 * Interlock for scanning list of vnodes attached to a mountpoint
431 */
432 extern struct simplelock mntvnode_slock;
433
434 /*
435 * Union filesystem hook for vn_readdir().
436 */
437 extern int (*vn_union_readdir_hook) (struct vnode **, struct file *, struct lwp *);
438
439 /*
440 * This macro is very helpful in defining those offsets in the vdesc struct.
441 *
442 * This is stolen from X11R4. I ingored all the fancy stuff for
443 * Crays, so if you decide to port this to such a serious machine,
444 * you might want to consult Intrisics.h's XtOffset{,Of,To}.
445 */
446 #define VOPARG_OFFSET(p_type,field) \
447 ((int) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
448 #define VOPARG_OFFSETOF(s_type,field) \
449 VOPARG_OFFSET(s_type*,field)
450 #define VOPARG_OFFSETTO(S_TYPE,S_OFFSET,STRUCT_P) \
451 ((S_TYPE)(((char*)(STRUCT_P))+(S_OFFSET)))
452
453
454 /*
455 * This structure is used to configure the new vnodeops vector.
456 */
457 struct vnodeopv_entry_desc {
458 const struct vnodeop_desc *opve_op; /* which operation this is */
459 int (*opve_impl)(void *); /* code implementing this operation */
460 };
461 struct vnodeopv_desc {
462 /* ptr to the ptr to the vector where op should go */
463 int (***opv_desc_vector_p)(void *);
464 const struct vnodeopv_entry_desc *opv_desc_ops; /* null terminated list */
465 };
466
467 /*
468 * A default routine which just returns an error.
469 */
470 int vn_default_error(void *);
471
472 /*
473 * A generic structure.
474 * This can be used by bypass routines to identify generic arguments.
475 */
476 struct vop_generic_args {
477 struct vnodeop_desc *a_desc;
478 /* other random data follows, presumably */
479 };
480
481 /*
482 * VOCALL calls an op given an ops vector. We break it out because BSD's
483 * vclean changes the ops vector and then wants to call ops with the old
484 * vector.
485 */
486 /*
487 * actually, vclean doesn't use it anymore, but nfs does,
488 * for device specials and fifos.
489 */
490 #define VOCALL(OPSV,OFF,AP) (( *((OPSV)[(OFF)])) (AP))
491
492 /*
493 * This call works for vnodes in the kernel.
494 */
495 #define VCALL(VP,OFF,AP) VOCALL((VP)->v_op,(OFF),(AP))
496 #define VDESC(OP) (& __CONCAT(OP,_desc))
497 #define VOFFSET(OP) (VDESC(OP)->vdesc_offset)
498
499 /*
500 * Functions to gate filesystem write operations. Declared static inline
501 * here because they usually go into time critical code paths.
502 */
503 #include <sys/mount.h>
504
505 int vn_start_write(struct vnode *, struct mount **, int);
506 void vn_finished_write(struct mount *, int);
507
508 /*
509 * Finally, include the default set of vnode operations.
510 */
511 #include <sys/vnode_if.h>
512
513 /*
514 * Public vnode manipulation functions.
515 */
516 struct file;
517 struct filedesc;
518 struct nameidata;
519 struct proc;
520 struct stat;
521 struct uio;
522 struct vattr;
523 struct vnode;
524
525 /* see vnode(9) */
526 int bdevvp(dev_t, struct vnode **);
527 int cdevvp(dev_t, struct vnode **);
528 struct vnode *
529 checkalias(struct vnode *, dev_t, struct mount *);
530 int getnewvnode(enum vtagtype, struct mount *, int (**)(void *),
531 struct vnode **);
532 void ungetnewvnode(struct vnode *);
533 int vaccess(enum vtype, mode_t, uid_t, gid_t, mode_t, kauth_cred_t);
534 void vattr_null(struct vattr *);
535 int vcount(struct vnode *);
536 void vdevgone(int, int, int, enum vtype);
537 int vfinddev(dev_t, enum vtype, struct vnode **);
538 int vflush(struct mount *, struct vnode *, int);
539 void vflushbuf(struct vnode *, int);
540 int vget(struct vnode *, int);
541 void vgone(struct vnode *);
542 void vgonel(struct vnode *, struct lwp *);
543 int vinvalbuf(struct vnode *, int, kauth_cred_t, struct lwp *, int, int);
544 void vprint(const char *, struct vnode *);
545 void vput(struct vnode *);
546 int vrecycle(struct vnode *, struct simplelock *, struct lwp *);
547 void vrele(struct vnode *);
548 int vtruncbuf(struct vnode *, daddr_t, int, int);
549 void vwakeup(struct buf *);
550
551 /* see vnsubr(9) */
552 int vn_bwrite(void *);
553 int vn_close(struct vnode *, int, kauth_cred_t, struct lwp *);
554 int vn_isunder(struct vnode *, struct vnode *, struct lwp *);
555 int vn_lock(struct vnode *, int);
556 void vn_markexec(struct vnode *);
557 int vn_marktext(struct vnode *);
558 int vn_open(struct nameidata *, int, int);
559 int vn_rdwr(enum uio_rw, struct vnode *, caddr_t, int, off_t, enum uio_seg,
560 int, kauth_cred_t, size_t *, struct lwp *);
561 int vn_readdir(struct file *, char *, int, u_int, int *, struct lwp *,
562 off_t **, int *);
563 void vn_restorerecurse(struct vnode *, u_int);
564 u_int vn_setrecurse(struct vnode *);
565 int vn_stat(struct vnode *, struct stat *, struct lwp *);
566 int vn_kqfilter(struct file *, struct knote *);
567 int vn_writechk(struct vnode *);
568 int vn_extattr_get(struct vnode *, int, int, const char *, size_t *,
569 void *, struct lwp *);
570 int vn_extattr_set(struct vnode *, int, int, const char *, size_t,
571 const void *, struct lwp *);
572 int vn_extattr_rm(struct vnode *, int, int, const char *, struct lwp *);
573 int vn_cow_establish(struct vnode *, int (*)(void *, struct buf *),
574 void *);
575 int vn_cow_disestablish(struct vnode *, int (*)(void *, struct buf *),
576 void *);
577 void vn_ra_allocctx(struct vnode *);
578
579 /* initialise global vnode management */
580 void vntblinit(void);
581
582 /* misc stuff */
583 void vn_syncer_add_to_worklist(struct vnode *, int);
584 void vn_syncer_remove_from_worklist(struct vnode *);
585 int speedup_syncer(void);
586
587 /* from vfs_syscalls.c - abused by compat code */
588 int getvnode(struct filedesc *, int, struct file **);
589
590 /* see vfssubr(9) */
591 void vfs_getnewfsid(struct mount *);
592 int vfs_drainvnodes(long target, struct lwp *);
593 void vfs_write_resume(struct mount *);
594 int vfs_write_suspend(struct mount *, int, int);
595 void vfs_timestamp(struct timespec *);
596 #ifdef DDB
597 void vfs_vnode_print(struct vnode *, int, void (*)(const char *, ...));
598 void vfs_mount_print(struct mount *, int, void (*)(const char *, ...));
599 #endif /* DDB */
600 #endif /* _KERNEL */
601
602 #endif /* !_SYS_VNODE_H_ */
Cache object: 929321a7b92360fe25c31e88fa4cc902
|