vnode.h revision 31561
11541Srgrimes/*
21541Srgrimes * Copyright (c) 1989, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * Redistribution and use in source and binary forms, with or without
61541Srgrimes * modification, are permitted provided that the following conditions
71541Srgrimes * are met:
81541Srgrimes * 1. Redistributions of source code must retain the above copyright
91541Srgrimes *    notice, this list of conditions and the following disclaimer.
101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes *    notice, this list of conditions and the following disclaimer in the
121541Srgrimes *    documentation and/or other materials provided with the distribution.
131541Srgrimes * 3. All advertising materials mentioning features or use of this software
141541Srgrimes *    must display the following acknowledgement:
151541Srgrimes *	This product includes software developed by the University of
161541Srgrimes *	California, Berkeley and its contributors.
171541Srgrimes * 4. Neither the name of the University nor the names of its contributors
181541Srgrimes *    may be used to endorse or promote products derived from this software
191541Srgrimes *    without specific prior written permission.
201541Srgrimes *
211541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2985052Sru * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3050477Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311541Srgrimes * SUCH DAMAGE.
321541Srgrimes *
332168Spaul *	@(#)vnode.h	8.7 (Berkeley) 2/4/94
342168Spaul * $Id: vnode.h,v 1.57 1997/11/22 08:35:43 bde Exp $
352168Spaul */
361541Srgrimes
371541Srgrimes#ifndef _SYS_VNODE_H_
388876Srgrimes#define	_SYS_VNODE_H_
391541Srgrimes
401541Srgrimes#include <sys/queue.h>
411541Srgrimes
421541Srgrimes#include <machine/lock.h>
431541Srgrimes
441541Srgrimes/*
451541Srgrimes * The vnode is the focus of all file activity in UNIX.  There is a
461541Srgrimes * unique vnode allocated for each active file, each current directory,
471541Srgrimes * each mounted-on file, text file, and the root.
481541Srgrimes */
491541Srgrimes
501541Srgrimes/*
511541Srgrimes * Vnode types.  VNON means no type.
521541Srgrimes */
531541Srgrimesenum vtype	{ VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
541541Srgrimes
551541Srgrimes/*
561541Srgrimes * Vnode tag types.
57122922Sandre * These are for the benefit of external programs only (e.g., pstat)
58122922Sandre * and should NEVER be inspected by the kernel.
59122922Sandre */
60122922Sandreenum vtagtype	{
61122922Sandre	VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC,
62122922Sandre	VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS,
631541Srgrimes	VT_UNION, VT_MSDOSFS, VT_DEVFS, VT_TFS
641541Srgrimes};
651541Srgrimes
661541Srgrimes/*
671541Srgrimes * Each underlying filesystem allocates its own private area and hangs
6813765Smpp * it from v_data.  If non-null, this area is freed in getnewvnode().
6913765Smpp */
701541SrgrimesLIST_HEAD(buflists, buf);
711541Srgrimes
721541Srgrimestypedef	int 	vop_t __P((void *));
731541Srgrimesstruct namecache;
745791Swollman
751541Srgrimes/*
761541Srgrimes * Reading or writing any of these items requires holding the appropriate lock.
771541Srgrimes * v_freelist is locked by the global vnode_free_list simple lock.
781541Srgrimes * v_mntvnodes is locked by the global mntvnodes simple lock.
791541Srgrimes * v_flag, v_usecount, v_holdcount and v_writecount are
801541Srgrimes *    locked by the v_interlock simple lock.
811541Srgrimes */
821541Srgrimesstruct vnode {
831541Srgrimes	u_long	v_flag;				/* vnode flags (see below) */
841541Srgrimes	int	v_usecount;			/* reference count of users */
851541Srgrimes	int	v_writecount;			/* reference count of writers */
865833Sbde	int	v_holdcnt;			/* page & buffer references */
875833Sbde	daddr_t	v_lastr;			/* last read (read-ahead) */
885833Sbde	u_long	v_id;				/* capability identifier */
895833Sbde	struct	mount *v_mount;			/* ptr to vfs we are in */
905833Sbde	vop_t	**v_op;				/* vnode operations vector */
911541Srgrimes	TAILQ_ENTRY(vnode) v_freelist;		/* vnode freelist */
921541Srgrimes	LIST_ENTRY(vnode) v_mntvnodes;		/* vnodes for mount point */
931541Srgrimes	struct	buflists v_cleanblkhd;		/* clean blocklist head */
941541Srgrimes	struct	buflists v_dirtyblkhd;		/* dirty blocklist head */
951541Srgrimes	long	v_numoutput;			/* num of writes in progress */
961541Srgrimes	enum	vtype v_type;			/* vnode type */
971541Srgrimes	union {
981541Srgrimes		struct mount	*vu_mountedhere;/* ptr to mounted vfs (VDIR) */
991541Srgrimes		struct socket	*vu_socket;	/* unix ipc (VSOCK) */
1001541Srgrimes		struct specinfo	*vu_specinfo;	/* device (VCHR, VBLK) */
1011541Srgrimes		struct fifoinfo	*vu_fifoinfo;	/* fifo (VFIFO) */
1021541Srgrimes	} v_un;
103128454Sluigi	struct	nqlease *v_lease;		/* Soft reference to lease */
104128454Sluigi	daddr_t	v_lastw;			/* last write (write cluster) */
105128454Sluigi	daddr_t	v_cstart;			/* start block of cluster */
106128454Sluigi	daddr_t	v_lasta;			/* last allocation */
107128454Sluigi	int	v_clen;				/* length of current cluster */
1081541Srgrimes	struct vm_object *v_object;		/* Place to store VM object */
1091541Srgrimes	struct	simplelock v_interlock;		/* lock on usecount and flag */
1101541Srgrimes	struct	lock *v_vnlock;			/* used for non-locking fs's */
1117197Swollman	enum	vtagtype v_tag;			/* type of underlying data */
1121541Srgrimes	void 	*v_data;			/* private data for fs */
113122922Sandre	LIST_HEAD(, namecache) v_cache_src;	/* Cache entries from us */
114127828Sluigi	TAILQ_HEAD(, namecache) v_cache_dst;	/* Cache entries to us */
115127828Sluigi	struct	vnode *v_dd;			/* .. vnode */
1161541Srgrimes	u_long	v_ddid;				/* .. capability identifier */
1171541Srgrimes};
1181541Srgrimes#define	v_mountedhere	v_un.vu_mountedhere
1195791Swollman#define	v_socket	v_un.vu_socket
120120727Ssam#define	v_specinfo	v_un.vu_specinfo
121120727Ssam#define	v_fifoinfo	v_un.vu_fifoinfo
122120727Ssam
123120727Ssam/*
1241541Srgrimes * Vnode flags.
1251541Srgrimes */
1261541Srgrimes#define	VROOT		0x00001	/* root of its file system */
1271541Srgrimes#define	VTEXT		0x00002	/* vnode is a pure text prototype */
1281541Srgrimes#define	VSYSTEM		0x00004	/* vnode being used by kernel */
1291541Srgrimes#define	VISTTY		0x00008	/* vnode represents a tty */
1301541Srgrimes#define	VXLOCK		0x00100	/* vnode is locked to change underlying type */
1311541Srgrimes#define	VXWANT		0x00200	/* process is waiting for vnode */
1321541Srgrimes#define	VBWAIT		0x00400	/* waiting for output to complete */
1331541Srgrimes#define	VALIASED	0x00800	/* vnode has an alias */
1341541Srgrimes#define	VDIROP		0x01000	/* LFS: vnode is involved in a directory op */
1351541Srgrimes#define	VVMIO		0x02000	/* VMIO flag */
1361541Srgrimes#define	VNINACT		0x04000	/* LFS: skip ufs_inactive() in lfs_vunref */
1371541Srgrimes#define	VAGE		0x08000	/* Insert vnode at head of free list */
1381541Srgrimes#define	VOLOCK		0x10000	/* vnode is locked waiting for an object */
1391541Srgrimes#define	VOWANT		0x20000	/* a process is waiting for VOLOCK */
1404104Swollman#define	VDOOMED		0x40000	/* This vnode is being recycled */
1414104Swollman#define	VFREE		0x80000	/* This vnode is on the freelist */
1421541Srgrimes
1431541Srgrimes/*
1441541Srgrimes * Vnode attributes.  A field value of VNOVAL represents a field whose value
1451541Srgrimes * is unavailable (getattr) or which is not to be changed (setattr).
1461541Srgrimes */
1471541Srgrimesstruct vattr {
1481541Srgrimes	enum vtype	va_type;	/* vnode type (for create) */
14986764Sjlemon	u_short		va_mode;	/* files access mode and type */
1501541Srgrimes	short		va_nlink;	/* number of references to file */
1511541Srgrimes	uid_t		va_uid;		/* owner user id */
15217835Sjulian	gid_t		va_gid;		/* owner group id */
1531541Srgrimes	long		va_fsid;	/* file system id (dev for now) */
1541541Srgrimes	long		va_fileid;	/* file id */
1551541Srgrimes	u_quad_t	va_size;	/* file size in bytes */
1561541Srgrimes	long		va_blocksize;	/* blocksize preferred for i/o */
1571541Srgrimes	struct timespec	va_atime;	/* time of last access */
158122921Sandre	struct timespec	va_mtime;	/* time of last modification */
159122921Sandre	struct timespec	va_ctime;	/* time file changed */
160122921Sandre	u_long		va_gen;		/* generation number of file */
161122921Sandre	u_long		va_flags;	/* flags defined for file */
162122921Sandre	dev_t		va_rdev;	/* device the special file represents */
1635099Swollman	u_quad_t	va_bytes;	/* bytes of disk space held by file */
1645099Swollman	u_quad_t	va_filerev;	/* file modification number */
16518839Swollman	u_int		va_vaflags;	/* operations flags, see below */
1666245Swollman	long		va_spare;	/* remain quad aligned */
16715652Swollman};
16815652Swollman
16915652Swollman/*
17015652Swollman * Flags for va_vaflags.
1711541Srgrimes */
1721541Srgrimes#define	VA_UTIMES_NULL	0x01		/* utimes argument was NULL */
1731541Srgrimes#define VA_EXCLUSIVE	0x02		/* exclusive create request */
1741541Srgrimes
1751541Srgrimes/*
1761541Srgrimes * Flags for ioflag.
1771541Srgrimes */
1781541Srgrimes#define	IO_UNIT		0x01		/* do I/O as atomic unit */
1791541Srgrimes#define	IO_APPEND	0x02		/* append write to end */
1801541Srgrimes#define	IO_SYNC		0x04		/* do I/O synchronously */
1811541Srgrimes#define	IO_NODELOCKED	0x08		/* underlying node already locked */
1821541Srgrimes#define	IO_NDELAY	0x10		/* FNDELAY flag set in file table */
1831541Srgrimes#define	IO_VMIO		0x20		/* data already in VMIO space */
1841541Srgrimes
1851541Srgrimes/*
1861541Srgrimes *  Modes.  Some values same as Ixxx entries from inode.h for now.
1871541Srgrimes */
1881541Srgrimes#define	VSUID	04000		/* set user id on execution */
1891541Srgrimes#define	VSGID	02000		/* set group id on execution */
1901541Srgrimes#define	VSVTX	01000		/* save swapped text even after use */
1911541Srgrimes#define	VREAD	00400		/* read, write, execute permissions */
1921541Srgrimes#define	VWRITE	00200
1931541Srgrimes#define	VEXEC	00100
1941541Srgrimes
1951541Srgrimes/*
1961541Srgrimes * Token indicating no attribute value yet assigned.
1971541Srgrimes */
1981541Srgrimes#define	VNOVAL	(-1)
1991541Srgrimes
2005791Swollman#ifdef KERNEL
2011541Srgrimes
20251252Sru#ifdef MALLOC_DECLARE
20351252SruMALLOC_DECLARE(M_VNODE);
20451252Sru#endif
2051541Srgrimes
2061541Srgrimes/*
2071541Srgrimes * Convert between vnode types and inode formats (since POSIX.1
2081541Srgrimes * defines mode word of stat structure in terms of inode formats).
2091541Srgrimes */
2101541Srgrimesextern enum vtype	iftovt_tab[];
2111541Srgrimesextern int		vttoif_tab[];
2121541Srgrimes#define IFTOVT(mode)	(iftovt_tab[((mode) & S_IFMT) >> 12])
2131541Srgrimes#define VTTOIF(indx)	(vttoif_tab[(int)(indx)])
2141541Srgrimes#define MAKEIMODE(indx, mode)	(int)(VTTOIF(indx) | (mode))
2151541Srgrimes
2161541Srgrimes/*
2171541Srgrimes * Flags to various vnode functions.
2181541Srgrimes */
21921666Swollman#define	SKIPSYSTEM	0x0001		/* vflush: skip vnodes marked VSYSTEM */
22021666Swollman#define	FORCECLOSE	0x0002		/* vflush: force file closure */
22189498Sru#define	WRITECLOSE	0x0004		/* vflush: only close writable files */
2221541Srgrimes#define	DOCLOSE		0x0008		/* vclean: close active files */
22351252Sru#define	V_SAVE		0x0001		/* vinvalbuf: sync file first */
22451252Sru#define	V_SAVEMETA	0x0002		/* vinvalbuf: leave indirect blocks */
22551252Sru#define	REVOKEALL	0x0001		/* vop_revoke: revoke all aliases */
2261541Srgrimes
2271541Srgrimes#define	VREF(vp)	vref(vp)
22851252Sru
2291541Srgrimes#ifdef DIAGNOSTIC
2301541Srgrimes#define	VATTR_NULL(vap)	vattr_null(vap)
2311541Srgrimes#else
2321541Srgrimes#define	VATTR_NULL(vap)	(*(vap) = va_null)	/* initialize a vattr */
2331541Srgrimes#endif /* DIAGNOSTIC */
2341541Srgrimes
2351541Srgrimes#define	NULLVP	((struct vnode *)NULL)
23651252Sru
2371541Srgrimes#ifdef VFS_LKM
2381541Srgrimes#define	VNODEOP_SET(f) DATA_SET(MODVNOPS,f)
2391541Srgrimes#else
2401541Srgrimes#define	VNODEOP_SET(f) DATA_SET(vfs_opv_descs_,f)
2411541Srgrimes#endif
2421541Srgrimes
2431541Srgrimes/*
2441541Srgrimes * Global vnode data.
2451541Srgrimes */
2461541Srgrimesextern	struct vnode *rootvnode;	/* root (i.e. "/") vnode */
2471541Srgrimesextern	int desiredvnodes;		/* number of vnodes desired */
2481541Srgrimesextern	struct vm_zone *namei_zone;
2491541Srgrimesextern	int prtactive;			/* nonzero to call vprint() */
2501541Srgrimesextern	struct vattr va_null;		/* predefined null vattr structure */
2511541Srgrimes
2521541Srgrimes/*
2531541Srgrimes * Macro/function to check for client cache inconsistency w.r.t. leasing.
2541541Srgrimes */
2551541Srgrimes#define	LEASE_READ	0x1		/* Check lease for readers */
2561541Srgrimes#define	LEASE_WRITE	0x2		/* Check lease for modifiers */
2571541Srgrimes
2581541Srgrimes
2591541Srgrimesextern void	(*lease_updatetime) __P((int deltat));
2601541Srgrimes
2611541Srgrimes#define VSHOULDFREE(vp)	\
2621541Srgrimes	(!((vp)->v_flag & (VFREE|VDOOMED)) && \
26385074Sru	 !(vp)->v_holdcnt && !(vp)->v_usecount)
26485074Sru
26585074Sru#define VSHOULDBUSY(vp)	\
2661541Srgrimes	(((vp)->v_flag & VFREE) && \
2671541Srgrimes	 ((vp)->v_holdcnt || (vp)->v_usecount))
268128185Sluigi
269128185Sluigi
270128185Sluigi#endif /* KERNEL */
271128185Sluigi
272128185Sluigi
273128185Sluigi/*
274128185Sluigi * Mods for extensibility.
275128185Sluigi */
276128185Sluigi
277128185Sluigi/*
278128185Sluigi * Flags for vdesc_flags:
279128185Sluigi */
28055205Speter#define VDESC_MAX_VPS		16
281117752Shsu/* Low order 16 flag bits are reserved for willrele flags for vp arguments. */
282120727Ssam#define VDESC_VP0_WILLRELE	0x0001
283120727Ssam#define VDESC_VP1_WILLRELE	0x0002
284120727Ssam#define VDESC_VP2_WILLRELE	0x0004
285120727Ssam#define VDESC_VP3_WILLRELE	0x0008
286120727Ssam#define VDESC_NOMAP_VPP		0x0100
287120727Ssam#define VDESC_VPP_WILLRELE	0x0200
288117752Shsu
289122334Ssam/*
290122334Ssam * VDESC_NO_OFFSET is used to identify the end of the offset list
291122334Ssam * and in places where no such field exists.
292122334Ssam */
293122334Ssam#define VDESC_NO_OFFSET -1
294122334Ssam
295122334Ssam/*
296122334Ssam * This structure describes the vnode operation taking place.
297122334Ssam */
298122334Ssamstruct vnodeop_desc {
299122334Ssam	int	vdesc_offset;		/* offset in vector--first for speed */
300122334Ssam	char    *vdesc_name;		/* a readable name for debugging */
301122334Ssam	int	vdesc_flags;		/* VDESC_* flags */
302122334Ssam
303122334Ssam	/*
304122334Ssam	 * These ops are used by bypass routines to map and locate arguments.
305122334Ssam	 * Creds and procs are not needed in bypass routines, but sometimes
306122334Ssam	 * they are useful to (for example) transport layers.
307122334Ssam	 * Nameidata is useful because it has a cred in it.
308122334Ssam	 */
309122334Ssam	int	*vdesc_vp_offsets;	/* list ended by VDESC_NO_OFFSET */
310122334Ssam	int	vdesc_vpp_offset;	/* return vpp location */
31146568Speter	int	vdesc_cred_offset;	/* cred location, if any */
312122334Ssam	int	vdesc_proc_offset;	/* proc location, if any */
313122334Ssam	int	vdesc_componentname_offset; /* if any */
314122334Ssam	/*
315120727Ssam	 * Finally, we've got a list of private data (about each operation)
3161541Srgrimes	 * for each transport layer.  (Support to manage this list is not
3179759Sbde	 * yet part of BSD.)
3181541Srgrimes	 */
31921666Swollman	caddr_t	*vdesc_transports;
32021666Swollman};
32192725Salfred
32292725Salfred#ifdef KERNEL
32392725Salfred/*
32492725Salfred * A list of all the operation descs.
32592725Salfred */
32692725Salfredextern struct vnodeop_desc *vnodeop_descs[];
32792725Salfred
328128621Sluigi/*
329128621Sluigi * Interlock for scanning list of vnodes attached to a mountpoint
330128621Sluigi */
331128621Sluigiextern struct simplelock mntvnode_slock;
332128621Sluigi
333128621Sluigi/*
334128621Sluigi * This macro is very helpful in defining those offsets in the vdesc struct.
335128621Sluigi *
336128621Sluigi * This is stolen from X11R4.  I ignored all the fancy stuff for
337128621Sluigi * Crays, so if you decide to port this to such a serious machine,
338128621Sluigi * you might want to consult Intrinsic.h's XtOffset{,Of,To}.
339128621Sluigi */
340128621Sluigi#define VOPARG_OFFSET(p_type,field) \
341128621Sluigi        ((int) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
342128621Sluigi#define VOPARG_OFFSETOF(s_type,field) \
343120727Ssam	VOPARG_OFFSET(s_type*,field)
344121770Ssam#define VOPARG_OFFSETTO(S_TYPE,S_OFFSET,STRUCT_P) \
34592725Salfred	((S_TYPE)(((char*)(STRUCT_P))+(S_OFFSET)))
34692725Salfred
34792725Salfred
34892725Salfred/*
349120727Ssam * This structure is used to configure the new vnodeops vector.
35092725Salfred */
35192725Salfredstruct vnodeopv_entry_desc {
35292725Salfred	struct vnodeop_desc *opve_op;   /* which operation this is */
353111767Smdodd	vop_t *opve_impl;		/* code implementing this operation */
3541541Srgrimes};
3552168Spaulstruct vnodeopv_desc {
3562168Spaul			/* ptr to the ptr to the vector where op should go */
357	vop_t ***opv_desc_vector_p;
358	struct vnodeopv_entry_desc *opv_desc_ops;   /* null terminated list */
359};
360
361/*
362 * A generic structure.
363 * This can be used by bypass routines to identify generic arguments.
364 */
365struct vop_generic_args {
366	struct vnodeop_desc *a_desc;
367	/* other random data follows, presumably */
368};
369
370
371#ifdef DEBUG_VFS_LOCKS
372/*
373 * Macros to aid in tracing VFS locking problems.  Not totally
374 * reliable since if the process sleeps between changing the lock
375 * state and checking it with the assert, some other process could
376 * change the state.  They are good enough for debugging a single
377 * filesystem using a single-threaded test.  I find that 'cvs co src'
378 * is a pretty good test.
379 */
380
381/*
382 * [dfr] Kludge until I get around to fixing all the vfs locking.
383 */
384#define IS_LOCKING_VFS(vp)	((vp)->v_tag == VT_UFS		\
385				 || (vp)->v_tag == VT_MFS	\
386				 || (vp)->v_tag == VT_NFS	\
387				 || (vp)->v_tag == VT_LFS	\
388				 || (vp)->v_tag == VT_ISOFS	\
389				 || (vp)->v_tag == VT_MSDOSFS	\
390				 || (vp)->v_tag == VT_DEVFS)
391
392#define ASSERT_VOP_LOCKED(vp, str)				\
393    if ((vp) && IS_LOCKING_VFS(vp) && !VOP_ISLOCKED(vp)) {	\
394	panic("%s: %x is not locked but should be", str, vp);	\
395    }
396
397#define ASSERT_VOP_UNLOCKED(vp, str)				\
398    if ((vp) && IS_LOCKING_VFS(vp) && VOP_ISLOCKED(vp)) {	\
399	panic("%s: %x is locked but shouldn't be", str, vp);	\
400    }
401
402#else
403
404#define ASSERT_VOP_LOCKED(vp, str)
405#define ASSERT_VOP_UNLOCKED(vp, str)
406
407#endif
408
409/*
410 * VOCALL calls an op given an ops vector.  We break it out because BSD's
411 * vclean changes the ops vector and then wants to call ops with the old
412 * vector.
413 */
414#define VOCALL(OPSV,OFF,AP) (( *((OPSV)[(OFF)])) (AP))
415
416/*
417 * This call works for vnodes in the kernel.
418 */
419#define VCALL(VP,OFF,AP) VOCALL((VP)->v_op,(OFF),(AP))
420#define VDESC(OP) (& __CONCAT(OP,_desc))
421#define VOFFSET(OP) (VDESC(OP)->vdesc_offset)
422
423/*
424 * Finally, include the default set of vnode operations.
425 */
426#include "vnode_if.h"
427
428/*
429 * Public vnode manipulation functions.
430 */
431struct componentname;
432struct file;
433struct mount;
434struct nameidata;
435struct ostat;
436struct proc;
437struct stat;
438struct ucred;
439struct uio;
440struct vattr;
441struct vnode;
442struct vop_bwrite_args;
443
444extern int	(*lease_check_hook) __P((struct vop_lease_args *));
445
446int 	bdevvp __P((dev_t dev, struct vnode **vpp));
447/* cache_* may belong in namei.h. */
448void	cache_enter __P((struct vnode *dvp, struct vnode *vp,
449	    struct componentname *cnp));
450int	cache_lookup __P((struct vnode *dvp, struct vnode **vpp,
451	    struct componentname *cnp));
452void	cache_purge __P((struct vnode *vp));
453void	cache_purgevfs __P((struct mount *mp));
454void	cvtstat __P((struct stat *st, struct ostat *ost));
455int 	getnewvnode __P((enum vtagtype tag,
456	    struct mount *mp, vop_t **vops, struct vnode **vpp));
457int	lease_check __P((struct vop_lease_args *ap));
458void 	vattr_null __P((struct vattr *vap));
459int 	vcount __P((struct vnode *vp));
460void	vdrop __P((struct vnode *));
461int	vfinddev __P((dev_t dev, enum vtype type, struct vnode **vpp));
462void	vfs_opv_init __P((struct vnodeopv_desc **them));
463int	vflush __P((struct mount *mp, struct vnode *skipvp, int flags));
464int 	vget __P((struct vnode *vp, int lockflag, struct proc *p));
465void 	vgone __P((struct vnode *vp));
466void	vhold __P((struct vnode *));
467int	vinvalbuf __P((struct vnode *vp, int save, struct ucred *cred,
468	    struct proc *p, int slpflag, int slptimeo));
469void	vprint __P((char *label, struct vnode *vp));
470int	vrecycle __P((struct vnode *vp, struct simplelock *inter_lkp,
471	    struct proc *p));
472int 	vn_close __P((struct vnode *vp,
473	    int flags, struct ucred *cred, struct proc *p));
474int	vn_lock __P((struct vnode *vp, int flags, struct proc *p));
475int 	vn_open __P((struct nameidata *ndp, int fmode, int cmode));
476int 	vn_rdwr __P((enum uio_rw rw, struct vnode *vp, caddr_t base,
477	    int len, off_t offset, enum uio_seg segflg, int ioflg,
478	    struct ucred *cred, int *aresid, struct proc *p));
479int	vn_stat __P((struct vnode *vp, struct stat *sb, struct proc *p));
480int	vfs_cache_lookup __P((struct vop_lookup_args *ap));
481int	vfs_object_create __P((struct vnode *vp, struct proc *p,
482                struct ucred *cred, int waslocked));
483int 	vn_writechk __P((struct vnode *vp));
484int	vop_stdbwrite __P((struct vop_bwrite_args *ap));
485int	vop_stdislocked __P((struct vop_islocked_args *));
486int	vop_stdlock __P((struct vop_lock_args *));
487int	vop_stdunlock __P((struct vop_unlock_args *));
488int	vop_noislocked __P((struct vop_islocked_args *));
489int	vop_nolock __P((struct vop_lock_args *));
490int	vop_nopoll __P((struct vop_poll_args *));
491int	vop_nounlock __P((struct vop_unlock_args *));
492int	vop_stdpathconf __P((struct vop_pathconf_args *));
493int	vop_revoke __P((struct vop_revoke_args *));
494int	vop_sharedlock __P((struct vop_lock_args *));
495int	vop_eopnotsupp __P((struct vop_generic_args *ap));
496int	vop_ebadf __P((struct vop_generic_args *ap));
497int	vop_einval __P((struct vop_generic_args *ap));
498int	vop_enotty __P((struct vop_generic_args *ap));
499int	vop_defaultop __P((struct vop_generic_args *ap));
500int	vop_null __P((struct vop_generic_args *ap));
501
502struct vnode *
503	checkalias __P((struct vnode *vp, dev_t nvp_rdev, struct mount *mp));
504void 	vput __P((struct vnode *vp));
505void 	vref __P((struct vnode *vp));
506void 	vrele __P((struct vnode *vp));
507
508extern	vop_t	**default_vnodeop_p;
509#endif /* KERNEL */
510
511#endif /* !_SYS_VNODE_H_ */
512