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