diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:55:43 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:55:43 -0400 |
| commit | ac5e55f5f2af5b92794c2aded46c6bae85b5f5ed (patch) | |
| tree | 9367490586c84cba28652e443e3166d66c33b0d9 /static/freebsd/man9/vnode.9 3.html | |
| parent | 253e67c8b3a72b3a4757fdbc5845297628db0a4a (diff) | |
docs: Added All FreeBSD Manuals
Diffstat (limited to 'static/freebsd/man9/vnode.9 3.html')
| -rw-r--r-- | static/freebsd/man9/vnode.9 3.html | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/static/freebsd/man9/vnode.9 3.html b/static/freebsd/man9/vnode.9 3.html new file mode 100644 index 00000000..27868c6b --- /dev/null +++ b/static/freebsd/man9/vnode.9 3.html @@ -0,0 +1,153 @@ +<table class="head"> + <tr> + <td class="head-ltitle">VNODE(9)</td> + <td class="head-vol">Kernel Developer's Manual</td> + <td class="head-rtitle">VNODE(9)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<p class="Pp"><code class="Nm">vnode</code> — <span class="Nd">internal + representation of a file or directory</span></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<p class="Pp"><code class="In">#include + <<a class="In">sys/param.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/vnode.h</a>></code></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<p class="Pp">The vnode is the focus of all file activity in + <span class="Ux">UNIX</span>. A vnode is described by <var class="Vt">struct + vnode</var>. There is a unique vnode allocated for each active file, each + current directory, each mounted-on file, text file, and the root.</p> +<p class="Pp">Each vnode has three reference counts, + <var class="Va">v_usecount</var>, <var class="Va">v_holdcnt</var> and + <var class="Va">v_writecount</var>. The first is the number of clients + within the kernel which are using this vnode. This count is maintained by + <a class="Xr">vref(9)</a>, <a class="Xr">vrele(9)</a> and + <a class="Xr">vput(9)</a>. The second is the number of clients within the + kernel who veto the recycling of this vnode. This count is maintained by + <a class="Xr">vhold(9)</a> and <a class="Xr">vdrop(9)</a>. When both the + <var class="Va">v_usecount</var> and the <var class="Va">v_holdcnt</var> of + a vnode reaches zero then the vnode will be put on the freelist and may be + reused for another file, possibly in another file system. The transition + from the freelist is handled by <a class="Xr">getnewvnode(9)</a>. The third + is a count of the number of clients which are writing into the file. It is + maintained by the <a class="Xr">open(2)</a> and <a class="Xr">close(2)</a> + system calls.</p> +<p class="Pp">Any call which returns a vnode (e.g., <a class="Xr">vget(9)</a>, + <a class="Xr">VOP_LOOKUP(9)</a>, etc.) will increase the + <var class="Va">v_usecount</var> of the vnode by one. When the caller is + finished with the vnode, it should release this reference by calling + <a class="Xr">vrele(9)</a> (or <a class="Xr">vput(9)</a> if the vnode is + locked).</p> +<p class="Pp" id="VOP_*">Other commonly used members of the vnode structure are + <var class="Va">v_id</var> which is used to maintain consistency in the name + cache, <var class="Va">v_mount</var> which points at the file system which + owns the vnode, <var class="Va">v_type</var> which contains the type of + object the vnode represents and <var class="Va">v_data</var> which is used + by file systems to store file system specific data with the vnode. The + <var class="Va">v_op</var> field is used by the + <a class="permalink" href="#VOP_*"><code class="Fn">VOP_*</code></a>() + functions to call functions in the file system which implement the vnode's + functionality.</p> +<p class="Pp" id="VOP_*~2">The + <a class="permalink" href="#VOP_*~2"><code class="Fn">VOP_*</code></a>() + function declarations and definitions are generated from + <span class="Pa">sys/kern/vnode_if.src</span> by the + <span class="Pa">sys/tools/vnode_if.awk</span> script. The interfaces are + documented in their respective manual pages like + <a class="Xr">VOP_READ(9)</a> and <a class="Xr">VOP_WRITE(9)</a>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="VNODE_TYPES"><a class="permalink" href="#VNODE_TYPES">VNODE + TYPES</a></h1> +<dl class="Bl-tag"> + <dt id="VNON"><a class="permalink" href="#VNON"><code class="Dv">VNON</code></a></dt> + <dd>No type.</dd> + <dt id="VREG"><a class="permalink" href="#VREG"><code class="Dv">VREG</code></a></dt> + <dd>A regular file; may be with or without VM object backing. If you want to + make sure this get a backing object, call + <a class="permalink" href="#vnode_create_vobject"><code class="Fn" id="vnode_create_vobject">vnode_create_vobject</code></a>().</dd> + <dt id="VDIR"><a class="permalink" href="#VDIR"><code class="Dv">VDIR</code></a></dt> + <dd>A directory.</dd> + <dt id="VBLK"><a class="permalink" href="#VBLK"><code class="Dv">VBLK</code></a></dt> + <dd>A block device; may be with or without VM object backing. If you want to + make sure this get a backing object, call + <code class="Fn">vnode_create_vobject</code>().</dd> + <dt id="VCHR"><a class="permalink" href="#VCHR"><code class="Dv">VCHR</code></a></dt> + <dd>A character device.</dd> + <dt id="VLNK"><a class="permalink" href="#VLNK"><code class="Dv">VLNK</code></a></dt> + <dd>A symbolic link.</dd> + <dt id="VSOCK"><a class="permalink" href="#VSOCK"><code class="Dv">VSOCK</code></a></dt> + <dd>A socket. Advisory locking will not work on this.</dd> + <dt id="VFIFO"><a class="permalink" href="#VFIFO"><code class="Dv">VFIFO</code></a></dt> + <dd>A FIFO (named pipe). Advisory locking will not work on this.</dd> + <dt id="VBAD"><a class="permalink" href="#VBAD"><code class="Dv">VBAD</code></a></dt> + <dd>Indicates that the vnode has been reclaimed.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="IMPLEMENTATION_NOTES"><a class="permalink" href="#IMPLEMENTATION_NOTES">IMPLEMENTATION + NOTES</a></h1> +<p class="Pp">VFIFO uses the "struct fileops" from + <span class="Pa">/sys/kern/sys_pipe.c</span>. VSOCK uses the "struct + fileops" from <span class="Pa">/sys/kern/sys_socket.c</span>. + Everything else uses the one from + <span class="Pa">/sys/kern/vfs_vnops.c</span>.</p> +<p class="Pp">The VFIFO/VSOCK code, which is why "struct fileops" is + used at all, is an artifact of an incomplete integration of the VFS code + into the kernel.</p> +<p class="Pp">Calls to <a class="Xr">malloc(9)</a> or <a class="Xr">free(9)</a> + when holding a <code class="Nm">vnode</code> interlock, will cause a LOR + (Lock Order Reversal) due to the intertwining of VM Objects and Vnodes.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1> +<dl class="Bl-tag Bl-compact"> + <dt><span class="Pa">sys/kern/vnode_if.src</span></dt> + <dd>The input file for <span class="Pa">sys/tools/vnode_if.awk</span>.</dd> + <dt><span class="Pa">sys/tools/vnode_if.awk</span></dt> + <dd>The script generating the source code of the + <code class="Fn">VOP_*</code>() functions.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<p class="Pp"><a class="Xr">malloc(9)</a>, <a class="Xr">VFS(9)</a>, + <a class="Xr">VOP_ACCESS(9)</a>, <a class="Xr">VOP_ACLCHECK(9)</a>, + <a class="Xr">VOP_ADVISE(9)</a>, <a class="Xr">VOP_ADVLOCK(9)</a>, + <a class="Xr">VOP_ALLOCATE(9)</a>, <a class="Xr">VOP_ATTRIB(9)</a>, + <a class="Xr">VOP_BWRITE(9)</a>, <a class="Xr">VOP_CREATE(9)</a>, + <a class="Xr">VOP_FSYNC(9)</a>, <a class="Xr">VOP_GETACL(9)</a>, + <a class="Xr">VOP_GETEXTATTR(9)</a>, <a class="Xr">VOP_GETPAGES(9)</a>, + <a class="Xr">VOP_INACTIVE(9)</a>, <a class="Xr">VOP_IOCTL(9)</a>, + <a class="Xr">VOP_LINK(9)</a>, <a class="Xr">VOP_LISTEXTATTR(9)</a>, + <a class="Xr">VOP_LOCK(9)</a>, <a class="Xr">VOP_LOOKUP(9)</a>, + <a class="Xr">VOP_OPENCLOSE(9)</a>, <a class="Xr">VOP_PATHCONF(9)</a>, + <a class="Xr">VOP_PRINT(9)</a>, <a class="Xr">VOP_RDWR(9)</a>, + <a class="Xr">VOP_READ_PGCACHE(9)</a>, <a class="Xr">VOP_READDIR(9)</a>, + <a class="Xr">VOP_READLINK(9)</a>, <a class="Xr">VOP_REALLOCBLKS(9)</a>, + <a class="Xr">VOP_REMOVE(9)</a>, <a class="Xr">VOP_RENAME(9)</a>, + <a class="Xr">VOP_REVOKE(9)</a>, <a class="Xr">VOP_SETACL(9)</a>, + <a class="Xr">VOP_SETEXTATTR(9)</a>, <a class="Xr">VOP_SETLABEL(9)</a>, + <a class="Xr">VOP_STRATEGY(9)</a>, <a class="Xr">VOP_VPTOCNP(9)</a>, + <a class="Xr">VOP_VPTOFH(9)</a></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<p class="Pp">This manual page was written by <span class="An">Doug + Rabson</span>.</p> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">July 15, 2025</td> + <td class="foot-os">FreeBSD 15.0</td> + </tr> +</table> |
