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