vnode.h revision 236043
1139743Simp/*- 239213Sgibbs * Copyright (c) 1989, 1993 3111206Sken * The Regents of the University of California. All rights reserved. 439213Sgibbs * 539213Sgibbs * Redistribution and use in source and binary forms, with or without 639213Sgibbs * modification, are permitted provided that the following conditions 739213Sgibbs * are met: 839213Sgibbs * 1. Redistributions of source code must retain the above copyright 939213Sgibbs * notice, this list of conditions and the following disclaimer. 1039213Sgibbs * 2. Redistributions in binary form must reproduce the above copyright 1139213Sgibbs * notice, this list of conditions and the following disclaimer in the 1239213Sgibbs * documentation and/or other materials provided with the distribution. 1339213Sgibbs * 4. Neither the name of the University nor the names of its contributors 1439213Sgibbs * may be used to endorse or promote products derived from this software 1539213Sgibbs * without specific prior written permission. 1639213Sgibbs * 1739213Sgibbs * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1839213Sgibbs * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1939213Sgibbs * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2039213Sgibbs * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2139213Sgibbs * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2239213Sgibbs * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2339213Sgibbs * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2439213Sgibbs * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2539213Sgibbs * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2639213Sgibbs * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27116162Sobrien * SUCH DAMAGE. 28139743Simp * 2939213Sgibbs * @(#)vnode.h 8.7 (Berkeley) 2/4/94 3039213Sgibbs * $FreeBSD: head/sys/sys/vnode.h 236043 2012-05-26 05:28:47Z kib $ 3139213Sgibbs */ 3239213Sgibbs 3339213Sgibbs#ifndef _SYS_VNODE_H_ 3439213Sgibbs#define _SYS_VNODE_H_ 3539213Sgibbs 3639213Sgibbs#include <sys/bufobj.h> 3739213Sgibbs#include <sys/queue.h> 3839213Sgibbs#include <sys/lock.h> 3939213Sgibbs#include <sys/lockmgr.h> 4039213Sgibbs#include <sys/mutex.h> 4139213Sgibbs#include <sys/selinfo.h> 4239213Sgibbs#include <sys/uio.h> 4339213Sgibbs#include <sys/acl.h> 4439213Sgibbs#include <sys/ktr.h> 4539213Sgibbs 4639213Sgibbs/* 4739213Sgibbs * The vnode is the focus of all file activity in UNIX. There is a 48116162Sobrien * unique vnode allocated for each active file, each current directory, 49116162Sobrien * each mounted-on file, text file, and the root. 50116162Sobrien */ 5140020Sken 5239213Sgibbs/* 5339213Sgibbs * Vnode types. VNON means no type. 5439213Sgibbs */ 5539213Sgibbsenum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, 5660041Sphk VMARKER }; 5751836Sphk 5851836Sphk/* 5939213Sgibbs * Each underlying filesystem allocates its own private area and hangs 6039213Sgibbs * it from v_data. If non-null, this area is freed in getnewvnode(). 61105421Snjl */ 6260422Sken 6339213Sgibbsstruct namecache; 6439213Sgibbs 65119708Skenstruct vpollinfo { 66120599Sphk struct mtx vpi_lock; /* lock to protect below */ 6739213Sgibbs struct selinfo vpi_selinfo; /* identity of poller(s) */ 6839213Sgibbs short vpi_events; /* what they are looking for */ 6939213Sgibbs short vpi_revents; /* what has happened */ 7039213Sgibbs}; 7139213Sgibbs 7239213Sgibbs/* 73168752Sscottl * Reading or writing any of these items requires holding the appropriate lock. 7439213Sgibbs * 7539213Sgibbs * Lock reference: 7639213Sgibbs * c - namecache mutex 7739213Sgibbs * f - freelist mutex 7839213Sgibbs * i - interlock 7939213Sgibbs * m - mount point interlock 8039213Sgibbs * p - pollinfo lock 8139213Sgibbs * u - Only a reference to the vnode is needed to read. 8239213Sgibbs * v - vnode lock 8339213Sgibbs * 8439213Sgibbs * Vnodes may be found on many lists. The general way to deal with operating 8539213Sgibbs * on a vnode that is on a list is: 8639213Sgibbs * 1) Lock the list and find the vnode. 87111206Sken * 2) Lock interlock so that the vnode does not go away. 88111206Sken * 3) Unlock the list to avoid lock order reversals. 89111206Sken * 4) vget with LK_INTERLOCK and check for ENOENT, or 90111206Sken * 5) Check for DOOMED if the vnode lock is not required. 91111206Sken * 6) Perform your operation, then vput(). 92111206Sken */ 9339213Sgibbs 9439213Sgibbs#if defined(_KERNEL) || defined(_KVM_VNODE) 9539213Sgibbs 96120884Sthomasstruct vnode { 97120884Sthomas /* 98120884Sthomas * Fields which define the identity of the vnode. These fields are 99120884Sthomas * owned by the filesystem (XXX: and vgone() ?) 100120884Sthomas */ 101120884Sthomas enum vtype v_type; /* u vnode type */ 102120884Sthomas const char *v_tag; /* u type of underlying data */ 103120884Sthomas struct vop_vector *v_op; /* u vnode operations vector */ 104120884Sthomas void *v_data; /* u private data for fs */ 105120884Sthomas 106237518Sken /* 10739213Sgibbs * Filesystem instance stuff 10839213Sgibbs */ 10939213Sgibbs struct mount *v_mount; /* u ptr to vfs we are in */ 11039213Sgibbs TAILQ_ENTRY(vnode) v_nmntvnodes; /* m vnodes for mount point */ 11139213Sgibbs 11239213Sgibbs /* 11339213Sgibbs * Type specific fields, only one applies to any given vnode. 11439213Sgibbs * See #defines below for renaming to v_* namespace. 11539213Sgibbs */ 11639213Sgibbs union { 11739213Sgibbs struct mount *vu_mount; /* v ptr to mountpoint (VDIR) */ 11839213Sgibbs struct socket *vu_socket; /* v unix domain net (VSOCK) */ 11939213Sgibbs struct cdev *vu_cdev; /* v device (VCHR, VBLK) */ 12039213Sgibbs struct fifoinfo *vu_fifoinfo; /* v fifo (VFIFO) */ 12139213Sgibbs } v_un; 12239213Sgibbs 12339213Sgibbs /* 12439213Sgibbs * vfs_hash: (mount + inode) -> vnode hash. 12539213Sgibbs */ 12639213Sgibbs LIST_ENTRY(vnode) v_hashlist; 127111206Sken u_int v_hash; 128111206Sken 129111206Sken /* 130111206Sken * VFS_namecache stuff 131111206Sken */ 132111206Sken LIST_HEAD(, namecache) v_cache_src; /* c Cache entries from us */ 133111206Sken TAILQ_HEAD(, namecache) v_cache_dst; /* c Cache entries to us */ 134111206Sken struct namecache *v_cache_dd; /* c Cache entry for .. vnode */ 135111206Sken 136111206Sken /* 13739213Sgibbs * clustering stuff 13839213Sgibbs */ 13939213Sgibbs daddr_t v_cstart; /* v start block of cluster */ 14039213Sgibbs daddr_t v_lasta; /* v last allocation */ 14139213Sgibbs daddr_t v_lastw; /* v last write */ 14239213Sgibbs int v_clen; /* v length of cur. cluster */ 14339213Sgibbs 14439213Sgibbs /* 14546581Sken * Locking 14659249Sphk */ 14760938Sjake struct lock v_lock; /* u (if fs don't have one) */ 14839213Sgibbs struct mtx v_interlock; /* lock for "i" things */ 14939213Sgibbs struct lock *v_vnlock; /* u pointer to vnode lock */ 15039213Sgibbs int v_holdcnt; /* i prevents recycling. */ 15160938Sjake int v_usecount; /* i ref count of users */ 15239213Sgibbs u_int v_iflag; /* i vnode flags (see below) */ 15339213Sgibbs u_int v_vflag; /* v vnode flags */ 15439213Sgibbs int v_writecount; /* v ref count of writers */ 155111206Sken 156112262Sphk /* 157119708Sken * The machinery of being a vnode 158111206Sken */ 159111206Sken TAILQ_ENTRY(vnode) v_actfreelist; /* f vnode active/free lists */ 160111206Sken struct bufobj v_bufobj; /* * Buffer cache object */ 161111206Sken 162125975Sphk /* 16339213Sgibbs * Hooks for various subsystems and features. 16439213Sgibbs */ 165111206Sken struct vpollinfo *v_pollinfo; /* i Poll events, p for *v_pi */ 166111206Sken struct label *v_label; /* MAC label for vnode */ 167111206Sken struct lockf *v_lockf; /* Byte-level lock list */ 168111206Sken}; 169111206Sken 170111206Sken#endif /* defined(_KERNEL) || defined(_KVM_VNODE) */ 171111206Sken 172111206Sken#define v_mountedhere v_un.vu_mount 173111206Sken#define v_socket v_un.vu_socket 174111206Sken#define v_rdev v_un.vu_cdev 17539213Sgibbs#define v_fifoinfo v_un.vu_fifoinfo 17639213Sgibbs 17739213Sgibbs/* XXX: These are temporary to avoid a source sweep at this time */ 17839213Sgibbs#define v_object v_bufobj.bo_object 17939213Sgibbs 18039213Sgibbs/* 181111206Sken * Userland version of struct vnode, for sysctl. 182111206Sken */ 183111206Skenstruct xvnode { 184111206Sken size_t xv_size; /* sizeof(struct xvnode) */ 185111206Sken void *xv_vnode; /* address of real vnode */ 18639213Sgibbs u_long xv_flag; /* vnode vflags */ 187111206Sken int xv_usecount; /* reference count of users */ 188111206Sken int xv_writecount; /* reference count of writers */ 189111206Sken int xv_holdcnt; /* page & buffer references */ 190111206Sken u_long xv_id; /* capability identifier */ 191111206Sken void *xv_mount; /* address of parent mount */ 192111206Sken long xv_numoutput; /* num of writes in progress */ 193111206Sken enum vtype xv_type; /* vnode type */ 194111206Sken union { 195111206Sken void *xvu_socket; /* socket, if VSOCK */ 196111206Sken void *xvu_fifo; /* fifo, if VFIFO */ 19739213Sgibbs dev_t xvu_rdev; /* maj/min, if VBLK/VCHR */ 19839213Sgibbs struct { 19939213Sgibbs dev_t xvu_dev; /* device, if VDIR/VREG/VLNK */ 20039213Sgibbs ino_t xvu_ino; /* id, if VDIR/VREG/VLNK */ 20139213Sgibbs } xv_uns; 20239213Sgibbs } xv_un; 20339213Sgibbs}; 20439213Sgibbs#define xv_socket xv_un.xvu_socket 20554451Sken#define xv_fifo xv_un.xvu_fifo 20639213Sgibbs#define xv_rdev xv_un.xvu_rdev 20740262Sken#define xv_dev xv_un.xv_uns.xvu_dev 20840262Sken#define xv_ino xv_un.xv_uns.xvu_ino 20967752Sken 21067752Sken/* We don't need to lock the knlist */ 21167752Sken#define VN_KNLIST_EMPTY(vp) ((vp)->v_pollinfo == NULL || \ 21267752Sken KNLIST_EMPTY(&(vp)->v_pollinfo->vpi_selinfo.si_note)) 21340262Sken 21440262Sken#define VN_KNOTE(vp, b, a) \ 21539213Sgibbs do { \ 21639213Sgibbs if (!VN_KNLIST_EMPTY(vp)) \ 21739213Sgibbs KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note, (b), \ 218120599Sphk (a) | KNF_NOKQLOCK); \ 219120599Sphk } while (0) 220120599Sphk#define VN_KNOTE_LOCKED(vp, b) VN_KNOTE(vp, b, KNF_LISTLOCKED) 221120599Sphk#define VN_KNOTE_UNLOCKED(vp, b) VN_KNOTE(vp, b, 0) 22239213Sgibbs 22339213Sgibbs/* 22439213Sgibbs * Vnode flags. 22539213Sgibbs * VI flags are protected by interlock and live in v_iflag 22639213Sgibbs * VV flags are protected by the vnode lock and live in v_vflag 22740603Sken * 22839213Sgibbs * VI_DOOMED is doubly protected by the interlock and vnode lock. Both 22939213Sgibbs * are required for writing but the status may be checked with either. 230111206Sken */ 23139213Sgibbs#define VI_MOUNT 0x0020 /* Mount in progress */ 23239213Sgibbs#define VI_AGE 0x0040 /* Insert vnode at head of free list */ 23339213Sgibbs#define VI_DOOMED 0x0080 /* This vnode is being recycled */ 23439213Sgibbs#define VI_FREE 0x0100 /* This vnode is on the freelist */ 23539213Sgibbs#define VI_ACTIVE 0x0200 /* This vnode is on the active list */ 23639213Sgibbs#define VI_DOINGINACT 0x0800 /* VOP_INACTIVE is in progress */ 23739213Sgibbs#define VI_OWEINACT 0x1000 /* Need to call inactive */ 23839213Sgibbs 23939213Sgibbs#define VV_ROOT 0x0001 /* root of its filesystem */ 240111206Sken#define VV_ISTTY 0x0002 /* vnode represents a tty */ 24139213Sgibbs#define VV_NOSYNC 0x0004 /* unlinked, stop syncing */ 24239213Sgibbs#define VV_ETERNALDEV 0x0008 /* device that is never destroyed */ 24339213Sgibbs#define VV_CACHEDLABEL 0x0010 /* Vnode has valid cached MAC label */ 244111206Sken#define VV_TEXT 0x0020 /* vnode is a pure text prototype */ 245111206Sken#define VV_COPYONWRITE 0x0040 /* vnode is doing copy-on-write */ 246111206Sken#define VV_SYSTEM 0x0080 /* vnode being used by kernel */ 247111206Sken#define VV_PROCDEP 0x0100 /* vnode is process dependent */ 248111206Sken#define VV_NOKNOTE 0x0200 /* don't activate knotes on this vnode */ 249111206Sken#define VV_DELETED 0x0400 /* should be removed */ 25039213Sgibbs#define VV_MD 0x0800 /* vnode backs the md device */ 25139213Sgibbs#define VV_FORCEINSMQ 0x1000 /* force the insmntque to succeed */ 25239213Sgibbs 253111206Sken/* 254111206Sken * Vnode attributes. A field value of VNOVAL represents a field whose value 25539213Sgibbs * is unavailable (getattr) or which is not to be changed (setattr). 256111206Sken */ 25739213Sgibbsstruct vattr { 258111206Sken enum vtype va_type; /* vnode type (for create) */ 25939213Sgibbs u_short va_mode; /* files access mode and type */ 26039213Sgibbs short va_nlink; /* number of references to file */ 26139213Sgibbs uid_t va_uid; /* owner user id */ 26239213Sgibbs gid_t va_gid; /* owner group id */ 26339213Sgibbs dev_t va_fsid; /* filesystem id */ 26439213Sgibbs long va_fileid; /* file id */ 26539213Sgibbs u_quad_t va_size; /* file size in bytes */ 26639213Sgibbs long va_blocksize; /* blocksize preferred for i/o */ 26739213Sgibbs struct timespec va_atime; /* time of last access */ 26839213Sgibbs struct timespec va_mtime; /* time of last modification */ 26939213Sgibbs struct timespec va_ctime; /* time file changed */ 27039213Sgibbs struct timespec va_birthtime; /* time file created */ 27139213Sgibbs u_long va_gen; /* generation number of file */ 27239213Sgibbs u_long va_flags; /* flags defined for file */ 27339213Sgibbs dev_t va_rdev; /* device the special file represents */ 27439213Sgibbs u_quad_t va_bytes; /* bytes of disk space held by file */ 275111206Sken u_quad_t va_filerev; /* file modification number */ 276105421Snjl u_int va_vaflags; /* operations flags, see below */ 277105421Snjl long va_spare; /* remain quad aligned */ 27860422Sken}; 27960422Sken 28060422Sken/* 28160422Sken * Flags for va_vaflags. 28260422Sken */ 28360422Sken#define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */ 28439213Sgibbs#define VA_EXCLUSIVE 0x02 /* exclusive create request */ 28539213Sgibbs 28639213Sgibbs/* 28739213Sgibbs * Flags for ioflag. (high 16 bits used to ask for read-ahead and 28839213Sgibbs * help with write clustering) 28939213Sgibbs * NB: IO_NDELAY and IO_DIRECT are linked to fcntl.h 29039213Sgibbs */ 29172119Speter#define IO_UNIT 0x0001 /* do I/O as atomic unit */ 29239213Sgibbs#define IO_APPEND 0x0002 /* append write to end */ 293186882Simp#define IO_NDELAY 0x0004 /* FNDELAY flag set in file table */ 294186882Simp#define IO_NODELOCKED 0x0008 /* underlying node already locked */ 295186882Simp#define IO_ASYNC 0x0010 /* bawrite rather then bdwrite */ 296237689Simp#define IO_VMIO 0x0020 /* data already in VMIO space */ 297237689Simp#define IO_INVAL 0x0040 /* invalidate after I/O */ 298237689Simp#define IO_SYNC 0x0080 /* do I/O synchronously */ 29939213Sgibbs#define IO_DIRECT 0x0100 /* attempt to bypass buffer cache */ 30046747Sken#define IO_EXT 0x0400 /* operate on external attributes */ 30139213Sgibbs#define IO_NORMAL 0x0800 /* operate on regular data */ 30239213Sgibbs#define IO_NOMACCHECK 0x1000 /* MAC checks unnecessary */ 30346747Sken#define IO_BUFLOCKED 0x2000 /* ffs flag; indir buf is locked */ 30439213Sgibbs 30539213Sgibbs#define IO_SEQMAX 0x7F /* seq heuristic max value */ 306186882Simp#define IO_SEQSHIFT 16 /* seq heuristic in upper 16 bits */ 307237689Simp 30839213Sgibbs/* 30939213Sgibbs * Flags for accmode_t. 31039213Sgibbs */ 311227309Sed#define VEXEC 000000000100 /* execute/search permission */ 312227309Sed#define VWRITE 000000000200 /* write permission */ 313227309Sed#define VREAD 000000000400 /* read permission */ 314186882Simp#define VADMIN 000000010000 /* being the file owner */ 315186882Simp#define VAPPEND 000000040000 /* permission to write/append */ 316186882Simp/* 317237689Simp * VEXPLICIT_DENY makes VOP_ACCESSX(9) return EPERM or EACCES only 318237689Simp * if permission was denied explicitly, by a "deny" rule in NFSv4 ACL, 319237689Simp * and 0 otherwise. This never happens with ordinary unix access rights 32039213Sgibbs * or POSIX.1e ACLs. Obviously, VEXPLICIT_DENY must be OR-ed with 32139213Sgibbs * some other V* constant. 322111206Sken */ 32339213Sgibbs#define VEXPLICIT_DENY 000000100000 32439213Sgibbs#define VREAD_NAMED_ATTRS 000000200000 /* not used */ 325111206Sken#define VWRITE_NAMED_ATTRS 000000400000 /* not used */ 32639213Sgibbs#define VDELETE_CHILD 000001000000 32739213Sgibbs#define VREAD_ATTRIBUTES 000002000000 /* permission to stat(2) */ 32839213Sgibbs#define VWRITE_ATTRIBUTES 000004000000 /* change {m,c,a}time */ 32939213Sgibbs#define VDELETE 000010000000 33039213Sgibbs#define VREAD_ACL 000020000000 /* read ACL and file mode */ 33139213Sgibbs#define VWRITE_ACL 000040000000 /* change ACL and/or file mode */ 33239213Sgibbs#define VWRITE_OWNER 000100000000 /* change file owner */ 33339213Sgibbs#define VSYNCHRONIZE 000200000000 /* not used */ 334168752Sscottl 335168752Sscottl/* 33646581Sken * Permissions that were traditionally granted only to the file owner. 33760938Sjake */ 33860938Sjake#define VADMIN_PERMS (VADMIN | VWRITE_ATTRIBUTES | VWRITE_ACL | \ 33939213Sgibbs VWRITE_OWNER) 34039213Sgibbs 341168752Sscottl/* 34260938Sjake * Permissions that were traditionally granted to everyone. 343168752Sscottl */ 34439213Sgibbs#define VSTAT_PERMS (VREAD_ATTRIBUTES | VREAD_ACL) 345227293Sed 346169562Sscottl/* 347104880Sphk * Permissions that allow to change the state of the file in any way. 34839213Sgibbs */ 34939213Sgibbs#define VMODIFY_PERMS (VWRITE | VAPPEND | VADMIN_PERMS | VDELETE_CHILD | \ 35039213Sgibbs VDELETE) 35139213Sgibbs 352168752Sscottl/* 353168752Sscottl * Token indicating no attribute value yet assigned. 354168752Sscottl */ 35539213Sgibbs#define VNOVAL (-1) 35639213Sgibbs 35739213Sgibbs/* 35839213Sgibbs * LK_TIMELOCK timeout for vnode locks (used mainly by the pageout daemon) 359169605Sscottl */ 36039213Sgibbs#define VLKTIMEOUT (hz / 20 + 1) 36139213Sgibbs 36239213Sgibbs#ifdef _KERNEL 36339213Sgibbs 36439213Sgibbs#ifdef MALLOC_DECLARE 36539213SgibbsMALLOC_DECLARE(M_VNODE); 36639213Sgibbs#endif 367237518Sken 368237518Sken/* 369237518Sken * Convert between vnode types and inode formats (since POSIX.1 370237518Sken * defines mode word of stat structure in terms of inode formats). 37139213Sgibbs */ 372237518Skenextern enum vtype iftovt_tab[]; 373237518Skenextern int vttoif_tab[]; 374237518Sken#define IFTOVT(mode) (iftovt_tab[((mode) & S_IFMT) >> 12]) 375237518Sken#define VTTOIF(indx) (vttoif_tab[(int)(indx)]) 376237518Sken#define MAKEIMODE(indx, mode) (int)(VTTOIF(indx) | (mode)) 377237518Sken 378237518Sken/* 379237518Sken * Flags to various vnode functions. 380237518Sken */ 381237518Sken#define SKIPSYSTEM 0x0001 /* vflush: skip vnodes marked VSYSTEM */ 38240603Sken#define FORCECLOSE 0x0002 /* vflush: force file closure */ 38340603Sken#define WRITECLOSE 0x0004 /* vflush: only close writable files */ 38440603Sken#define V_SAVE 0x0001 /* vinvalbuf: sync file first */ 38540603Sken#define V_ALT 0x0002 /* vinvalbuf: invalidate only alternate bufs */ 38640603Sken#define V_NORMAL 0x0004 /* vinvalbuf: invalidate only regular bufs */ 38740603Sken#define V_CLEANONLY 0x0008 /* vinvalbuf: invalidate only clean bufs */ 38840603Sken#define REVOKEALL 0x0001 /* vop_revoke: revoke all aliases */ 38940603Sken#define V_WAIT 0x0001 /* vn_start_write: sleep for suspend */ 39040603Sken#define V_NOWAIT 0x0002 /* vn_start_write: don't sleep for suspend */ 391169605Sscottl#define V_XSLEEP 0x0004 /* vn_start_write: just return after sleep */ 39240603Sken 39340603Sken#define VREF(vp) vref(vp) 39440603Sken 39540603Sken#ifdef DIAGNOSTIC 39640603Sken#define VATTR_NULL(vap) vattr_null(vap) 39740603Sken#else 39840603Sken#define VATTR_NULL(vap) (*(vap) = va_null) /* initialize a vattr */ 39940603Sken#endif /* DIAGNOSTIC */ 400112946Sphk 40140603Sken#define NULLVP ((struct vnode *)NULL) 40240603Sken 40340603Sken/* 40440603Sken * Global vnode data. 40540603Sken */ 40640603Skenextern struct vnode *rootvnode; /* root (i.e. "/") vnode */ 40740603Skenextern int async_io_version; /* 0 or POSIX version of AIO i'face */ 40840603Skenextern int desiredvnodes; /* number of vnodes desired */ 40940603Skenextern struct uma_zone *namei_zone; 41040603Skenextern struct vattr va_null; /* predefined null vattr structure */ 411152565Sjdp 412237518Sken#define VI_LOCK(vp) mtx_lock(&(vp)->v_interlock) 41340603Sken#define VI_LOCK_FLAGS(vp, flags) mtx_lock_flags(&(vp)->v_interlock, (flags)) 41440603Sken#define VI_TRYLOCK(vp) mtx_trylock(&(vp)->v_interlock) 41540603Sken#define VI_UNLOCK(vp) mtx_unlock(&(vp)->v_interlock) 41639213Sgibbs#define VI_MTX(vp) (&(vp)->v_interlock) 41739213Sgibbs 41839213Sgibbs#define VN_LOCK_AREC(vp) lockallowrecurse((vp)->v_vnlock) 41939213Sgibbs#define VN_LOCK_ASHARE(vp) lockallowshare((vp)->v_vnlock) 42039213Sgibbs 42139213Sgibbs#endif /* _KERNEL */ 422164906Smjacob 42340603Sken/* 42439213Sgibbs * Mods for extensibility. 42539213Sgibbs */ 42639213Sgibbs 42739213Sgibbs/* 42839213Sgibbs * Flags for vdesc_flags: 42939213Sgibbs */ 43039213Sgibbs#define VDESC_MAX_VPS 16 43139213Sgibbs/* Low order 16 flag bits are reserved for willrele flags for vp arguments. */ 43239213Sgibbs#define VDESC_VP0_WILLRELE 0x0001 43339213Sgibbs#define VDESC_VP1_WILLRELE 0x0002 43439213Sgibbs#define VDESC_VP2_WILLRELE 0x0004 43539213Sgibbs#define VDESC_VP3_WILLRELE 0x0008 43639213Sgibbs#define VDESC_NOMAP_VPP 0x0100 43739213Sgibbs#define VDESC_VPP_WILLRELE 0x0200 43839213Sgibbs 43939213Sgibbs/* 44039213Sgibbs * A generic structure. 44139213Sgibbs * This can be used by bypass routines to identify generic arguments. 44239213Sgibbs */ 44339213Sgibbsstruct vop_generic_args { 44439213Sgibbs struct vnodeop_desc *a_desc; 44539213Sgibbs /* other random data follows, presumably */ 44639213Sgibbs}; 44739213Sgibbs 44839213Sgibbstypedef int vop_bypass_t(struct vop_generic_args *); 44939213Sgibbs 45039213Sgibbs/* 45139213Sgibbs * VDESC_NO_OFFSET is used to identify the end of the offset list 45239213Sgibbs * and in places where no such field exists. 453168752Sscottl */ 45439213Sgibbs#define VDESC_NO_OFFSET -1 45539213Sgibbs 456203108Smav/* 45739213Sgibbs * This structure describes the vnode operation taking place. 45839213Sgibbs */ 45939213Sgibbsstruct vnodeop_desc { 46039213Sgibbs char *vdesc_name; /* a readable name for debugging */ 46139213Sgibbs int vdesc_flags; /* VDESC_* flags */ 46239213Sgibbs vop_bypass_t *vdesc_call; /* Function to call */ 46339213Sgibbs 46439213Sgibbs /* 46539213Sgibbs * These ops are used by bypass routines to map and locate arguments. 46639213Sgibbs * Creds and procs are not needed in bypass routines, but sometimes 46739213Sgibbs * they are useful to (for example) transport layers. 46839213Sgibbs * Nameidata is useful because it has a cred in it. 46939213Sgibbs */ 47039213Sgibbs int *vdesc_vp_offsets; /* list ended by VDESC_NO_OFFSET */ 47139213Sgibbs int vdesc_vpp_offset; /* return vpp location */ 47239213Sgibbs int vdesc_cred_offset; /* cred location, if any */ 47339213Sgibbs int vdesc_thread_offset; /* thread location, if any */ 474168752Sscottl int vdesc_componentname_offset; /* if any */ 47539213Sgibbs}; 47639213Sgibbs 47739213Sgibbs#ifdef _KERNEL 47839213Sgibbs/* 479168752Sscottl * A list of all the operation descs. 48039213Sgibbs */ 48139213Sgibbsextern struct vnodeop_desc *vnodeop_descs[]; 48239213Sgibbs 483168752Sscottl#define VOPARG_OFFSETOF(s_type, field) __offsetof(s_type, field) 48460938Sjake#define VOPARG_OFFSETTO(s_type, s_offset, struct_p) \ 48539213Sgibbs ((s_type)(((char*)(struct_p)) + (s_offset))) 486168752Sscottl 487168752Sscottl 488164906Smjacob#ifdef DEBUG_VFS_LOCKS 48939213Sgibbs/* 49039213Sgibbs * Support code to aid in debugging VFS locking problems. Not totally 491168786Sscottl * reliable since if the thread sleeps between changing the lock 492188503Sjhb * state and checking it with the assert, some other thread could 493188503Sjhb * change the state. They are good enough for debugging a single 494188503Sjhb * filesystem using a single-threaded test. 495188503Sjhb */ 496188503Sjhbvoid assert_vi_locked(struct vnode *vp, const char *str); 497125975Sphkvoid assert_vi_unlocked(struct vnode *vp, const char *str); 498188503Sjhbvoid assert_vop_elocked(struct vnode *vp, const char *str); 499168786Sscottl#if 0 50039213Sgibbsvoid assert_vop_elocked_other(struct vnode *vp, const char *str); 50139213Sgibbs#endif 50239213Sgibbsvoid assert_vop_locked(struct vnode *vp, const char *str); 50339213Sgibbs#if 0 50439213Sgibbsvoi0 assert_vop_slocked(struct vnode *vp, const char *str); 50539213Sgibbs#endif 50639213Sgibbsvoid assert_vop_unlocked(struct vnode *vp, const char *str); 50739213Sgibbs 50839213Sgibbs#define ASSERT_VI_LOCKED(vp, str) assert_vi_locked((vp), (str)) 50939213Sgibbs#define ASSERT_VI_UNLOCKED(vp, str) assert_vi_unlocked((vp), (str)) 51039213Sgibbs#define ASSERT_VOP_ELOCKED(vp, str) assert_vop_elocked((vp), (str)) 51139213Sgibbs#if 0 51239213Sgibbs#define ASSERT_VOP_ELOCKED_OTHER(vp, str) assert_vop_locked_other((vp), (str)) 51339213Sgibbs#endif 51439213Sgibbs#define ASSERT_VOP_LOCKED(vp, str) assert_vop_locked((vp), (str)) 51539213Sgibbs#if 0 51679177Smjacob#define ASSERT_VOP_SLOCKED(vp, str) assert_vop_slocked((vp), (str)) 51779177Smjacob#endif 51839213Sgibbs#define ASSERT_VOP_UNLOCKED(vp, str) assert_vop_unlocked((vp), (str)) 519195534Sscottl 520195534Sscottl#else /* !DEBUG_VFS_LOCKS */ 521195534Sscottl 52256148Smjacob#define ASSERT_VI_LOCKED(vp, str) ((void)0) 52356148Smjacob#define ASSERT_VI_UNLOCKED(vp, str) ((void)0) 52439213Sgibbs#define ASSERT_VOP_ELOCKED(vp, str) ((void)0) 52539213Sgibbs#if 0 52639213Sgibbs#define ASSERT_VOP_ELOCKED_OTHER(vp, str) 52739213Sgibbs#endif 52839213Sgibbs#define ASSERT_VOP_LOCKED(vp, str) ((void)0) 52939213Sgibbs#if 0 53039213Sgibbs#define ASSERT_VOP_SLOCKED(vp, str) 53140603Sken#endif 53240603Sken#define ASSERT_VOP_UNLOCKED(vp, str) ((void)0) 53340603Sken#endif /* DEBUG_VFS_LOCKS */ 53440603Sken 53540603Sken 53639213Sgibbs/* 53739213Sgibbs * This call works for vnodes in the kernel. 53839213Sgibbs */ 53939213Sgibbs#define VCALL(c) ((c)->a_desc->vdesc_call(c)) 54039213Sgibbs 54139213Sgibbs#define DOINGASYNC(vp) \ 54239213Sgibbs (((vp)->v_mount->mnt_kern_flag & MNTK_ASYNC) != 0 && \ 54339213Sgibbs ((curthread->td_pflags & TDP_SYNCIO) == 0)) 54439213Sgibbs 54539213Sgibbs/* 54639213Sgibbs * VMIO support inline 54739213Sgibbs */ 54839213Sgibbs 54939213Sgibbsextern int vmiodirenable; 55039213Sgibbs 55139213Sgibbsstatic __inline int 55239213Sgibbsvn_canvmio(struct vnode *vp) 55339213Sgibbs{ 55439213Sgibbs if (vp && (vp->v_type == VREG || (vmiodirenable && vp->v_type == VDIR))) 55539213Sgibbs return(TRUE); 55671999Sphk return(FALSE); 55739213Sgibbs} 55847413Sgibbs 55939213Sgibbs/* 56039213Sgibbs * Finally, include the default set of vnode operations. 56147413Sgibbs */ 56239213Sgibbs#include "vnode_if.h" 56339213Sgibbs 56439213Sgibbs/* vn_open_flags */ 56539213Sgibbs#define VN_OPEN_NOAUDIT 0x00000001 566119708Sken 567119708Sken/* 568119708Sken * Public vnode manipulation functions. 569119708Sken */ 570119708Skenstruct componentname; 571119708Skenstruct file; 572119708Skenstruct mount; 573119708Skenstruct nameidata; 574168752Sscottlstruct ostat; 575168752Sscottlstruct thread; 576168752Sscottlstruct proc; 577119708Skenstruct stat; 578119708Skenstruct nstat; 579119708Skenstruct ucred; 580119708Skenstruct uio; 581119708Skenstruct vattr; 582120884Sthomasstruct vnode; 583119708Sken 584119708Sken/* cache_* may belong in namei.h. */ 585119708Sken#define cache_enter(dvp, vp, cnp) \ 586119708Sken cache_enter_time(dvp, vp, cnp, NULL, NULL) 587119708Skenvoid cache_enter_time(struct vnode *dvp, struct vnode *vp, 588119708Sken struct componentname *cnp, struct timespec *tsp, 589168752Sscottl struct timespec *dtsp); 590119708Skenint cache_lookup(struct vnode *dvp, struct vnode **vpp, 591119708Sken struct componentname *cnp, struct timespec *tsp, int *ticksp); 592119708Skenvoid cache_purge(struct vnode *vp); 593119708Skenvoid cache_purge_negative(struct vnode *vp); 594119708Skenvoid cache_purgevfs(struct mount *mp); 595119708Skenint change_dir(struct vnode *vp, struct thread *td); 596119708Skenint change_root(struct vnode *vp, struct thread *td); 597119708Skenvoid cvtstat(struct stat *st, struct ostat *ost); 598119708Skenvoid cvtnstat(struct stat *sb, struct nstat *nsb); 599119708Skenint getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops, 600119708Sken struct vnode **vpp); 601119708Skenint insmntque1(struct vnode *vp, struct mount *mp, 602168752Sscottl void (*dtr)(struct vnode *, void *), void *dtr_arg); 603119708Skenint insmntque(struct vnode *vp, struct mount *mp); 604119708Skenu_quad_t init_va_filerev(void); 605111206Skenint speedup_syncer(void); 606111206Skenint vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf, 607111206Sken u_int *buflen); 608111206Sken#define textvp_fullpath(p, rb, rfb) \ 609111206Sken vn_fullpath(FIRST_THREAD_IN_PROC(p), (p)->p_textvp, rb, rfb) 610111206Skenint vn_fullpath(struct thread *td, struct vnode *vn, 611111206Sken char **retbuf, char **freebuf); 612111206Skenint vn_fullpath_global(struct thread *td, struct vnode *vn, 613111206Sken char **retbuf, char **freebuf); 614111206Skenint vn_commname(struct vnode *vn, char *buf, u_int buflen); 615111206Skenint vn_path_to_global_path(struct thread *td, struct vnode *vp, 616111206Sken char *path, u_int pathlen); 617111206Skenint vaccess(enum vtype type, mode_t file_mode, uid_t file_uid, 618111206Sken gid_t file_gid, accmode_t accmode, struct ucred *cred, 619111206Sken int *privused); 620111206Skenint vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid, 621111206Sken struct acl *aclp, accmode_t accmode, struct ucred *cred, 622111206Sken int *privused); 623111206Skenint vaccess_acl_posix1e(enum vtype type, uid_t file_uid, 624111206Sken gid_t file_gid, struct acl *acl, accmode_t accmode, 625111206Sken struct ucred *cred, int *privused); 626111206Skenvoid vattr_null(struct vattr *vap); 627111206Skenint vcount(struct vnode *vp); 628111206Skenvoid vdrop(struct vnode *); 629111206Skenvoid vdropl(struct vnode *); 630111206Skenint vflush(struct mount *mp, int rootrefs, int flags, struct thread *td); 631111206Skenint vget(struct vnode *vp, int lockflag, struct thread *td); 632111206Skenvoid vgone(struct vnode *vp); 633111206Skenvoid vhold(struct vnode *); 634111206Skenvoid vholdl(struct vnode *); 635111206Skenvoid vinactive(struct vnode *, struct thread *); 636111206Skenint vinvalbuf(struct vnode *vp, int save, int slpflag, int slptimeo); 637111206Skenint vtruncbuf(struct vnode *vp, struct ucred *cred, off_t length, 638111206Sken int blksize); 639111206Skenvoid vunref(struct vnode *); 640111206Skenvoid vn_printf(struct vnode *vp, const char *fmt, ...) __printflike(2,3); 641111206Sken#define vprint(label, vp) vn_printf((vp), "%s\n", (label)) 64239213Sgibbsint vrecycle(struct vnode *vp); 64339213Sgibbsint vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, 64439213Sgibbs struct ucred *cred); 64539213Sgibbsint vn_close(struct vnode *vp, 646118105Snjl int flags, struct ucred *file_cred, struct thread *td); 64739213Sgibbsvoid vn_finished_write(struct mount *mp); 648119708Skenvoid vn_finished_secondary_write(struct mount *mp); 64939213Sgibbsint vn_isdisk(struct vnode *vp, int *errp); 65039213Sgibbsint _vn_lock(struct vnode *vp, int flags, char *file, int line); 65139213Sgibbs#define vn_lock(vp, flags) _vn_lock(vp, flags, __FILE__, __LINE__) 65239213Sgibbsint vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp); 65339213Sgibbsint vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, 65439213Sgibbs u_int vn_open_flags, struct ucred *cred, struct file *fp); 65539213Sgibbsvoid vn_pages_remove(struct vnode *vp, vm_pindex_t start, vm_pindex_t end); 65639213Sgibbsint vn_pollrecord(struct vnode *vp, struct thread *p, int events); 65739213Sgibbsint vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, 65839213Sgibbs int len, off_t offset, enum uio_seg segflg, int ioflg, 65939213Sgibbs struct ucred *active_cred, struct ucred *file_cred, ssize_t *aresid, 66039213Sgibbs struct thread *td); 661203931Smavint vn_rdwr_inchunks(enum uio_rw rw, struct vnode *vp, void *base, 662203931Smav size_t len, off_t offset, enum uio_seg segflg, int ioflg, 66339213Sgibbs struct ucred *active_cred, struct ucred *file_cred, size_t *aresid, 66439213Sgibbs struct thread *td); 66539213Sgibbsint vn_rlimit_fsize(const struct vnode *vn, const struct uio *uio, 66639213Sgibbs const struct thread *td); 66739213Sgibbsint vn_stat(struct vnode *vp, struct stat *sb, struct ucred *active_cred, 66839213Sgibbs struct ucred *file_cred, struct thread *td); 66939213Sgibbsint vn_start_write(struct vnode *vp, struct mount **mpp, int flags); 670111206Skenint vn_start_secondary_write(struct vnode *vp, struct mount **mpp, 67139213Sgibbs int flags); 67259249Sphkint vn_writechk(struct vnode *vp); 67339213Sgibbsint vn_extattr_get(struct vnode *vp, int ioflg, int attrnamespace, 67439213Sgibbs const char *attrname, int *buflen, char *buf, struct thread *td); 67539213Sgibbsint vn_extattr_set(struct vnode *vp, int ioflg, int attrnamespace, 67639213Sgibbs const char *attrname, int buflen, char *buf, struct thread *td); 67739213Sgibbsint vn_extattr_rm(struct vnode *vp, int ioflg, int attrnamespace, 67839213Sgibbs const char *attrname, struct thread *td); 67939213Sgibbsint vn_vget_ino(struct vnode *vp, ino_t ino, int lkflags, 68039213Sgibbs struct vnode **rvp); 68139213Sgibbs 68239213Sgibbs 68339213Sgibbsint vfs_cache_lookup(struct vop_lookup_args *ap); 68439213Sgibbsvoid vfs_timestamp(struct timespec *); 68539213Sgibbsvoid vfs_write_resume(struct mount *mp); 68639213Sgibbsint vfs_write_suspend(struct mount *mp); 68739213Sgibbsint vop_stdbmap(struct vop_bmap_args *); 68839213Sgibbsint vop_stdfsync(struct vop_fsync_args *); 68939213Sgibbsint vop_stdgetwritemount(struct vop_getwritemount_args *); 69039213Sgibbsint vop_stdgetpages(struct vop_getpages_args *); 69139213Sgibbsint vop_stdinactive(struct vop_inactive_args *); 692118105Snjlint vop_stdislocked(struct vop_islocked_args *); 693200295Smavint vop_stdkqfilter(struct vop_kqfilter_args *); 694198382Smavint vop_stdlock(struct vop_lock1_args *); 695118105Snjlint vop_stdputpages(struct vop_putpages_args *); 696118105Snjlint vop_stdunlock(struct vop_unlock_args *); 697118105Snjlint vop_nopoll(struct vop_poll_args *); 698118105Snjlint vop_stdaccess(struct vop_access_args *ap); 699118105Snjlint vop_stdaccessx(struct vop_accessx_args *ap); 700119708Skenint vop_stdadvise(struct vop_advise_args *ap); 701111206Skenint vop_stdadvlock(struct vop_advlock_args *ap); 702111206Skenint vop_stdadvlockasync(struct vop_advlockasync_args *ap); 703111206Skenint vop_stdadvlockpurge(struct vop_advlockpurge_args *ap); 704111206Skenint vop_stdallocate(struct vop_allocate_args *ap); 705111206Skenint vop_stdpathconf(struct vop_pathconf_args *); 706111206Skenint vop_stdpoll(struct vop_poll_args *); 707111206Skenint vop_stdvptocnp(struct vop_vptocnp_args *ap); 708223557Sgibbsint vop_stdvptofh(struct vop_vptofh_args *ap); 709223557Sgibbsint vop_stdunp_bind(struct vop_unp_bind_args *ap); 710223557Sgibbsint vop_stdunp_connect(struct vop_unp_connect_args *ap); 711223557Sgibbsint vop_stdunp_detach(struct vop_unp_detach_args *ap); 712220686Sjhint vop_eopnotsupp(struct vop_generic_args *ap); 713220686Sjhint vop_ebadf(struct vop_generic_args *ap); 71439213Sgibbsint vop_einval(struct vop_generic_args *ap); 715111206Skenint vop_enoent(struct vop_generic_args *ap); 716111206Skenint vop_enotty(struct vop_generic_args *ap); 717111206Skenint vop_null(struct vop_generic_args *ap); 718111206Skenint vop_panic(struct vop_generic_args *ap); 719111206Sken 720111206Sken/* These are called from within the actual VOPS. */ 721111206Skenvoid vop_create_post(void *a, int rc); 722111206Skenvoid vop_deleteextattr_post(void *a, int rc); 723111206Skenvoid vop_link_post(void *a, int rc); 724111206Skenvoid vop_lock_pre(void *a); 725111206Skenvoid vop_lock_post(void *a, int rc); 726111206Skenvoid vop_lookup_post(void *a, int rc); 727111206Skenvoid vop_lookup_pre(void *a); 72839213Sgibbsvoid vop_mkdir_post(void *a, int rc); 72939213Sgibbsvoid vop_mknod_post(void *a, int rc); 73039213Sgibbsvoid vop_remove_post(void *a, int rc); 73139213Sgibbsvoid vop_rename_post(void *a, int rc); 73239213Sgibbsvoid vop_rename_pre(void *a); 73356148Smjacobvoid vop_rmdir_post(void *a, int rc); 73439213Sgibbsvoid vop_setattr_post(void *a, int rc); 73539213Sgibbsvoid vop_setextattr_post(void *a, int rc); 73639213Sgibbsvoid vop_strategy_pre(void *a); 73739213Sgibbsvoid vop_symlink_post(void *a, int rc); 73839213Sgibbsvoid vop_unlock_post(void *a, int rc); 739125975Sphkvoid vop_unlock_pre(void *a); 740220644Smav 74139213Sgibbsvoid vop_rename_fail(struct vop_rename_args *ap); 742220644Smav 743220644Smav#define VOP_WRITE_PRE(ap) \ 744220644Smav struct vattr va; \ 74543819Sken int error, osize, ooffset, noffset; \ 746125975Sphk \ 747125975Sphk osize = ooffset = noffset = 0; \ 748125975Sphk if (!VN_KNLIST_EMPTY((ap)->a_vp)) { \ 749237518Sken error = VOP_GETATTR((ap)->a_vp, &va, (ap)->a_cred); \ 750125975Sphk if (error) \ 751125975Sphk return (error); \ 752219056Snwhitehorn ooffset = (ap)->a_uio->uio_offset; \ 753219056Snwhitehorn osize = va.va_size; \ 754219056Snwhitehorn } 755219056Snwhitehorn 756219056Snwhitehorn#define VOP_WRITE_POST(ap, ret) \ 757219056Snwhitehorn noffset = (ap)->a_uio->uio_offset; \ 758125975Sphk if (noffset > ooffset && !VN_KNLIST_EMPTY((ap)->a_vp)) { \ 759125975Sphk VFS_KNOTE_LOCKED((ap)->a_vp, NOTE_WRITE \ 760200171Smav | (noffset > osize ? NOTE_EXTEND : 0)); \ 761200171Smav } 762200171Smav 763200171Smav#define VOP_LOCK(vp, flags) VOP_LOCK1(vp, flags, __FILE__, __LINE__) 764200171Smav 765200171Smav 766168752Sscottlvoid vput(struct vnode *vp); 767210471Smavvoid vrele(struct vnode *vp); 768210471Smavvoid vref(struct vnode *vp); 769210471Smavint vrefcnt(struct vnode *vp); 770210471Smavvoid v_addpollinfo(struct vnode *vp); 771237518Sken 772237518Skenint vnode_create_vobject(struct vnode *vp, off_t size, struct thread *td); 773237518Skenvoid vnode_destroy_vobject(struct vnode *vp); 774237518Sken 775237518Skenextern struct vop_vector fifo_specops; 776237518Skenextern struct vop_vector dead_vnodeops; 777237518Skenextern struct vop_vector default_vnodeops; 778237518Sken 779237518Sken#define VOP_PANIC ((void*)(uintptr_t)vop_panic) 780237518Sken#define VOP_NULL ((void*)(uintptr_t)vop_null) 781237518Sken#define VOP_EBADF ((void*)(uintptr_t)vop_ebadf) 782237518Sken#define VOP_ENOTTY ((void*)(uintptr_t)vop_enotty) 783237518Sken#define VOP_EINVAL ((void*)(uintptr_t)vop_einval) 784125975Sphk#define VOP_ENOENT ((void*)(uintptr_t)vop_enoent) 785168752Sscottl#define VOP_EOPNOTSUPP ((void*)(uintptr_t)vop_eopnotsupp) 78639213Sgibbs 78739213Sgibbs/* fifo_vnops.c */ 78839213Sgibbsint fifo_printinfo(struct vnode *); 78939213Sgibbs 79039213Sgibbs/* vfs_hash.c */ 791169605Sscottltypedef int vfs_hash_cmp_t(struct vnode *vp, void *arg); 792169605Sscottl 79339213Sgibbsint vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg); 79439213Sgibbsint vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg); 79539213Sgibbsvoid vfs_hash_rehash(struct vnode *vp, u_int hash); 79639213Sgibbsvoid vfs_hash_remove(struct vnode *vp); 79739213Sgibbs 79839213Sgibbsint vfs_kqfilter(struct vop_kqfilter_args *); 79939213Sgibbsvoid vfs_mark_atime(struct vnode *vp, struct ucred *cred); 80039213Sgibbsstruct dirent; 80139213Sgibbsint vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off); 80239213Sgibbs 80339213Sgibbsint vfs_unixify_accmode(accmode_t *accmode); 80439213Sgibbs 80539213Sgibbsvoid vfs_unp_reclaim(struct vnode *vp); 80639213Sgibbs 80739213Sgibbsint setfmode(struct thread *td, struct ucred *cred, struct vnode *vp, int mode); 80839213Sgibbsint setfown(struct thread *td, struct ucred *cred, struct vnode *vp, uid_t uid, 80939213Sgibbs gid_t gid); 81039213Sgibbsint vn_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, 81139213Sgibbs struct thread *td); 81239213Sgibbsint vn_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, 81339213Sgibbs struct thread *td); 81439213Sgibbs 81539213Sgibbs#endif /* _KERNEL */ 81639213Sgibbs 81739213Sgibbs#endif /* !_SYS_VNODE_H_ */ 81839213Sgibbs