1 .\" Copyright (c) 1996 Doug Rabson
3 .\" All rights reserved.
5 .\" This program is free software.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .\" $FreeBSD: src/share/man/man9/vnode.9,v 1.10.2.5 2001/12/17 11:30:19 ru Exp $
28 .\" $DragonFly: src/share/man/man9/vnode.9,v 1.4 2003/07/28 07:27:38 hmp Exp $
35 .Nd internal representation of a file or directory
40 The vnode is the focus of all file activity in
47 unique vnode allocated for each active file, each current directory,
48 each mounted-on file, text file, and the root.
50 Each vnode has three reference counts,
55 The first is the number of clients within the kernel which are
56 using this vnode. This count is maintained by
61 The second is the number of clients within the kernel who veto
62 the recycling of this vnode. This count is
71 of a vnode reaches zero then the vnode will be put on the freelist
72 and may be reused for another file, possibly in another filesystem.
73 The transition to and from the freelist is handled by
78 The third is a count of the number of clients which are writing into
79 the file. It is maintained by the
85 Any call which returns a vnode (e.g.\&
91 of the vnode by one. When the caller is finished with the vnode, it
92 should release this reference by calling
96 if the vnode is locked).
98 Other commonly used members of the vnode structure are
100 which is used to maintain consistency in the name cache,
102 which points at the filesystem which owns the vnode,
104 which contains the type of object the vnode represents and
106 which is used by filesystems to store filesystem specific data with
112 macros to call functions in the filesystem which implement the vnode's
115 .Bl -tag -width VSOCK
119 A regular file; may be with or without VM object backing. If you want
120 to make sure this get a backing object, call
121 .Xr vfs_object_create 9 .
125 A block device; may be with or without VM object backing. If you want
126 to make sure this get a backing object, call
127 .Xr vfs_object_create 9 .
133 A socket. Advisory locking won't work on this.
135 A FIFO (named pipe). Advisory locking won't work on this.
137 An old style bad sector map
140 VFIFO uses the "struct fileops" from
141 .Pa /sys/kern/sys_pipe.c .
142 VSOCK uses the "struct fileops" from
143 .Pa /sys/kern/sys_socket.c .
144 Everything else uses the one from
145 .Pa /sys/kern/vfs_vnops.c .
147 The VFIFO/VSOCK code, which is why
149 is used at all, is an artifact of an incomplete integration of
150 the VFS code into the kernel.
154 This manual page was written by