1/* $NetBSD: vnode.h,v 1.281 2019/01/01 10:06:54 hannken Exp $ */
2
3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * 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 *
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
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. Neither the name of the University nor the names of its contributors
42 * may be used to endorse or promote products derived from this software
43 * without specific prior written permission.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE.
56 *
57 * @(#)vnode.h 8.17 (Berkeley) 5/20/95
58 */
59
60#ifndef _SYS_VNODE_H_
61#define _SYS_VNODE_H_
62
63#include <sys/event.h>
64#include <sys/queue.h>
65#include <sys/condvar.h>
66#include <sys/rwlock.h>
67#include <sys/mutex.h>
68#include <sys/time.h>
69
70/* XXX: clean up includes later */
71#include <uvm/uvm_param.h> /* XXX */
72#if defined(_KERNEL) || defined(_KMEMUSER)
73#include <uvm/uvm_pglist.h> /* XXX */
74#include <uvm/uvm_object.h> /* XXX */
75#include <uvm/uvm_extern.h> /* XXX */
76
77struct uvm_ractx;
78#endif
79
80/*
81 * The vnode is the focus of all file activity in UNIX. There is a
82 * unique vnode allocated for each active file, each current directory,
83 * each mounted-on file, text file, and the root.
84 */
85
86/*
87 * Vnode types. VNON means no type.
88 */
89enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
90
91#define VNODE_TYPES \
92 "VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD"
93
94/*
95 * Vnode tag types.
96 * These are for the benefit of external programs only (e.g., pstat)
97 * and should NEVER be inspected by the kernel.
98 */
99enum vtagtype {
100 VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_MSDOSFS, VT_LFS, VT_LOFS,
101 VT_FDESC, VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS,
102 VT_AFS, VT_ISOFS, VT_UNION, VT_ADOSFS, VT_EXT2FS, VT_CODA,
103 VT_FILECORE, VT_NTFS, VT_VFS, VT_OVERLAY, VT_SMBFS, VT_PTYFS,
104 VT_TMPFS, VT_UDF, VT_SYSVBFS, VT_PUFFS, VT_HFS, VT_EFS, VT_ZFS,
105 VT_RUMP, VT_NILFS, VT_V7FS, VT_CHFS, VT_AUTOFS
106};
107
108#define VNODE_TAGS \
109 "VT_NON", "VT_UFS", "VT_NFS", "VT_MFS", "VT_MSDOSFS", "VT_LFS", "VT_LOFS", \
110 "VT_FDESC", "VT_PORTAL", "VT_NULL", "VT_UMAP", "VT_KERNFS", "VT_PROCFS", \
111 "VT_AFS", "VT_ISOFS", "VT_UNION", "VT_ADOSFS", "VT_EXT2FS", "VT_CODA", \
112 "VT_FILECORE", "VT_NTFS", "VT_VFS", "VT_OVERLAY", "VT_SMBFS", "VT_PTYFS", \
113 "VT_TMPFS", "VT_UDF", "VT_SYSVBFS", "VT_PUFFS", "VT_HFS", "VT_EFS", \
114 "VT_ZFS", "VT_RUMP", "VT_NILFS", "VT_V7FS", "VT_CHFS", "VT_AUTOFS"
115
116#if defined(_KERNEL) || defined(_KMEMUSER)
117struct vnode;
118struct buf;
119
120LIST_HEAD(buflists, buf);
121
122/*
123 * Reading or writing any of these items requires holding the appropriate
124 * lock. Field markings and the corresponding locks:
125 *
126 * : stable, reference to the vnode is required
127 * f vnode_free_list_lock, or vrele_lock for vrele_list
128 * i v_interlock
129 * u locked by underlying filesystem
130 * v vnode lock
131 * x v_interlock + bufcache_lock to modify, either to inspect
132 *
133 * Each underlying filesystem allocates its own private area and hangs
134 * it from v_data.
135 */
136struct vnode {
137 struct uvm_object v_uobj; /* i: the VM object */
138 kcondvar_t v_cv; /* i: synchronization */
139 voff_t v_size; /* i: size of file */
140 voff_t v_writesize; /* i: new size after write */
141 int v_iflag; /* i: VI_* flags */
142 int v_vflag; /* v: VV_* flags */
143 int v_uflag; /* u: VU_* flags */
144 int v_numoutput; /* i: # of pending writes */
145 int v_writecount; /* i: ref count of writers */
146 int v_holdcnt; /* i: page & buffer refs */
147 struct mount *v_mount; /* v: ptr to vfs we are in */
148 int (**v_op)(void *); /* :: vnode operations vector */
149 struct buflists v_cleanblkhd; /* x: clean blocklist head */
150 struct buflists v_dirtyblkhd; /* x: dirty blocklist head */
151 union {
152 struct mount *vu_mountedhere;/* v: ptr to vfs (VDIR) */
153 struct socket *vu_socket; /* v: unix ipc (VSOCK) */
154 struct specnode *vu_specnode; /* v: device (VCHR, VBLK) */
155 struct fifoinfo *vu_fifoinfo; /* v: fifo (VFIFO) */
156 struct uvm_ractx *vu_ractx; /* i: read-ahead ctx (VREG) */
157 } v_un;
158 enum vtype v_type; /* :: vnode type */
159 enum vtagtype v_tag; /* :: type of underlying data */
160 void *v_data; /* :: private data for fs */
161 struct klist v_klist; /* i: notes attached to vnode */
162};
163#define v_usecount v_uobj.uo_refs
164#define v_interlock v_uobj.vmobjlock
165#define v_mountedhere v_un.vu_mountedhere
166#define v_socket v_un.vu_socket
167#define v_specnode v_un.vu_specnode
168#define v_fifoinfo v_un.vu_fifoinfo
169#define v_ractx v_un.vu_ractx
170
171typedef struct vnode vnode_t;
172#endif
173
174/*
175 * Vnode flags. The first set are locked by vnode lock or are stable.
176 * VSYSTEM is only used to skip vflush()ing quota files. VISTTY is used
177 * when reading dead vnodes.
178 */
179#define VV_ROOT 0x00000001 /* root of its file system */
180#define VV_SYSTEM 0x00000002 /* vnode being used by kernel */
181#define VV_ISTTY 0x00000004 /* vnode represents a tty */
182#define VV_MAPPED 0x00000008 /* vnode might have user mappings */
183#define VV_MPSAFE 0x00000010 /* file system code is MP safe */
184#define VV_LOCKSWORK 0x00000020 /* FS supports locking discipline */
185
186/*
187 * The second set are locked by vp->v_interlock.
188 */
189#define VI_TEXT 0x00000100 /* vnode is a pure text prototype */
190#define VI_EXECMAP 0x00000200 /* might have PROT_EXEC mappings */
191#define VI_WRMAP 0x00000400 /* might have PROT_WRITE u. mappings */
192#define VI_WRMAPDIRTY 0x00000800 /* might have dirty pages */
193#define VI_ONWORKLST 0x00004000 /* On syncer work-list */
194
195/*
196 * The third set are locked by the underlying file system.
197 */
198#define VU_DIROP 0x01000000 /* LFS: involved in a directory op */
199
200#define VNODE_FLAGBITS \
201 "\20\1ROOT\2SYSTEM\3ISTTY\4MAPPED\5MPSAFE\6LOCKSWORK\11TEXT\12EXECMAP" \
202 "\13WRMAP\14WRMAPDIRTY\17ONWORKLST\31DIROP"
203
204#define VSIZENOTSET ((voff_t)-1)
205
206/*
207 * vnode lock flags
208 */
209#define LK_SHARED 0x00000001 /* shared lock */
210#define LK_EXCLUSIVE 0x00000002 /* exclusive lock */
211#define LK_NOWAIT 0x00000010 /* do not sleep to await lock */
212#define LK_RETRY 0x00020000 /* vn_lock: retry until locked */
213
214/*
215 * Vnode attributes. A field value of VNOVAL represents a field whose value
216 * is unavailable (getattr) or which is not to be changed (setattr).
217 */
218struct vattr {
219 enum vtype va_type; /* vnode type (for create) */
220 mode_t va_mode; /* files access mode and type */
221 nlink_t va_nlink; /* number of references to file */
222 uid_t va_uid; /* owner user id */
223 gid_t va_gid; /* owner group id */
224 dev_t va_fsid; /* file system id (dev for now) */
225 ino_t va_fileid; /* file id */
226 u_quad_t va_size; /* file size in bytes */
227 long va_blocksize; /* blocksize preferred for i/o */
228 struct timespec va_atime; /* time of last access */
229 struct timespec va_mtime; /* time of last modification */
230 struct timespec va_ctime; /* time file changed */
231 struct timespec va_birthtime; /* time file created */
232 u_long va_gen; /* generation number of file */
233 u_long va_flags; /* flags defined for file */
234 dev_t va_rdev; /* device the special file represents */
235 u_quad_t va_bytes; /* bytes of disk space held by file */
236 u_quad_t va_filerev; /* file modification number */
237 unsigned int va_vaflags; /* operations flags, see below */
238 long va_spare; /* remain quad aligned */
239};
240
241/*
242 * Flags for va_vaflags.
243 */
244#define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */
245#define VA_EXCLUSIVE 0x02 /* exclusive create request */
246
247#ifdef _KERNEL
248
249/*
250 * Flags for ioflag.
251 */
252#define IO_UNIT 0x00010 /* do I/O as atomic unit */
253#define IO_APPEND 0x00020 /* append write to end */
254#define IO_SYNC (0x40|IO_DSYNC) /* sync I/O file integrity completion */
255#define IO_NODELOCKED 0x00080 /* underlying node already locked */
256#define IO_NDELAY 0x00100 /* FNDELAY flag set in file table */
257#define IO_DSYNC 0x00200 /* sync I/O data integrity completion */
258#define IO_ALTSEMANTICS 0x00400 /* use alternate i/o semantics */
259#define IO_NORMAL 0x00800 /* operate on regular data */
260#define IO_EXT 0x01000 /* operate on extended attributes */
261#define IO_DIRECT 0x02000 /* direct I/O hint */
262#define IO_JOURNALLOCKED 0x04000 /* journal is already locked */
263#define IO_ADV_MASK 0x00003 /* access pattern hint */
264
265#define IO_ADV_SHIFT 0
266#define IO_ADV_ENCODE(adv) (((adv) << IO_ADV_SHIFT) & IO_ADV_MASK)
267#define IO_ADV_DECODE(ioflag) (((ioflag) & IO_ADV_MASK) >> IO_ADV_SHIFT)
268
269/*
270 * Modes.
271 */
272#define VREAD 00004 /* read, write, execute permissions */
273#define VWRITE 00002
274#define VEXEC 00001
275
276/*
277 * Token indicating no attribute value yet assigned.
278 */
279#define VNOVAL (-1)
280
281/*
282 * Convert between vnode types and inode formats (since POSIX.1
283 * defines mode word of stat structure in terms of inode formats).
284 */
285extern const enum vtype iftovt_tab[];
286extern const int vttoif_tab[];
287#define IFTOVT(mode) (iftovt_tab[((mode) & S_IFMT) >> 12])
288#define VTTOIF(indx) (vttoif_tab[(int)(indx)])
289#define MAKEIMODE(indx, mode) (int)(VTTOIF(indx) | (mode))
290
291/*
292 * Flags to various vnode functions.
293 */
294#define SKIPSYSTEM 0x0001 /* vflush: skip vnodes marked VSYSTEM */
295#define FORCECLOSE 0x0002 /* vflush: force file closeure */
296#define WRITECLOSE 0x0004 /* vflush: only close writable files */
297#define V_SAVE 0x0001 /* vinvalbuf: sync file first */
298
299/*
300 * Flags to various vnode operations.
301 */
302#define REVOKEALL 0x0001 /* revoke: revoke all aliases */
303
304#define FSYNC_WAIT 0x0001 /* fsync: wait for completion */
305#define FSYNC_DATAONLY 0x0002 /* fsync: hint: sync file data only */
306#define FSYNC_RECLAIM 0x0004 /* fsync: hint: vnode is being reclaimed */
307#define FSYNC_LAZY 0x0008 /* fsync: lazy sync (trickle) */
308#define FSYNC_NOLOG 0x0010 /* fsync: do not flush the log */
309#define FSYNC_CACHE 0x0100 /* fsync: flush disk caches too */
310
311#define UPDATE_WAIT 0x0001 /* update: wait for completion */
312#define UPDATE_DIROP 0x0002 /* update: hint to fs to wait or not */
313#define UPDATE_CLOSE 0x0004 /* update: clean up on close */
314
315#define VDEAD_NOWAIT 0x0001 /* vdead_check: do not sleep */
316
317void holdrelel(struct vnode *);
318void vholdl(struct vnode *);
319void vref(struct vnode *);
320
321static __inline void holdrele(struct vnode *) __unused;
322static __inline void vhold(struct vnode *) __unused;
323
324/*
325 * decrease buf or page ref
326 */
327static __inline void
328holdrele(struct vnode *vp)
329{
330
331 mutex_enter(vp->v_interlock);
332 holdrelel(vp);
333 mutex_exit(vp->v_interlock);
334}
335
336/*
337 * increase buf or page ref
338 */
339static __inline void
340vhold(struct vnode *vp)
341{
342
343 mutex_enter(vp->v_interlock);
344 vholdl(vp);
345 mutex_exit(vp->v_interlock);
346}
347
348#define NULLVP ((struct vnode *)NULL)
349
350static __inline void
351VN_KNOTE(struct vnode *vp, long hint)
352{
353
354 mutex_enter(vp->v_interlock);
355 KNOTE(&vp->v_klist, hint);
356 mutex_exit(vp->v_interlock);
357}
358
359/*
360 * Global vnode data.
361 */
362extern struct vnode *rootvnode; /* root (i.e. "/") vnode */
363extern int desiredvnodes; /* number of vnodes desired */
364extern unsigned int numvnodes; /* current number of vnodes */
365
366#endif /* _KERNEL */
367
368
369/*
370 * Mods for exensibility.
371 */
372
373/*
374 * Flags for vdesc_flags:
375 */
376#define VDESC_MAX_VPS 8
377/* Low order 16 flag bits are reserved for willrele flags for vp arguments. */
378#define VDESC_VP0_WILLRELE 0x00000001
379#define VDESC_VP1_WILLRELE 0x00000002
380#define VDESC_VP2_WILLRELE 0x00000004
381#define VDESC_VP3_WILLRELE 0x00000008
382#define VDESC_VP0_WILLPUT 0x00000101
383#define VDESC_VP1_WILLPUT 0x00000202
384#define VDESC_VP2_WILLPUT 0x00000404
385#define VDESC_VP3_WILLPUT 0x00000808
386
387/*
388 * VDESC_NO_OFFSET is used to identify the end of the offset list
389 * and in places where no such field exists.
390 */
391#define VDESC_NO_OFFSET -1
392
393/*
394 * This structure describes the vnode operation taking place.
395 */
396struct vnodeop_desc {
397 int vdesc_offset; /* offset in vector--first for speed */
398 const char *vdesc_name; /* a readable name for debugging */
399 int vdesc_flags; /* VDESC_* flags */
400
401 /*
402 * These ops are used by bypass routines to map and locate arguments.
403 * Creds and procs are not needed in bypass routines, but sometimes
404 * they are useful to (for example) transport layers.
405 * Nameidata is useful because it has a cred in it.
406 */
407 const int *vdesc_vp_offsets; /* list ended by VDESC_NO_OFFSET */
408 int vdesc_vpp_offset; /* return vpp location */
409 int vdesc_cred_offset; /* cred location, if any */
410 int vdesc_componentname_offset; /* if any */
411};
412
413#ifdef _KERNEL
414
415/*
416 * Interlock for scanning list of vnodes attached to a mountpoint
417 */
418extern kmutex_t mntvnode_lock;
419
420/*
421 * Union filesystem hook for vn_readdir().
422 */
423extern int (*vn_union_readdir_hook) (struct vnode **, struct file *, struct lwp *);
424
425/*
426 * Macros for offsets in the vdesc struct.
427 */
428#define VOPARG_OFFSETOF(type, member) offsetof(type, member)
429#define VOPARG_OFFSETTO(type,offset,sp) ((type)(((char *)(sp)) + (offset)))
430
431/*
432 * This structure is used to configure the new vnodeops vector.
433 */
434struct vnodeopv_entry_desc {
435 const struct vnodeop_desc *opve_op; /* which operation this is */
436 int (*opve_impl)(void *); /* code implementing this operation */
437};
438
439struct vnodeopv_desc {
440 /* ptr to the ptr to the vector where op should go */
441 int (***opv_desc_vector_p)(void *);
442 const struct vnodeopv_entry_desc *opv_desc_ops; /* null terminated list */
443};
444
445/*
446 * A default routine which just returns an error.
447 */
448int vn_default_error(void *);
449
450/*
451 * A generic structure.
452 * This can be used by bypass routines to identify generic arguments.
453 */
454struct vop_generic_args {
455 struct vnodeop_desc *a_desc;
456 /* other random data follows, presumably */
457};
458
459/*
460 * VOCALL calls an op given an ops vector. We break it out because BSD's
461 * vclean changes the ops vector and then wants to call ops with the old
462 * vector.
463 */
464/*
465 * actually, vclean doesn't use it anymore, but nfs does,
466 * for device specials and fifos.
467 */
468#define VOCALL(OPSV,OFF,AP) (( *((OPSV)[(OFF)])) (AP))
469
470/*
471 * This call works for vnodes in the kernel.
472 */
473#define VCALL(VP,OFF,AP) VOCALL((VP)->v_op,(OFF),(AP))
474#define VDESC(OP) (& __CONCAT(OP,_desc))
475#define VOFFSET(OP) (VDESC(OP)->vdesc_offset)
476
477/* XXX This include should go away */
478#include <sys/mount.h>
479
480/*
481 * Finally, include the default set of vnode operations.
482 */
483#include <sys/vnode_if.h>
484
485/*
486 * Public vnode manipulation functions.
487 */
488struct file;
489struct filedesc;
490struct nameidata;
491struct proc;
492struct stat;
493struct uio;
494struct vattr;
495struct vnode;
496
497/* see vnode(9) */
498void vfs_vnode_sysinit(void);
499int bdevvp(dev_t, struct vnode **);
500int cdevvp(dev_t, struct vnode **);
501int vaccess(enum vtype, mode_t, uid_t, gid_t, mode_t, kauth_cred_t);
502void vattr_null(struct vattr *);
503void vdevgone(int, int, int, enum vtype);
504int vfinddev(dev_t, enum vtype, struct vnode **);
505int vflush(struct mount *, struct vnode *, int);
506int vflushbuf(struct vnode *, int);
507void vgone(struct vnode *);
508int vinvalbuf(struct vnode *, int, kauth_cred_t, struct lwp *, bool, int);
509void vprint(const char *, struct vnode *);
510void vput(struct vnode *);
511bool vrecycle(struct vnode *);
512void vrele(struct vnode *);
513void vrele_async(struct vnode *);
514void vrele_flush(struct mount *);
515int vtruncbuf(struct vnode *, daddr_t, bool, int);
516void vwakeup(struct buf *);
517int vdead_check(struct vnode *, int);
518void vrevoke(struct vnode *);
519void vremfree(struct vnode *);
520int vcache_get(struct mount *, const void *, size_t, struct vnode **);
521int vcache_new(struct mount *, struct vnode *,
522 struct vattr *, kauth_cred_t, void *, struct vnode **);
523int vcache_rekey_enter(struct mount *, struct vnode *,
524 const void *, size_t, const void *, size_t);
525void vcache_rekey_exit(struct mount *, struct vnode *,
526 const void *, size_t, const void *, size_t);
527
528/* see vnsubr(9) */
529int vn_bwrite(void *);
530int vn_close(struct vnode *, int, kauth_cred_t);
531int vn_isunder(struct vnode *, struct vnode *, struct lwp *);
532int vn_lock(struct vnode *, int);
533void vn_markexec(struct vnode *);
534int vn_marktext(struct vnode *);
535int vn_open(struct nameidata *, int, int);
536int vn_rdwr(enum uio_rw, struct vnode *, void *, int, off_t, enum uio_seg,
537 int, kauth_cred_t, size_t *, struct lwp *);
538int vn_readdir(struct file *, char *, int, unsigned int, int *,
539 struct lwp *, off_t **, int *);
540int vn_stat(struct vnode *, struct stat *);
541int vn_kqfilter(struct file *, struct knote *);
542int vn_writechk(struct vnode *);
543int vn_openchk(struct vnode *, kauth_cred_t, int);
544int vn_extattr_get(struct vnode *, int, int, const char *, size_t *,
545 void *, struct lwp *);
546int vn_extattr_set(struct vnode *, int, int, const char *, size_t,
547 const void *, struct lwp *);
548int vn_extattr_rm(struct vnode *, int, int, const char *, struct lwp *);
549void vn_ra_allocctx(struct vnode *);
550int vn_fifo_bypass(void *);
551
552#ifdef DIAGNOSTIC
553static __inline bool
554vn_locked(struct vnode *_vp)
555{
556
557 return (_vp->v_vflag & VV_LOCKSWORK) == 0 ||
558 VOP_ISLOCKED(_vp) == LK_EXCLUSIVE;
559}
560
561static __inline bool
562vn_anylocked(struct vnode *_vp)
563{
564
565 return (_vp->v_vflag & VV_LOCKSWORK) == 0 || VOP_ISLOCKED(_vp);
566}
567#endif
568
569/* initialise global vnode management */
570void vntblinit(void);
571
572/* misc stuff */
573void sched_sync(void *);
574void vn_syncer_add_to_worklist(struct vnode *, int);
575void vn_syncer_remove_from_worklist(struct vnode *);
576int dorevoke(struct vnode *, kauth_cred_t);
577int rawdev_mounted(struct vnode *, struct vnode **);
578uint8_t vtype2dt(enum vtype);
579
580/* see vfssubr(9) */
581void vfs_getnewfsid(struct mount *);
582void vfs_timestamp(struct timespec *);
583#if defined(DDB) || defined(DEBUGPRINT)
584void vfs_vnode_print(struct vnode *, int, void (*)(const char *, ...)
585 __printflike(1, 2));
586void vfs_vnode_lock_print(void *, int, void (*)(const char *, ...)
587 __printflike(1, 2));
588void vfs_mount_print(struct mount *, int, void (*)(const char *, ...)
589 __printflike(1, 2));
590#endif /* DDB */
591
592#endif /* _KERNEL */
593
594#endif /* !_SYS_VNODE_H_ */
595