xref: /openbsd/sys/sys/vnode.h (revision af61481e)
1 /*	$OpenBSD: vnode.h,v 1.176 2024/11/05 06:03:20 jsg Exp $	*/
2 /*	$NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $	*/
3 
4 /*
5  * Copyright (c) 1989, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. Neither the name of the University nor the names of its contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  *	@(#)vnode.h	8.11 (Berkeley) 11/21/94
33  */
34 
35 #ifndef _SYS_VNODE_H_
36 #define _SYS_VNODE_H_
37 
38 #include <sys/buf.h>
39 #include <sys/types.h>
40 #include <sys/event.h>
41 #include <sys/queue.h>
42 #include <sys/tree.h>
43 
44 /*
45  * The vnode is the focus of all file activity in UNIX.  There is a
46  * unique vnode allocated for each active file, each current directory,
47  * each mounted-on file, text file, and the root.
48  */
49 
50 /*
51  * Vnode types.  VNON means no type.
52  */
53 enum vtype	{ VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
54 
55 #define	VTYPE_NAMES \
56     "VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD"
57 
58 /*
59  * Vnode tag types.
60  * These are for the benefit of external programs only (e.g., pstat)
61  * and should NEVER be inspected by the kernel.
62  *
63  * Note that v_tag is actually used to tell MFS from FFS, and EXT2FS from
64  * the rest, so don't believe the above comment!
65  */
66 enum vtagtype	{
67 	VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_MSDOSFS,
68 	VT_PORTAL, VT_PROCFS, VT_AFS, VT_ISOFS, VT_ADOSFS,
69 	VT_EXT2FS, VT_VFS, VT_NTFS, VT_UDF, VT_FUSEFS, VT_TMPFS,
70 };
71 
72 #define	VTAG_NAMES \
73     "NON", "UFS", "NFS", "MFS", "MSDOSFS",			\
74     "unused", "unused", "unused", "ISOFS", "unused",		\
75     "EXT2FS", "VFS", "NTFS", "UDF", "FUSEFS", "TMPFS"
76 
77 /*
78  * Each underlying filesystem allocates its own private area and hangs
79  * it from v_data.  If non-null, this area is freed in getnewvnode().
80  */
81 LIST_HEAD(buflists, buf);
82 
83 RBT_HEAD(buf_rb_bufs, buf);
84 
85 struct namecache;
86 RBT_HEAD(namecache_rb_cache, namecache);
87 
88 /*
89  * Locks used to protect struct members in struct vnode:
90  *	a	atomic
91  *	V	vnode_mtx
92  *	B	IPL_BIO
93  */
94 struct uvm_vnode;
95 struct vnode {
96 	struct uvm_vnode *v_uvm;	/* uvm data */
97 	const struct vops *v_op;	/* vnode operations vector */
98 	enum	vtype v_type;		/* vnode type */
99 	enum	vtagtype v_tag;		/* type of underlying data */
100 	u_int	v_flag;			/* vnode flags (see below) */
101 	u_int	v_lflag;		/* [V] lock vnode flags */
102 	u_int   v_usecount;		/* reference count of users */
103 	u_int   v_uvcount;		/* unveil references */
104 	u_int   v_writecount;		/* reference count of writers */
105 	u_int	v_lockcount;		/* [V] # threads waiting on lock */
106 
107 	u_int   v_bioflag;		/* [B] flags accessed in interrupts */
108 	u_int   v_holdcnt;		/* [B] buffer references */
109 	u_int   v_id;				/* capability identifier */
110 	struct	mount *v_mount;			/* ptr to vfs we are in */
111 	TAILQ_ENTRY(vnode) v_freelist;	/* [B] vnode freelist */
112 	TAILQ_ENTRY(vnode) v_mntvnodes;		/* vnodes for mount point */
113 	struct	buf_rb_bufs v_bufs_tree;/* [B] lookup of all bufs */
114 	struct	buflists v_cleanblkhd;	/* [B] clean blocklist head */
115 	struct	buflists v_dirtyblkhd;	/* [B] dirty blocklist head */
116 	u_int   v_numoutput;		/* [B] num of writes in progress */
117 	LIST_ENTRY(vnode) v_synclist;	/* [B] vnode with dirty buffers */
118 	union {
119 		struct mount	*vu_mountedhere;/* ptr to mounted vfs (VDIR) */
120 		struct socket	*vu_socket;	/* unix ipc (VSOCK) */
121 		struct specinfo	*vu_specinfo;	/* device (VCHR, VBLK) */
122 		struct fifoinfo	*vu_fifoinfo;	/* fifo (VFIFO) */
123 	} v_un;
124 
125 	/* VFS namecache */
126 	struct namecache_rb_cache v_nc_tree;
127 	TAILQ_HEAD(, namecache) v_cache_dst;	 /* cache entries to us */
128 
129 	void	*v_data;			/* private data for fs */
130 	struct	klist v_klist;			/* identity of poller(s) */
131 };
132 #define	v_mountedhere	v_un.vu_mountedhere
133 #define	v_socket	v_un.vu_socket
134 #define	v_specinfo	v_un.vu_specinfo
135 #define	v_fifoinfo	v_un.vu_fifoinfo
136 
137 /*
138  * Vnode flags.
139  */
140 #define	VROOT		0x0001	/* root of its file system */
141 #define	VTEXT		0x0002	/* vnode is a pure text prototype */
142 #define	VSYSTEM		0x0004	/* vnode being used by kernel */
143 #define	VISTTY		0x0008	/* vnode represents a tty */
144 #define	VXLOCK		0x0100	/* vnode is locked to change underlying type */
145 #define	VXWANT		0x0200	/* process is waiting for vnode */
146 #define	VCLONED		0x0400	/* vnode was cloned */
147 #define	VALIASED	0x0800	/* vnode has an alias */
148 #define	VLARVAL		0x1000	/* vnode data not yet set up by higher level */
149 #define	VLOCKSWORK	0x4000	/* FS supports locking discipline */
150 #define	VCLONE		0x8000	/* vnode is a clone */
151 
152 /*
153  * (v_bioflag) Flags that may be manipulated by interrupt handlers
154  */
155 #define	VBIOWAIT	0x0001	/* waiting for output to complete */
156 #define VBIOONSYNCLIST	0x0002	/* Vnode is on syncer worklist */
157 #define VBIOONFREELIST  0x0004  /* Vnode is on a free list */
158 #define VBIOERROR	0x0008  /* A write failed */
159 
160 /*
161  * Vnode attributes.  A field value of VNOVAL represents a field whose value
162  * is unavailable (getattr) or which is not to be changed (setattr).  For
163  * the timespec fields, only the tv_nsec member needs to be set to VNOVAL:
164  * if tv_nsec != VNOVAL then both tv_sec and tv_nsec are valid.
165  */
166 struct vattr {
167 	enum vtype	va_type;	/* vnode type (for create) */
168 	mode_t		va_mode;	/* files access mode and type */
169 	nlink_t		va_nlink;	/* number of references to file */
170 	uid_t		va_uid;		/* owner user id */
171 	gid_t		va_gid;		/* owner group id */
172 	long		va_fsid;	/* file system id (dev for now) */
173 	u_quad_t	va_fileid;	/* file id */
174 	u_quad_t	va_size;	/* file size in bytes */
175 	long		va_blocksize;	/* blocksize preferred for i/o */
176 	struct timespec	va_atime;	/* time of last access */
177 	struct timespec	va_mtime;	/* time of last modification */
178 	struct timespec	va_ctime;	/* time file changed */
179 	u_long		va_gen;		/* generation number of file */
180 	u_long		va_flags;	/* flags defined for file */
181 	dev_t		va_rdev;	/* device the special file represents */
182 	u_quad_t	va_bytes;	/* bytes of disk space held by file */
183 	u_quad_t	va_filerev;	/* file modification number */
184 	u_int		va_vaflags;	/* operations flags, see below */
185 	long		va_spare;	/* remain quad aligned */
186 };
187 
188 /*
189  * Flags for va_vaflags.
190  */
191 #define	VA_UTIMES_NULL		0x01	/* utimes argument was NULL */
192 #define	VA_EXCLUSIVE		0x02	/* exclusive create request */
193 #define	VA_UTIMES_CHANGE	0x04	/* ctime should be updated */
194 /*
195  * Flags for ioflag.
196  */
197 #define	IO_UNIT		0x01		/* do I/O as atomic unit */
198 #define	IO_APPEND	0x02		/* append write to end */
199 #define	IO_SYNC		0x04		/* do I/O synchronously */
200 #define	IO_NODELOCKED	0x08		/* underlying node already locked */
201 #define	IO_NDELAY	0x10		/* FNDELAY flag set in file table */
202 #define	IO_NOLIMIT	0x20		/* don't enforce limits on i/o */
203 #define	IO_NOCACHE	0x40		/* don't cache result of this i/o */
204 
205 /*
206  *  Modes.  Some values same as Ixxx entries from inode.h for now.
207  */
208 #define	VSUID	04000		/* set user id on execution */
209 #define	VSGID	02000		/* set group id on execution */
210 #define	VSVTX	01000		/* save swapped text even after use */
211 #define	VREAD	00400		/* read, write, execute permissions */
212 #define	VWRITE	00200
213 #define	VEXEC	00100
214 
215 /*
216  * Token indicating no attribute value yet assigned.
217  */
218 #define	VNOVAL	(-1)
219 
220 #ifdef _KERNEL
221 RBT_PROTOTYPE(buf_rb_bufs, buf, b_rbbufs, rb_buf_compare);
222 /*
223  * Convert between vnode types and inode formats (since POSIX.1
224  * defines mode word of stat structure in terms of inode formats).
225  */
226 extern enum vtype	iftovt_tab[];
227 extern int		vttoif_tab[];
228 #define IFTOVT(mode)	(iftovt_tab[((mode) & S_IFMT) >> 12])
229 #define VTTOIF(indx)	(vttoif_tab[(int)(indx)])
230 #define MAKEIMODE(indx, mode)	(int)(VTTOIF(indx) | (mode))
231 
232 /*
233  * Flags to various vnode functions.
234  */
235 #define	SKIPSYSTEM	0x0001		/* vflush: skip vnodes marked VSYSTEM */
236 #define	FORCECLOSE	0x0002		/* vflush: force file closure */
237 #define	WRITECLOSE	0x0004		/* vflush: only close writeable files */
238 #define	DOCLOSE		0x0008		/* vclean: close active files */
239 #define	IGNORECLEAN	0x0010		/* vflush: ignore clean vnodes */
240 #define	V_SAVE		0x0001		/* vinvalbuf: sync file first */
241 #define	V_SAVEMETA	0x0002		/* vinvalbuf: leave indirect blocks */
242 
243 #define REVOKEALL	0x0001		/* vop_revoke: revoke all aliases */
244 
245 
246 #define	NULLVP	((struct vnode *)NULL)
247 #define	VN_KNOTE(vp, b)					\
248 	knote_locked(&vp->v_klist, (b))
249 
250 /*
251  * Global vnode data.
252  */
253 extern	struct vnode *rootvnode;	/* root (i.e. "/") vnode */
254 extern	int initialvnodes;		/* XXX number of vnodes to start */
255 extern	int maxvnodes;			/* XXX number of vnodes to allocate */
256 extern	int syncdelay;			/* seconds to delay syncing vnodes */
257 extern	int rushjob;			/* # of slots syncer should run ASAP */
258 extern	struct mutex vnode_mtx;
259 extern void    vhold(struct vnode *);
260 extern void    vdrop(struct vnode *);
261 
262 /* vnode operations */
263 struct vops {
264 	int	(*vop_lock)(void *);
265 	int	(*vop_unlock)(void *);
266 	int	(*vop_islocked)(void *);
267 	int	(*vop_abortop)(void *);
268 	int	(*vop_access)(void *);
269 	int	(*vop_advlock)(void *);
270 	int	(*vop_bmap)(void *);
271 	int	(*vop_bwrite)(void *);
272 	int	(*vop_close)(void *);
273 	int	(*vop_create)(void *);
274 	int	(*vop_fsync)(void *);
275 	int	(*vop_getattr)(void *);
276 	int	(*vop_inactive)(void *);
277 	int	(*vop_ioctl)(void *);
278 	int	(*vop_link)(void *);
279 	int	(*vop_lookup)(void *);
280 	int	(*vop_mknod)(void *);
281 	int	(*vop_open)(void *);
282 	int	(*vop_pathconf)(void *);
283 	int	(*vop_print)(void *);
284 	int	(*vop_read)(void *);
285 	int	(*vop_readdir)(void *);
286 	int	(*vop_readlink)(void *);
287 	int	(*vop_reclaim)(void *);
288 	int	(*vop_remove)(void *);
289 	int	(*vop_rename)(void *);
290 	int	(*vop_revoke)(void *);
291 	int	(*vop_mkdir)(void *);
292 	int	(*vop_rmdir)(void *);
293 	int	(*vop_setattr)(void *);
294 	int	(*vop_strategy)(void *);
295 	int	(*vop_symlink)(void *);
296 	int	(*vop_write)(void *);
297 	int	(*vop_kqfilter)(void *);
298 };
299 
300 extern const struct vops dead_vops;
301 extern const struct vops spec_vops;
302 
303 struct vop_generic_args {
304 	void		*a_garbage;
305 	/* Other data probably follows; */
306 };
307 
308 struct vop_islocked_args {
309 	struct vnode *a_vp;
310 };
311 int VOP_ISLOCKED(struct vnode *);
312 
313 struct vop_lookup_args {
314 	struct vnode *a_dvp;
315 	struct vnode **a_vpp;
316 	struct componentname *a_cnp;
317 };
318 int VOP_LOOKUP(struct vnode *, struct vnode **, struct componentname *);
319 
320 struct vop_create_args {
321 	struct vnode *a_dvp;
322 	struct vnode **a_vpp;
323 	struct componentname *a_cnp;
324 	struct vattr *a_vap;
325 };
326 int VOP_CREATE(struct vnode *, struct vnode **, struct componentname *,
327     struct vattr *);
328 
329 struct vop_mknod_args {
330 	struct vnode *a_dvp;
331 	struct vnode **a_vpp;
332 	struct componentname *a_cnp;
333 	struct vattr *a_vap;
334 };
335 int VOP_MKNOD(struct vnode *, struct vnode **, struct componentname *,
336     struct vattr *);
337 
338 struct vop_open_args {
339 	struct vnode *a_vp;
340 	int a_mode;
341 	struct ucred *a_cred;
342 	struct proc *a_p;
343 };
344 int VOP_OPEN(struct vnode *, int, struct ucred *, struct proc *);
345 
346 struct vop_close_args {
347 	struct vnode *a_vp;
348 	int a_fflag;
349 	struct ucred *a_cred;
350 	struct proc *a_p;
351 };
352 int VOP_CLOSE(struct vnode *, int, struct ucred *, struct proc *);
353 
354 struct vop_access_args {
355 	struct vnode *a_vp;
356 	int a_mode;
357 	struct ucred *a_cred;
358 	struct proc *a_p;
359 };
360 int VOP_ACCESS(struct vnode *, int, struct ucred *, struct proc *);
361 
362 struct vop_getattr_args {
363 	struct vnode *a_vp;
364 	struct vattr *a_vap;
365 	struct ucred *a_cred;
366 	struct proc *a_p;
367 };
368 int VOP_GETATTR(struct vnode *, struct vattr *, struct ucred *, struct proc *);
369 
370 struct vop_setattr_args {
371 	struct vnode *a_vp;
372 	struct vattr *a_vap;
373 	struct ucred *a_cred;
374 	struct proc *a_p;
375 };
376 int VOP_SETATTR(struct vnode *, struct vattr *, struct ucred *, struct proc *);
377 
378 struct vop_read_args {
379 	struct vnode *a_vp;
380 	struct uio *a_uio;
381 	int a_ioflag;
382 	struct ucred *a_cred;
383 };
384 int VOP_READ(struct vnode *, struct uio *, int, struct ucred *);
385 
386 struct vop_write_args {
387 	struct vnode *a_vp;
388 	struct uio *a_uio;
389 	int a_ioflag;
390 	struct ucred *a_cred;
391 };
392 int VOP_WRITE(struct vnode *, struct uio *, int, struct ucred *);
393 
394 struct vop_ioctl_args {
395 	struct vnode *a_vp;
396 	u_long a_command;
397 	void *a_data;
398 	int a_fflag;
399 	struct ucred *a_cred;
400 	struct proc *a_p;
401 };
402 int VOP_IOCTL(struct vnode *, u_long, void *, int, struct ucred *,
403     struct proc *);
404 
405 struct vop_kqfilter_args {
406 	struct vnode *a_vp;
407 	int a_fflag;
408 	struct knote *a_kn;
409 };
410 int VOP_KQFILTER(struct vnode *, int, struct knote *);
411 
412 struct vop_revoke_args {
413 	struct vnode *a_vp;
414 	int a_flags;
415 };
416 int VOP_REVOKE(struct vnode *, int);
417 
418 struct vop_fsync_args {
419 	struct vnode *a_vp;
420 	struct ucred *a_cred;
421 	int a_waitfor;
422 	struct proc *a_p;
423 };
424 int VOP_FSYNC(struct vnode *, struct ucred *, int, struct proc *);
425 
426 struct vop_remove_args {
427 	struct vnode *a_dvp;
428 	struct vnode *a_vp;
429 	struct componentname *a_cnp;
430 };
431 int VOP_REMOVE(struct vnode *, struct vnode *, struct componentname *);
432 
433 struct vop_link_args {
434 	struct vnode *a_dvp;
435 	struct vnode *a_vp;
436 	struct componentname *a_cnp;
437 };
438 int VOP_LINK(struct vnode *, struct vnode *, struct componentname *);
439 
440 struct vop_rename_args {
441 	struct vnode *a_fdvp;
442 	struct vnode *a_fvp;
443 	struct componentname *a_fcnp;
444 	struct vnode *a_tdvp;
445 	struct vnode *a_tvp;
446 	struct componentname *a_tcnp;
447 };
448 int VOP_RENAME(struct vnode *, struct vnode *, struct componentname *,
449     struct vnode *, struct vnode *, struct componentname *);
450 
451 struct vop_mkdir_args {
452 	struct vnode *a_dvp;
453 	struct vnode **a_vpp;
454 	struct componentname *a_cnp;
455 	struct vattr *a_vap;
456 };
457 int VOP_MKDIR(struct vnode *, struct vnode **, struct componentname *,
458     struct vattr *);
459 
460 struct vop_rmdir_args {
461 	struct vnode *a_dvp;
462 	struct vnode *a_vp;
463 	struct componentname *a_cnp;
464 };
465 int VOP_RMDIR(struct vnode *, struct vnode *, struct componentname *);
466 
467 struct vop_symlink_args {
468 	struct vnode *a_dvp;
469 	struct vnode **a_vpp;
470 	struct componentname *a_cnp;
471 	struct vattr *a_vap;
472 	char *a_target;
473 };
474 int VOP_SYMLINK(struct vnode *, struct vnode **, struct componentname *,
475     struct vattr *, char *);
476 
477 struct vop_readdir_args {
478 	struct vnode *a_vp;
479 	struct uio *a_uio;
480 	struct ucred *a_cred;
481 	int *a_eofflag;
482 };
483 int VOP_READDIR(struct vnode *, struct uio *, struct ucred *, int *);
484 
485 struct vop_readlink_args {
486 	struct vnode *a_vp;
487 	struct uio *a_uio;
488 	struct ucred *a_cred;
489 };
490 int VOP_READLINK(struct vnode *, struct uio *, struct ucred *);
491 
492 struct vop_abortop_args {
493 	struct vnode *a_dvp;
494 	struct componentname *a_cnp;
495 };
496 int VOP_ABORTOP(struct vnode *, struct componentname *);
497 
498 struct vop_inactive_args {
499 	struct vnode *a_vp;
500 	struct proc *a_p;
501 };
502 int VOP_INACTIVE(struct vnode *, struct proc *);
503 
504 struct vop_reclaim_args {
505 	struct vnode *a_vp;
506 	struct proc *a_p;
507 };
508 int VOP_RECLAIM(struct vnode *, struct proc *);
509 
510 struct vop_lock_args {
511 	struct vnode *a_vp;
512 	int a_flags;
513 };
514 int VOP_LOCK(struct vnode *, int);
515 
516 struct vop_unlock_args {
517 	struct vnode *a_vp;
518 };
519 int VOP_UNLOCK(struct vnode *);
520 
521 struct vop_bmap_args {
522 	struct vnode *a_vp;
523 	daddr_t a_bn;
524 	struct vnode **a_vpp;
525 	daddr_t *a_bnp;
526 	int *a_runp;
527 };
528 int VOP_BMAP(struct vnode *, daddr_t, struct vnode **, daddr_t *, int *);
529 
530 struct vop_print_args {
531 	struct vnode *a_vp;
532 };
533 int VOP_PRINT(struct vnode *);
534 
535 struct vop_pathconf_args {
536 	struct vnode *a_vp;
537 	int a_name;
538 	register_t *a_retval;
539 };
540 int VOP_PATHCONF(struct vnode *, int, register_t *);
541 
542 struct vop_advlock_args {
543 	struct vnode *a_vp;
544 	void *a_id;
545 	int a_op;
546 	struct flock *a_fl;
547 	int a_flags;
548 };
549 int VOP_ADVLOCK(struct vnode *, void *, int, struct flock *, int);
550 
551 struct vop_strategy_args {
552 	struct vnode *a_vp;
553 	struct buf *a_bp;
554 };
555 int VOP_STRATEGY(struct vnode *, struct buf *);
556 
557 /* Special cases: */
558 struct vop_bwrite_args {
559 	struct buf *a_bp;
560 };
561 int VOP_BWRITE(struct buf *);
562 /* End of special cases. */
563 
564 
565 /* Public vnode manipulation functions. */
566 struct file;
567 struct mount;
568 struct nameidata;
569 struct proc;
570 struct stat;
571 struct statfs;
572 struct ucred;
573 struct uio;
574 struct vattr;
575 struct vnode;
576 
577 /* vfs_subr */
578 int	bdevvp(dev_t, struct vnode **);
579 int	cdevvp(dev_t, struct vnode **);
580 struct vnode *checkalias(struct vnode *, dev_t, struct mount *);
581 int	getnewvnode(enum vtagtype, struct mount *, const struct vops *,
582 	    struct vnode **);
583 int	vaccess(enum vtype, mode_t, uid_t, gid_t, mode_t, struct ucred *);
584 int	vnoperm(struct vnode *);
585 void	vattr_null(struct vattr *);
586 void	vdevgone(int, int, int, enum vtype);
587 int	vcount(struct vnode *);
588 int	vfinddev(dev_t, enum vtype, struct vnode **);
589 void	vflushbuf(struct vnode *, int);
590 int	vflush(struct mount *, struct vnode *, int);
591 int	vget(struct vnode *, int);
592 void	vgone(struct vnode *);
593 void	vgonel(struct vnode *, struct proc *);
594 int	vinvalbuf(struct vnode *, int, struct ucred *, struct proc *,
595 	    int, uint64_t);
596 void	vntblinit(void);
597 int	vwaitforio(struct vnode *, int, char *, uint64_t);
598 void	vwakeup(struct vnode *);
599 void	vput(struct vnode *);
600 int	vrecycle(struct vnode *, struct proc *);
601 int	vrele(struct vnode *);
602 void	vref(struct vnode *);
603 void	vprint(char *, struct vnode *);
604 void	copy_statfs_info(struct statfs *, const struct mount *);
605 
606 /* vfs_getcwd.c */
607 #define GETCWD_CHECK_ACCESS 0x0001
608 int vfs_getcwd_scandir(struct vnode **, struct vnode **, char **, char *,
609     struct proc *);
610 int vfs_getcwd_common(struct vnode *, struct vnode *, char **, char *, int,
611     int, struct proc *);
612 int vfs_getcwd_getcache(struct vnode **, struct vnode **, char **, char *);
613 
614 /* vfs_default.c */
615 int	vop_generic_abortop(void *);
616 int	vop_generic_badop(void *);
617 int	vop_generic_bmap(void *);
618 int	vop_generic_bwrite(void *);
619 int	vop_generic_revoke(void *);
620 int	vop_generic_kqfilter(void *);
621 int	vop_generic_lookup(void *);
622 
623 /* vfs_vnops.c */
624 int	vn_isunder(struct vnode *, struct vnode *, struct proc *);
625 int	vn_close(struct vnode *, int, struct ucred *, struct proc *);
626 int	vn_open(struct nameidata *, int, int);
627 int	vn_rdwr(enum uio_rw, struct vnode *, caddr_t, int, off_t,
628 	    enum uio_seg, int, struct ucred *, size_t *, struct proc *);
629 int	vn_stat(struct vnode *, struct stat *, struct proc *);
630 int	vn_statfile(struct file *, struct stat *, struct proc *);
631 int	vn_lock(struct vnode *, int);
632 int	vn_writechk(struct vnode *);
633 int	vn_fsizechk(struct vnode *, struct uio *, int, ssize_t *);
634 int	vn_ioctl(struct file *, u_long, caddr_t, struct proc *);
635 void	vn_marktext(struct vnode *);
636 
637 /* vfs_sync.c */
638 void	syncer_thread(void *);
639 void	vn_initialize_syncerd(void);
640 void	vn_syncer_add_to_worklist(struct vnode *, int);
641 
642 /* misc */
643 int 	getvnode(struct proc *, int, struct file **);
644 
645 /* uvm */
646 void	uvm_vnp_setsize(struct vnode *, off_t);
647 void	uvm_vnp_sync(struct mount *);
648 void	uvm_vnp_terminate(struct vnode *);
649 int	uvm_vnp_uncache(struct vnode *);
650 
651 
652 #endif /* _KERNEL */
653 #endif /* _SYS_VNODE_H_ */
654