diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:55:15 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:55:15 -0400 |
| commit | 253e67c8b3a72b3a4757fdbc5845297628db0a4a (patch) | |
| tree | adf53b66087aa30dfbf8bf391a1dadb044c3bf4d /static/netbsd/man9/vnodeops.9 3.html | |
| parent | a9157ce950dfe2fc30795d43b9d79b9d1bffc48b (diff) | |
docs: Added All NetBSD Manuals
Diffstat (limited to 'static/netbsd/man9/vnodeops.9 3.html')
| -rw-r--r-- | static/netbsd/man9/vnodeops.9 3.html | 1441 |
1 files changed, 1441 insertions, 0 deletions
diff --git a/static/netbsd/man9/vnodeops.9 3.html b/static/netbsd/man9/vnodeops.9 3.html new file mode 100644 index 00000000..17e8c6f5 --- /dev/null +++ b/static/netbsd/man9/vnodeops.9 3.html @@ -0,0 +1,1441 @@ +<table class="head"> + <tr> + <td class="head-ltitle">VNODEOPS(9)</td> + <td class="head-vol">Kernel Developer's Manual</td> + <td class="head-rtitle">VNODEOPS(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">vnodeops</code>, + <code class="Nm">VOP_LOOKUP</code>, <code class="Nm">VOP_CREATE</code>, + <code class="Nm">VOP_MKNOD</code>, <code class="Nm">VOP_OPEN</code>, + <code class="Nm">VOP_CLOSE</code>, <code class="Nm">VOP_ACCESS</code>, + <code class="Nm">VOP_GETATTR</code>, <code class="Nm">VOP_SETATTR</code>, + <code class="Nm">VOP_READ</code>, <code class="Nm">VOP_WRITE</code>, + <code class="Nm">VOP_FALLOCATE</code>, <code class="Nm">VOP_FDISCARD</code>, + <code class="Nm">VOP_IOCTL</code>, <code class="Nm">VOP_FCNTL</code>, + <code class="Nm">VOP_POLL</code>, <code class="Nm">VOP_KQFILTER</code>, + <code class="Nm">VOP_REVOKE</code>, <code class="Nm">VOP_MMAP</code>, + <code class="Nm">VOP_FSYNC</code>, <code class="Nm">VOP_SEEK</code>, + <code class="Nm">VOP_REMOVE</code>, <code class="Nm">VOP_LINK</code>, + <code class="Nm">VOP_RENAME</code>, <code class="Nm">VOP_MKDIR</code>, + <code class="Nm">VOP_RMDIR</code>, <code class="Nm">VOP_SYMLINK</code>, + <code class="Nm">VOP_READDIR</code>, <code class="Nm">VOP_READLINK</code>, + <code class="Nm">VOP_ABORTOP</code>, <code class="Nm">VOP_INACTIVE</code>, + <code class="Nm">VOP_RECLAIM</code>, <code class="Nm">VOP_LOCK</code>, + <code class="Nm">VOP_UNLOCK</code>, <code class="Nm">VOP_ISLOCKED</code>, + <code class="Nm">VOP_BMAP</code>, <code class="Nm">VOP_PRINT</code>, + <code class="Nm">VOP_PATHCONF</code>, <code class="Nm">VOP_ADVLOCK</code>, + <code class="Nm">VOP_WHITEOUT</code>, <code class="Nm">VOP_GETPAGES</code>, + <code class="Nm">VOP_PUTPAGES</code>, <code class="Nm">VOP_STRATEGY</code>, + <code class="Nm">VOP_BWRITE</code>, <code class="Nm">VOP_GETEXTATTR</code>, + <code class="Nm">VOP_SETEXTATTR</code>, + <code class="Nm">VOP_LISTEXTATTR</code>, + <code class="Nm">VOP_DELETEEXTATTR</code> — <span class="Nd">vnode + operations</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/buf.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/dirent.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/vnode.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/mount.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/namei.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/unistd.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/fcntl.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/lockf.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/extattr.h</a>></code></p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_LOOKUP</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *dvp</var>, <var class="Fa" style="white-space: nowrap;">struct vnode + **vpp</var>, <var class="Fa" style="white-space: nowrap;">struct + componentname *cnp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_CREATE</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *dvp</var>, <var class="Fa" style="white-space: nowrap;">struct vnode + **vpp</var>, <var class="Fa" style="white-space: nowrap;">struct + componentname *cnp</var>, + <var class="Fa" style="white-space: nowrap;">struct vattr *vap</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_MKNOD</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *dvp</var>, <var class="Fa" style="white-space: nowrap;">struct vnode + **vpp</var>, <var class="Fa" style="white-space: nowrap;">struct + componentname *cnp</var>, + <var class="Fa" style="white-space: nowrap;">struct vattr *vap</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_OPEN</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + mode</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_CLOSE</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + fflag</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_ACCESS</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + mode</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_GETATTR</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">struct vattr + *vap</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_SETATTR</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">struct vattr + *vap</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_READ</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">struct uio + *uio</var>, <var class="Fa" style="white-space: nowrap;">int ioflag</var>, + <var class="Fa" style="white-space: nowrap;">kauth_cred_t cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_WRITE</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">struct uio + *uio</var>, <var class="Fa" style="white-space: nowrap;">int ioflag</var>, + <var class="Fa" style="white-space: nowrap;">kauth_cred_t cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_FALLOCATE</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">off_t + pos</var>, <var class="Fa" style="white-space: nowrap;">off_t + len</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_FDISCARD</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">off_t + pos</var>, <var class="Fa" style="white-space: nowrap;">off_t + len</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_IOCTL</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">u_long + command</var>, <var class="Fa" style="white-space: nowrap;">void + *data</var>, <var class="Fa" style="white-space: nowrap;">int fflag</var>, + <var class="Fa" style="white-space: nowrap;">kauth_cred_t cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_FCNTL</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">u_int + command</var>, <var class="Fa" style="white-space: nowrap;">void + *data</var>, <var class="Fa" style="white-space: nowrap;">int fflag</var>, + <var class="Fa" style="white-space: nowrap;">kauth_cred_t cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_POLL</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + events</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_KQFILTER</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">struct knote + *kn</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_REVOKE</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + flags</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_MMAP</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">vm_prot_t + prot</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_FSYNC</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>, <var class="Fa" style="white-space: nowrap;">int flags</var>, + <var class="Fa" style="white-space: nowrap;">off_t offlo</var>, + <var class="Fa" style="white-space: nowrap;">off_t offhi</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_SEEK</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">off_t + oldoff</var>, <var class="Fa" style="white-space: nowrap;">off_t + newoff</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_REMOVE</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *dvp</var>, <var class="Fa" style="white-space: nowrap;">struct vnode + *vp</var>, <var class="Fa" style="white-space: nowrap;">struct componentname + *cnp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_LINK</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *dvp</var>, <var class="Fa" style="white-space: nowrap;">struct vnode + *vp</var>, <var class="Fa" style="white-space: nowrap;">struct componentname + *cnp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_RENAME</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *fdvp</var>, <var class="Fa" style="white-space: nowrap;">struct vnode + *fvp</var>, <var class="Fa" style="white-space: nowrap;">struct + componentname *fcnp</var>, + <var class="Fa" style="white-space: nowrap;">struct vnode *tdvp</var>, + <var class="Fa" style="white-space: nowrap;">struct vnode *tvp</var>, + <var class="Fa" style="white-space: nowrap;">struct componentname + *tcnp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_MKDIR</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *dvp</var>, <var class="Fa" style="white-space: nowrap;">struct vnode + **vpp</var>, <var class="Fa" style="white-space: nowrap;">struct + componentname *cnp</var>, + <var class="Fa" style="white-space: nowrap;">struct vattr *vap</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_RMDIR</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *dvp</var>, <var class="Fa" style="white-space: nowrap;">struct vnode + *vp</var>, <var class="Fa" style="white-space: nowrap;">struct componentname + *cnp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_SYMLINK</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *dvp</var>, <var class="Fa" style="white-space: nowrap;">struct vnode + **vpp</var>, <var class="Fa" style="white-space: nowrap;">struct + componentname *cnp</var>, + <var class="Fa" style="white-space: nowrap;">struct vattr *vap</var>, + <var class="Fa" style="white-space: nowrap;">char *target</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_READDIR</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">struct uio + *uio</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>, <var class="Fa" style="white-space: nowrap;">int *eofflag</var>, + <var class="Fa" style="white-space: nowrap;">off_t **cookies</var>, + <var class="Fa" style="white-space: nowrap;">int *ncookies</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_READLINK</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">struct uio + *uio</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_ABORTOP</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *dvp</var>, <var class="Fa" style="white-space: nowrap;">struct + componentname *cnp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_INACTIVE</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_RECLAIM</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_LOCK</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + flags</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_UNLOCK</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_ISLOCKED</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_BMAP</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">daddr_t + bn</var>, <var class="Fa" style="white-space: nowrap;">struct vnode + **vpp</var>, <var class="Fa" style="white-space: nowrap;">daddr_t + *bnp</var>, <var class="Fa" style="white-space: nowrap;">int + *runp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_PRINT</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_PATHCONF</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + name</var>, <var class="Fa" style="white-space: nowrap;">register_t + *retval</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_ADVLOCK</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">void + *id</var>, <var class="Fa" style="white-space: nowrap;">int op</var>, + <var class="Fa" style="white-space: nowrap;">struct flock *fl</var>, + <var class="Fa" style="white-space: nowrap;">int flags</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_WHITEOUT</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *dvp</var>, <var class="Fa" style="white-space: nowrap;">struct + componentname *cnp</var>, <var class="Fa" style="white-space: nowrap;">int + flags</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_GETPAGES</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">voff_t + offset</var>, <var class="Fa" style="white-space: nowrap;">struct vm_page + **m</var>, <var class="Fa" style="white-space: nowrap;">int *count</var>, + <var class="Fa" style="white-space: nowrap;">int centeridx</var>, + <var class="Fa" style="white-space: nowrap;">vm_prot_t access_type</var>, + <var class="Fa" style="white-space: nowrap;">int advice</var>, + <var class="Fa" style="white-space: nowrap;">int flags</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_PUTPAGES</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">voff_t + offlo</var>, <var class="Fa" style="white-space: nowrap;">voff_t + offhi</var>, <var class="Fa" style="white-space: nowrap;">int + flags</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_STRATEGY</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">struct buf + *bp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_BWRITE</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">struct buf + *bp</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_GETEXTATTR</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + attrnamespace</var>, <var class="Fa" style="white-space: nowrap;">const char + *name</var>, <var class="Fa" style="white-space: nowrap;">struct uio + *uio</var>, <var class="Fa" style="white-space: nowrap;">size_t *size</var>, + <var class="Fa" style="white-space: nowrap;">kauth_cred_t cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_SETEXTATTR</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + attrnamespace</var>, <var class="Fa" style="white-space: nowrap;">const char + *name</var>, <var class="Fa" style="white-space: nowrap;">struct uio + *uio</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_LISTEXTATTR</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + attrnamespace</var>, <var class="Fa" style="white-space: nowrap;">struct uio + *uio</var>, <var class="Fa" style="white-space: nowrap;">size_t *size</var>, + <var class="Fa" style="white-space: nowrap;">kauth_cred_t cred</var>);</p> +<p class="Pp"><var class="Ft">int</var> + <br/> + <code class="Fn">VOP_DELETEEXTATTR</code>(<var class="Fa" style="white-space: nowrap;">struct + vnode *vp</var>, <var class="Fa" style="white-space: nowrap;">int + attrnamespace</var>, <var class="Fa" style="white-space: nowrap;">const char + *name</var>, <var class="Fa" style="white-space: nowrap;">kauth_cred_t + cred</var>);</p> +<p class="Pp">Not all header files are required for each function.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<p class="Pp">The vnode operations vector describes what operations can be done + to the file associated with the vnode. The system maintains one vnode + operations vector for each file system type configured into the kernel. The + vnode operations vector contains a pointer to a function for each operation + supported by the file system. Many of the functions described in the vnode + operations vector are closely related to their corresponding system calls. + In most cases, they are called as a result of the system call associated + with the operation being invoked.</p> +<p class="Pp">Functions in the vnode operations vector are invoked using + specialized macros. The following table gives a summary of the + operations.</p> +<p class="Pp"></p> +<table class="Bl-column Bl-compact"> + <tr id="Macro"> + <td><a class="permalink" href="#Macro"><b class="Sy">Macro</b></a></td> + <td><a class="permalink" href="#Description"><b class="Sy" id="Description">Description</b></a></td> + </tr> + <tr> + <td>VOP_LOOKUP</td> + <td>Lookup file name in name cache</td> + </tr> + <tr> + <td>VOP_CREATE</td> + <td>Create a new file</td> + </tr> + <tr> + <td>VOP_MKNOD</td> + <td>Make a new device</td> + </tr> + <tr> + <td>VOP_OPEN</td> + <td>Open a file</td> + </tr> + <tr> + <td>VOP_CLOSE</td> + <td>Close a file</td> + </tr> + <tr> + <td>VOP_ACCESS</td> + <td>Determine file accessibility</td> + </tr> + <tr> + <td>VOP_GETATTR</td> + <td>Get file attributes</td> + </tr> + <tr> + <td>VOP_SETATTR</td> + <td>Set file attributes</td> + </tr> + <tr> + <td>VOP_READ</td> + <td>Read from a file</td> + </tr> + <tr> + <td>VOP_WRITE</td> + <td>Write to a file</td> + </tr> + <tr> + <td>VOP_FALLOCATE</td> + <td>Allocate backing for a file</td> + </tr> + <tr> + <td>VOP_FDISCARD</td> + <td>Discard backing for a file</td> + </tr> + <tr> + <td>VOP_IOCTL</td> + <td>Perform device-specific I/O</td> + </tr> + <tr> + <td>VOP_FCNTL</td> + <td>Perform file control</td> + </tr> + <tr> + <td>VOP_POLL</td> + <td>Test if poll event has occurred</td> + </tr> + <tr> + <td>VOP_KQFILTER</td> + <td>Register a knote</td> + </tr> + <tr> + <td>VOP_REVOKE</td> + <td>Eliminate vnode activity</td> + </tr> + <tr> + <td>VOP_MMAP</td> + <td>Map file into user address space</td> + </tr> + <tr> + <td>VOP_FSYNC</td> + <td>Flush pending data to disk</td> + </tr> + <tr> + <td>VOP_SEEK</td> + <td>Test if file is seekable</td> + </tr> + <tr> + <td>VOP_REMOVE</td> + <td>Remove a file</td> + </tr> + <tr> + <td>VOP_LINK</td> + <td>Link a file</td> + </tr> + <tr> + <td>VOP_RENAME</td> + <td>Rename a file</td> + </tr> + <tr> + <td>VOP_MKDIR</td> + <td>Make a new directory</td> + </tr> + <tr> + <td>VOP_RMDIR</td> + <td>Remove a directory</td> + </tr> + <tr> + <td>VOP_SYMLINK</td> + <td>Create a symbolic link</td> + </tr> + <tr> + <td>VOP_READDIR</td> + <td>Read directory entry</td> + </tr> + <tr> + <td>VOP_READLINK</td> + <td>Read contents of a symlink</td> + </tr> + <tr> + <td>VOP_ABORTOP</td> + <td>Abort pending operation</td> + </tr> + <tr> + <td>VOP_INACTIVE</td> + <td>Release the inactive vnode</td> + </tr> + <tr> + <td>VOP_RECLAIM</td> + <td>Reclaim vnode for another file</td> + </tr> + <tr> + <td>VOP_LOCK</td> + <td>Sleep until vnode lock is free</td> + </tr> + <tr> + <td>VOP_UNLOCK</td> + <td>Wake up process sleeping on lock</td> + </tr> + <tr> + <td>VOP_ISLOCKED</td> + <td>Test if vnode is locked</td> + </tr> + <tr> + <td>VOP_BMAP</td> + <td>Logical block number conversion</td> + </tr> + <tr> + <td>VOP_PRINT</td> + <td>Print debugging information</td> + </tr> + <tr> + <td>VOP_PATHCONF</td> + <td>Return POSIX pathconf data</td> + </tr> + <tr> + <td>VOP_ADVLOCK</td> + <td>Advisory record locking</td> + </tr> + <tr> + <td>VOP_WHITEOUT</td> + <td>Whiteout vnode</td> + </tr> + <tr> + <td>VOP_GETPAGES</td> + <td>Read VM pages from file</td> + </tr> + <tr> + <td>VOP_PUTPAGES</td> + <td>Write VM pages to file</td> + </tr> + <tr> + <td>VOP_STRATEGY</td> + <td>Read/write a file system buffer</td> + </tr> + <tr> + <td>VOP_BWRITE</td> + <td>Write a file system buffer</td> + </tr> + <tr> + <td>VOP_GETEXTATTR</td> + <td>Get extended attribute</td> + </tr> + <tr> + <td>VOP_SETEXTATTR</td> + <td>Set extended attribute</td> + </tr> + <tr> + <td>VOP_LISTEXTATTR</td> + <td>List extended attributes</td> + </tr> + <tr> + <td>VOP_DELETEEXTATTR</td> + <td>Remove extended attribute</td> + </tr> +</table> +<p class="Pp">The implementation details of the vnode operations vector are not + quite what is described here.</p> +<p class="Pp">If the file system type does not support a specific operation, it + must nevertheless assign an appropriate stub in the vnode operations vector + to do the minimum required of it. In most cases, such functions either do + nothing or return an error value to the effect that it is not supported.</p> +<p class="Pp">Many of the functions in the vnode operations vector take a + componentname structure. It is used to encapsulate many parameters into a + single function argument. It has the following structure:</p> +<div class="Bd Pp Li"> +<pre>struct componentname { + /* + * Arguments to lookup. + */ + uint32_t cn_nameiop; /* namei operation */ + uint32_t cn_flags; /* flags to namei */ + kauth_cred_t cn_cred; /* credentials */ + /* + * Shared between lookup and commit routines. + */ + const char *cn_nameptr; /* pointer to looked up name */ + size_t cn_namelen; /* length of looked up component */ + size_t cn_consume; /* chars to consume in lookup() */ +};</pre> +</div> +<p class="Pp" id="VOP_LOOKUP">The top half of the structure is used exclusively + for the pathname lookups using + <a class="permalink" href="#VOP_LOOKUP"><code class="Fn">VOP_LOOKUP</code></a>() + and is initialized by the caller. The semantics of the lookup are affected + by the lookup operation specified in + <a class="permalink" href="#cn_nameiop"><i class="Em" id="cn_nameiop">cn_nameiop</i></a> + and the flags specified in + <a class="permalink" href="#cn_flags"><i class="Em" id="cn_flags">cn_flags</i></a>. + Valid operations are:</p> +<p class="Pp"></p> +<div class="Bd-indent"> +<dl class="Bl-tag Bl-compact"> + <dt>LOOKUP</dt> + <dd>perform name lookup only</dd> + <dt>CREATE</dt> + <dd>set up for file creation</dd> + <dt>DELETE</dt> + <dd>set up for file deletion</dd> + <dt>RENAME</dt> + <dd>set up for file renaming</dd> + <dt>OPMASK</dt> + <dd>mask for operation</dd> +</dl> +</div> +<p class="Pp" id="cn-_cn_flags">Valid values for + <a class="permalink" href="#cn-_cn_flags"><i class="Em">cn->cn_flags</i></a> + are:</p> +<p class="Pp"></p> +<div class="Bd-indent"> +<dl class="Bl-tag Bl-compact"> + <dt>LOCKLEAF</dt> + <dd>lock inode on return</dd> + <dt>LOCKPARENT</dt> + <dd>want parent vnode returned locked</dd> + <dt>NOCACHE</dt> + <dd>name must not be left in name cache (see + <a class="Xr">namecache(9)</a>)</dd> + <dt>FOLLOW</dt> + <dd>follow symbolic links</dd> + <dt>NOFOLLOW</dt> + <dd>do not follow symbolic links (pseudo)</dd> + <dt>MODMASK</dt> + <dd>mask of operational modifiers</dd> +</dl> +</div> +<p class="Pp">No vnode operations may be called from interrupt context. Most + operations also require the vnode to be locked on entry. To prevent + deadlocks, when acquiring locks on multiple vnodes, the lock of parent + directory must be acquired before the lock on the child directory.</p> +<p class="Pp">Vnode operations for a file system type generally should not be + called directly from the kernel, but accessed indirectly through the + high-level convenience functions discussed in + <a class="Xr">vnsubr(9)</a>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="FUNCTIONS"><a class="permalink" href="#FUNCTIONS">FUNCTIONS</a></h1> +<dl class="Bl-tag"> + <dt id="VOP_LOOKUP~2"><a class="permalink" href="#VOP_LOOKUP~2"><code class="Fn">VOP_LOOKUP</code></a>(<var class="Fa">dvp</var>, + <var class="Fa">vpp</var>, <var class="Fa">cnp</var>)</dt> + <dd>Lookup a single pathname component in a given directory. The argument + <var class="Fa">dvp</var> is the locked vnode of the directory to search + and <var class="Fa">cnp</var> is the pathname component to be searched + for. If the pathname component is found, the address of the resulting + unlocked vnode is returned in <var class="Fa">vpp</var>. The operation + specified in + <a class="permalink" href="#cnp-_cn_nameiop"><i class="Em" id="cnp-_cn_nameiop">cnp->cn_nameiop</i></a> + indicates <code class="Fn">VOP_LOOKUP</code>() the reason for requesting + the lookup and uses it to cache file system type specific information in + the vnode for subsequent operations. + <p class="Pp" id="VOP_LOOKUP~3">There are three types of lookups: + ".", ".." (ISDOTDOT), and regular. If the pathname + component being searched for is ".", then + <var class="Fa">dvp</var> has an extra reference added to it and it is + returned in <var class="Fa">*vpp</var>. For other pathname components, + <a class="permalink" href="#VOP_LOOKUP~3"><code class="Fn">VOP_LOOKUP</code></a>() + checks the accessibility of the directory and searches the name cache + for the pathname component. See <a class="Xr">namecache(9)</a>. If the + pathname is not found in the name cache, the directory is searched for + the pathname. The resulting unlocked vnode is returned in + <var class="Fa">vpp</var>. <var class="Fa">dvp</var> is always returned + locked.</p> + <p class="Pp">On failure <var class="Fa">*vpp</var> is + <code class="Dv">NULL</code>, and <var class="Fa">*dvp</var> is left + locked. If the operation is successful <var class="Fa">*vpp</var> is + unlocked and zero is returned. Typically, if <var class="Fa">*vpp</var> + and <var class="Fa">dvp</var> are the same vnode the caller will need to + release twice (decrement the reference count) and unlock once.</p> + </dd> + <dt id="VOP_CREATE"><a class="permalink" href="#VOP_CREATE"><code class="Fn">VOP_CREATE</code></a>(<var class="Fa">dvp</var>, + <var class="Fa">vpp</var>, <var class="Fa">cnp</var>, + <var class="Fa">vap</var>)</dt> + <dd>Create a new file in a given directory. The argument + <var class="Fa">dvp</var> is the locked vnode of the directory to create + the new file in and <var class="Fa">cnp</var> is the pathname component of + the new file. The argument <var class="Fa">vap</var> specifies the + attributes that the new file should be created with. If the file is + successfully created, the address of the resulting unlocked vnode is + returned in <var class="Fa">vpp</var> and zero is returned. + <p class="Pp" id="VOP_LOOKUP~4">This function is called after + <a class="permalink" href="#VOP_LOOKUP~4"><code class="Fn">VOP_LOOKUP</code></a>() + when a file is being created. Normally, + <code class="Fn">VOP_LOOKUP</code>() will have set the SAVENAME flag in + <i class="Em">cnp->cn_flags</i> to keep the memory pointed to by + <i class="Em">cnp->cn_pnbuf</i> valid. If an error is detected when + creating the file, this memory is released. If the file is created + successfully it will be released unless the SAVESTART flags in specified + in <i class="Em">cnp->cn_flags</i>.</p> + </dd> + <dt id="VOP_MKNOD"><a class="permalink" href="#VOP_MKNOD"><code class="Fn">VOP_MKNOD</code></a>(<var class="Fa">dvp</var>, + <var class="Fa">vpp</var>, <var class="Fa">cnp</var>, + <var class="Fa">vap</var>)</dt> + <dd>Make a new device-special file in a given directory. The argument + <var class="Fa">dvp</var> is the locked vnode of the directory to create + the new device-special file in and <var class="Fa">cnp</var> is the + pathname component of the new device-special file. The argument + <var class="Fa">vap</var> specifies the attributes that the new + device-special file should be created with. If the file is successfully + created, the address of the resulting unlocked vnode is returned in + <var class="Fa">vpp</var> and zero is returned. + <p class="Pp" id="VOP_LOOKUP~5">This function is called after + <a class="permalink" href="#VOP_LOOKUP~5"><code class="Fn">VOP_LOOKUP</code></a>() + when a device-special file is being created. Normally, + <code class="Fn">VOP_LOOKUP</code>() will have set the SAVENAME flag in + <i class="Em">cnp->cn_flags</i> to keep the memory pointed to by + <i class="Em">cnp->cn_pnbuf</i> valid. If an error is detected when + creating the device-special file, this memory is released. If the + device-special file is created successfully it will be released unless + the SAVESTART flags in specified in + <i class="Em">cnp->cn_flags</i>.</p> + </dd> + <dt><code class="Fn">VOP_OPEN</code>(<var class="Fa">vp</var>, + <var class="Fa">mode</var>, <var class="Fa">cred</var>)</dt> + <dd>Open a file. The argument <var class="Fa">vp</var> is the vnode of the + file to open and <var class="Fa">mode</var> specifies the access mode + required by the calling process. The calling credentials are specified by + <var class="Fa">cred</var>. The access mode is a set of flags, including + FREAD, FWRITE, O_NONBLOCK, O_APPEND, etc. + <code class="Fn">VOP_OPEN</code>() must be called before a file can be + accessed by a thread. The vnode reference count is incremented. + <p class="Pp" id="VOP_OPEN"><a class="permalink" href="#VOP_OPEN"><code class="Fn">VOP_OPEN</code></a>() + expects the vnode <var class="Fa">vp</var> to be locked on entry and + will leave it locked on return. If the operation is successful zero is + returned, otherwise an appropriate error code is returned.</p> + </dd> + <dt id="VOP_CLOSE"><a class="permalink" href="#VOP_CLOSE"><code class="Fn">VOP_CLOSE</code></a>(<var class="Fa">vp</var>, + <var class="Fa">fflag</var>, <var class="Fa">cred</var>)</dt> + <dd>Close a file. The argument <var class="Fa">vp</var> is the vnode of the + file to close and <var class="Fa">fflag</var> specifies the access mode by + the calling process. The possible flags are <code class="Dv">FREAD</code>, + <code class="Dv">FWRITE</code> and <code class="Dv">FNONBLOCK</code>. The + calling credentials are specified by <var class="Fa">cred</var>. + <code class="Fn">VOP_CLOSE</code>() frees resources allocated by + <code class="Fn">VOP_OPEN</code>(). + <p class="Pp">The vnode <var class="Fa">vp</var> will be locked on entry and + should remain locked on return.</p> + </dd> + <dt id="VOP_ACCESS"><a class="permalink" href="#VOP_ACCESS"><code class="Fn">VOP_ACCESS</code></a>(<var class="Fa">vp</var>, + <var class="Fa">mode</var>, <var class="Fa">cred</var>)</dt> + <dd>Determine the accessibility (permissions) of the file against the + specified credentials. The argument <var class="Fa">vp</var> is the vnode + of the file to check, <var class="Fa">mode</var> is the type of access + required and <var class="Fa">cred</var> contains the user credentials to + check. The argument <var class="Fa">mode</var> is a mask which can contain + VREAD, VWRITE or VEXEC. If the file is accessible in the specified way, + zero is returned, otherwise an appropriate error code is returned. + <p class="Pp">The vnode <var class="Fa">vp</var> will be locked on entry and + should remain locked on return.</p> + </dd> + <dt id="VOP_GETATTR"><a class="permalink" href="#VOP_GETATTR"><code class="Fn">VOP_GETATTR</code></a>(<var class="Fa">vp</var>, + <var class="Fa">vap</var>, <var class="Fa">cred</var>)</dt> + <dd>Get specific vnode attributes on a file. The argument + <var class="Fa">vp</var> is the vnode of the file to get the attributes + for. The argument <var class="Fa">cred</var> specifies the calling + credentials. <code class="Fn">VOP_GETATTR</code>() uses the file system + type specific data object <i class="Em">vp->v_data</i> to reference the + underlying file attributes. The attributes are returned in + <var class="Fa">vap</var>. Attributes which are not available are set to + the value VNOVAL. + <p class="Pp" id="VOP_GETATTR~2">For more information on vnode attributes + see <a class="Xr">vattr(9)</a>. Historically it was considered + acceptable to call + <a class="permalink" href="#VOP_GETATTR~2"><code class="Fn">VOP_GETATTR</code></a>() + without first locking the vnode. This usage is deprecated.</p> + <p class="Pp">The vnode <var class="Fa">vp</var> will be locked on entry and + should remain locked on return.</p> + </dd> + <dt id="VOP_SETATTR"><a class="permalink" href="#VOP_SETATTR"><code class="Fn">VOP_SETATTR</code></a>(<var class="Fa">vp</var>, + <var class="Fa">vap</var>, <var class="Fa">cred</var>)</dt> + <dd>Set specific vnode attributes on a file. The argument + <var class="Fa">vp</var> is the locked vnode of the file to set the + attributes for. The argument <var class="Fa">cred</var> specifies the + calling credentials. <code class="Fn">VOP_SETATTR</code>() uses the file + system type specific data object <i class="Em">vp->v_data</i> to + reference the underlying file attributes. The new attributes are defined + in <var class="Fa">vap</var>. Attributes which are not being modified by + <code class="Fn">VOP_SETATTR</code>() should be set to the value VNOVAL. + If the operation is successful zero is returned, otherwise an appropriate + error is returned. + <p class="Pp">For more information on vnode attributes see + <a class="Xr">vattr(9)</a>.</p> + </dd> + <dt id="VOP_READ"><a class="permalink" href="#VOP_READ"><code class="Fn">VOP_READ</code></a>(<var class="Fa">vp</var>, + <var class="Fa">uio</var>, <var class="Fa">ioflag</var>, + <var class="Fa">cred</var>)</dt> + <dd>Read the contents of a file. The argument <var class="Fa">vp</var> is the + vnode of the file to read from, <var class="Fa">uio</var> is the location + to read the data into, <var class="Fa">ioflag</var> is a set of flags and + <var class="Fa">cred</var> are the credentials of the calling process. + <p class="Pp">The <var class="Fa">ioflag</var> argument is used to give + directives and hints to the file system. When attempting a read, the + high 16 bits are used to provide a read-ahead hint (in unit of file + system blocks) that the file system should attempt. The low 16 bits are + a bit mask which can contain the following flags:</p> + <p class="Pp"></p> + <div class="Bd-indent"> + <dl class="Bl-tag Bl-compact"> + <dt>IO_UNIT</dt> + <dd>do I/O as atomic unit</dd> + <dt>IO_APPEND</dt> + <dd>append write to end</dd> + <dt>IO_SYNC</dt> + <dd>sync I/O file integrity completion</dd> + <dt>IO_NODELOCKED</dt> + <dd>underlying node already locked</dd> + <dt>IO_NDELAY</dt> + <dd>FNDELAY flag set in file table</dd> + <dt>IO_DSYNC</dt> + <dd>sync I/O data integrity completion</dd> + <dt>IO_ALTSEMANTICS</dt> + <dd>use alternate I/O semantics</dd> + <dt>IO_NORMAL</dt> + <dd>operate on regular data</dd> + <dt>IO_EXT</dt> + <dd>operate on extended attributes</dd> + <dt>IO_DIRECT</dt> + <dd>do not buffer data in the kernel</dd> + </dl> + </div> + <p class="Pp">Zero is returned on success, otherwise an error is returned. + The vnode should be locked on entry and remains locked on exit.</p> + </dd> + <dt id="VOP_WRITE"><a class="permalink" href="#VOP_WRITE"><code class="Fn">VOP_WRITE</code></a>(<var class="Fa">vp</var>, + <var class="Fa">uio</var>, <var class="Fa">ioflag</var>, + <var class="Fa">cred</var>)</dt> + <dd>Write to a file. The argument <var class="Fa">vp</var> is the vnode of the + file to write to, <var class="Fa">uio</var> is the location of the data to + write, <var class="Fa">ioflag</var> is a set of flags and + <var class="Fa">cred</var> are the credentials of the calling process. + <p class="Pp" id="VOP_READ~2">The <var class="Fa">ioflag</var> argument is + used to give directives and hints to the file system. The low 16 bits + are a bit mask which can contain the same flags as + <a class="permalink" href="#VOP_READ~2"><code class="Fn">VOP_READ</code></a>().</p> + <p class="Pp">Zero is returned on success, otherwise an error is returned. + The vnode should be locked on entry and remains locked on exit.</p> + </dd> + <dt id="VOP_FALLOCATE"><a class="permalink" href="#VOP_FALLOCATE"><code class="Fn">VOP_FALLOCATE</code></a>(<var class="Fa">vp</var>, + <var class="Fa">pos</var>, <var class="Fa">len</var>)</dt> + <dd>Allocate backing store. The argument <var class="Fa">vp</var> is the vnode + for the file. The <var class="Fa">pos</var> and <var class="Fa">len</var> + arguments (specified in bytes) name an extent within the file. The blocks + underlying this range, rounding up at the top and down at the bottom if + needed, are checked; if no physical storage is allocated, a physical block + is allocated and zeroed. This operation removes “holes” from + files.</dd> + <dt id="VOP_FDISCARD"><a class="permalink" href="#VOP_FDISCARD"><code class="Fn">VOP_FDISCARD</code></a>(<var class="Fa">vp</var>, + <var class="Fa">pos</var>, <var class="Fa">len</var>)</dt> + <dd>Discard backing store. The argument <var class="Fa">vp</var> is the vnode + for the file. The <var class="Fa">pos</var> and <var class="Fa">len</var> + arguments (specified in bytes) name an extent within the file. The blocks + underlying this range, rounding down at the top and up at the bottom if + needed, are checked. If any physical storage is used, it is deallocated. + This operation creates “holes” in files. Discarded blocks of + regular files read back afterwards as zeroes. On devices, the underlying + discard-block operation if any (e.g. ATA TRIM) is issued. The device + handles this as it sees fit. In particular it is + <a class="permalink" href="#not"><i class="Em" id="not">not</i></a> + guaranteed that discarded blocks on devices will be zeroed; reading a + discarded block might produce zeros, or ones, or the previously existing + data, or some other data, or trash.</dd> + <dt><code class="Fn">VOP_IOCTL</code>(<var class="Fa">vp</var>, + <var class="Fa">command</var>, <var class="Fa">data</var>, + <var class="Fa">fflag</var>, <var class="Fa">cred</var>)</dt> + <dd>Perform device-specific I/O. The argument <var class="Fa">vp</var> is the + vnode of the file, normally representing a device. The argument + <var class="Fa">command</var> specifies the device-specific operation to + perform and <var class="Fa">cnp</var> provides extra data for the + specified operation. The argument <var class="Fa">fflags</var> is a set of + flags. The argument <var class="Fa">cred</var> is the caller's + credentials. If the operation is successful, zero is returned, otherwise + an appropriate error code is returned. + <p class="Pp" id="VOP_IOCTL">Most file systems do not supply a function for + <a class="permalink" href="#VOP_IOCTL"><code class="Fn">VOP_IOCTL</code></a>(). + This function implements the <a class="Xr">ioctl(2)</a> system call.</p> + </dd> + <dt id="VOP_FCNTL"><a class="permalink" href="#VOP_FCNTL"><code class="Fn">VOP_FCNTL</code></a>(<var class="Fa">vp</var>, + <var class="Fa">command</var>, <var class="Fa">data</var>, + <var class="Fa">fflag</var>, <var class="Fa">cred</var>)</dt> + <dd>Perform file control. The argument <var class="Fa">vp</var> is the locked + vnode of the file. The argument <var class="Fa">command</var> specifies + the operation to perform and <var class="Fa">cnp</var> provides extra data + for the specified operation. The argument <var class="Fa">fflags</var> is + a set of flags. The argument <var class="Fa">cred</var> is the caller's + credentials. If the operation is successful, zero is returned, otherwise + an appropriate error code is returned.</dd> + <dt id="VOP_POLL"><a class="permalink" href="#VOP_POLL"><code class="Fn">VOP_POLL</code></a>(<var class="Fa">vp</var>, + <var class="Fa">events</var>)</dt> + <dd>Test if a poll event has occurred. The argument <var class="Fa">vp</var> + is the vnode of the file to poll. It returns any events of interest as + specified by <var class="Fa">events</var> that may have occurred for the + file. The argument <var class="Fa">events</var> is a set of flags as + specified by <a class="Xr">poll(2)</a>. + <p class="Pp">The vnode <var class="Fa">vp</var> remains unlocked throughout + the whole operation.</p> + </dd> + <dt id="VOP_KQFILTER"><a class="permalink" href="#VOP_KQFILTER"><code class="Fn">VOP_KQFILTER</code></a>(<var class="Fa">vp</var>, + <var class="Fa">kn</var>)</dt> + <dd>Register a knote <var class="Fa">kn</var> with the vnode + <var class="Fa">vn</var>. If the operation is successful zero is returned, + otherwise an appropriate error code is returned. + <p class="Pp">The vnode <var class="Fa">vp</var> remains unlocked throughout + the whole operation.</p> + </dd> + <dt id="VOP_REVOKE"><a class="permalink" href="#VOP_REVOKE"><code class="Fn">VOP_REVOKE</code></a>(<var class="Fa">vp</var>, + <var class="Fa">flags</var>)</dt> + <dd>Eliminate all activity associated with the vnode <var class="Fa">vp</var>. + The argument <var class="Fa">flags</var> is a set of flags. If REVOKEALL + is set in <var class="Fa">flags</var> all vnodes aliased to the vnode + <var class="Fa">vp</var> are also eliminated. If the operation is + successful zero is returned, otherwise an appropriate error is returned. + <p class="Pp">The vnode <var class="Fa">vp</var> remains unlocked throughout + the whole operation.</p> + </dd> + <dt id="VOP_MMAP"><a class="permalink" href="#VOP_MMAP"><code class="Fn">VOP_MMAP</code></a>(<var class="Fa">vp</var>, + <var class="Fa">prot</var>, <var class="Fa">cred</var>)</dt> + <dd>Inform file system that <var class="Fa">vp</var> is in the process of + being memory mapped. The argument <var class="Fa">prot</var> specifies the + vm access protection the vnode is going to be mapped with. The argument + <var class="Fa">cred</var> is the caller's credentials. If the file system + allows the memory mapping, zero is returned, otherwise an appropriate + error code is returned. + <p class="Pp" id="VOP_MMAP~2">Most file systems do not supply a function for + <a class="permalink" href="#VOP_MMAP~2"><code class="Fn">VOP_MMAP</code></a>() + and use + <a class="permalink" href="#genfs_mmap"><code class="Fn" id="genfs_mmap">genfs_mmap</code></a>() + to default for success. Only file systems which do not integrate with + the page cache at all typically want to disallow memory mapping.</p> + </dd> + <dt id="VOP_FSYNC"><a class="permalink" href="#VOP_FSYNC"><code class="Fn">VOP_FSYNC</code></a>(<var class="Fa">vp</var>, + <var class="Fa">cred</var>, <var class="Fa">flags</var>, + <var class="Fa">offlo</var>, <var class="Fa">offhi</var>)</dt> + <dd>Flush pending data buffers for a file to disk. The argument + <var class="Fa">vp</var> is the locked vnode of the file for flush. The + argument <var class="Fa">cred</var> is the caller's credentials. The + argument <var class="Fa">flags</var> is a set of flags. If FSYNC_WAIT is + specified in <var class="Fa">flags</var>, the function should wait for I/O + to complete before returning. The argument <var class="Fa">offlo</var> and + <var class="Fa">offhi</var> specify the range of file to flush. If the + operation is successful zero is returned, otherwise an appropriate error + code is returned. + <p class="Pp">This function implements the <a class="Xr">sync(2)</a> and + <a class="Xr">fsync(2)</a> system calls.</p> + </dd> + <dt id="VOP_SEEK"><a class="permalink" href="#VOP_SEEK"><code class="Fn">VOP_SEEK</code></a>(<var class="Fa">vp</var>, + <var class="Fa">oldoff</var>, <var class="Fa">newoff</var>, + <var class="Fa">cred</var>)</dt> + <dd>Test if the file is seekable for the specified offset + <var class="Fa">newoff</var>. The argument <var class="Fa">vp</var> is the + locked vnode of the file to test. For most file systems this function + simply tests if <var class="Fa">newoff</var> is valid. If the specified + <var class="Fa">newoff</var> is less than zero, the function returns error + code EINVAL.</dd> + <dt id="VOP_REMOVE"><a class="permalink" href="#VOP_REMOVE"><code class="Fn">VOP_REMOVE</code></a>(<var class="Fa">dvp</var>, + <var class="Fa">vp</var>, <var class="Fa">cnp</var>)</dt> + <dd>Remove a file. The argument <var class="Fa">dvp</var> is the locked vnode + of the directory to remove the file from and <var class="Fa">vp</var> is + the locked vnode of the file to remove. The argument + <var class="Fa">cnp</var> is the pathname component about the file to + remove. If the operation is successful zero is returned, otherwise an + appropriate error code is returned. Both <var class="Fa">dvp</var> and + <var class="Fa">vp</var> are locked on entry and are to be unlocked before + returning.</dd> + <dt id="VOP_LINK"><a class="permalink" href="#VOP_LINK"><code class="Fn">VOP_LINK</code></a>(<var class="Fa">dvp</var>, + <var class="Fa">vp</var>, <var class="Fa">cnp</var>)</dt> + <dd>Link to a file. The argument <var class="Fa">dvp</var> is the locked node + of the directory to create the new link and <var class="Fa">vp</var> is + the vnode of the file to be linked. The argument <var class="Fa">cnp</var> + is the pathname component of the new link. If the operation is successful + zero is returned, otherwise an error code is returned. The directory vnode + <var class="Fa">dvp</var> should be locked on entry and will be released + and unlocked on return. The vnode <var class="Fa">vp</var> should not be + locked on entry and will remain unlocked on return.</dd> + <dt><code class="Fn">VOP_RENAME</code>(<var class="Fa">fdvp</var>, + <var class="Fa">fvp</var>, <var class="Fa">fcnp</var>, + <var class="Fa">tdvp</var>, <var class="Fa">tvp</var>, + <var class="Fa">tcnp</var>)</dt> + <dd>Rename a file. The argument <var class="Fa">fdvp</var> is the vnode of the + old parent directory containing in the file to be renamed and + <var class="Fa">fvp</var> is the vnode of the file to be renamed. The + argument <var class="Fa">fcnp</var> is the pathname component about the + file to be renamed. The argument <var class="Fa">tdvp</var> is the vnode + of the new directory of the target file and <var class="Fa">tvp</var> is + the vnode of the target file (if it exists). The argument + <var class="Fa">tcnp</var> is the pathname component about the file's new + name. If the operation is successful zero is returned, otherwise an error + code is returned. + <p class="Pp" id="VOP_RENAME">The caller must hold the target file system's + rename lock. The source directory and file vnodes should be unlocked and + their reference counts should be incremented before entry. The target + directory and file vnodes should both be locked on entry. + <a class="permalink" href="#VOP_RENAME"><code class="Fn">VOP_RENAME</code></a>() + updates the reference counts prior to returning.</p> + <p class="Pp" id="VOP_RENAME~2">Because of the complexity and nastiness of + the interface, please do not write new code that calls + <a class="permalink" href="#VOP_RENAME~2"><code class="Fn">VOP_RENAME</code></a>() + directly until such time as ongoing cleanup work reaches a point where + the interface has been rendered halfway sane.</p> + </dd> + <dt id="VOP_MKDIR"><a class="permalink" href="#VOP_MKDIR"><code class="Fn">VOP_MKDIR</code></a>(<var class="Fa">dvp</var>, + <var class="Fa">vpp</var>, <var class="Fa">cnp</var>, + <var class="Fa">vap</var>)</dt> + <dd>Make a new directory in a given directory. The argument + <var class="Fa">dvp</var> is the locked vnode of the directory to create + the new directory in and <var class="Fa">cnp</var> is the pathname + component of the new directory. The argument <var class="Fa">vap</var> + specifies the attributes that the new directory should be created with. If + the file is successfully created, the address of the resulting unlocked + vnode is returned in <var class="Fa">vpp</var> and zero is returned. + <p class="Pp" id="VOP_LOOKUP~6">This function is called after + <a class="permalink" href="#VOP_LOOKUP~6"><code class="Fn">VOP_LOOKUP</code></a>() + when a directory is being created. Normally, + <code class="Fn">VOP_LOOKUP</code>() will have set the SAVENAME flag in + <i class="Em">cnp->cn_flags</i> to keep the memory pointed to by + <i class="Em">cnp->cn_pnbuf</i> valid. If an error is detected when + creating the directory, this memory is released. If the directory is + created successfully it will be released unless the SAVESTART flags in + specified in <i class="Em">cnp->cn_flags</i>.</p> + </dd> + <dt id="VOP_RMDIR"><a class="permalink" href="#VOP_RMDIR"><code class="Fn">VOP_RMDIR</code></a>(<var class="Fa">dvp</var>, + <var class="Fa">vp</var>, <var class="Fa">cnp</var>)</dt> + <dd>Remove a directory in a given directory. The argument + <var class="Fa">dvp</var> is the locked vnode of the directory to remove + the directory from and <var class="Fa">vp</var> is the locked vnode of the + directory to remove. The argument <var class="Fa">cnp</var> is the + pathname component of the directory. Zero is returned on success, + otherwise an error code is returned. Both <var class="Fa">dvp</var> and + <var class="Fa">vp</var> should be locked on entry and will be released + and unlocked on return.</dd> + <dt id="VOP_SYMLINK"><a class="permalink" href="#VOP_SYMLINK"><code class="Fn">VOP_SYMLINK</code></a>(<var class="Fa">dvp</var>, + <var class="Fa">vpp</var>, <var class="Fa">cnp</var>, + <var class="Fa">vap</var>, <var class="Fa">target</var>)</dt> + <dd>Create a symbolic link in a given directory. The argument + <var class="Fa">dvp</var> is the locked vnode of the directory to create + the symbolic link in and <var class="Fa">cnp</var> is the pathname + component of the symbolic link. The argument <var class="Fa">vap</var> + specifies the attributes that the symbolic link should be created with and + <var class="Fa">target</var> specifies the pathname of the target of the + symbolic link. If the symbolic link is successfully created, the address + of the resulting unlocked vnode is returned in <var class="Fa">vpp</var> + and zero is returned. + <p class="Pp" id="VOP_LOOKUP~7">This function is called after + <a class="permalink" href="#VOP_LOOKUP~7"><code class="Fn">VOP_LOOKUP</code></a>() + when a symbolic link is being created. Normally, + <code class="Fn">VOP_LOOKUP</code>() will have set the SAVENAME flag in + <i class="Em">cnp->cn_flags</i> to keep the memory pointed to by + <i class="Em">cnp->cn_pnbuf</i> valid. If an error is detected when + creating the symbolic link, this memory is released. If the symbolic + link is created successfully it will be released unless the SAVESTART + flags in specified in <i class="Em">cnp->cn_flags</i>.</p> + </dd> + <dt><code class="Fn">VOP_READDIR</code>(<var class="Fa">vp</var>, + <var class="Fa">uio</var>, <var class="Fa">cred</var>, + <var class="Fa">eofflag</var>, <var class="Fa">cookies</var>, + <var class="Fa">ncookies</var>)</dt> + <dd>Read directory entry. The argument <var class="Fa">vp</var> is the vnode + of the directory to read the contents of and <var class="Fa">uio</var> is + the destination location to read the contents into. The argument + <var class="Fa">cred</var> is the caller's credentials. The argument + <var class="Fa">eofflag</var> is the pointer to a flag which is set by + <code class="Fn">VOP_READDIR</code>() to indicate an end-of-file + condition. If <var class="Fa">eofflag</var> is + <code class="Dv">NULL</code>, the end-of-file condition is not returned. + The arguments <var class="Fa">cookies</var> and + <var class="Fa">ncookies</var> specify the addresses for the list and + number of directory seek cookies generated for NFS. Both + <var class="Fa">cookies</var> and <var class="Fa">ncookies</var> should be + <code class="Dv">NULL</code> if they aren't required to be returned by + <code class="Fn">VOP_READDIR</code>(). The directory contents are read + into struct dirent structures and <var class="Fa">uio->uio_offset</var> + is set to the offset of the next unread directory entry. This offset may + be used in a following invocation to continue a sequential read of the + directory contents. If the operation is successful zero is returned, + otherwise an appropriate error code is returned. + <p class="Pp">The directory should be locked on entry and will remain locked + on return.</p> + <p class="Pp">In case <var class="Fa">ncookies</var> and + <var class="Fa">cookies</var> are supplied, one cookie should be + returned per directory entry. The value of the cookie for each directory + entry should be the offset within the directory where the on-disk + version of the following directory entry starts. That is, for each + directory entry <var class="Fa">i</var>, the corresponding cookie should + refer to the offset of directory entry <var class="Fa">i + 1</var>.</p> + <p class="Pp" id="VOP_READDIR">Note that the <var class="Fa">cookies</var> + array must be allocated by the callee using the M_TEMP malloc type as + callers of + <a class="permalink" href="#VOP_READDIR"><code class="Fn">VOP_READDIR</code></a>() + must be able to free the allocation.</p> + </dd> + <dt id="VOP_READLINK"><a class="permalink" href="#VOP_READLINK"><code class="Fn">VOP_READLINK</code></a>(<var class="Fa">vp</var>, + <var class="Fa">uio</var>, <var class="Fa">cred</var>)</dt> + <dd>Read the contents of a symbolic link. The argument + <var class="Fa">vp</var> is the locked vnode of the symlink and + <var class="Fa">uio</var> is the destination location to read the contents + into. The argument <var class="Fa">cred</var> is the credentials of the + caller. If the operation is successful zero is returned, otherwise an + error code is returned. + <p class="Pp">The vnode should be locked on entry and will remain locked on + return.</p> + </dd> + <dt id="VOP_ABORTOP"><a class="permalink" href="#VOP_ABORTOP"><code class="Fn">VOP_ABORTOP</code></a>(<var class="Fa">dvp</var>, + <var class="Fa">cnp</var>)</dt> + <dd>Abort pending operation on vnode <var class="Fa">dvp</var> and free + resources allocated in <var class="Fa">cnp</var>. + <p class="Pp" id="genfs_abortop">This operation is rarely implemented in + file systems and + <a class="permalink" href="#genfs_abortop"><code class="Fn">genfs_abortop</code></a>() + is typically used instead.</p> + </dd> + <dt id="VOP_INACTIVE"><a class="permalink" href="#VOP_INACTIVE"><code class="Fn">VOP_INACTIVE</code></a>(<var class="Fa">vp</var>)</dt> + <dd>Release the inactive vnode. <code class="Fn">VOP_INACTIVE</code>() is + called when the kernel is no longer using the vnode. This may be because + the reference count reaches zero or it may be that the file system is + being forcibly unmounted while there are open files. It can be used to + reclaim space for open but deleted files. The argument + <var class="Fa">vp</var> is the locked vnode to be released. If the + operation is successful zero is returned, otherwise an appropriate error + code is returned. The vnode <var class="Fa">vp</var> must be locked on + entry, and will remain locked on return.</dd> + <dt id="VOP_RECLAIM"><a class="permalink" href="#VOP_RECLAIM"><code class="Fn">VOP_RECLAIM</code></a>(<var class="Fa">vp</var>)</dt> + <dd>Reclaim the vnode for another file system. + <code class="Fn">VOP_RECLAIM</code>() is called when a vnode is being + reused for a different file system. Any file system specific resources + associated with the vnode should be freed. The argument + <var class="Fa">vp</var> is the vnode to be reclaimed. If the operation is + successful zero is returned, otherwise an appropriate error code is + returned. The vnode <var class="Fa">vp</var> should be locked on entry, + and will be returned unlocked.</dd> + <dt id="VOP_LOCK"><a class="permalink" href="#VOP_LOCK"><code class="Fn">VOP_LOCK</code></a>(<var class="Fa">vp</var>, + <var class="Fa">flags</var>)</dt> + <dd>Sleep until vnode lock is free. The argument <var class="Fa">vp</var> is + the vnode of the file to be locked. The argument + <var class="Fa">flags</var> is <code class="Dv">LK_EXCLUSIVE</code> to + take the lock exclusively or <code class="Dv">LK_SHARED</code> to take a + shared lock. If <var class="Fa">flags</var> contains + <code class="Dv">LK_NOWAIT</code> and the lock is busy, the operation will + return immediately with an error code. If <var class="Fa">flags</var> + contains <code class="Dv">LK_RETRY</code> this is a hint the caller wants + the lock on dead vnodes too. If the operation is successful zero is + returned, otherwise an appropriate error code is returned. + <code class="Fn">VOP_LOCK</code>() is used to serialize access to the file + system such as to prevent two writes to the same file from happening at + the same time. Kernel code should use <a class="Xr">vn_lock(9)</a> to lock + a vnode rather than calling <code class="Fn">VOP_LOCK</code>() + directly.</dd> + <dt id="VOP_UNLOCK"><a class="permalink" href="#VOP_UNLOCK"><code class="Fn">VOP_UNLOCK</code></a>(<var class="Fa">vp</var>)</dt> + <dd>Wake up process sleeping on lock. The argument <var class="Fa">vp</var> is + the vnode of the file to be unlocked. If the operation is successful zero + is returned, otherwise an appropriate error code is returned. + <code class="Fn">VOP_UNLOCK</code>() is used to serialize access to the + file system such as to prevent two writes to the same file from happening + at the same time.</dd> + <dt id="VOP_ISLOCKED"><a class="permalink" href="#VOP_ISLOCKED"><code class="Fn">VOP_ISLOCKED</code></a>(<var class="Fa">vp</var>)</dt> + <dd>Test if the vnode <var class="Fa">vp</var> is locked. Possible return + values are <code class="Dv">LK_EXCLUSIVE</code>, + <code class="Dv">LK_SHARED</code> or 0 for lock held exclusively by the + calling thread, shared lock held by anyone or unlocked, respectively. + <p class="Pp">This function must never be used to make locking decisions at + run time: it is provided only for diagnostic purposes.</p> + </dd> + <dt id="VOP_BMAP"><a class="permalink" href="#VOP_BMAP"><code class="Fn">VOP_BMAP</code></a>(<var class="Fa">vp</var>, + <var class="Fa">bn</var>, <var class="Fa">vpp</var>, + <var class="Fa">bnp</var>, <var class="Fa">runp</var>)</dt> + <dd>Convert the logical block number <var class="Fa">bn</var> of a file + specified by vnode <var class="Fa">vp</var> to its physical block number + on the disk. The physical block is returned in <var class="Fa">bnp</var>. + In case the logical block is not allocated, -1 is used. + <p class="Pp">If <var class="Fa">vpp</var> is not + <code class="Dv">NULL</code>, the vnode of the device vnode for the file + system is returned in the address specified by + <var class="Fa">vpp</var>. If <var class="Fa">runp</var> is not + <code class="Dv">NULL</code>, the number of contiguous blocks starting + from the next block after the queried block will be returned in + <var class="Fa">runp</var>.</p> + </dd> + <dt id="VOP_PRINT"><a class="permalink" href="#VOP_PRINT"><code class="Fn">VOP_PRINT</code></a>(<var class="Fa">vp</var>)</dt> + <dd>Print debugging information. The argument <var class="Fa">vp</var> is the + vnode to print. If the operation is successful zero is returned, otherwise + an appropriate error code is returned.</dd> + <dt id="VOP_PATHCONF"><a class="permalink" href="#VOP_PATHCONF"><code class="Fn">VOP_PATHCONF</code></a>(<var class="Fa">vp</var>, + <var class="Fa">name</var>, <var class="Fa">retval</var>)</dt> + <dd>Implement POSIX <a class="Xr">pathconf(2)</a> and + <a class="Xr">fpathconf(2)</a> support. The argument + <var class="Fa">vp</var> is the locked vnode to get information about. The + argument <var class="Fa">name</var> specified the type of information to + return. The information is returned in the address specified by + <var class="Fa">retval</var>. Valid values for <var class="Fa">name</var> + are: + <p class="Pp"></p> + <div class="Bd-indent"> + <dl class="Bl-tag Bl-compact"> + <dt>_PC_LINK_MAX</dt> + <dd>return the maximum number of links to a file</dd> + <dt>_PC_NAME_MAX</dt> + <dd>return the maximum number of bytes in a file name</dd> + <dt>_PC_PATH_MAX</dt> + <dd>return the maximum number of bytes in a pathname</dd> + <dt>_PC_PIPE_BUF</dt> + <dd>return the maximum number of bytes which will be written atomically to + a pipe</dd> + <dt>_PC_CHOWN_RESTRICTED</dt> + <dd>return 1 if appropriate privileges are required for the + <a class="Xr">chown(2)</a> system call, otherwise zero</dd> + <dt>_PC_NO_TRUNC</dt> + <dd>return 0 if file names longer than {<code class="Dv">NAME_MAX</code>} + are silently truncated</dd> + </dl> + </div> + <p class="Pp">If <var class="Fa">name</var> is recognized, + <var class="Fa">*retval</var> is set to the specified value and zero is + returned, otherwise an appropriate error is returned.</p> + </dd> + <dt id="VOP_ADVLOCK"><a class="permalink" href="#VOP_ADVLOCK"><code class="Fn">VOP_ADVLOCK</code></a>(<var class="Fa">vp</var>, + <var class="Fa">id</var>, <var class="Fa">op</var>, + <var class="Fa">fl</var>, <var class="Fa">flags</var>)</dt> + <dd>Manipulate Advisory record locks on a vnode. The argument + <var class="Fa">vp</var> is the vnode on which locks are manipulated. The + argument <var class="Fa">id</var> is the id token which is changing the + lock and <var class="Fa">op</var> is the <a class="Xr">fcntl(2)</a> + operation to perform. Valid values are: + <p class="Pp"></p> + <div class="Bd-indent"> + <dl class="Bl-tag Bl-compact"> + <dt>F_SETLK</dt> + <dd>set lock</dd> + <dt>F_GETLK</dt> + <dd>get the first conflicted lock</dd> + <dt>F_UNLCK</dt> + <dd>clear lock</dd> + </dl> + </div> + <p class="Pp" id="VOP_ADVLOCK~2">The argument <var class="Fa">fl</var> is a + description of the lock. In the case of + <code class="Dv">SEEK_CUR</code>, The caller should add the current file + offset to fl->l_start beforehand. + <a class="permalink" href="#VOP_ADVLOCK~2"><code class="Fn">VOP_ADVLOCK</code></a>() + treats <code class="Dv">SEEK_CUR</code> as + <code class="Dv">SEEK_SET</code>.</p> + <p class="Pp">The argument <var class="Fa">flags</var> is the set of flags. + Valid values are:</p> + <p class="Pp"></p> + <div class="Bd-indent"> + <dl class="Bl-tag Bl-compact"> + <dt>F_WAIT</dt> + <dd>wait until lock is granted</dd> + <dt>F_FLOCK</dt> + <dd>use <a class="Xr">flock(2)</a> semantics for lock</dd> + <dt>F_POSIX</dt> + <dd>use POSIX semantics for lock</dd> + </dl> + </div> + <p class="Pp">If the operation is successful zero is returned, otherwise an + appropriate error is returned.</p> + </dd> + <dt id="VOP_WHITEOUT"><a class="permalink" href="#VOP_WHITEOUT"><code class="Fn">VOP_WHITEOUT</code></a>(<var class="Fa">dvp</var>, + <var class="Fa">cnp</var>, <var class="Fa">flags</var>)</dt> + <dd>Whiteout pathname component in directory with vnode + <var class="Fa">dvp</var>. The argument <var class="Fa">cnp</var> + specifies the pathname component to whiteout. + <p class="Pp">The vnode <var class="Fa">dvp</var> should be locked on entry + and will remain locked on return.</p> + </dd> + <dt id="VOP_GETPAGES"><a class="permalink" href="#VOP_GETPAGES"><code class="Fn">VOP_GETPAGES</code></a>(<var class="Fa">vp</var>, + <var class="Fa">offset</var>, <var class="Fa">m</var>, + <var class="Fa">count</var>, <var class="Fa">centeridx</var>, + <var class="Fa">access_type</var>, <var class="Fa">advice</var>, + <var class="Fa">flags</var>)</dt> + <dd>Read VM pages from file. The argument <var class="Fa">vp</var> is the + locked vnode to read the VM pages from. The argument + <var class="Fa">offset</var> is offset in the file to start accessing and + <var class="Fa">m</var> is an array of VM pages. The argument + <var class="Fa">count</var> points a variable that specifies the number of + pages to read. If the operation is successful zero is returned, otherwise + an appropriate error code is returned. If PGO_LOCKED is specified in + <a class="permalink" href="#flags"><i class="Em" id="flags">flags</i></a>, + <code class="Fn">VOP_GETPAGES</code>() might return less pages than + requested. In that case, the variable pointed to by + <a class="permalink" href="#count"><i class="Em" id="count">count</i></a> + will be updated. + <p class="Pp">This function is primarily used by the page-fault handing + mechanism.</p> + </dd> + <dt id="VOP_PUTPAGES"><a class="permalink" href="#VOP_PUTPAGES"><code class="Fn">VOP_PUTPAGES</code></a>(<var class="Fa">vp</var>, + <var class="Fa">offlo</var>, <var class="Fa">offhi</var>, + <var class="Fa">flags</var>)</dt> + <dd>Write modified (dirty) VM pages to file. The argument + <var class="Fa">vp</var> is the vnode to write the VM pages to. The + vnode's vm object lock (<var class="Va">v_uobj.vmobjlock</var>) must be + held by the caller and will be released upon return. The arguments + <var class="Fa">offlo</var> and <var class="Fa">offhi</var> specify the + range of VM pages to write. In case <var class="Fa">offhi</var> is given + as 0, all pages at and after the start offset <var class="Fa">offlo</var> + belonging the vnode <var class="Fa">vp</var> will be written. The argument + <var class="Fa">flags</var> controls the behavior of the routine and takes + the vm pager's flags (<code class="Dv">PGO_ -prefixed</code>). If the + operation is successful zero is returned, otherwise an appropriate error + code is returned. + <p class="Pp" id="genfs_putpages">The function is primarily used by the + pageout handling mechanism and is commonly implemented indirectly by + <a class="permalink" href="#genfs_putpages"><code class="Fn">genfs_putpages</code></a>() + with the help of + <a class="permalink" href="#VOP_STRATEGY"><code class="Fn" id="VOP_STRATEGY">VOP_STRATEGY</code></a>() + and <code class="Fn">VOP_BMAP</code>().</p> + </dd> + <dt id="bp-_b_flags"><code class="Fn">VOP_STRATEGY</code>(<var class="Fa">vp</var>, + <var class="Fa">bp</var>)</dt> + <dd>Read/write a file system buffer. The argument <var class="Fa">vp</var> is + the vnode to read/write to. The argument <var class="Fa">bp</var> is the + buffer to be read or written. <code class="Fn">VOP_STRATEGY</code>() will + either read or write data to the file depending on the value of + <a class="permalink" href="#bp-_b_flags"><i class="Em">bp->b_flags</i></a>. + If the operation is successful zero is returned, otherwise an appropriate + error code is returned.</dd> + <dt id="VOP_BWRITE"><a class="permalink" href="#VOP_BWRITE"><code class="Fn">VOP_BWRITE</code></a>(<var class="Fa">vp</var>, + <var class="Fa">bp</var>)</dt> + <dd>Write a file system buffer. The argument <var class="Fa">vp</var> is the + vnode to write to. The argument <var class="Fa">bp</var> specifies the + buffer to be written. If the operation is successful zero is returned, + otherwise an appropriate error code is returned.</dd> + <dt id="VOP_GETEXTATTR"><a class="permalink" href="#VOP_GETEXTATTR"><code class="Fn">VOP_GETEXTATTR</code></a>(<var class="Fa">vp</var>, + <var class="Fa">attrnamespace</var>, <var class="Fa">name</var>, + <var class="Fa">uio</var>, <var class="Fa">size</var>, + <var class="Fa">cred</var>)</dt> + <dd>Get an extended attribute. The argument <var class="Fa">vp</var> is the + locked vnode of the file or directory from which to retrieve the + attribute. The argument <var class="Fa">attrnamespace</var> specifies the + extended attribute namespace. The argument <var class="Fa">name</var> is a + nul-terminated character string naming the attribute to retrieve. The + argument <var class="Fa">uio</var>, if not <code class="Dv">NULL</code>, + specifies where the extended attribute value is to be written. The + argument <var class="Fa">size</var>, if not <code class="Dv">NULL</code>, + will contain the number of bytes required to read all of the attribute + data upon return. In most cases, <var class="Fa">uio</var> will be + <code class="Dv">NULL</code> when <var class="Fa">size</var> is not, and + vice versa. The argument <var class="Fa">cred</var> specifies the user + credentials to use when authorizing the request.</dd> + <dt id="VOP_SETEXTATTR"><a class="permalink" href="#VOP_SETEXTATTR"><code class="Fn">VOP_SETEXTATTR</code></a>(<var class="Fa">vp</var>, + <var class="Fa">attrnamespace</var>, <var class="Fa">name</var>, + <var class="Fa">uio</var>, <var class="Fa">cred</var>)</dt> + <dd>Set an extended attribute. The argument <var class="Fa">vp</var> is the + locked vnode of the file or directory to which to store the attribute. The + argument <var class="Fa">namespace</var> specifies the extended attribute + namespace. The argument <var class="Fa">name</var> is a nul-terminated + character string naming the attribute to store. The argument + <var class="Fa">uio</var> specifies the source of the extended attribute + data. The argument <var class="Fa">cred</var> specifies the user + credentials to use when authorizing the request.</dd> + <dt id="VOP_LISTEXTATTR"><a class="permalink" href="#VOP_LISTEXTATTR"><code class="Fn">VOP_LISTEXTATTR</code></a>(<var class="Fa">vp</var>, + <var class="Fa">attrnamespace</var>, <var class="Fa">uio</var>, + <var class="Fa">size</var>, <var class="Fa">cred</var>)</dt> + <dd>Retrieve the list of extended attributes. The argument + <var class="Fa">vp</var> is the locked vnode of the file or directory + whose attributes are to be listed. The argument + <var class="Fa">attrnamespace</var> specifies the extended attribute + namespace. The argument <var class="Fa">uio</var>, if not + <code class="Dv">NULL</code>, specifies where the extended attribute list + is to be written. The argument <var class="Fa">size</var>, if not + <code class="Dv">NULL</code>, will contain the number of bytes required to + read all of the attribute names upon return. In most cases, + <var class="Fa">uio</var> will be <code class="Dv">NULL</code> when + <var class="Fa">size</var> is not, and vice versa. The argument + <var class="Fa">cred</var> specifies the user credentials to use when + authorizing the request.</dd> + <dt id="VOP_DELETEEXTATTR"><a class="permalink" href="#VOP_DELETEEXTATTR"><code class="Fn">VOP_DELETEEXTATTR</code></a>(<var class="Fa">vp</var>, + <var class="Fa">attrnamespace</var>, <var class="Fa">name</var>, + <var class="Fa">cred</var>)</dt> + <dd>Remove attribute <var class="Fa">name</var> from file associated with + <var class="Fa">vp</var>. The argument <var class="Fa">attrnamespace</var> + specifies the extended attribute namespace. If full removal is not + supported, the file system should return + <code class="Er">EOPNOTSUPP</code> to allow the caller to zero out the + value with <code class="Fn">VOP_SETEXTATTR</code>(). + <p class="Pp">The vnode <var class="Fa">vp</var> should be locked on entry + and will remain locked on return.</p> + </dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1> +<p class="Pp"><span class="Pa">src/sys/kern/vnode_if.src</span> contains the + list of vnode functions, their definitions and an exact locking + protocol.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1> +<dl class="Bl-tag"> + <dt id="EACCES">[<a class="permalink" href="#EACCES"><code class="Er">EACCES</code></a>]</dt> + <dd>Access for the specified operation is denied.</dd> + <dt id="EDQUOT">[<a class="permalink" href="#EDQUOT"><code class="Er">EDQUOT</code></a>]</dt> + <dd>Quota exceeded.</dd> + <dt id="EINVAL">[<a class="permalink" href="#EINVAL"><code class="Er">EINVAL</code></a>]</dt> + <dd>attempt to read from an illegal offset in the directory; unrecognized + input</dd> + <dt id="EIO">[<a class="permalink" href="#EIO"><code class="Er">EIO</code></a>]</dt> + <dd>a read error occurred while reading the directory or reading the contents + of a symbolic link</dd> + <dt id="EJUSTRETURN">[<a class="permalink" href="#EJUSTRETURN"><code class="Er">EJUSTRETURN</code></a>]</dt> + <dd>A CREATE or RENAME operation would be successful.</dd> + <dt id="ENOATTR">[<a class="permalink" href="#ENOATTR"><code class="Er">ENOATTR</code></a>]</dt> + <dd>The requested attribute is not defined for this vnode.</dd> + <dt id="ENOENT">[<a class="permalink" href="#ENOENT"><code class="Er">ENOENT</code></a>]</dt> + <dd>The component was not found in the directory.</dd> + <dt id="ENOSPC">[<a class="permalink" href="#ENOSPC"><code class="Er">ENOSPC</code></a>]</dt> + <dd>The file system is full.</dd> + <dt id="ENOTDIR">[<a class="permalink" href="#ENOTDIR"><code class="Er">ENOTDIR</code></a>]</dt> + <dd>The vnode does not represent a directory.</dd> + <dt id="ENOTEMPTY">[<a class="permalink" href="#ENOTEMPTY"><code class="Er">ENOTEMPTY</code></a>]</dt> + <dd>attempt to remove a directory which is not empty</dd> + <dt id="EPERM">[<a class="permalink" href="#EPERM"><code class="Er">EPERM</code></a>]</dt> + <dd>an attempt was made to change an immutable file</dd> + <dt id="EROFS">[<a class="permalink" href="#EROFS"><code class="Er">EROFS</code></a>]</dt> + <dd>the file system is read-only</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">extattr(9)</a>, <a class="Xr">intro(9)</a>, + <a class="Xr">namei(9)</a>, <a class="Xr">vattr(9)</a>, + <a class="Xr">vfs(9)</a>, <a class="Xr">vfsops(9)</a>, + <a class="Xr">vnode(9)</a></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<p class="Pp">The vnode operations vector, its functions and the corresponding + macros appeared in <span class="Ux">4.3BSD</span>.</p> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">June 15, 2023</td> + <td class="foot-os">NetBSD 10.1</td> + </tr> +</table> |
