vnode.h revision 54372
1204552Salfred/*
2204552Salfred * Copyright (c) 1989, 1993
3204552Salfred *	The Regents of the University of California.  All rights reserved.
4204552Salfred *
5204552Salfred * Redistribution and use in source and binary forms, with or without
6204552Salfred * modification, are permitted provided that the following conditions
7204552Salfred * are met:
8204552Salfred * 1. Redistributions of source code must retain the above copyright
9204552Salfred *    notice, this list of conditions and the following disclaimer.
10204552Salfred * 2. Redistributions in binary form must reproduce the above copyright
11204552Salfred *    notice, this list of conditions and the following disclaimer in the
12204552Salfred *    documentation and/or other materials provided with the distribution.
13204552Salfred * 3. All advertising materials mentioning features or use of this software
14204552Salfred *    must display the following acknowledgement:
15204552Salfred *	This product includes software developed by the University of
16204552Salfred *	California, Berkeley and its contributors.
17204552Salfred * 4. Neither the name of the University nor the names of its contributors
18204552Salfred *    may be used to endorse or promote products derived from this software
19204552Salfred *    without specific prior written permission.
20204552Salfred *
21204552Salfred * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22204552Salfred * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23204552Salfred * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24204552Salfred * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25204552Salfred * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26204552Salfred * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27204552Salfred * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28204552Salfred * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29204552Salfred * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30204552Salfred * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31204552Salfred * SUCH DAMAGE.
32204552Salfred *
33204552Salfred *	@(#)vnode.h	8.7 (Berkeley) 2/4/94
34204552Salfred * $FreeBSD: head/sys/sys/vnode.h 54372 1999-12-09 19:10:36Z semenu $
35204552Salfred */
36204552Salfred
37204552Salfred#ifndef _SYS_VNODE_H_
38204552Salfred#define	_SYS_VNODE_H_
39204552Salfred
40204552Salfred#include <sys/queue.h>
41204552Salfred#include <sys/select.h>
42204552Salfred#include <sys/uio.h>
43204552Salfred
44204552Salfred#include <machine/lock.h>
45204552Salfred
46204552Salfred/*
47204552Salfred * The vnode is the focus of all file activity in UNIX.  There is a
48204552Salfred * unique vnode allocated for each active file, each current directory,
49204552Salfred * each mounted-on file, text file, and the root.
50204552Salfred */
51204552Salfred
52204552Salfred/*
53204552Salfred * Vnode types.  VNON means no type.
54204552Salfred */
55204552Salfredenum vtype	{ VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
56204552Salfred
57204552Salfred/*
58204552Salfred * Vnode tag types.
59204552Salfred * These are for the benefit of external programs only (e.g., pstat)
60204552Salfred * and should NEVER be inspected by the kernel.
61204552Salfred */
62204552Salfredenum vtagtype	{
63204552Salfred	VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC,
64204552Salfred	VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS,
65204552Salfred	VT_UNION, VT_MSDOSFS, VT_DEVFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS,
66204552Salfred	VT_HPFS
67204552Salfred};
68204552Salfred
69204552Salfred/*
70204552Salfred * Each underlying filesystem allocates its own private area and hangs
71204552Salfred * it from v_data.  If non-null, this area is freed in getnewvnode().
72204552Salfred */
73204552SalfredTAILQ_HEAD(buflists, buf);
74204552Salfred
75204552Salfredtypedef	int 	vop_t __P((void *));
76204552Salfredstruct namecache;
77204552Salfred
78204552Salfred/*
79204552Salfred * Reading or writing any of these items requires holding the appropriate lock.
80204552Salfred * v_freelist is locked by the global vnode_free_list simple lock.
81204552Salfred * v_mntvnodes is locked by the global mntvnodes simple lock.
82204552Salfred * v_flag, v_usecount, v_holdcount and v_writecount are
83204552Salfred *    locked by the v_interlock simple lock.
84204552Salfred * v_pollinfo is locked by the lock contained inside it.
85204552Salfred */
86204552Salfredstruct vnode {
87204552Salfred	u_long	v_flag;				/* vnode flags (see below) */
88204552Salfred	int	v_usecount;			/* reference count of users */
89204552Salfred	int	v_writecount;			/* reference count of writers */
90204552Salfred	int	v_holdcnt;			/* page & buffer references */
91204552Salfred	u_long	v_id;				/* capability identifier */
92204552Salfred	struct	mount *v_mount;			/* ptr to vfs we are in */
93204552Salfred	vop_t	**v_op;				/* vnode operations vector */
94204552Salfred	TAILQ_ENTRY(vnode) v_freelist;		/* vnode freelist */
95204552Salfred	LIST_ENTRY(vnode) v_mntvnodes;		/* vnodes for mount point */
96204552Salfred	struct	buflists v_cleanblkhd;		/* clean blocklist head */
97204552Salfred	struct	buflists v_dirtyblkhd;		/* dirty blocklist head */
98204552Salfred	LIST_ENTRY(vnode) v_synclist;		/* vnodes with dirty buffers */
99204552Salfred	long	v_numoutput;			/* num of writes in progress */
100204552Salfred	enum	vtype v_type;			/* vnode type */
101204552Salfred	union {
102204552Salfred		struct mount	*vu_mountedhere;/* ptr to mounted vfs (VDIR) */
103204552Salfred		struct socket	*vu_socket;	/* unix ipc (VSOCK) */
104204552Salfred		struct {
105204552Salfred			struct specinfo	*vu_specinfo; /* device (VCHR, VBLK) */
106204552Salfred			SLIST_ENTRY(vnode) vu_specnext;
107204552Salfred		} vu_spec;
108204552Salfred		struct fifoinfo	*vu_fifoinfo;	/* fifo (VFIFO) */
109204552Salfred	} v_un;
110204552Salfred	struct	nqlease *v_lease;		/* Soft reference to lease */
111204552Salfred	daddr_t	v_lastw;			/* last write (write cluster) */
112204552Salfred	daddr_t	v_cstart;			/* start block of cluster */
113204552Salfred	daddr_t	v_lasta;			/* last allocation */
114204552Salfred	int	v_clen;				/* length of current cluster */
115204552Salfred	struct vm_object *v_object;		/* Place to store VM object */
116204552Salfred	struct	simplelock v_interlock;		/* lock on usecount and flag */
117204552Salfred	struct	lock *v_vnlock;			/* used for non-locking fs's */
118204552Salfred	enum	vtagtype v_tag;			/* type of underlying data */
119204552Salfred	void 	*v_data;			/* private data for fs */
120204552Salfred	LIST_HEAD(, namecache) v_cache_src;	/* Cache entries from us */
121204552Salfred	TAILQ_HEAD(, namecache) v_cache_dst;	/* Cache entries to us */
122204552Salfred	struct	vnode *v_dd;			/* .. vnode */
123204552Salfred	u_long	v_ddid;				/* .. capability identifier */
124204552Salfred	struct	{
125204552Salfred		struct	simplelock vpi_lock;	/* lock to protect below */
126204552Salfred		struct	selinfo vpi_selinfo;	/* identity of poller(s) */
127204552Salfred		short	vpi_events;		/* what they are looking for */
128204552Salfred		short	vpi_revents;		/* what has happened */
129204552Salfred	} v_pollinfo;
130204552Salfred#ifdef	DEBUG_LOCKS
131204552Salfred	const char *filename;			/* Source file doing locking */
132204552Salfred	int line;				/* Line number doing locking */
133204552Salfred#endif
134204552Salfred};
135204552Salfred#define	v_mountedhere	v_un.vu_mountedhere
136204552Salfred#define	v_socket	v_un.vu_socket
137204552Salfred#define	v_rdev		v_un.vu_spec.vu_specinfo
138204552Salfred#define	v_specnext	v_un.vu_spec.vu_specnext
139204552Salfred#define	v_fifoinfo	v_un.vu_fifoinfo
140204552Salfred
141204552Salfred#define	VN_POLLEVENT(vp, events)				\
142204552Salfred	do {							\
143204552Salfred		if ((vp)->v_pollinfo.vpi_events & (events))	\
144204552Salfred			vn_pollevent((vp), (events));		\
145204552Salfred	} while (0)
146204552Salfred
147204552Salfred/*
148204552Salfred * Vnode flags.
149204552Salfred */
150204552Salfred#define	VROOT		0x00001	/* root of its file system */
151204552Salfred#define	VTEXT		0x00002	/* vnode is a pure text prototype */
152204552Salfred#define	VSYSTEM		0x00004	/* vnode being used by kernel */
153204552Salfred#define	VISTTY		0x00008	/* vnode represents a tty */
154204552Salfred#define	VXLOCK		0x00100	/* vnode is locked to change underlying type */
155204552Salfred#define	VXWANT		0x00200	/* process is waiting for vnode */
156204552Salfred#define	VBWAIT		0x00400	/* waiting for output to complete */
157204552Salfred/* open for business    0x00800 */
158204552Salfred/* open for business    0x01000 */
159204552Salfred#define	VOBJBUF		0x02000	/* Allocate buffers in VM object */
160204552Salfred/* open for business    0x04000 */
161204552Salfred#define	VAGE		0x08000	/* Insert vnode at head of free list */
162204552Salfred#define	VOLOCK		0x10000	/* vnode is locked waiting for an object */
163204552Salfred#define	VOWANT		0x20000	/* a process is waiting for VOLOCK */
164204552Salfred#define	VDOOMED		0x40000	/* This vnode is being recycled */
165204552Salfred#define	VFREE		0x80000	/* This vnode is on the freelist */
166204552Salfred#define	VTBFREE		0x100000 /* This vnode is on the to-be-freelist */
167204552Salfred#define	VONWORKLST	0x200000 /* On syncer work-list */
168204552Salfred#define	VMOUNT		0x400000 /* Mount in progress */
169204552Salfred
170204552Salfred/*
171204552Salfred * Vnode attributes.  A field value of VNOVAL represents a field whose value
172204552Salfred * is unavailable (getattr) or which is not to be changed (setattr).
173204552Salfred */
174204552Salfredstruct vattr {
175204552Salfred	enum vtype	va_type;	/* vnode type (for create) */
176204552Salfred	u_short		va_mode;	/* files access mode and type */
177204552Salfred	short		va_nlink;	/* number of references to file */
178204552Salfred	uid_t		va_uid;		/* owner user id */
179204552Salfred	gid_t		va_gid;		/* owner group id */
180204552Salfred	udev_t		va_fsid;	/* file system id */
181204552Salfred	long		va_fileid;	/* file id */
182204552Salfred	u_quad_t	va_size;	/* file size in bytes */
183204552Salfred	long		va_blocksize;	/* blocksize preferred for i/o */
184204552Salfred	struct timespec	va_atime;	/* time of last access */
185204552Salfred	struct timespec	va_mtime;	/* time of last modification */
186204552Salfred	struct timespec	va_ctime;	/* time file changed */
187204552Salfred	u_long		va_gen;		/* generation number of file */
188204552Salfred	u_long		va_flags;	/* flags defined for file */
189204552Salfred	udev_t		va_rdev;	/* device the special file represents */
190204552Salfred	u_quad_t	va_bytes;	/* bytes of disk space held by file */
191204552Salfred	u_quad_t	va_filerev;	/* file modification number */
192204552Salfred	u_int		va_vaflags;	/* operations flags, see below */
193204552Salfred	long		va_spare;	/* remain quad aligned */
194204552Salfred};
195204552Salfred
196204552Salfred/*
197204552Salfred * Flags for va_vaflags.
198204552Salfred */
199204552Salfred#define	VA_UTIMES_NULL	0x01		/* utimes argument was NULL */
200204552Salfred#define VA_EXCLUSIVE	0x02		/* exclusive create request */
201204552Salfred
202204552Salfred/*
203204552Salfred * Flags for ioflag.
204204552Salfred */
205204552Salfred#define	IO_UNIT		0x01		/* do I/O as atomic unit */
206204552Salfred#define	IO_APPEND	0x02		/* append write to end */
207204552Salfred#define	IO_SYNC		0x04		/* do I/O synchronously */
208204552Salfred#define	IO_NODELOCKED	0x08		/* underlying node already locked */
209204552Salfred#define	IO_NDELAY	0x10		/* FNDELAY flag set in file table */
210204552Salfred#define	IO_VMIO		0x20		/* data already in VMIO space */
211204552Salfred#define	IO_INVAL	0x40		/* invalidate after I/O */
212204552Salfred
213204552Salfred/*
214204552Salfred *  Modes.  Some values same as Ixxx entries from inode.h for now.
215204552Salfred */
216204552Salfred#define	VSUID	04000		/* set user id on execution */
217204552Salfred#define	VSGID	02000		/* set group id on execution */
218204552Salfred#define	VSVTX	01000		/* save swapped text even after use */
219204552Salfred#define	VREAD	00400		/* read, write, execute permissions */
220204552Salfred#define	VWRITE	00200
221204552Salfred#define	VEXEC	00100
222204552Salfred
223204552Salfred/*
224204552Salfred * Token indicating no attribute value yet assigned.
225204552Salfred */
226204552Salfred#define	VNOVAL	(-1)
227204552Salfred
228204552Salfred#ifdef KERNEL
229204552Salfred
230204552Salfred#ifdef MALLOC_DECLARE
231204552SalfredMALLOC_DECLARE(M_VNODE);
232#endif
233
234/*
235 * Convert between vnode types and inode formats (since POSIX.1
236 * defines mode word of stat structure in terms of inode formats).
237 */
238extern enum vtype	iftovt_tab[];
239extern int		vttoif_tab[];
240#define IFTOVT(mode)	(iftovt_tab[((mode) & S_IFMT) >> 12])
241#define VTTOIF(indx)	(vttoif_tab[(int)(indx)])
242#define MAKEIMODE(indx, mode)	(int)(VTTOIF(indx) | (mode))
243
244/*
245 * Flags to various vnode functions.
246 */
247#define	SKIPSYSTEM	0x0001		/* vflush: skip vnodes marked VSYSTEM */
248#define	FORCECLOSE	0x0002		/* vflush: force file closure */
249#define	WRITECLOSE	0x0004		/* vflush: only close writable files */
250#define	DOCLOSE		0x0008		/* vclean: close active files */
251#define	V_SAVE		0x0001		/* vinvalbuf: sync file first */
252#define	REVOKEALL	0x0001		/* vop_revoke: revoke all aliases */
253
254#define	VREF(vp)	vref(vp)
255
256
257#ifdef DIAGNOSTIC
258#define	VATTR_NULL(vap)	vattr_null(vap)
259#else
260#define	VATTR_NULL(vap)	(*(vap) = va_null)	/* initialize a vattr */
261#endif /* DIAGNOSTIC */
262
263#define	NULLVP	((struct vnode *)NULL)
264
265#define	VNODEOP_SET(f) \
266	C_SYSINIT(f##init, SI_SUB_VFS, SI_ORDER_SECOND, vfs_add_vnodeops, &f); \
267	C_SYSUNINIT(f##uninit, SI_SUB_VFS, SI_ORDER_SECOND, vfs_rm_vnodeops, &f);
268
269/*
270 * Global vnode data.
271 */
272extern	struct vnode *rootvnode;	/* root (i.e. "/") vnode */
273extern	int desiredvnodes;		/* number of vnodes desired */
274extern	time_t syncdelay;		/* max time to delay syncing data */
275extern	time_t filedelay;		/* time to delay syncing files */
276extern	time_t dirdelay;		/* time to delay syncing directories */
277extern	time_t metadelay;		/* time to delay syncing metadata */
278extern	struct vm_zone *namei_zone;
279extern	int prtactive;			/* nonzero to call vprint() */
280extern	struct vattr va_null;		/* predefined null vattr structure */
281extern	int vfs_ioopt;
282
283/*
284 * Macro/function to check for client cache inconsistency w.r.t. leasing.
285 */
286#define	LEASE_READ	0x1		/* Check lease for readers */
287#define	LEASE_WRITE	0x2		/* Check lease for modifiers */
288
289
290extern void	(*lease_updatetime) __P((int deltat));
291
292#define VSHOULDFREE(vp)	\
293	(!((vp)->v_flag & (VFREE|VDOOMED)) && \
294	 !(vp)->v_holdcnt && !(vp)->v_usecount && \
295	 (!(vp)->v_object || \
296	  !((vp)->v_object->ref_count || (vp)->v_object->resident_page_count)))
297
298#define VSHOULDBUSY(vp)	\
299	(((vp)->v_flag & (VFREE|VTBFREE)) && \
300	 ((vp)->v_holdcnt || (vp)->v_usecount))
301
302#endif /* KERNEL */
303
304
305/*
306 * Mods for extensibility.
307 */
308
309/*
310 * Flags for vdesc_flags:
311 */
312#define VDESC_MAX_VPS		16
313/* Low order 16 flag bits are reserved for willrele flags for vp arguments. */
314#define VDESC_VP0_WILLRELE	0x0001
315#define VDESC_VP1_WILLRELE	0x0002
316#define VDESC_VP2_WILLRELE	0x0004
317#define VDESC_VP3_WILLRELE	0x0008
318#define VDESC_NOMAP_VPP		0x0100
319#define VDESC_VPP_WILLRELE	0x0200
320
321/*
322 * VDESC_NO_OFFSET is used to identify the end of the offset list
323 * and in places where no such field exists.
324 */
325#define VDESC_NO_OFFSET -1
326
327/*
328 * This structure describes the vnode operation taking place.
329 */
330struct vnodeop_desc {
331	int	vdesc_offset;		/* offset in vector--first for speed */
332	char    *vdesc_name;		/* a readable name for debugging */
333	int	vdesc_flags;		/* VDESC_* flags */
334
335	/*
336	 * These ops are used by bypass routines to map and locate arguments.
337	 * Creds and procs are not needed in bypass routines, but sometimes
338	 * they are useful to (for example) transport layers.
339	 * Nameidata is useful because it has a cred in it.
340	 */
341	int	*vdesc_vp_offsets;	/* list ended by VDESC_NO_OFFSET */
342	int	vdesc_vpp_offset;	/* return vpp location */
343	int	vdesc_cred_offset;	/* cred location, if any */
344	int	vdesc_proc_offset;	/* proc location, if any */
345	int	vdesc_componentname_offset; /* if any */
346	/*
347	 * Finally, we've got a list of private data (about each operation)
348	 * for each transport layer.  (Support to manage this list is not
349	 * yet part of BSD.)
350	 */
351	caddr_t	*vdesc_transports;
352};
353
354#ifdef KERNEL
355/*
356 * A list of all the operation descs.
357 */
358extern struct vnodeop_desc *vnodeop_descs[];
359
360/*
361 * Interlock for scanning list of vnodes attached to a mountpoint
362 */
363extern struct simplelock mntvnode_slock;
364
365/*
366 * This macro is very helpful in defining those offsets in the vdesc struct.
367 *
368 * This is stolen from X11R4.  I ignored all the fancy stuff for
369 * Crays, so if you decide to port this to such a serious machine,
370 * you might want to consult Intrinsic.h's XtOffset{,Of,To}.
371 */
372#define VOPARG_OFFSET(p_type,field) \
373        ((int) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
374#define VOPARG_OFFSETOF(s_type,field) \
375	VOPARG_OFFSET(s_type*,field)
376#define VOPARG_OFFSETTO(S_TYPE,S_OFFSET,STRUCT_P) \
377	((S_TYPE)(((char*)(STRUCT_P))+(S_OFFSET)))
378
379
380/*
381 * This structure is used to configure the new vnodeops vector.
382 */
383struct vnodeopv_entry_desc {
384	struct vnodeop_desc *opve_op;   /* which operation this is */
385	vop_t *opve_impl;		/* code implementing this operation */
386};
387struct vnodeopv_desc {
388			/* ptr to the ptr to the vector where op should go */
389	vop_t ***opv_desc_vector_p;
390	struct vnodeopv_entry_desc *opv_desc_ops;   /* null terminated list */
391};
392
393/*
394 * A generic structure.
395 * This can be used by bypass routines to identify generic arguments.
396 */
397struct vop_generic_args {
398	struct vnodeop_desc *a_desc;
399	/* other random data follows, presumably */
400};
401
402
403#ifdef DEBUG_VFS_LOCKS
404/*
405 * Macros to aid in tracing VFS locking problems.  Not totally
406 * reliable since if the process sleeps between changing the lock
407 * state and checking it with the assert, some other process could
408 * change the state.  They are good enough for debugging a single
409 * filesystem using a single-threaded test.  I find that 'cvs co src'
410 * is a pretty good test.
411 */
412
413/*
414 * [dfr] Kludge until I get around to fixing all the vfs locking.
415 */
416#define IS_LOCKING_VFS(vp)	((vp)->v_tag == VT_UFS		\
417				 || (vp)->v_tag == VT_MFS	\
418				 || (vp)->v_tag == VT_NFS	\
419				 || (vp)->v_tag == VT_LFS	\
420				 || (vp)->v_tag == VT_ISOFS	\
421				 || (vp)->v_tag == VT_MSDOSFS	\
422				 || (vp)->v_tag == VT_DEVFS)
423
424#define ASSERT_VOP_LOCKED(vp, str)				\
425    if ((vp) && IS_LOCKING_VFS(vp) && !VOP_ISLOCKED(vp)) {	\
426	panic("%s: %p is not locked but should be", str, vp);	\
427    }
428
429#define ASSERT_VOP_UNLOCKED(vp, str)				\
430    if ((vp) && IS_LOCKING_VFS(vp) && VOP_ISLOCKED(vp)) {	\
431	panic("%s: %p is locked but shouldn't be", str, vp);	\
432    }
433
434#else
435
436#define ASSERT_VOP_LOCKED(vp, str)
437#define ASSERT_VOP_UNLOCKED(vp, str)
438
439#endif
440
441/*
442 * VOCALL calls an op given an ops vector.  We break it out because BSD's
443 * vclean changes the ops vector and then wants to call ops with the old
444 * vector.
445 */
446#define VOCALL(OPSV,OFF,AP) (( *((OPSV)[(OFF)])) (AP))
447
448/*
449 * This call works for vnodes in the kernel.
450 */
451#define VCALL(VP,OFF,AP) VOCALL((VP)->v_op,(OFF),(AP))
452#define VDESC(OP) (& __CONCAT(OP,_desc))
453#define VOFFSET(OP) (VDESC(OP)->vdesc_offset)
454
455/*
456 * VMIO support inline
457 */
458
459extern int vmiodirenable;
460
461static __inline int
462vn_canvmio(struct vnode *vp)
463{
464    if (vp && (vp->v_type == VREG || (vmiodirenable && vp->v_type == VDIR)))
465        return(TRUE);
466    return(FALSE);
467}
468
469/*
470 * Finally, include the default set of vnode operations.
471 */
472#include "vnode_if.h"
473
474/*
475 * Public vnode manipulation functions.
476 */
477struct componentname;
478struct file;
479struct mount;
480struct nameidata;
481struct ostat;
482struct proc;
483struct stat;
484struct nstat;
485struct ucred;
486struct uio;
487struct vattr;
488struct vnode;
489struct vop_bwrite_args;
490
491extern int	(*lease_check_hook) __P((struct vop_lease_args *));
492
493void	addalias __P((struct vnode *vp, dev_t nvp_rdev));
494void	addaliasu __P((struct vnode *vp, udev_t nvp_rdev));
495int 	bdevvp __P((dev_t dev, struct vnode **vpp));
496/* cache_* may belong in namei.h. */
497void	cache_enter __P((struct vnode *dvp, struct vnode *vp,
498	    struct componentname *cnp));
499int	cache_lookup __P((struct vnode *dvp, struct vnode **vpp,
500	    struct componentname *cnp));
501void	cache_purge __P((struct vnode *vp));
502void	cache_purgevfs __P((struct mount *mp));
503void	cvtstat __P((struct stat *st, struct ostat *ost));
504void	cvtnstat __P((struct stat *sb, struct nstat *nsb));
505int 	getnewvnode __P((enum vtagtype tag,
506	    struct mount *mp, vop_t **vops, struct vnode **vpp));
507int	lease_check __P((struct vop_lease_args *ap));
508int	spec_vnoperate __P((struct vop_generic_args *));
509int	speedup_syncer __P((void));
510void 	vattr_null __P((struct vattr *vap));
511int 	vcount __P((struct vnode *vp));
512void	vdrop __P((struct vnode *));
513int	vfinddev __P((dev_t dev, enum vtype type, struct vnode **vpp));
514void	vfs_add_vnodeops __P((const void *));
515void	vfs_rm_vnodeops __P((const void *));
516int	vflush __P((struct mount *mp, struct vnode *skipvp, int flags));
517int 	vget __P((struct vnode *vp, int lockflag, struct proc *p));
518void 	vgone __P((struct vnode *vp));
519void	vhold __P((struct vnode *));
520int	vinvalbuf __P((struct vnode *vp, int save, struct ucred *cred,
521
522	    struct proc *p, int slpflag, int slptimeo));
523int	vtruncbuf __P((struct vnode *vp, struct ucred *cred, struct proc *p,
524		off_t length, int blksize));
525void	vprint __P((char *label, struct vnode *vp));
526int	vrecycle __P((struct vnode *vp, struct simplelock *inter_lkp,
527	    struct proc *p));
528int 	vn_close __P((struct vnode *vp,
529	    int flags, struct ucred *cred, struct proc *p));
530int	vn_isdisk __P((struct vnode *vp));
531int	vn_lock __P((struct vnode *vp, int flags, struct proc *p));
532#ifdef	DEBUG_LOCKS
533int	debug_vn_lock __P((struct vnode *vp, int flags, struct proc *p,
534	    const char *filename, int line));
535#define vn_lock(vp,flags,p) debug_vn_lock(vp,flags,p,__FILE__,__LINE__)
536#endif
537int 	vn_open __P((struct nameidata *ndp, int fmode, int cmode));
538void	vn_pollevent __P((struct vnode *vp, int events));
539void	vn_pollgone __P((struct vnode *vp));
540int	vn_pollrecord __P((struct vnode *vp, struct proc *p, int events));
541int 	vn_rdwr __P((enum uio_rw rw, struct vnode *vp, caddr_t base,
542	    int len, off_t offset, enum uio_seg segflg, int ioflg,
543	    struct ucred *cred, int *aresid, struct proc *p));
544int	vn_stat __P((struct vnode *vp, struct stat *sb, struct proc *p));
545dev_t	vn_todev __P((struct vnode *vp));
546int	vfs_cache_lookup __P((struct vop_lookup_args *ap));
547int	vfs_object_create __P((struct vnode *vp, struct proc *p,
548                struct ucred *cred));
549void	vfs_timestamp __P((struct timespec *));
550int 	vn_writechk __P((struct vnode *vp));
551int	vop_stdbwrite __P((struct vop_bwrite_args *ap));
552int	vop_stdislocked __P((struct vop_islocked_args *));
553int	vop_stdlock __P((struct vop_lock_args *));
554int	vop_stdunlock __P((struct vop_unlock_args *));
555int	vop_noislocked __P((struct vop_islocked_args *));
556int	vop_nolock __P((struct vop_lock_args *));
557int	vop_nopoll __P((struct vop_poll_args *));
558int	vop_nounlock __P((struct vop_unlock_args *));
559int	vop_stdpathconf __P((struct vop_pathconf_args *));
560int	vop_stdpoll __P((struct vop_poll_args *));
561int	vop_revoke __P((struct vop_revoke_args *));
562int	vop_sharedlock __P((struct vop_lock_args *));
563int	vop_eopnotsupp __P((struct vop_generic_args *ap));
564int	vop_ebadf __P((struct vop_generic_args *ap));
565int	vop_einval __P((struct vop_generic_args *ap));
566int	vop_enotty __P((struct vop_generic_args *ap));
567int	vop_defaultop __P((struct vop_generic_args *ap));
568int	vop_null __P((struct vop_generic_args *ap));
569int	vop_panic __P((struct vop_generic_args *ap));
570
571void 	vput __P((struct vnode *vp));
572void 	vrele __P((struct vnode *vp));
573void	vref __P((struct vnode *vp));
574void	vbusy __P((struct vnode *vp));
575
576extern	vop_t	**default_vnodeop_p;
577extern	vop_t **spec_vnodeop_p;
578
579extern TAILQ_HEAD(tobefreelist, vnode)
580	vnode_tobefree_list;	/* vnode free list */
581
582#endif /* KERNEL */
583
584#endif /* !_SYS_VNODE_H_ */
585