xref: /openbsd/sys/sys/vnode.h (revision 81fb472f)
1 /*	$OpenBSD: vnode.h,v 1.170 2024/02/03 18:51:58 beck 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 closeure */
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	VATTR_NULL(vap)	vattr_null(vap)
247 #define	NULLVP	((struct vnode *)NULL)
248 #define	VN_KNOTE(vp, b)					\
249 	knote_locked(&vp->v_klist, (b))
250 
251 /*
252  * Global vnode data.
253  */
254 extern	struct vnode *rootvnode;	/* root (i.e. "/") vnode */
255 extern	int initialvnodes;		/* XXX number of vnodes to start */
256 extern	int maxvnodes;			/* XXX number of vnodes to allocate */
257 extern	int syncdelay;			/* seconds to delay syncing vnodes */
258 extern	int rushjob;			/* # of slots syncer should run ASAP */
259 extern	struct mutex vnode_mtx;
260 extern void    vhold(struct vnode *);
261 extern void    vdrop(struct vnode *);
262 
263 /* vnode operations */
264 struct vops {
265 	int	(*vop_lock)(void *);
266 	int	(*vop_unlock)(void *);
267 	int	(*vop_islocked)(void *);
268 	int	(*vop_abortop)(void *);
269 	int	(*vop_access)(void *);
270 	int	(*vop_advlock)(void *);
271 	int	(*vop_bmap)(void *);
272 	int	(*vop_bwrite)(void *);
273 	int	(*vop_close)(void *);
274 	int	(*vop_create)(void *);
275 	int	(*vop_fsync)(void *);
276 	int	(*vop_getattr)(void *);
277 	int	(*vop_inactive)(void *);
278 	int	(*vop_ioctl)(void *);
279 	int	(*vop_link)(void *);
280 	int	(*vop_lookup)(void *);
281 	int	(*vop_mknod)(void *);
282 	int	(*vop_open)(void *);
283 	int	(*vop_pathconf)(void *);
284 	int	(*vop_print)(void *);
285 	int	(*vop_read)(void *);
286 	int	(*vop_readdir)(void *);
287 	int	(*vop_readlink)(void *);
288 	int	(*vop_reclaim)(void *);
289 	int	(*vop_remove)(void *);
290 	int	(*vop_rename)(void *);
291 	int	(*vop_revoke)(void *);
292 	int	(*vop_mkdir)(void *);
293 	int	(*vop_rmdir)(void *);
294 	int	(*vop_setattr)(void *);
295 	int	(*vop_strategy)(void *);
296 	int	(*vop_symlink)(void *);
297 	int	(*vop_write)(void *);
298 	int	(*vop_kqfilter)(void *);
299 };
300 
301 extern const struct vops dead_vops;
302 extern const struct vops spec_vops;
303 
304 struct vop_generic_args {
305 	void		*a_garbage;
306 	/* Other data probably follows; */
307 };
308 
309 struct vop_islocked_args {
310 	struct vnode *a_vp;
311 };
312 int VOP_ISLOCKED(struct vnode *);
313 
314 struct vop_lookup_args {
315 	struct vnode *a_dvp;
316 	struct vnode **a_vpp;
317 	struct componentname *a_cnp;
318 };
319 int VOP_LOOKUP(struct vnode *, struct vnode **, struct componentname *);
320 
321 struct vop_create_args {
322 	struct vnode *a_dvp;
323 	struct vnode **a_vpp;
324 	struct componentname *a_cnp;
325 	struct vattr *a_vap;
326 };
327 int VOP_CREATE(struct vnode *, struct vnode **, struct componentname *,
328     struct vattr *);
329 
330 struct vop_mknod_args {
331 	struct vnode *a_dvp;
332 	struct vnode **a_vpp;
333 	struct componentname *a_cnp;
334 	struct vattr *a_vap;
335 };
336 int VOP_MKNOD(struct vnode *, struct vnode **, struct componentname *,
337     struct vattr *);
338 
339 struct vop_open_args {
340 	struct vnode *a_vp;
341 	int a_mode;
342 	struct ucred *a_cred;
343 	struct proc *a_p;
344 };
345 int VOP_OPEN(struct vnode *, int, struct ucred *, struct proc *);
346 
347 struct vop_close_args {
348 	struct vnode *a_vp;
349 	int a_fflag;
350 	struct ucred *a_cred;
351 	struct proc *a_p;
352 };
353 int VOP_CLOSE(struct vnode *, int, struct ucred *, struct proc *);
354 
355 struct vop_access_args {
356 	struct vnode *a_vp;
357 	int a_mode;
358 	struct ucred *a_cred;
359 	struct proc *a_p;
360 };
361 int VOP_ACCESS(struct vnode *, int, struct ucred *, struct proc *);
362 
363 struct vop_getattr_args {
364 	struct vnode *a_vp;
365 	struct vattr *a_vap;
366 	struct ucred *a_cred;
367 	struct proc *a_p;
368 };
369 int VOP_GETATTR(struct vnode *, struct vattr *, struct ucred *, struct proc *);
370 
371 struct vop_setattr_args {
372 	struct vnode *a_vp;
373 	struct vattr *a_vap;
374 	struct ucred *a_cred;
375 	struct proc *a_p;
376 };
377 int VOP_SETATTR(struct vnode *, struct vattr *, struct ucred *, struct proc *);
378 
379 struct vop_read_args {
380 	struct vnode *a_vp;
381 	struct uio *a_uio;
382 	int a_ioflag;
383 	struct ucred *a_cred;
384 };
385 int VOP_READ(struct vnode *, struct uio *, int, struct ucred *);
386 
387 struct vop_write_args {
388 	struct vnode *a_vp;
389 	struct uio *a_uio;
390 	int a_ioflag;
391 	struct ucred *a_cred;
392 };
393 int VOP_WRITE(struct vnode *, struct uio *, int, struct ucred *);
394 
395 struct vop_ioctl_args {
396 	struct vnode *a_vp;
397 	u_long a_command;
398 	void *a_data;
399 	int a_fflag;
400 	struct ucred *a_cred;
401 	struct proc *a_p;
402 };
403 int VOP_IOCTL(struct vnode *, u_long, void *, int, struct ucred *,
404     struct proc *);
405 
406 struct vop_kqfilter_args {
407 	struct vnode *a_vp;
408 	int a_fflag;
409 	struct knote *a_kn;
410 };
411 int VOP_KQFILTER(struct vnode *, int, struct knote *);
412 
413 struct vop_revoke_args {
414 	struct vnode *a_vp;
415 	int a_flags;
416 };
417 int VOP_REVOKE(struct vnode *, int);
418 
419 struct vop_fsync_args {
420 	struct vnode *a_vp;
421 	struct ucred *a_cred;
422 	int a_waitfor;
423 	struct proc *a_p;
424 };
425 int VOP_FSYNC(struct vnode *, struct ucred *, int, struct proc *);
426 
427 struct vop_remove_args {
428 	struct vnode *a_dvp;
429 	struct vnode *a_vp;
430 	struct componentname *a_cnp;
431 };
432 int VOP_REMOVE(struct vnode *, struct vnode *, struct componentname *);
433 
434 struct vop_link_args {
435 	struct vnode *a_dvp;
436 	struct vnode *a_vp;
437 	struct componentname *a_cnp;
438 };
439 int VOP_LINK(struct vnode *, struct vnode *, struct componentname *);
440 
441 struct vop_rename_args {
442 	struct vnode *a_fdvp;
443 	struct vnode *a_fvp;
444 	struct componentname *a_fcnp;
445 	struct vnode *a_tdvp;
446 	struct vnode *a_tvp;
447 	struct componentname *a_tcnp;
448 };
449 int VOP_RENAME(struct vnode *, struct vnode *, struct componentname *,
450     struct vnode *, struct vnode *, struct componentname *);
451 
452 struct vop_mkdir_args {
453 	struct vnode *a_dvp;
454 	struct vnode **a_vpp;
455 	struct componentname *a_cnp;
456 	struct vattr *a_vap;
457 };
458 int VOP_MKDIR(struct vnode *, struct vnode **, struct componentname *,
459     struct vattr *);
460 
461 struct vop_rmdir_args {
462 	struct vnode *a_dvp;
463 	struct vnode *a_vp;
464 	struct componentname *a_cnp;
465 };
466 int VOP_RMDIR(struct vnode *, struct vnode *, struct componentname *);
467 
468 struct vop_symlink_args {
469 	struct vnode *a_dvp;
470 	struct vnode **a_vpp;
471 	struct componentname *a_cnp;
472 	struct vattr *a_vap;
473 	char *a_target;
474 };
475 int VOP_SYMLINK(struct vnode *, struct vnode **, struct componentname *,
476     struct vattr *, char *);
477 
478 struct vop_readdir_args {
479 	struct vnode *a_vp;
480 	struct uio *a_uio;
481 	struct ucred *a_cred;
482 	int *a_eofflag;
483 };
484 int VOP_READDIR(struct vnode *, struct uio *, struct ucred *, int *);
485 
486 struct vop_readlink_args {
487 	struct vnode *a_vp;
488 	struct uio *a_uio;
489 	struct ucred *a_cred;
490 };
491 int VOP_READLINK(struct vnode *, struct uio *, struct ucred *);
492 
493 struct vop_abortop_args {
494 	struct vnode *a_dvp;
495 	struct componentname *a_cnp;
496 };
497 int VOP_ABORTOP(struct vnode *, struct componentname *);
498 
499 struct vop_inactive_args {
500 	struct vnode *a_vp;
501 	struct proc *a_p;
502 };
503 int VOP_INACTIVE(struct vnode *, struct proc *);
504 
505 struct vop_reclaim_args {
506 	struct vnode *a_vp;
507 	struct proc *a_p;
508 };
509 int VOP_RECLAIM(struct vnode *, struct proc *);
510 
511 struct vop_lock_args {
512 	struct vnode *a_vp;
513 	int a_flags;
514 };
515 int VOP_LOCK(struct vnode *, int);
516 
517 struct vop_unlock_args {
518 	struct vnode *a_vp;
519 };
520 int VOP_UNLOCK(struct vnode *);
521 
522 struct vop_bmap_args {
523 	struct vnode *a_vp;
524 	daddr_t a_bn;
525 	struct vnode **a_vpp;
526 	daddr_t *a_bnp;
527 	int *a_runp;
528 };
529 int VOP_BMAP(struct vnode *, daddr_t, struct vnode **, daddr_t *, int *);
530 
531 struct vop_print_args {
532 	struct vnode *a_vp;
533 };
534 int VOP_PRINT(struct vnode *);
535 
536 struct vop_pathconf_args {
537 	struct vnode *a_vp;
538 	int a_name;
539 	register_t *a_retval;
540 };
541 int VOP_PATHCONF(struct vnode *, int, register_t *);
542 
543 struct vop_advlock_args {
544 	struct vnode *a_vp;
545 	void *a_id;
546 	int a_op;
547 	struct flock *a_fl;
548 	int a_flags;
549 };
550 int VOP_ADVLOCK(struct vnode *, void *, int, struct flock *, int);
551 
552 struct vop_strategy_args {
553 	struct vnode *a_vp;
554 	struct buf *a_bp;
555 };
556 int VOP_STRATEGY(struct vnode *, struct buf *);
557 
558 /* Special cases: */
559 struct vop_bwrite_args {
560 	struct buf *a_bp;
561 };
562 int VOP_BWRITE(struct buf *);
563 /* End of special cases. */
564 
565 
566 /* Public vnode manipulation functions. */
567 struct file;
568 struct filedesc;
569 struct mount;
570 struct nameidata;
571 struct proc;
572 struct stat;
573 struct statfs;
574 struct ucred;
575 struct uio;
576 struct vattr;
577 struct vnode;
578 
579 /* vfs_subr */
580 int	bdevvp(dev_t, struct vnode **);
581 int	cdevvp(dev_t, struct vnode **);
582 struct vnode *checkalias(struct vnode *, dev_t, struct mount *);
583 int	getnewvnode(enum vtagtype, struct mount *, const struct vops *,
584 	    struct vnode **);
585 int	vaccess(enum vtype, mode_t, uid_t, gid_t, mode_t, struct ucred *);
586 int	vnoperm(struct vnode *);
587 void	vattr_null(struct vattr *);
588 void	vdevgone(int, int, int, enum vtype);
589 int	vcount(struct vnode *);
590 int	vfinddev(dev_t, enum vtype, struct vnode **);
591 void	vflushbuf(struct vnode *, int);
592 int	vflush(struct mount *, struct vnode *, int);
593 int	vget(struct vnode *, int);
594 void	vgone(struct vnode *);
595 void	vgonel(struct vnode *, struct proc *);
596 int	vinvalbuf(struct vnode *, int, struct ucred *, struct proc *,
597 	    int, uint64_t);
598 void	vntblinit(void);
599 int	vwaitforio(struct vnode *, int, char *, uint64_t);
600 void	vwakeup(struct vnode *);
601 void	vput(struct vnode *);
602 int	vrecycle(struct vnode *, struct proc *);
603 int	vrele(struct vnode *);
604 void	vref(struct vnode *);
605 void	vprint(char *, struct vnode *);
606 void	copy_statfs_info(struct statfs *, const struct mount *);
607 
608 /* vfs_getcwd.c */
609 #define GETCWD_CHECK_ACCESS 0x0001
610 int vfs_getcwd_scandir(struct vnode **, struct vnode **, char **, char *,
611     struct proc *);
612 int vfs_getcwd_common(struct vnode *, struct vnode *, char **, char *, int,
613     int, struct proc *);
614 int vfs_getcwd_getcache(struct vnode **, struct vnode **, char **, char *);
615 
616 /* vfs_default.c */
617 int	vop_generic_abortop(void *);
618 int	vop_generic_badop(void *);
619 int	vop_generic_bmap(void *);
620 int	vop_generic_bwrite(void *);
621 int	vop_generic_revoke(void *);
622 int	vop_generic_kqfilter(void *);
623 int	vop_generic_lookup(void *);
624 
625 /* vfs_vnops.c */
626 int	vn_isunder(struct vnode *, struct vnode *, struct proc *);
627 int	vn_close(struct vnode *, int, struct ucred *, struct proc *);
628 int	vn_open(struct nameidata *, int, int);
629 int	vn_rdwr(enum uio_rw, struct vnode *, caddr_t, int, off_t,
630 	    enum uio_seg, int, struct ucred *, size_t *, struct proc *);
631 int	vn_stat(struct vnode *, struct stat *, struct proc *);
632 int	vn_statfile(struct file *, struct stat *, struct proc *);
633 int	vn_lock(struct vnode *, int);
634 int	vn_writechk(struct vnode *);
635 int	vn_fsizechk(struct vnode *, struct uio *, int, ssize_t *);
636 int	vn_ioctl(struct file *, u_long, caddr_t, struct proc *);
637 void	vn_marktext(struct vnode *);
638 
639 /* vfs_sync.c */
640 void	syncer_thread(void *);
641 void	vn_initialize_syncerd(void);
642 void	vn_syncer_add_to_worklist(struct vnode *, int);
643 
644 /* misc */
645 int	vn_isdisk(struct vnode *, int *);
646 int 	getvnode(struct proc *, int, struct file **);
647 
648 /* uvm */
649 void	uvm_vnp_setsize(struct vnode *, off_t);
650 void	uvm_vnp_sync(struct mount *);
651 void	uvm_vnp_terminate(struct vnode *);
652 int	uvm_vnp_uncache(struct vnode *);
653 
654 
655 #endif /* _KERNEL */
656 #endif /* _SYS_VNODE_H_ */
657