2019-01-01 13:06:54 +03:00
|
|
|
.\" $NetBSD: vnode.9,v 1.82 2019/01/01 10:06:54 hannken Exp $
|
2001-10-22 07:33:19 +04:00
|
|
|
.\"
|
2006-01-29 06:09:19 +03:00
|
|
|
.\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
|
2001-10-22 07:33:19 +04:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Gregory McGarry.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
2001-10-22 12:21:32 +04:00
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
2001-10-22 07:33:19 +04:00
|
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
2019-01-01 13:06:54 +03:00
|
|
|
.Dd January 1, 2019
|
2001-10-22 07:33:19 +04:00
|
|
|
.Dt VNODE 9
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm vnode ,
|
|
|
|
.Nm vref ,
|
|
|
|
.Nm vrele ,
|
2010-02-12 02:16:35 +03:00
|
|
|
.Nm vrele_async ,
|
2001-10-22 07:33:19 +04:00
|
|
|
.Nm vput ,
|
|
|
|
.Nm vhold ,
|
|
|
|
.Nm holdrele ,
|
2015-07-12 11:11:27 +03:00
|
|
|
.Nm vcache_get ,
|
|
|
|
.Nm vcache_new ,
|
|
|
|
.Nm vcache_rekey_enter ,
|
|
|
|
.Nm vcache_rekey_exit ,
|
2001-10-22 07:33:19 +04:00
|
|
|
.Nm vrecycle ,
|
|
|
|
.Nm vgone ,
|
2002-10-23 10:15:59 +04:00
|
|
|
.Nm vgonel ,
|
2014-03-24 17:42:40 +04:00
|
|
|
.Nm vdead_check ,
|
2001-10-22 07:33:19 +04:00
|
|
|
.Nm vflush ,
|
|
|
|
.Nm vaccess ,
|
|
|
|
.Nm bdevvp ,
|
|
|
|
.Nm cdevvp ,
|
|
|
|
.Nm vfinddev ,
|
|
|
|
.Nm vdevgone ,
|
|
|
|
.Nm vwakeup ,
|
|
|
|
.Nm vflushbuf ,
|
|
|
|
.Nm vinvalbuf ,
|
|
|
|
.Nm vtruncbuf ,
|
|
|
|
.Nm vprint
|
|
|
|
.Nd kernel representation of a file or directory
|
|
|
|
.Sh SYNOPSIS
|
2003-04-16 17:34:34 +04:00
|
|
|
.In sys/param.h
|
|
|
|
.In sys/vnode.h
|
2001-10-22 07:33:19 +04:00
|
|
|
.Ft void
|
|
|
|
.Fn vref "struct vnode *vp"
|
|
|
|
.Ft void
|
|
|
|
.Fn vrele "struct vnode *vp"
|
2010-02-12 02:16:35 +03:00
|
|
|
.Ft void
|
|
|
|
.Fn vrele_async "struct vnode *vp"
|
2001-10-22 07:33:19 +04:00
|
|
|
.Ft void
|
|
|
|
.Fn vput "struct vnode *vp"
|
|
|
|
.Ft void
|
|
|
|
.Fn vhold "struct vnode *vp"
|
|
|
|
.Ft void
|
|
|
|
.Fn holdrele "struct vnode *vp"
|
|
|
|
.Ft int
|
2015-07-12 11:11:27 +03:00
|
|
|
.Fn vcache_get "struct mount *mp" "const void *key" "size_t key_len" "struct vnode **vpp"
|
|
|
|
.Ft int
|
2019-01-01 13:06:54 +03:00
|
|
|
.Fn vcache_new "struct mount *mp" "struct vnode *dvp" "struct vattr *vap" "kauth_cred_t cred" "void *extra" "struct vnode **vpp"
|
2015-07-12 11:11:27 +03:00
|
|
|
.Ft int
|
|
|
|
.Fn vcache_rekey_enter "struct mount *mp" "struct vnode *vp" "const void *old_key" "size_t old_key_len" "const void *new_key" "size_t new_key_len"
|
2001-10-22 07:33:19 +04:00
|
|
|
.Ft void
|
2015-07-12 11:11:27 +03:00
|
|
|
.Fn vcache_rekey_exit "struct mount *mp" "struct vnode *vp" "const void *old_key" "size_t old_key_len" "const void *new_key" "size_t new_key_len"
|
2001-10-22 07:33:19 +04:00
|
|
|
.Ft int
|
2014-03-05 13:37:29 +04:00
|
|
|
.Fn vrecycle "struct vnode *vp"
|
2001-10-22 07:33:19 +04:00
|
|
|
.Ft void
|
|
|
|
.Fn vgone "struct vnode *vp"
|
2002-10-23 10:15:59 +04:00
|
|
|
.Ft void
|
2005-12-20 22:53:14 +03:00
|
|
|
.Fn vgonel "struct vnode *vp" "struct lwp *l"
|
2001-10-22 07:33:19 +04:00
|
|
|
.Ft int
|
2014-03-24 17:42:40 +04:00
|
|
|
.Fn vdead_check "struct vnode *vp" "int flags"
|
|
|
|
.Ft int
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fn vflush "struct mount *mp" "struct vnode *skipvp" "int flags"
|
|
|
|
.Ft int
|
2006-10-04 15:35:47 +04:00
|
|
|
.Fn vaccess "enum vtype type" "mode_t file_mode" "uid_t uid" "gid_t gid" "mode_t acc_mode" "kauth_cred_t cred"
|
2001-10-22 07:33:19 +04:00
|
|
|
.Ft int
|
|
|
|
.Fn bdevvp "dev_t dev" "struct vnode **vpp"
|
|
|
|
.Ft int
|
|
|
|
.Fn cdevvp "dev_t dev" "struct vnode **vpp"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfinddev "dev_t dev" "enum vtype" "struct vnode **vpp"
|
|
|
|
.Ft void
|
|
|
|
.Fn vdevgone "int maj" "int minl" "int minh" "enum vtype type"
|
|
|
|
.Ft void
|
|
|
|
.Fn vwakeup "struct buf *bp"
|
2011-04-26 15:32:38 +04:00
|
|
|
.Ft int
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fn vflushbuf "struct vnode *vp" "int sync"
|
|
|
|
.Ft int
|
2006-10-04 15:35:47 +04:00
|
|
|
.Fn vinvalbuf "struct vnode *vp" "int flags" "kauth_cred_t cred" "struct lwp *l" "int slpflag" "int slptimeo"
|
2001-10-22 07:33:19 +04:00
|
|
|
.Ft int
|
|
|
|
.Fn vtruncbuf "struct vnode *vp" "daddr_t lbn" "int slpflag" "int slptimeo"
|
|
|
|
.Ft void
|
2007-06-15 15:42:11 +04:00
|
|
|
.Fn vprint "const char *label" "struct vnode *vp"
|
2001-10-22 07:33:19 +04:00
|
|
|
.Sh DESCRIPTION
|
2015-04-20 18:30:41 +03:00
|
|
|
A
|
|
|
|
.Em vnode
|
|
|
|
represents an on-disk file in use by the system.
|
|
|
|
Each
|
2002-08-14 22:50:48 +04:00
|
|
|
.Xr vfs 9
|
2015-04-20 18:30:41 +03:00
|
|
|
file system provides a set of
|
|
|
|
.Xr vnodeops 9
|
|
|
|
operations on vnodes, invoked by file-system-independent system calls
|
|
|
|
and supported by file-system-independent library routines.
|
|
|
|
.Pp
|
|
|
|
Each mounted file system provides a vnode for the root of the file
|
|
|
|
system, via
|
|
|
|
.Xr VFS_ROOT 9 .
|
|
|
|
Other vnodes are obtained by
|
|
|
|
.Xr VOP_LOOKUP 9 .
|
|
|
|
Users of vnodes usually invoke these indirectly via
|
|
|
|
.Xr namei 9
|
|
|
|
to obtain vnodes from paths.
|
|
|
|
.Pp
|
|
|
|
Each file system usually maintains a cache mapping recently used inode
|
|
|
|
numbers, or the equivalent, to vnodes, and a cache mapping recently
|
|
|
|
used file names to vnodes.
|
|
|
|
If memory is scarce, the system may decide to
|
|
|
|
.Em reclaim
|
|
|
|
an unused cached vnode, calling
|
|
|
|
.Xr VOP_RECLAIM 9
|
|
|
|
to remove it from the caches and to free file-system-specific memory
|
|
|
|
associated with it.
|
|
|
|
A file system may also choose to immediately reclaim a cached vnode
|
|
|
|
once it is unused, in
|
|
|
|
.Xr VOP_INACTIVE 9 ,
|
|
|
|
if the vnode has been deleted on disk.
|
|
|
|
.Pp
|
|
|
|
When a file system retrieves a vnode from a cache, the vnode may not
|
|
|
|
have any users, and another thread in the system may be simultaneously
|
|
|
|
deciding to reclaim it.
|
|
|
|
Thus, to retrieve a vnode from a cache, one must use
|
2017-01-02 13:33:28 +03:00
|
|
|
.Fn vcache_get ,
|
2015-04-20 18:30:41 +03:00
|
|
|
not
|
|
|
|
.Fn vref ,
|
2017-01-02 13:33:28 +03:00
|
|
|
to acquire the first reference.
|
2001-10-22 07:33:19 +04:00
|
|
|
.Pp
|
|
|
|
The vnode has the following structure:
|
|
|
|
.Bd -literal
|
|
|
|
struct vnode {
|
2010-05-30 17:50:16 +04:00
|
|
|
struct uvm_object v_uobj; /* the VM object */
|
|
|
|
kcondvar_t v_cv; /* synchronization */
|
|
|
|
voff_t v_size; /* size of file */
|
|
|
|
voff_t v_writesize; /* new size after write */
|
|
|
|
int v_iflag; /* VI_* flags */
|
|
|
|
int v_vflag; /* VV_* flags */
|
|
|
|
int v_uflag; /* VU_* flags */
|
|
|
|
int v_numoutput; /* # of pending writes */
|
|
|
|
int v_writecount; /* ref count of writers */
|
|
|
|
int v_holdcnt; /* page & buffer refs */
|
|
|
|
struct mount *v_mount; /* ptr to vfs we are in */
|
|
|
|
int (**v_op)(void *); /* vnode operations vector */
|
|
|
|
struct buflists v_cleanblkhd; /* clean blocklist head */
|
|
|
|
struct buflists v_dirtyblkhd; /* dirty blocklist head */
|
|
|
|
union {
|
|
|
|
struct mount *vu_mountedhere;/* ptr to vfs (VDIR) */
|
|
|
|
struct socket *vu_socket; /* unix ipc (VSOCK) */
|
|
|
|
struct specnode *vu_specnode; /* device (VCHR, VBLK) */
|
|
|
|
struct fifoinfo *vu_fifoinfo; /* fifo (VFIFO) */
|
|
|
|
struct uvm_ractx *vu_ractx; /* read-ahead ctx (VREG) */
|
|
|
|
} v_un;
|
|
|
|
enum vtype v_type; /* vnode type */
|
|
|
|
enum vtagtype v_tag; /* type of underlying data */
|
|
|
|
void *v_data; /* private data for fs */
|
|
|
|
struct klist v_klist; /* notes attached to vnode */
|
2001-10-22 07:33:19 +04:00
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Most members of the vnode structure should be treated as opaque and
|
2002-10-14 17:43:14 +04:00
|
|
|
only manipulated using the proper functions.
|
|
|
|
There are some rather common exceptions detailed throughout this page.
|
2001-10-22 07:33:19 +04:00
|
|
|
.Pp
|
|
|
|
Files and file systems are inextricably linked with the virtual memory
|
|
|
|
system and
|
|
|
|
.Em v_uobj
|
2002-10-14 17:43:14 +04:00
|
|
|
contains the data maintained by the virtual memory system.
|
|
|
|
For compatibility with code written before the integration of
|
2001-10-22 07:33:19 +04:00
|
|
|
.Xr uvm 9
|
|
|
|
into
|
2005-08-05 17:28:50 +04:00
|
|
|
.Nx ,
|
2001-10-22 07:33:19 +04:00
|
|
|
C-preprocessor directives are used to alias the members of
|
|
|
|
.Em v_uobj .
|
|
|
|
.Pp
|
|
|
|
Vnode flags are recorded by
|
2014-02-22 14:08:12 +04:00
|
|
|
.Em v_iflag ,
|
|
|
|
.Em v_vflag
|
|
|
|
and
|
|
|
|
.Em v_uflag .
|
2001-10-22 07:33:19 +04:00
|
|
|
Valid flags are:
|
|
|
|
.Pp
|
2014-02-22 15:28:18 +04:00
|
|
|
.Bl -tag -offset indent -width ".Dv VI_WRMAPDIRTY" -compact
|
|
|
|
.It Dv VV_ROOT
|
2001-10-22 07:33:19 +04:00
|
|
|
This vnode is the root of its file system.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VV_SYSTEM
|
2005-08-05 17:28:50 +04:00
|
|
|
This vnode is being used by the kernel; only used to skip quota files in
|
2002-08-14 22:50:48 +04:00
|
|
|
.Fn vflush .
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VV_ISTTY
|
2001-10-22 07:33:19 +04:00
|
|
|
This vnode represents a tty; used when reading dead vnodes.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VV_MAPPED
|
2014-02-22 14:08:12 +04:00
|
|
|
This vnode might have user mappings.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VV_MPSAFE
|
2014-02-22 14:08:12 +04:00
|
|
|
This file system is MP safe.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VV_LOCKSWORK
|
2014-02-22 14:08:12 +04:00
|
|
|
This vnode's file system supports locking.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VI_TEXT
|
2014-02-22 14:08:12 +04:00
|
|
|
This vnode is a pure text prototype.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VI_EXECMAP
|
2006-03-03 05:17:41 +03:00
|
|
|
This vnode has executable mappings.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VI_WRMAP
|
2006-03-03 05:17:41 +03:00
|
|
|
This vnode might have PROT_WRITE user mappings.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VI_WRMAPDIRTY
|
|
|
|
This vnode might have dirty pages due to
|
|
|
|
.Dv VWRITEMAP .
|
|
|
|
.It Dv VI_XLOCK
|
2001-10-22 07:33:19 +04:00
|
|
|
This vnode is currently locked to change underlying type.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VI_ONWORKLST
|
2014-02-22 14:08:12 +04:00
|
|
|
This vnode is on syncer work-list.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VI_MARKER
|
2014-02-22 14:08:12 +04:00
|
|
|
A dummy marker vnode.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VI_CLEAN
|
2014-02-22 14:08:12 +04:00
|
|
|
This vnode has been reclaimed and is no longer attached to a file system.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VU_DIROP
|
2002-10-14 17:43:14 +04:00
|
|
|
This vnode is involved in a directory operation.
|
|
|
|
This flag is used exclusively by LFS.
|
2001-10-22 07:33:19 +04:00
|
|
|
.El
|
|
|
|
.Pp
|
2014-02-22 15:28:18 +04:00
|
|
|
The
|
|
|
|
.Dv VI_XLOCK
|
|
|
|
flag is used to prevent multiple processes from entering
|
2002-10-14 17:43:14 +04:00
|
|
|
the vnode reclamation code.
|
|
|
|
It is also used as a flag to indicate that reclamation is in progress.
|
|
|
|
Before
|
2014-02-22 14:08:12 +04:00
|
|
|
.Em v_iflag
|
2001-10-22 07:33:19 +04:00
|
|
|
can be modified, the
|
|
|
|
.Em v_interlock
|
2014-02-22 14:08:12 +04:00
|
|
|
mutex must be acquired.
|
2002-10-14 17:43:14 +04:00
|
|
|
See
|
2001-10-22 07:33:19 +04:00
|
|
|
.Xr lock 9
|
|
|
|
for details on the kernel locking API.
|
|
|
|
.Pp
|
|
|
|
Each vnode has three reference counts:
|
|
|
|
.Em v_usecount ,
|
|
|
|
.Em v_writecount
|
|
|
|
and
|
|
|
|
.Em v_holdcnt .
|
|
|
|
The first is the number of active references within the
|
2002-10-14 17:43:14 +04:00
|
|
|
kernel to the vnode.
|
|
|
|
This count is maintained by
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fn vref ,
|
|
|
|
.Fn vrele ,
|
2010-02-12 02:16:35 +03:00
|
|
|
.Fn vrele_async ,
|
2001-10-22 07:33:19 +04:00
|
|
|
and
|
|
|
|
.Fn vput .
|
|
|
|
The second is the number of active references within the kernel to the
|
2002-10-14 17:43:14 +04:00
|
|
|
vnode performing write access to the file.
|
|
|
|
It is maintained by the
|
2001-10-22 07:33:19 +04:00
|
|
|
.Xr open 2
|
|
|
|
and
|
|
|
|
.Xr close 2
|
2002-10-14 17:43:14 +04:00
|
|
|
system calls.
|
|
|
|
The third is the number of references within the kernel
|
|
|
|
requiring the vnode to remain active and not be recycled.
|
|
|
|
This count is maintained by
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fn vhold
|
|
|
|
and
|
|
|
|
.Fn holdrele .
|
|
|
|
When both the
|
|
|
|
.Em v_usecount
|
|
|
|
and
|
|
|
|
.Em v_holdcnt
|
2016-12-14 18:48:54 +03:00
|
|
|
reach zero, the vnode is cached.
|
|
|
|
The transition from the cache is handled by a kernel thread and
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fn vrecycle .
|
|
|
|
Access to
|
|
|
|
.Em v_usecount ,
|
|
|
|
.Em v_writecount
|
|
|
|
and
|
|
|
|
.Em v_holdcnt
|
|
|
|
is also protected by the
|
|
|
|
.Em v_interlock
|
2014-02-22 14:08:12 +04:00
|
|
|
mutex.
|
2001-10-22 07:33:19 +04:00
|
|
|
.Pp
|
|
|
|
The number of pending synchronous and asynchronous writes on the
|
|
|
|
vnode are recorded in
|
|
|
|
.Em v_numoutput .
|
|
|
|
It is used by
|
|
|
|
.Xr fsync 2
|
2002-10-14 17:43:14 +04:00
|
|
|
to wait for all writes to complete before returning to the user.
|
|
|
|
Its value must only be modified at splbio (see
|
2002-08-15 07:22:49 +04:00
|
|
|
.Xr spl 9 ) .
|
2001-10-22 07:33:19 +04:00
|
|
|
It does not track the number of dirty buffers attached to the
|
2001-10-22 12:21:32 +04:00
|
|
|
vnode.
|
2001-10-22 07:33:19 +04:00
|
|
|
.Pp
|
|
|
|
The link to the file system which owns the vnode is recorded by
|
|
|
|
.Em v_mount .
|
|
|
|
See
|
|
|
|
.Xr vfsops 9
|
|
|
|
for further information of file system mount status.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Em v_op
|
2002-10-14 17:43:14 +04:00
|
|
|
pointer points to its vnode operations vector.
|
|
|
|
This vector describes what operations can be done to the file associated
|
|
|
|
with the vnode.
|
2001-10-22 07:33:19 +04:00
|
|
|
The system maintains one vnode operations vector for each file system
|
2002-10-14 17:43:14 +04:00
|
|
|
type configured into the kernel.
|
|
|
|
The vnode operations vector contains a pointer to a function for
|
|
|
|
each operation supported by the file system.
|
|
|
|
See
|
2001-10-22 07:33:19 +04:00
|
|
|
.Xr vnodeops 9
|
|
|
|
for a description of vnode operations.
|
|
|
|
.Pp
|
2017-01-02 13:33:28 +03:00
|
|
|
When a user wants a new vnode for another file or wants a valid vnode
|
|
|
|
which is cached,
|
2015-07-12 11:11:27 +03:00
|
|
|
.Fn vcache_get
|
|
|
|
or
|
|
|
|
.Fn vcache_new
|
2014-02-22 14:08:12 +04:00
|
|
|
is invoked to allocate a vnode and initialize it for the new file.
|
2001-10-22 07:33:19 +04:00
|
|
|
.Pp
|
|
|
|
The type of object the vnode represents is recorded by
|
|
|
|
.Em v_type .
|
|
|
|
It is used by generic code to perform checks to ensure operations are
|
2002-10-14 17:43:14 +04:00
|
|
|
performed on valid file system objects.
|
|
|
|
Valid types are:
|
2001-10-22 07:33:19 +04:00
|
|
|
.Pp
|
|
|
|
.Bl -tag -offset indent -width VFIFO -compact
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VNON
|
2001-10-22 07:33:19 +04:00
|
|
|
The vnode has no type.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VREG
|
2001-10-22 07:33:19 +04:00
|
|
|
The vnode represents a regular file.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VDIR
|
2001-10-22 07:33:19 +04:00
|
|
|
The vnode represents a directory.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VBLK
|
2001-10-22 07:33:19 +04:00
|
|
|
The vnode represents a block special device.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VCHR
|
2001-10-22 07:33:19 +04:00
|
|
|
The vnode represents a character special device.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VLNK
|
2001-10-22 07:33:19 +04:00
|
|
|
The vnode represents a symbolic link.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VSOCK
|
2001-10-22 07:33:19 +04:00
|
|
|
The vnode represents a socket.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VFIFO
|
2001-10-22 07:33:19 +04:00
|
|
|
The vnode represents a pipe.
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VBAD
|
2001-10-22 07:33:19 +04:00
|
|
|
The vnode represents a bad file (not currently used).
|
|
|
|
.El
|
|
|
|
.Pp
|
2002-06-12 03:56:21 +04:00
|
|
|
Vnode tag types are used by external programs only (e.g.,
|
2001-10-22 07:33:19 +04:00
|
|
|
.Xr pstat 8 ) ,
|
2002-10-14 17:43:14 +04:00
|
|
|
and should never be inspected by the kernel.
|
|
|
|
Its use is deprecated
|
2001-10-22 07:33:19 +04:00
|
|
|
since new
|
|
|
|
.Em v_tag
|
2002-10-14 17:43:14 +04:00
|
|
|
values cannot be defined for loadable file systems.
|
|
|
|
The
|
2001-10-22 07:33:19 +04:00
|
|
|
.Em v_tag
|
2002-10-14 17:43:14 +04:00
|
|
|
member is read-only.
|
|
|
|
Valid tag types are:
|
2001-10-22 07:33:19 +04:00
|
|
|
.Pp
|
2002-08-14 22:50:48 +04:00
|
|
|
.Bl -tag -offset indent -width "VT_FILECORE " -compact
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_NON
|
2001-10-22 07:33:19 +04:00
|
|
|
non file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_UFS
|
2001-10-22 07:33:19 +04:00
|
|
|
universal file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_NFS
|
2001-10-22 07:33:19 +04:00
|
|
|
network file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_MFS
|
2001-10-22 07:33:19 +04:00
|
|
|
memory file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_MSDOSFS
|
2001-10-22 07:33:19 +04:00
|
|
|
FAT file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_LFS
|
2001-10-22 07:33:19 +04:00
|
|
|
log-structured file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_LOFS
|
2001-10-22 07:33:19 +04:00
|
|
|
loopback file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_FDESC
|
2001-10-22 07:33:19 +04:00
|
|
|
file descriptor file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_NULL
|
2001-10-22 07:33:19 +04:00
|
|
|
null file system layer
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_UMAP
|
2002-08-14 22:50:48 +04:00
|
|
|
uid/gid remapping file system layer
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_KERNFS
|
2001-10-22 07:33:19 +04:00
|
|
|
kernel interface file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_PROCFS
|
2001-10-22 07:33:19 +04:00
|
|
|
process interface file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_AFS
|
2001-10-22 07:33:19 +04:00
|
|
|
AFS file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_ISOFS
|
2002-08-14 22:50:48 +04:00
|
|
|
ISO 9660 file system(s)
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_UNION
|
2001-10-22 07:33:19 +04:00
|
|
|
union file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_ADOSFS
|
2001-10-22 07:33:19 +04:00
|
|
|
Amiga file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_EXT2FS
|
2010-02-21 16:28:12 +03:00
|
|
|
Linux's ext2 file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_CODA
|
2001-10-22 07:33:19 +04:00
|
|
|
Coda file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_FILECORE
|
2001-10-22 07:33:19 +04:00
|
|
|
filecore file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_NTFS
|
2001-10-22 07:33:19 +04:00
|
|
|
Microsoft NT's file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_VFS
|
2001-10-22 07:33:19 +04:00
|
|
|
virtual file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_OVERLAY
|
2001-10-22 07:33:19 +04:00
|
|
|
overlay file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_SMBFS
|
2002-08-14 22:50:48 +04:00
|
|
|
SMB file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_PTYFS
|
2005-08-05 17:28:50 +04:00
|
|
|
pseudo-terminal device file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_TMPFS
|
2005-08-05 17:37:25 +04:00
|
|
|
efficient memory file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_UDF
|
2006-03-03 05:17:41 +03:00
|
|
|
universal disk format file system
|
2014-02-22 15:28:18 +04:00
|
|
|
.It Dv VT_SYSVBFS
|
2006-03-03 05:17:41 +03:00
|
|
|
systemV boot file system
|
2001-10-22 07:33:19 +04:00
|
|
|
.El
|
|
|
|
.Pp
|
2017-01-11 12:08:58 +03:00
|
|
|
The vnode lock is acquired by calling
|
2001-10-22 07:33:19 +04:00
|
|
|
.Xr vn_lock 9
|
|
|
|
and released by calling
|
2002-06-12 03:56:21 +04:00
|
|
|
.Xr VOP_UNLOCK 9 .
|
|
|
|
The reason for this asymmetry is that
|
|
|
|
.Xr vn_lock 9
|
|
|
|
is a wrapper for
|
|
|
|
.Xr VOP_LOCK 9
|
|
|
|
with extra checks, while the unlocking step usually does not need
|
|
|
|
additional checks and thus has no wrapper.
|
|
|
|
.Pp
|
2001-10-22 07:33:19 +04:00
|
|
|
The vnode locking operation is complicated because it is used for many
|
2002-10-14 17:43:14 +04:00
|
|
|
purposes.
|
|
|
|
Sometimes it is used to bundle a series of vnode operations (see
|
2001-10-22 12:21:32 +04:00
|
|
|
.Xr vnodeops 9 )
|
2002-10-14 17:43:14 +04:00
|
|
|
into an atomic group.
|
|
|
|
Many file systems rely on it to prevent race conditions in updating
|
|
|
|
file system type specific data structures rather than using their
|
|
|
|
own private locks.
|
2004-05-25 21:27:03 +04:00
|
|
|
The vnode lock can operate as a multiple-reader (shared-access lock)
|
|
|
|
or single-writer lock (exclusive access lock), however many current file
|
|
|
|
system implementations were written assuming only single-writer
|
|
|
|
locking.
|
|
|
|
Multiple-reader locking functions equivalently only in the presence
|
|
|
|
of big-lock SMP locking or a uni-processor machine.
|
2002-10-14 17:43:14 +04:00
|
|
|
The lock may be held while sleeping.
|
2017-01-11 12:08:58 +03:00
|
|
|
While the vnode lock is acquired, the holder is guaranteed that the
|
|
|
|
vnode will not be reclaimed or invalidated.
|
2002-10-14 17:43:14 +04:00
|
|
|
Most file system functions require that you hold the vnode lock on entry.
|
|
|
|
See
|
2001-10-22 07:33:19 +04:00
|
|
|
.Xr lock 9
|
|
|
|
for details on the kernel locking API.
|
|
|
|
.Pp
|
|
|
|
Each file system underlying a vnode allocates its own private area and
|
|
|
|
hangs it from
|
|
|
|
.Em v_data .
|
|
|
|
.Pp
|
|
|
|
Most functions discussed in this page that operate on vnodes cannot be
|
2002-10-14 17:43:14 +04:00
|
|
|
called from interrupt context.
|
|
|
|
The members
|
2001-10-22 07:33:19 +04:00
|
|
|
.Em v_numoutput ,
|
|
|
|
.Em v_holdcnt ,
|
|
|
|
.Em v_dirtyblkhd ,
|
|
|
|
and
|
2017-01-11 12:06:57 +03:00
|
|
|
.Em v_cleanblkhd
|
2001-10-22 07:33:19 +04:00
|
|
|
are modified in interrupt context and must be protected by
|
|
|
|
.Xr splbio 9
|
|
|
|
unless it is certain that there is no chance an interrupt handler will
|
2002-10-14 17:43:14 +04:00
|
|
|
modify them.
|
|
|
|
The vnode lock must not be acquired within interrupt context.
|
2001-10-22 07:33:19 +04:00
|
|
|
.Sh FUNCTIONS
|
|
|
|
.Bl -tag -width compact
|
|
|
|
.It Fn vref "vp"
|
|
|
|
Increment
|
|
|
|
.Em v_usecount
|
|
|
|
of the vnode
|
|
|
|
.Em vp .
|
2003-04-07 11:04:49 +04:00
|
|
|
Any kernel thread system which uses a vnode (e.g., during the operation
|
2001-10-22 07:33:19 +04:00
|
|
|
of some algorithm or to store in a data structure) should call
|
|
|
|
.Fn vref .
|
|
|
|
.It Fn vrele "vp"
|
|
|
|
Decrement
|
|
|
|
.Em v_usecount
|
|
|
|
of unlocked vnode
|
|
|
|
.Em vp .
|
|
|
|
Any code in the system which is using a vnode should call
|
|
|
|
.Fn vrele
|
2002-10-14 17:43:14 +04:00
|
|
|
when it is finished with the vnode.
|
|
|
|
If
|
2001-10-22 07:33:19 +04:00
|
|
|
.Em v_usecount
|
|
|
|
of the vnode reaches zero and
|
|
|
|
.Em v_holdcnt
|
2002-10-14 17:43:14 +04:00
|
|
|
is greater than zero, the vnode is placed on the holdlist.
|
|
|
|
If both
|
2001-10-22 07:33:19 +04:00
|
|
|
.Em v_usecount
|
|
|
|
and
|
|
|
|
.Em v_holdcnt
|
2016-12-14 18:48:54 +03:00
|
|
|
are zero, the vnode is cached.
|
2010-02-12 02:16:35 +03:00
|
|
|
.It Fn vrele_async "vp"
|
2017-01-23 14:49:03 +03:00
|
|
|
Will asynchronously release the vnode in different context than the caller,
|
2010-02-13 10:48:01 +03:00
|
|
|
sometime after the call.
|
2001-10-22 07:33:19 +04:00
|
|
|
.It Fn vput "vp"
|
2015-04-20 17:07:24 +03:00
|
|
|
Legacy convenience routine for unlocking and releasing
|
|
|
|
.Fa vp .
|
|
|
|
Equivalent to:
|
|
|
|
.Bd -literal -offset abcd
|
|
|
|
.No "VOP_UNLOCK(" Ns Fa vp Ns Li ");"
|
|
|
|
.No "vrele(" Ns Fa vp Ns Li ");"
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
New code should prefer using
|
2001-10-22 07:33:19 +04:00
|
|
|
.Xr VOP_UNLOCK 9
|
2015-04-20 17:07:24 +03:00
|
|
|
and
|
|
|
|
.Fn vrele
|
|
|
|
directly.
|
2001-10-22 07:33:19 +04:00
|
|
|
.It Fn vhold "vp"
|
|
|
|
Mark the vnode
|
|
|
|
.Fa vp
|
|
|
|
as active by incrementing
|
2017-07-04 00:28:48 +03:00
|
|
|
.Em vp->v_holdcnt .
|
2016-12-14 18:48:54 +03:00
|
|
|
Once held, the vnode will not be recycled until it is
|
2002-10-14 17:43:14 +04:00
|
|
|
released with
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fn holdrele .
|
|
|
|
.It Fn holdrele "vp"
|
|
|
|
Mark the vnode
|
|
|
|
.Fa vp
|
|
|
|
as inactive by decrementing
|
2017-07-04 00:28:48 +03:00
|
|
|
.Em vp->v_holdcnt .
|
2015-07-12 11:11:27 +03:00
|
|
|
.It Fn vcache_get "mp" "key" "key_len" "vpp"
|
|
|
|
Allocate a new vnode.
|
|
|
|
The new vnode is returned referenced in the address specified by
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fa vpp .
|
|
|
|
.Pp
|
|
|
|
The argument
|
|
|
|
.Fa mp
|
2015-07-12 11:11:27 +03:00
|
|
|
is the mount point for the file system to lookup the file in.
|
|
|
|
.Pp
|
|
|
|
The arguments
|
|
|
|
.Fa key
|
|
|
|
and
|
|
|
|
.Fa key_len
|
|
|
|
uniquely identify the file in the file system.
|
|
|
|
.Pp
|
|
|
|
If a vnode is successfully retrieved zero is returned, otherwise an
|
|
|
|
appropriate error code is returned.
|
|
|
|
.It Fn vcache_new "mp" "dvp" "vap" "cred" "vpp"
|
|
|
|
Allocate a new vnode with a new file.
|
|
|
|
The new vnode is returned referenced in the address specified by
|
|
|
|
.Fa vpp .
|
2001-10-22 07:33:19 +04:00
|
|
|
.Pp
|
|
|
|
The argument
|
2015-07-12 11:11:27 +03:00
|
|
|
.Fa mp
|
|
|
|
is the mount point for the file system to create the file in.
|
|
|
|
.Pp
|
2001-10-22 07:33:19 +04:00
|
|
|
The argument
|
2015-07-12 11:11:27 +03:00
|
|
|
.Fa dvp
|
|
|
|
points to the directory to create the file in.
|
|
|
|
.Pp
|
|
|
|
The argument
|
|
|
|
.Fa vap
|
|
|
|
points to the attributes for the file to create.
|
|
|
|
.Pp
|
|
|
|
The argument
|
|
|
|
.Fa cred
|
|
|
|
holds the credentials for the file to create.
|
|
|
|
.Pp
|
2019-01-01 13:06:54 +03:00
|
|
|
The argument
|
|
|
|
.Fa extra
|
|
|
|
allows the caller to pass more information about the file to create.
|
|
|
|
.Pp
|
2015-07-12 11:11:27 +03:00
|
|
|
If a vnode is successfully created zero is returned, otherwise an
|
2002-10-14 17:43:14 +04:00
|
|
|
appropriate error code is returned.
|
2015-07-12 11:11:27 +03:00
|
|
|
.It Fn vcache_rekey_enter "mp" "vp" "old_key" "old_key_len" "new_key" "new_key_len"
|
|
|
|
Prepare to change the key of a cached vnode.
|
|
|
|
.Pp
|
2001-10-22 07:33:19 +04:00
|
|
|
The argument
|
2015-07-12 11:11:27 +03:00
|
|
|
.Fa mp
|
|
|
|
is the mount point for the file system the vnode
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fa vp
|
2015-07-12 11:11:27 +03:00
|
|
|
resides in.
|
|
|
|
.Pp
|
|
|
|
The arguments
|
2015-07-17 09:45:55 +03:00
|
|
|
.Fa old_key
|
|
|
|
and
|
2015-07-12 11:11:27 +03:00
|
|
|
.Fa old_key_len
|
|
|
|
identify the cached vnode.
|
|
|
|
.Pp
|
|
|
|
The arguments
|
|
|
|
.Fa new_key
|
|
|
|
and
|
|
|
|
.Fa new_key_len
|
|
|
|
will identify the vnode after rename.
|
|
|
|
.Pp
|
|
|
|
If the new key already exists
|
|
|
|
.Er EEXIST
|
|
|
|
is returned, otherwise zero is returned.
|
|
|
|
.It Fn vcache_rekey_exit "mp" "vp" "old_key" "old_key_len" "new_key" "new_key_len"
|
|
|
|
Finish rename after calling
|
|
|
|
.Fn vcache_rekey_enter .
|
2014-03-05 13:37:29 +04:00
|
|
|
.It Fn vrecycle "vp"
|
|
|
|
Recycle the referenced vnode
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fa vp
|
2014-03-05 13:37:29 +04:00
|
|
|
if this is the last reference.
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fn vrecycle
|
2014-03-05 13:37:29 +04:00
|
|
|
is a null operation if the reference count is greater than one.
|
2001-10-22 07:33:19 +04:00
|
|
|
.It Fn vgone "vp"
|
2002-10-23 10:15:59 +04:00
|
|
|
Eliminate all activity associated with the unlocked vnode
|
|
|
|
.Fa vp
|
|
|
|
in preparation for recycling.
|
2017-05-28 19:39:41 +03:00
|
|
|
This operation is restricted to suspended file systems.
|
|
|
|
See
|
|
|
|
.Xr vfs_suspend 9 .
|
2005-08-05 17:37:25 +04:00
|
|
|
.It Fn vgonel "vp" "p"
|
2002-10-23 10:15:59 +04:00
|
|
|
Eliminate all activity associated with the locked vnode
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fa vp
|
2001-10-22 12:21:32 +04:00
|
|
|
in preparation for recycling.
|
2014-03-24 17:42:40 +04:00
|
|
|
.It Fn vdead_check "vp" "flags"
|
|
|
|
Check the vnode
|
|
|
|
.Fa vp
|
|
|
|
for being or becoming dead.
|
|
|
|
Returns
|
|
|
|
.Er ENOENT
|
|
|
|
for a dead vnode and zero otherwise.
|
|
|
|
If
|
|
|
|
.Fa flags
|
|
|
|
is
|
|
|
|
.Dv VDEAD_NOWAIT
|
|
|
|
it will return
|
|
|
|
.Er EBUSY
|
|
|
|
if the vnode is becoming dead and the function will not sleep.
|
|
|
|
.Pp
|
|
|
|
Whenever this function returns a non-zero value all future calls
|
|
|
|
for this
|
|
|
|
.Fa vp
|
|
|
|
will also return a non-zero value.
|
2001-10-22 07:33:19 +04:00
|
|
|
.It Fn vflush "mp" "skipvp" "flags"
|
|
|
|
Remove any vnodes in the vnode table belonging to mount point
|
|
|
|
.Fa mp .
|
|
|
|
If
|
|
|
|
.Fa skipvp
|
2011-06-14 11:49:09 +04:00
|
|
|
is not
|
|
|
|
.Dv NULL
|
|
|
|
it is exempt from being flushed.
|
2002-10-14 17:43:14 +04:00
|
|
|
The argument
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fa flags
|
|
|
|
is a set of flags modifying the operation of
|
|
|
|
.Fn vflush .
|
2014-02-22 15:28:18 +04:00
|
|
|
If
|
|
|
|
.Dv FORCECLOSE
|
|
|
|
is not specified, there should not be any active vnodes and
|
2003-10-24 11:43:35 +04:00
|
|
|
the error
|
|
|
|
.Er EBUSY
|
|
|
|
is returned if any are found (this is a user error, not a system error).
|
2014-02-22 15:28:18 +04:00
|
|
|
If
|
|
|
|
.Dv FORCECLOSE
|
|
|
|
is specified, active vnodes that are found are detached.
|
|
|
|
If
|
|
|
|
.Dv WRITECLOSE
|
|
|
|
is set, only flush out regular file vnodes open for writing.
|
|
|
|
SKIPSYSTEM causes any vnodes marked
|
|
|
|
.Dv V_SYSTEM
|
|
|
|
to be skipped.
|
2001-10-22 07:33:19 +04:00
|
|
|
.It Fn vaccess "type" "file_mode" "uid" "gid" "acc_mode" "cred"
|
2002-08-14 22:50:48 +04:00
|
|
|
Do access checking by comparing the file's permissions to the caller's
|
|
|
|
desired access type
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fa acc_mode
|
2002-08-14 22:50:48 +04:00
|
|
|
and credentials
|
|
|
|
.Fa cred .
|
2001-10-22 07:33:19 +04:00
|
|
|
.It Fn bdevvp "dev" "vpp"
|
|
|
|
Create a vnode for a block device.
|
|
|
|
.Fn bdevvp
|
|
|
|
is used for root file systems, swap areas and for memory file system
|
|
|
|
special devices.
|
|
|
|
.It Fn cdevvp "dev" "vpp"
|
|
|
|
Create a vnode for a character device.
|
|
|
|
.Fn cdevvp
|
|
|
|
is used for the console and kernfs special devices.
|
|
|
|
.It Fn vfinddev "dev" "vtype" "vpp"
|
2002-10-14 17:43:14 +04:00
|
|
|
Lookup a vnode by device number.
|
2010-07-21 13:06:37 +04:00
|
|
|
The vnode is referenced and returned in the address specified by
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fa vpp .
|
|
|
|
.It Fn vdevgone "int maj" "int min" "int minh" "enum vtype type"
|
|
|
|
Reclaim all vnodes that correspond to the specified minor number range
|
|
|
|
.Fa minl
|
|
|
|
to
|
|
|
|
.Fa minh
|
|
|
|
(endpoints inclusive) of the specified major
|
|
|
|
.Fa maj .
|
|
|
|
.It Fn vwakeup "bp"
|
|
|
|
Update outstanding I/O count
|
2017-07-04 00:28:48 +03:00
|
|
|
.Em vp->v_numoutput
|
2001-10-22 07:33:19 +04:00
|
|
|
for the vnode
|
2017-07-04 00:28:48 +03:00
|
|
|
.Em bp->b_vp
|
2002-08-14 22:50:48 +04:00
|
|
|
and do a wakeup if requested and
|
2017-07-04 00:28:48 +03:00
|
|
|
.Em vp->vflag
|
2014-02-22 15:28:18 +04:00
|
|
|
has
|
|
|
|
.Dv VBWAIT
|
|
|
|
set.
|
2001-10-22 07:33:19 +04:00
|
|
|
.It Fn vflushbuf "vp" "sync"
|
|
|
|
Flush all dirty buffers to disk for the file with the locked vnode
|
|
|
|
.Fa vp .
|
|
|
|
The argument
|
|
|
|
.Fa sync
|
|
|
|
specifies whether the I/O should be synchronous and
|
|
|
|
.Fn vflushbuf
|
|
|
|
will sleep until
|
2017-07-04 00:28:48 +03:00
|
|
|
.Em vp->v_numoutput
|
2001-10-22 07:33:19 +04:00
|
|
|
is zero and
|
2017-07-04 00:28:48 +03:00
|
|
|
.Em vp->v_dirtyblkhd
|
2001-10-22 07:33:19 +04:00
|
|
|
is empty.
|
2006-01-29 06:09:19 +03:00
|
|
|
.It Fn vinvalbuf "vp" "flags" "cred" "l" "slpflag" "slptimeo"
|
2001-10-22 07:33:19 +04:00
|
|
|
Flush out and invalidate all buffers associated with locked vnode
|
|
|
|
.Fa vp .
|
|
|
|
The argument
|
2006-01-29 06:09:19 +03:00
|
|
|
.Fa l
|
2001-10-22 07:33:19 +04:00
|
|
|
and
|
|
|
|
.Fa cred
|
2002-10-14 17:43:14 +04:00
|
|
|
specified the calling process and its credentials.
|
|
|
|
The
|
2003-04-04 23:39:17 +04:00
|
|
|
.Xr ltsleep 9
|
2002-08-14 22:50:48 +04:00
|
|
|
flag and timeout are specified by the arguments
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fa slpflag
|
|
|
|
and
|
|
|
|
.Fa slptimeo
|
2002-10-14 17:43:14 +04:00
|
|
|
respectively.
|
|
|
|
If the operation is successful zero is returned, otherwise an
|
|
|
|
appropriate error code is returned.
|
2001-10-22 07:33:19 +04:00
|
|
|
.It Fn vtruncbuf "vp" "lbn" "slpflag" "slptimeo"
|
|
|
|
Destroy any in-core buffers past the file truncation length for the
|
|
|
|
locked vnode
|
|
|
|
.Fa vp .
|
|
|
|
The truncation length is specified by
|
|
|
|
.Fa lbn .
|
|
|
|
.Fn vtruncbuf
|
|
|
|
will sleep while the I/O is performed, The
|
2003-04-04 23:39:17 +04:00
|
|
|
.Xr ltsleep 9
|
2001-10-22 07:33:19 +04:00
|
|
|
flag and timeout are specified by the arguments
|
|
|
|
.Fa slpflag
|
|
|
|
and
|
|
|
|
.Fa slptimeo
|
2002-10-14 17:43:14 +04:00
|
|
|
respectively.
|
|
|
|
If the operation is successful zero is returned, otherwise an
|
|
|
|
appropriate error code is returned.
|
2001-10-22 07:33:19 +04:00
|
|
|
.It Fn vprint "label" "vp"
|
|
|
|
This function is used by the kernel to dump vnode information during a
|
2002-10-14 17:43:14 +04:00
|
|
|
panic.
|
|
|
|
It is only used if the kernel option DIAGNOSTIC is compiled into the kernel.
|
|
|
|
The argument
|
2001-10-22 07:33:19 +04:00
|
|
|
.Fa label
|
|
|
|
is a string to prefix the information dump of vnode
|
|
|
|
.Fa vp .
|
|
|
|
.El
|
|
|
|
.Sh CODE REFERENCES
|
2009-04-23 00:53:44 +04:00
|
|
|
The vnode framework is implemented within the file
|
|
|
|
.Pa sys/kern/vfs_subr.c .
|
2001-10-22 07:33:19 +04:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr intro 9 ,
|
|
|
|
.Xr lock 9 ,
|
|
|
|
.Xr namecache 9 ,
|
|
|
|
.Xr namei 9 ,
|
|
|
|
.Xr uvm 9 ,
|
|
|
|
.Xr vattr 9 ,
|
|
|
|
.Xr vfs 9 ,
|
|
|
|
.Xr vfsops 9 ,
|
|
|
|
.Xr vnodeops 9 ,
|
|
|
|
.Xr vnsubr 9
|
|
|
|
.Sh BUGS
|
2002-10-14 17:43:14 +04:00
|
|
|
The locking protocol is inconsistent.
|
|
|
|
Many vnode operations are passed locked vnodes on entry but release
|
|
|
|
the lock before they exit.
|
2001-10-22 07:33:19 +04:00
|
|
|
The locking protocol is used in some places to attempt to make a
|
2002-10-14 17:43:14 +04:00
|
|
|
series of operations atomic (e.g., access check then operation).
|
|
|
|
This does not work for non-local file systems that do not support locking
|
2003-04-07 11:04:49 +04:00
|
|
|
(e.g., NFS).
|
2002-10-14 17:43:14 +04:00
|
|
|
The
|
2001-10-22 07:33:19 +04:00
|
|
|
.Nm
|
2001-10-22 12:21:32 +04:00
|
|
|
interface would benefit from a simpler locking protocol.
|