xref: /netbsd-src/share/man/man9/vnodeops.9 (revision 466a16a118933bd295a8a104f095714fadf9cf68)
1.\"     $NetBSD: vnodeops.9,v 1.75 2008/08/04 21:22:02 pooka Exp $
2.\"
3.\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Gregory McGarry.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd August 5, 2008
31.Dt VNODEOPS 9
32.Os
33.Sh NAME
34.Nm vnodeops ,
35.Nm VOP_LOOKUP ,
36.Nm VOP_CREATE ,
37.Nm VOP_MKNOD ,
38.Nm VOP_OPEN ,
39.Nm VOP_CLOSE ,
40.Nm VOP_ACCESS ,
41.Nm VOP_GETATTR ,
42.Nm VOP_SETATTR ,
43.Nm VOP_READ ,
44.Nm VOP_WRITE ,
45.Nm VOP_IOCTL ,
46.Nm VOP_FCNTL ,
47.Nm VOP_POLL ,
48.Nm VOP_KQFILTER ,
49.Nm VOP_REVOKE ,
50.Nm VOP_MMAP ,
51.Nm VOP_FSYNC ,
52.Nm VOP_SEEK ,
53.Nm VOP_REMOVE ,
54.Nm VOP_LINK ,
55.Nm VOP_RENAME ,
56.Nm VOP_MKDIR ,
57.Nm VOP_RMDIR ,
58.Nm VOP_SYMLINK ,
59.Nm VOP_READDIR ,
60.Nm VOP_READLINK ,
61.Nm VOP_ABORTOP ,
62.Nm VOP_INACTIVE ,
63.Nm VOP_RECLAIM ,
64.Nm VOP_LOCK ,
65.Nm VOP_UNLOCK ,
66.Nm VOP_ISLOCKED ,
67.Nm VOP_BMAP ,
68.Nm VOP_PRINT ,
69.Nm VOP_PATHCONF ,
70.Nm VOP_ADVLOCK ,
71.Nm VOP_LEASE ,
72.Nm VOP_WHITEOUT ,
73.Nm VOP_GETPAGES ,
74.Nm VOP_PUTPAGES ,
75.Nm VOP_STRATEGY ,
76.Nm VOP_BWRITE ,
77.Nm VOP_GETEXTATTR ,
78.Nm VOP_SETEXTATTR ,
79.Nm VOP_LISTEXTATTR
80.Nd vnode operations
81.Sh SYNOPSIS
82.In sys/param.h
83.In sys/buf.h
84.In sys/dirent.h
85.In sys/lock.h
86.In sys/vnode.h
87.In sys/mount.h
88.In sys/namei.h
89.In sys/unistd.h
90.In sys/fcntl.h
91.In sys/lockf.h
92.In sys/extattr.h
93.Ft int
94.Fn VOP_LOOKUP "struct vnode *dvp" "struct vnode **vpp" \
95"struct componentname *cnp"
96.Ft int
97.Fn VOP_CREATE "struct vnode *dvp" "struct vnode **vpp" \
98"struct componentname *cnp" "struct vattr *vap"
99.Ft int
100.Fn VOP_MKNOD "struct vnode *dvp" "struct vnode **vpp" \
101"struct componentname *cnp" "struct vattr *vap"
102.Ft int
103.Fn VOP_OPEN "struct vnode *vp" "int mode" "kauth_cred_t cred"
104.Ft int
105.Fn VOP_CLOSE "struct vnode *vp" "int fflag" "kauth_cred_t cred"
106.Ft int
107.Fn VOP_ACCESS "struct vnode *vp" "int mode" "kauth_cred_t cred"
108.Ft int
109.Fn VOP_GETATTR "struct vnode *vp" "struct vattr *vap" "kauth_cred_t cred"
110.Ft int
111.Fn VOP_SETATTR "struct vnode *vp" "struct vattr *vap" "kauth_cred_t cred"
112.Ft int
113.Fn VOP_READ "struct vnode *vp" "struct uio *uio" "int ioflag" \
114"kauth_cred_t cred"
115.Ft int
116.Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" \
117"kauth_cred_t cred"
118.Ft int
119.Fn VOP_IOCTL "struct vnode *vp" "u_long command" "void *data" \
120"int fflag" "kauth_cred_t cred"
121.Ft int
122.Fn VOP_FCNTL "struct vnode *vp" "u_int command" "void *data" \
123"int fflag" "kauth_cred_t cred"
124.Ft int
125.Fn VOP_POLL "struct vnode *vp" "int events"
126.Ft int
127.Fn VOP_KQFILTER "struct vnode *vp" "struct knote *kn"
128.Ft int
129.Fn VOP_REVOKE "struct vnode *vp" "int flags"
130.Ft int
131.Fn VOP_MMAP "struct vnode *vp" "vm_prot_t prot" "kauth_cred_t cred"
132.Ft int
133.Fn VOP_FSYNC "struct vnode *vp" "kauth_cred_t cred" "int flags" \
134"off_t offlo" "off_t offhi"
135.Ft int
136.Fn VOP_SEEK "struct vnode *vp" "off_t oldoff" "off_t newoff" \
137"kauth_cred_t cred"
138.Ft int
139.Fn VOP_REMOVE "struct vnode *vp" "struct vnode *vp" \
140"struct componentname *cnp"
141.Ft int
142.Fn VOP_LINK "struct vnode *dvp" "struct vnode *vp" \
143"struct componentname *cnp"
144.Ft int
145.Fn VOP_RENAME "struct vnode *fdvp" "struct vnode *fvp" \
146"struct componentname *fcnp" "struct vnode *tdvp" \
147"struct vnode *tvp" "struct componentname *tcnp"
148.Ft int
149.Fn VOP_MKDIR "struct vnode *dvp" "struct vnode **vpp" \
150"struct componentname *cnp" "struct vattr *vap"
151.Ft int
152.Fn VOP_RMDIR "struct vnode *dvp" "struct vnode *vp" \
153"struct componentname *cnp"
154.Ft int
155.Fn VOP_SYMLINK "struct vnode *dvp" "struct vnode **vpp" \
156"struct componentname *cnp" "struct vattr *vap" "char *target"
157.Ft int
158.Fn VOP_READDIR "struct vnode *vp" "struct uio *uio" \
159"kauth_cred_t cred" "int *eofflag" "off_t **cookies" "int *ncookies"
160.Ft int
161.Fn VOP_READLINK "struct vnode *vp" "struct uio *uio" "kauth_cred_t cred"
162.Ft int
163.Fn VOP_ABORTOP "struct vnode *dvp" "struct componentname *cnp"
164.Ft int
165.Fn VOP_INACTIVE "struct vnode *vp"
166.Ft int
167.Fn VOP_RECLAIM "struct vnode *vp"
168.Ft int
169.Fn VOP_LOCK "struct vnode *vp" "int flags"
170.Ft int
171.Fn VOP_UNLOCK "struct vnode *vp" "int flags"
172.Ft int
173.Fn VOP_ISLOCKED "struct vnode *vp"
174.Ft int
175.Fn VOP_BMAP "struct vnode *vp" "daddr_t bn" "struct vnode **vpp" \
176"daddr_t *bnp" "int *runp"
177.Ft int
178.Fn VOP_PRINT "struct vnode *vp"
179.Ft int
180.Fn VOP_PATHCONF "struct vnode *vp" "int name" "register_t *retval"
181.Ft int
182.Fn VOP_ADVLOCK "struct vnode *vp" "void *id" "int op" \
183"struct flock *fl" "int flags"
184.Ft int
185.Fn VOP_LEASE "struct vnode *vp" "kauth_cred_t cred" \
186"int flag"
187.Ft int
188.Fn VOP_WHITEOUT "struct vnode *dvp" "struct componentname *cnp" \
189"int flags"
190.Ft int
191.Fn VOP_GETPAGES "struct vnode *vp" "voff_t offset" "struct vm_page **m" \
192"int *count" "int centeridx" "vm_prot_t access_type" "int advice" "int flags"
193.Ft int
194.Fn VOP_PUTPAGES "struct vnode *vp" "voff_t offlo" "voff_t offhi" \
195"int flags"
196.Ft int
197.Fn VOP_STRATEGY "struct vnode *vp" "struct buf *bp"
198.Ft int
199.Fn VOP_BWRITE "struct buf *bp"
200.Ft int
201.Fn VOP_GETEXTATTR "struct vnode *vp" "int attrnamespace" "const char *name" \
202"struct uio *uio" "size_t *size" "kauth_cred_t cred"
203.Ft int
204.Fn VOP_SETEXTATTR "struct vnode *vp" "int attrnamespace" "const char *name" \
205"struct uio *uio" "kauth_cred_t cred"
206.Ft int
207.Fn VOP_LISTEXTATTR "struct vnode *vp" "int attrnamespace" "struct uio *uio" \
208"size_t *size" "kauth_cred_t cred"
209.Pp
210Not all header files are required for each function.
211.Sh DESCRIPTION
212The vnode operations vector describes what operations can be done to
213the file associated with the vnode.
214The system maintains one vnode operations vector for each file system
215type configured into the kernel.
216The vnode operations vector contains a pointer to a function for each
217operation supported by the file system.
218Many of the functions described in the vnode operations vector are
219closely related to their corresponding system calls.
220In most cases, they are called as a result of the system call
221associated with the operation being invoked.
222.Pp
223Functions in the vnode operations vector are invoked using specialized
224macros.
225The following table lists the elements of the vnode operations vector,
226the corresponding invocation macro, and a description of the element.
227.Pp
228.nf
229.ta \w'int (*vop_listextattr)()'u+2n +\w'VOP_LISTEXTATTR'u+2n +\w'Map file into user address space'u
230\fIVector element\fP	\fIMacro\fP	\fIDescription\fP
231.ta \w'int (*vop_listextattr)()'u+2n +\w'VOP_LISTEXTATTR'u+2n +\w'Map file into user address space'u+6nC
232.sp 5p
233int (*vop_lookup)() 	VOP_LOOKUP	Lookup file name in name cache
234int (*vop_create)() 	VOP_CREATE	Create a new file
235int (*vop_mknod)() 	VOP_MKNOD	Make a new device
236int (*vop_open)() 	VOP_OPEN	Open a file
237int (*vop_close)() 	VOP_CLOSE	Close a file
238int (*vop_access)() 	VOP_ACCESS	Determine file accessibility
239int (*vop_getattr)() 	VOP_GETATTR	Get file attributes
240int (*vop_setattr)() 	VOP_SETATTR	Set file attributes
241int (*vop_read)() 	VOP_READ	Read from a file
242int (*vop_write)() 	VOP_WRITE	Write to a file
243int (*vop_ioctl)() 	VOP_IOCTL	Perform device-specific I/O
244int (*vop_fcntl)() 	VOP_FCNTL	Perform file control
245int (*vop_poll)() 	VOP_POLL	Test if poll event has occurred
246int (*vop_kqfilter)()	VOP_KQFILTER	Register a knote
247int (*vop_revoke)() 	VOP_REVOKE	Eliminate vode activity
248int (*vop_mmap)() 	VOP_MMAP	Map file into user address space
249int (*vop_fsync)() 	VOP_FSYNC	Flush pending data to disk
250int (*vop_seek)() 	VOP_SEEK	Test if file is seekable
251int (*vop_remove)() 	VOP_REMOVE	Remove a file
252int (*vop_link)() 	VOP_LINK	Link a file
253int (*vop_rename)() 	VOP_RENAME	Rename a file
254int (*vop_mkdir)() 	VOP_MKDIR	Make a new directory
255int (*vop_rmdir)() 	VOP_RMDIR	Remove a directory
256int (*vop_symlink)() 	VOP_SYMLINK	Create a symbolic link
257int (*vop_readdir)() 	VOP_READDIR	Read directory entry
258int (*vop_readlink)() 	VOP_READLINK	Read contents of a symlink
259int (*vop_abortop)() 	VOP_ABORTOP	Abort pending operation
260int (*vop_inactive)() 	VOP_INACTIVE	Release the inactive vnode
261int (*vop_reclaim)() 	VOP_RECLAIM	Reclaim vnode for another file
262int (*vop_lock)() 	VOP_LOCK	Sleep until vnode lock is free
263int (*vop_unlock)() 	VOP_UNLOCK	Wake up process sleeping on lock
264int (*vop_islocked)() 	VOP_ISLOCKED	Test if vnode is locked
265int (*vop_bmap)() 	VOP_BMAP	Logical block number conversion
266int (*vop_print)() 	VOP_PRINT	Print debugging information
267int (*vop_pathconf)() 	VOP_PATHCONF	Return POSIX pathconf data
268int (*vop_advlock)() 	VOP_ADVLOCK	Advisory record locking
269int (*vop_lease)() 	VOP_LEASE	Validate vnode credentials
270int (*vop_whiteout)() 	VOP_WHITEOUT	Whiteout vnode
271int (*vop_getpages)() 	VOP_GETPAGES	Read VM pages from file
272int (*vop_putpages)() 	VOP_PUTPAGES	Write VM pages to file
273int (*vop_strategy)() 	VOP_STRATEGY	Read/write a file system buffer
274int (*vop_bwrite)() 	VOP_BWRITE	Write a file system buffer
275int (*vop_getextattr)()	VOP_GETEXTATTR	Get extended attribute
276int (*vop_setextattr)()	VOP_SETEXTATTR	Set extended attribute
277int (*vop_listextattr)()	VOP_LISTEXTATTR	List extended attributes
278.fi
279.Pp
280The implementation details of the vnode operations vector are not
281quite what is described here.
282.Pp
283If the file system type does not support a specific operation, it must
284nevertheless assign an appropriate function in the vnode operations
285vector to do the minimum required of it.
286In most cases, such functions either do nothing or return an error
287value to the effect that it is not supported.
288.Pp
289Many of the functions in the vnode operations vector take a
290componentname structure.
291It is used to encapsulate many parameters into a single function
292argument.
293It has the following structure:
294.Bd -literal
295struct componentname {
296        /*
297         * Arguments to lookup.
298         */
299        uint32_t cn_nameiop;    /* namei operation */
300        uint32_t cn_flags;      /* flags to namei */
301        kauth_cred_t cn_cred;   /* credentials */
302        /*
303         * Shared between lookup and commit routines.
304         */
305        char    *cn_pnbuf;      /* pathname buffer */
306        const char *cn_nameptr; /* pointer to looked up name */
307        size_t  cn_namelen;     /* length of looked up component */
308        u_long  cn_hash;        /* hash value of looked up name */
309        size_t  cn_consume;     /* chars to consume in lookup() */
310};
311.Ed
312.Pp
313The top half of the structure is used exclusively for the pathname
314lookups using
315.Fn VOP_LOOKUP
316and is initialized by the caller.
317The semantics of the lookup are affected by the lookup operation
318specified in
319.Em cn_nameiop
320and the flags specified in
321.Em cn_flags .
322Valid operations are:
323.Pp
324.Bl  -tag -offset indent -width LOOKUP -compact
325.It LOOKUP
326perform name lookup only
327.It CREATE
328set up for file creation
329.It DELETE
330set up for file deletion
331.It RENAME
332set up for file renaming
333.It OPMASK
334mask for operation
335.El
336.Pp
337Valid values for
338.Em cn-\*[Gt]cn_flags
339are:
340.Pp
341.Bl  -tag -offset indent -width LOCKPARENT -compact
342.It LOCKLEAF
343lock inode on return
344.It LOCKPARENT
345want parent vnode returned locked
346.It NOCACHE
347name must not be left in name cache (see
348.Xr namecache 9 )
349.It FOLLOW
350follow symbolic links
351.It NOFOLLOW
352do not follow symbolic links (pseudo)
353.It MODMASK
354mask of operational modifiers
355.El
356.Pp
357No vnode operations may be called from interrupt context.
358Most operations also require the vnode to be locked on entry.
359To prevent deadlocks, when acquiring locks on multiple vnodes, the
360lock of parent directory must be acquired before the lock on the child
361directory.
362.Pp
363Vnode operations for a file system type generally should not be
364called directly from the kernel, but accessed indirectly through the
365high-level convenience functions discussed in
366.Xr vnsubr 9 .
367.Sh FUNCTIONS
368.Bl -tag -width compact
369.It Fn VOP_LOOKUP "dvp" "vpp" "cnp"
370Lookup a single pathname component in a given directory.
371The argument
372.Fa dvp
373is the locked vnode of the directory to search and
374.Fa cnp
375is the pathname component to be searched for.
376If the pathname component is found, the address of the resulting
377locked vnode is returned in
378.Fa vpp .
379The operation specified in
380.Em cnp-\*[Gt]cn_nameiop
381gives
382.Fn VOP_LOOKUP
383hints about the reason for requesting the lookup and uses it to cache
384file system type specific information in the vnode for subsequent
385operations.
386.Pp
387There are three types of lookups: ".", ".." (ISDOTDOT), and other.
388If the pathname component being searched for is ".", then
389.Fa dvp
390has an extra reference added to it and it is returned in
391.Fa *vpp .
392If the pathname component being search for is ".." (ISDOTDOT),
393.Fa dvp
394is unlocked, the ".." node is locked and then
395.Fa dvp
396is relocked.
397This process preserves the protocol of always locking nodes from root
398downward and prevents deadlock.
399For other pathname components,
400.Fn VOP_LOOKUP
401checks the accessibility of the directory and searches the name cache
402for the pathname component.
403See
404.Xr namecache 9 .
405If the pathname is not found in the name cache, the directory is
406searched for the pathname.
407The resulting locked vnode is returned in
408.Fa vpp .
409.Fa dvp
410is always returned locked.
411.Pp
412On failure
413.Fa *vpp
414is
415.Dv NULL ,
416and
417.Fa *dvp
418is left locked.
419If the operation is successful
420.Fa *vpp
421is locked and zero is returned.
422Typically, if
423.Fa *vpp
424and
425.Fa dvp
426are the same vnode the caller will need to release twice (decrement
427the reference count) and unlock once.
428.It Fn VOP_CREATE "dvp" "vpp" "cnp" "vap"
429Create a new file in a given directory.
430The argument
431.Fa dvp
432is the locked vnode of the directory to create the new file in and
433.Fa cnp
434is the pathname component of the new file.
435The argument
436.Fa vap
437specifies the attributes that the new file should be created with.
438If the file is successfully created, the address of the resulting
439locked vnode is returned in
440.Fa vpp
441and zero is returned.
442Regardless of the return value, the directory vnode
443.Fa dvp
444will be unlocked on return.
445.Pp
446This function is called after
447.Fn VOP_LOOKUP
448when a file is being created.
449Normally,
450.Fn VOP_LOOKUP
451will have set the SAVENAME flag in
452.Em cnp-\*[Gt]cn_flags
453to keep the memory pointed to by
454.Em cnp-\*[Gt]cn_pnbuf
455valid.
456If an error is detected when creating the file, this memory is
457released.
458If the file is created successfully it will be released unless the
459SAVESTART flags in specified in
460.Em cnp-\*[Gt]cn_flags .
461.It Fn VOP_MKNOD "dvp" "vpp" "cnp" "vap"
462Make a new device-special file in a given directory.
463The argument
464.Fa dvp
465is the locked vnode of the directory to create the new device-special
466file in and
467.Fa cnp
468is the pathname component of the new device-special file.
469The argument
470.Fa vap
471specifies the attributes that the new device-special file should be
472created with.
473If the file is successfully created, the address of the resulting
474locked vnode is returned in
475.Fa vpp
476and zero is returned.
477.Pp
478This function is called after
479.Fn VOP_LOOKUP
480when a device-special file is being created.
481Normally,
482.Fn VOP_LOOKUP
483will have set the SAVENAME flag in
484.Em cnp-\*[Gt]cn_flags
485to keep the memory pointed to by
486.Em cnp-\*[Gt]cn_pnbuf
487valid.
488If an error is detected when creating the device-special file,
489this memory is released.
490If the device-special file is created successfully it will be released
491unless the SAVESTART flags in specified in
492.Em cnp-\*[Gt]cn_flags .
493.It Fn VOP_OPEN "vp" "mode" "cred"
494Open a file.
495The argument
496.Fa vp
497is the vnode of the file to open and
498.Fa mode
499specifies the access mode required by the calling process.
500The calling credentials are specified by
501.Fa cred .
502The access mode is a set of flags, including FREAD, FWRITE,
503O_NONBLOCK, O_APPEND, etc.
504.Fn VOP_OPEN
505must be called before a file can be accessed by a thread.
506The vnode reference count is incremented.
507.Pp
508.Fn VOP_OPEN
509expects the vnode
510.Fa vp
511to be locked on entry and will leave it locked on return.
512If the operation is successful zero is returned, otherwise an
513appropriate error code is returned.
514.It Fn VOP_CLOSE "vp" "fflag" "cred"
515Close a file.
516The argument
517.Fa vp
518is the vnode of the file to close and
519.Fa fflag
520specifies the access mode by the calling process.
521The possible flags are
522.Dv FREAD ,
523.Dv FWRITE
524and
525.Dv FNONBLOCK .
526The calling credentials are specified by
527.Fa cred .
528.Fn VOP_CLOSE
529frees resources allocated by
530.Fn VOP_OPEN .
531.Pp
532The vnode
533.Fa vp
534will be locked on entry and should remain locked on return.
535.It Fn VOP_ACCESS "vp" "mode" "cred"
536Determine the accessibility (permissions) of the file against the
537specified credentials.
538The argument
539.Fa vp
540is the vnode of the file to check,
541.Fa mode
542is the type of access required and
543.Fa cred
544contains the user credentials to check.
545The argument
546.Fa mode
547is a mask which can contain VREAD, VWRITE or VEXEC.
548If the file is accessible in the specified way, zero is returned,
549otherwise an appropriate error code is returned.
550.Pp
551The vnode
552.Fa vp
553will be locked on entry and should remain locked on return.
554.It Fn VOP_GETATTR "vp" "vap" "cred"
555Get specific vnode attributes on a file.
556The argument
557.Fa vp
558is the vnode of the file to get the attributes for.
559The argument
560.Fa cred
561specifies the calling credentials.
562.Fn VOP_GETATTR
563uses the file system type specific data object
564.Em vp-\*[Gt]v_data
565to reference the underlying file attributes.
566Attributes associated with the file are collected by setting the
567required attribute bits in
568.Em vap-\*[Gt]va_mask .
569The attributes are returned in
570.Fa vap .
571Attributes which are not available are set to the value VNOVAL.
572.Pp
573For more information on vnode attributes see
574.Xr vattr 9 .
575.It Fn VOP_SETATTR "vp" "vap" "cred"
576Set specific vnode attributes on a file.
577The argument
578.Fa vp
579is the locked vnode of the file to set the attributes for.
580The argument
581.Fa cred
582specifies the calling credentials.
583.Fn VOP_SETATTR
584uses the file system type specific data object
585.Em vp-\*[Gt]v_data
586to reference the underlying file attributes.
587The new attributes are defined in
588.Fa vap .
589Attributes associated with the file are set by setting the required
590attribute bits in
591.Em vap-\*[Gt]va_mask .
592Attributes which are not being modified by
593.Fn VOP_SETATTR
594should be set to the value VNOVAL.
595If the operation is successful zero is returned, otherwise an
596appropriate error is returned.
597.Pp
598For more information on vnode attributes see
599.Xr vattr 9 .
600.It Fn VOP_READ "vp" "uio" "ioflag" "cred"
601Read the contents of a file.
602The argument
603.Fa vp
604is the vnode of the file to read from,
605.Fa uio
606is the location to read the data into,
607.Fa ioflag
608is a set of flags and
609.Fa cred
610are the credentials of the calling process.
611.Pp
612The
613.Fa ioflag
614argument is used to give directives and hints to the file system.
615When attempting a read, the high 16 bits are used to provide a
616read-ahead hint (in unit of file system blocks) that the file system
617should attempt.
618The low 16 bits are a bit mask which can contain the following flags:
619.Pp
620.Bl -tag -offset indent -width IO_ALTSEMANTICS -compact
621.It IO_UNIT
622do I/O as atomic unit
623.It IO_APPEND
624append write to end
625.It IO_SYNC
626sync I/O file integrity completion
627.It IO_NODELOCKED
628underlying node already locked
629.It IO_NDELAY
630FNDELAY flag set in file table
631.It IO_DSYNC
632sync I/O data integrity completion
633.It IO_ALTSEMANTICS
634use alternate I/O semantics
635.It IO_NORMAL
636operate on regular data
637.It IO_EXT
638operate on extended attributes
639.It IO_DIRECT
640do not buffer data in the kernel
641.El
642.Pp
643Zero is returned on success, otherwise an error is returned.
644The vnode should be locked on entry and remains locked on exit.
645.It Fn VOP_WRITE "vp" "uio" "ioflag" "cred"
646Write to a file.
647The argument
648.Fa vp
649is the vnode of the file to write to,
650.Fa uio
651is the location of the data to write,
652.Fa ioflag
653is a set of flags and
654.Fa cred
655are the credentials of the calling process.
656.Pp
657The
658.Fa ioflag
659argument is used to give directives and hints to the file system.
660The low 16 bits are a bit mask which can contain the same flags as
661.Fn VOP_READ .
662.Pp
663Zero is returned on success, otherwise an error is returned.
664The vnode should be locked on entry and remains locked on exit.
665.It Fn VOP_IOCTL "vp" "command" "data" "fflag" "cred"
666Perform device-specific I/O.
667The argument
668.Fa vp
669is the locked vnode of the file, normally representing a device.
670The argument
671.Fa command
672specifies the device-specific operation to perform and
673.Fa cnp
674provides extra data for the specified operation.
675The argument
676.Fa fflags
677is a set of flags.
678The argument
679.Fa cred
680is the caller's credentials.
681If the operation is successful, zero is
682returned, otherwise an appropriate error code is returned.
683.Pp
684Most file systems do not supply a function for
685.Fn VOP_IOCTL .
686This function implements the
687.Xr ioctl 2
688system call.
689.It Fn VOP_FCNTL "vp" "command" "data" "fflag" "cred"
690Perform file control.
691The argument
692.Fa vp
693is the locked vnode of the file.
694The argument
695.Fa command
696specifies the operation to perform and
697.Fa cnp
698provides extra data for the specified operation.
699The argument
700.Fa fflags
701is a set of flags.
702The argument
703.Fa cred
704is the caller's credentials.
705If the operation is successful, zero is returned, otherwise an
706appropriate error code is returned.
707.It Fn VOP_POLL "vp" "events"
708Test if a poll event has occurred.
709The argument
710.Fa vp
711is the vnode of the file to poll.
712It returns any events of interest as specified by
713.Fa events
714that may have occurred for the file.
715The argument
716.Fa events
717is a set of flags as specified by
718.Xr poll 2 .
719.It Fn VOP_KQFILTER "vp" "kn"
720Register a knote
721.Fa kn
722with the vnode
723.Fa vn .
724If the operation is successful zero is returned, otherwise an
725appropriate error code is returned.
726.It Fn VOP_REVOKE "vp" "flags"
727Eliminate all activity associated with the vnode
728.Fa vp .
729The argument
730.Fa flags
731is a set of flags.
732If REVOKEALL is set in
733.Fa flags
734all vnodes aliased to the vnode
735.Fa vp
736are also eliminated.
737If the operation is successful zero is returned, otherwise an
738appropriate error is returned.
739.It Fn VOP_MMAP "vp" "prot" "cred"
740Inform file system that
741.Fa vp
742is in the process of being memory mapped.
743The argument
744.Fa prot
745specifies the vm access protection the vnode is going to be mapped with.
746The argument
747.Fa cred
748is the caller's credentials.
749If the file system allows the memory mapping, zero is returned, otherwise
750an appropriate error code is returned.
751.Pp
752Most file systems do not supply a function for
753.Fn VOP_MMAP
754and use
755.Fn genfs_mmap
756to default for success.
757Only file systems which do not integrate with the page cache at all
758typically want to disallow memory mapping.
759.It Fn VOP_FSYNC "vp" "cred" "flags" "offlo" "offhi"
760Flush pending data buffers for a file to disk.
761The argument
762.Fa vp
763is the locked vnode of the file for flush.
764The argument
765.Fa cred
766is the caller's credentials.
767The argument
768.Fa flags
769is a set of flags.
770If FSYNC_WAIT is specified in
771.Fa flags ,
772the function should wait for I/O to complete before returning.
773The argument
774.Fa offlo
775and
776.Fa offhi
777specify the range of file to flush.
778If the operation is successful zero is returned, otherwise an
779appropriate error code is returned.
780.Pp
781This function implements the
782.Xr sync 2
783and
784.Xr fsync 2
785system calls.
786.It Fn VOP_SEEK "vp" "oldoff" "newoff" "cred"
787Test if the file is seekable for the specified offset
788.Fa newoff .
789The argument
790.Fa vp
791is the locked vnode of the file to test.
792For most file systems this function simply tests if
793.Fa newoff
794is valid.
795If the specified
796.Fa newoff
797is less than zero, the function returns error code EINVAL.
798.It Fn VOP_REMOVE "dvp" "vp" "cnp"
799Remove a file.
800The argument
801.Fa dvp
802is the locked vnode of the directory to remove the file from and
803.Fa vp
804is the locked vnode of the file to remove.
805The argument
806.Fa cnp
807is the pathname component about the file to remove.
808If the operation is successful zero is returned, otherwise an
809appropriate error code is returned.
810Both
811.Fa dvp
812and
813.Fa vp
814are locked on entry and are to be unlocked before returning.
815.It Fn VOP_LINK "dvp" "vp" "cnp"
816Link to a file.
817The argument
818.Fa dvp
819is the locked node of the directory to create the new link and
820.Fa vp
821is the vnode of the file to be linked.
822The argument
823.Fa cnp
824is the pathname component of the new link.
825If the operation is successful zero is returned, otherwise an error
826code is returned.
827The directory vnode
828.Fa dvp
829should be locked on entry and will be released and unlocked on return.
830The vnode
831.Fa vp
832should not be locked on entry and will remain unlocked on return.
833.It Fn VOP_RENAME "fdvp" "fvp" "fcnp" "tdvp" "tvp" "tcnp"
834Rename a file.
835The argument
836.Fa fdvp
837is the vnode of the old parent directory containing in the file to be
838renamed and
839.Fa fvp
840is the vnode of the file to be renamed.
841The argument
842.Fa fcnp
843is the pathname component about the file to be renamed.
844The argument
845.Fa tdvp
846is the vnode of the new directory of the target file and
847.Fa tvp
848is the vnode of the target file (if it exists).
849The argument
850.Fa tcnp
851is the pathname component about the file's new name.
852If the operation is successful zero is returned, otherwise and error
853code is returned.
854.Pp
855The source directory and file vnodes should be unlocked and their
856reference counts should be incremented before entry.
857The target directory and file vnodes should both be locked on entry.
858.Fn VOP_RENAME
859updates the reference counts prior to returning.
860.It Fn VOP_MKDIR "dvp" "vpp" "cnp" "vap"
861Make a new directory in a given directory.
862The argument
863.Fa dvp
864is the locked vnode of the directory to create the new directory in and
865.Fa cnp
866is the pathname component of the new directory.
867The argument
868.Fa vap
869specifies the attributes that the new directory should be created
870with.
871If the file is successfully created, the address of the resulting
872locked vnode is returned in
873.Fa vpp
874and zero is returned.
875.Pp
876This function is called after
877.Fn VOP_LOOKUP
878when a directory is being created.
879Normally,
880.Fn VOP_LOOKUP
881will have set the SAVENAME flag in
882.Em cnp-\*[Gt]cn_flags
883to keep the memory pointed to by
884.Em cnp-\*[Gt]cn_pnbuf
885valid.
886If an error is detected when creating the directory, this memory is
887released.
888If the directory is created successfully it will be released unless
889the SAVESTART flags in specified in
890.Em cnp-\*[Gt]cn_flags .
891.It Fn VOP_RMDIR "dvp" "vp" "cnp"
892Remove a directory in a given directory.
893The argument
894.Fa dvp
895is the locked vnode of the directory to remove the directory from and
896.Fa vp
897is the locked vnode of the directory to remove.
898The argument
899.Fa cnp
900is the pathname component of the directory.
901Zero is returned on success, otherwise an error code is returned.
902Both
903.Fa dvp
904and
905.Fa vp
906should be locked on entry and will be released and unlocked on return.
907.It Fn VOP_SYMLINK "dvp" "vpp" "cnp" "vap" "target"
908Create a symbolic link in a given directory.
909The argument
910.Fa dvp
911is the locked vnode of the directory to create the symbolic link in
912and
913.Fa cnp
914is the pathname component of the symbolic link.
915The argument
916.Fa vap
917specifies the attributes that the symbolic link should be created
918with and
919.Fa target
920specifies the pathname of the target of the symbolic link.
921If the symbolic link is successfully created, the address of the
922resulting locked vnode is returned in
923.Fa vpp
924and zero is returned.
925.Pp
926This function is called after
927.Fn VOP_LOOKUP
928when a symbolic link is being created.
929Normally,
930.Fn VOP_LOOKUP
931will have set the SAVENAME flag in
932.Em cnp-\*[Gt]cn_flags
933to keep the memory pointed to by
934.Em cnp-\*[Gt]cn_pnbuf
935valid.
936If an error is detected when creating the symbolic link, this memory
937is released.
938If the symbolic link is created successfully it will be released
939unless the SAVESTART flags in specified in
940.Em cnp-\*[Gt]cn_flags .
941.It Fn VOP_READDIR "vp" "uio" "cred" "eofflag" "cookies" "ncookies"
942Read directory entry.
943The argument
944.Fa vp
945is the vnode of the directory to read the contents of and
946.Fa uio
947is the destination location to read the contents into.
948The argument
949.Fa cred
950is the caller's credentials.
951The argument
952.Fa eofflag
953is the pointer to a flag which is set by
954.Fn VOP_READDIR
955to indicate an end-of-file condition.
956If
957.Fa eofflag
958is
959.Dv NULL ,
960the end-of-file condition is not returned.
961The arguments
962.Fa cookies
963and
964.Fa ncookies
965specify the addresses for the list and number of directory seek
966cookies generated for NFS.
967Both
968.Fa cookies
969and
970.Fa ncookies
971should be
972.Dv NULL
973if they aren't required to be returned by
974.Fn VOP_READDIR .
975The directory contents are read into struct dirent structures and
976.Fa uio-\*[Gt]uio_offset
977is set to the offset of the next unread directory entry.
978This offset may be used in a following invocation to continue a
979sequential read of the directory contents.
980If the operation is successful zero is returned, otherwise an
981appropriate error code is returned.
982.Pp
983The directory should be locked on entry and will remain locked on
984return.
985.Pp
986In case
987.Fa ncookies
988and
989.Fa cookies
990are supplied, one cookie should be returned per directory entry.
991The value of the cookie for each directory entry should be the offset
992within the directory where the on-disk version of the following
993directory entry starts.
994That is, for each directory entry
995.Fa i ,
996the corresponding cookie should refer to the offset of directory entry
997.Fa i + 1 .
998.Pp
999Note that the
1000.Fa cookies
1001array must be allocated by the callee using the M_TEMP malloc type as
1002callers of
1003.Fn VOP_READDIR
1004must be able to free the allocation.
1005.It Fn VOP_READLINK "vp" "uio" "cred"
1006Read the contents of a symbolic link.
1007The argument
1008.Fa vp
1009is the locked vnode of the symlink and
1010.Fa uio
1011is the destination location to read the contents into.
1012The argument
1013.Fa cred
1014is the credentials of the caller.
1015If the operation is successful zero is returned, otherwise an error
1016code is returned.
1017.Pp
1018The vnode should be locked on entry and will remain locked on return.
1019.It Fn VOP_ABORTOP "dvp" "cnp"
1020Abort pending operation on vnode
1021.Fa dvp
1022and free resources allocated in
1023.Fa cnp .
1024.Pp
1025This operation is rarely implemented in file systems and
1026.Fn genfs_abortop
1027is typically used instead.
1028.It Fn VOP_INACTIVE "vp"
1029Release the inactive vnode.
1030.Fn VOP_INACTIVE
1031is called when the kernel is no longer using the vnode.
1032This may be because the reference count reaches zero or it may be that
1033the file system is being forcibly unmounted while there are open
1034files.
1035It can be used to reclaim space for open but deleted files.
1036The argument
1037.Fa vp
1038is the locked vnode to be released.
1039If the operation is successful zero is returned, otherwise an
1040appropriate error code is returned.
1041The vnode
1042.Fa vp
1043must be locked on entry, and will be unlocked on return.
1044.It Fn VOP_RECLAIM "vp"
1045Reclaim the vnode for another file system.
1046.Fn VOP_RECLAIM
1047is called when a vnode is being reused for a different file system.
1048Any file system specific resources associated with the vnode should be
1049freed.
1050The argument
1051.Fa vp
1052is the vnode to be reclaimed.
1053If the operation is successful zero is returned, otherwise an
1054appropriate error code is returned.
1055The vnode
1056.Fa vp
1057should not be locked on entry, and will remain unlocked on return.
1058.It Fn VOP_LOCK "vp" "flags"
1059Sleep until vnode lock is free.
1060The argument
1061.Fa vp
1062is the vnode of the file to be locked.
1063The argument
1064.Fa flags
1065is a set of
1066.Xr lockmgr 9
1067flags.
1068If the operation is successful zero is returned, otherwise an
1069appropriate error code is returned.
1070.Fn VOP_LOCK
1071is used to serialize access to the file system such as to prevent two
1072writes to the same file from happening at the same time.
1073Kernel code should use
1074.Xr vn_lock 9
1075to lock a vnode rather than calling
1076.Fn VOP_LOCK
1077directly.
1078.It Fn VOP_UNLOCK "vp" "flags"
1079Wake up process sleeping on lock.
1080The argument
1081.Fa vp
1082is the vnode of the file to be unlocked.
1083The argument
1084.Fa flags
1085is a set of
1086.Xr lockmgr 9
1087flags.
1088If the operation is successful zero is returned, otherwise an
1089appropriate error code is returned.
1090.Fn VOP_UNLOCK
1091is used to serialize access to the file system such as to prevent two
1092writes to the same file from happening at the same time.
1093.It Fn VOP_ISLOCKED "vp"
1094Test if the vnode
1095.Fa vp
1096is locked.
1097Possible return values are
1098.Dv LK_EXCLUSIVE ,
1099.Dv LK_SHARED
1100or 0 for lock held exclusively by the calling thread, shared lock held
1101by anyone or unlocked, respectively.
1102.It Fn VOP_BMAP "vp" "bn" "vpp" "bnp" "runp"
1103Convert the logical block number
1104.Fa bn
1105of a file specified by vnode
1106.Fa vp
1107to its physical block number on the disk.
1108The physical block is returned in
1109.Fa bnp .
1110In case the logical block is not allocated, \-1 is used.
1111.Pp
1112If
1113.Fa vpp
1114is not
1115.Dv NULL ,
1116the vnode of the device vnode for the file system is
1117returned in the address specified by
1118.Fa vpp .
1119If
1120.Fa runp
1121is not
1122.Dv NULL ,
1123the number of contiguous blocks starting from the next block after
1124the queried block will be returned in
1125.Fa runp .
1126.It Fn VOP_PRINT "vp"
1127Print debugging information.
1128The argument
1129.Fa vp
1130is the vnode to print.
1131If the operation is successful zero is returned, otherwise an
1132appropriate error code is returned.
1133.It Fn VOP_PATHCONF "vp" "name" "retval"
1134Implement POSIX
1135.Xr pathconf 2
1136and
1137.Xr fpathconf 2
1138support.
1139The argument
1140.Fa vp
1141is the locked vnode to get information about.
1142The argument
1143.Fa name
1144specified the type of information to return.
1145The information is returned in the address specified by
1146.Fa retval .
1147Valid values for
1148.Fa name
1149are:
1150.Pp
1151.Bl -tag -offset indent -width _PC_CHOWN_RESTRICTED -compact
1152.It _PC_LINK_MAX
1153return the maximum number of links to a file
1154.It _PC_NAME_MAX
1155return the maximum number of bytes in a file name
1156.It _PC_PATH_MAX
1157return the maximum number of bytes in a pathname
1158.It _PC_PIPE_BUF
1159return the maximum number of bytes which will be written atomically to
1160a pipe
1161.It _PC_CHOWN_RESTRICTED
1162return 1 if appropriate privileges are required for the
1163.Xr chown 2
1164system call, otherwise zero
1165.It _PC_NO_TRUNC
1166return if file names longer than KERN_NAME_MAX are truncated
1167.El
1168.Pp
1169If
1170.Fa name
1171is recognized,
1172.Fa *retval
1173is set to the specified value and zero is returned, otherwise an
1174appropriate error is returned.
1175.It Fn VOP_ADVLOCK "vp" "id" "op" "fl" "flags"
1176Manipulate Advisory record locks on a vnode.
1177The argument
1178.Fa vp
1179is the vnode on which locks are manipulated.
1180The argument
1181.Fa id
1182is the id token which is changing the lock and
1183.Fa op
1184is the
1185.Xr fcntl 2
1186operation to perform.
1187Valid values are:
1188.Pp
1189.Bl -tag -offset indent -width F_UNLCK -compact
1190.It F_SETLK
1191set lock
1192.It F_GETLK
1193get the first conflicted lock
1194.It F_UNLCK
1195clear lock
1196.El
1197.Pp
1198The argument
1199.Fa fl
1200is a description of the lock.
1201In the case of
1202.Dv SEEK_CUR ,
1203The caller should add the current file offset to
1204fl-\*[Gt]l_start beforehand.
1205.Fn VOP_ADVLOCK
1206treats
1207.Dv SEEK_CUR
1208as
1209.Dv SEEK_SET .
1210.Pp
1211The argument
1212.Fa flags
1213is the set of flags.
1214Valid values are:
1215.Pp
1216.Bl -tag -offset indent -width F_FLOCK -compact
1217.It F_WAIT
1218wait until lock is granted
1219.It F_FLOCK
1220use
1221.Xr flock 2
1222semantics for lock
1223.It F_POSIX
1224use POSIX semantics for lock
1225.El
1226.Pp
1227If the operation is successful zero is returned, otherwise an
1228appropriate error is returned.
1229.It Fn VOP_LEASE "vp" "cred" "flags"
1230Validate vnode credentials and operation type.
1231The argument
1232.Fa vp
1233is the locked vnode of the file to validate credentials
1234.Fa cred .
1235The argument
1236.Fa flags
1237specifies the operation flags.
1238If the operation is successful zero is returned, otherwise an
1239appropriate error code is returned.
1240The vnode must be locked on entry and remains locked on return.
1241.It Fn VOP_WHITEOUT "dvp" "cnp" "flags"
1242Whiteout pathname component in directory with vnode
1243.Fa dvp .
1244The argument
1245.Fa cnp
1246specifies the pathname component to whiteout.
1247.It Fn VOP_GETPAGES "vp" "offset" "m" "count" "centeridx" "access_type" "advice" "flags"
1248Read VM pages from file.
1249The argument
1250.Fa vp
1251is the locked vnode to read the VM pages from.
1252The argument
1253.Fa offset
1254is offset in the file to start accessing and
1255.Fa m
1256is an array of VM pages.
1257The argument
1258.Fa count
1259points a variable that specifies the number of pages to read.
1260If the operation is successful zero is returned, otherwise an
1261appropriate error code is returned.
1262If PGO_LOCKED is specified in
1263.Em flags ,
1264.Fn VOP_GETPAGES
1265might return less pages than requested.
1266In that case, the variable pointed to by
1267.Em count
1268will be updated.
1269.Pp
1270This function is primarily used by the page-fault handing mechanism.
1271.It Fn VOP_PUTPAGES "vp" "offlo" "offhi" "flags"
1272Write modified (dirty) VM pages to file.
1273The argument
1274.Fa vp
1275is the vnode to write the VM pages to.
1276The vnode's vm object lock
1277.Va ( v_uobj.vmobjlock )
1278must be held by the caller and will be released upon return.
1279The arguments
1280.Fa offlo
1281and
1282.Fa offhi
1283specify the range of VM pages to write.
1284In case
1285.Fa offhi
1286is given as 0, all pages at and after the start offset
1287.Fa offlo
1288belonging the vnode
1289.Fa vp
1290will be written.
1291The argument
1292.Fa flags
1293controls the behavior of the routine and takes the vm pager's
1294flags
1295.Dv ( PGO_ -prefixed ) .
1296If the operation is successful zero is returned, otherwise an
1297appropriate error code is returned.
1298.Pp
1299The function is primarily used by the pageout handling mechanism and
1300is commonly implemented indirectly
1301by
1302.Fn genfs_putpages
1303with the help of
1304.Fn VOP_STRATEGY
1305and
1306.Fn VOP_BMAP .
1307.It Fn VOP_STRATEGY "vp" "bp"
1308Read/write a file system buffer.
1309The argument
1310.Fa vp
1311is the vnode to read/write to.
1312The argument
1313.Fa bp
1314is the buffer to be read or written.
1315.Fn VOP_STRATEGY
1316will either read or write data to the file depending on the value of
1317.Em bp-\*[Gt]b_flags .
1318If the operation is successful zero is returned, otherwise an
1319appropriate error code is returned.
1320.It Fn VOP_BWRITE "bp"
1321Write a file system buffer.
1322The argument
1323.Fa bp
1324specifies the buffer to be written.
1325If the operation is successful zero is returned, otherwise an
1326appropriate error code is returned.
1327.It Fn VOP_GETEXTATTR "vp" "attrnamespace" "name" "uio" "size" "cred"
1328Get an extended attribute.
1329The argument
1330.Fa vp
1331is the locked vnode of the file or directory from which to retrieve the
1332attribute.
1333The argument
1334.Fa attrnamespace
1335specifies the extended attribute namespace.
1336The argument
1337.Fa name
1338is a nul-terminated character string naming the attribute to retrieve.
1339The argument
1340.Fa uio ,
1341if not
1342.Dv NULL ,
1343specifies where the extended attribute value is to be written.
1344The argument
1345.Fa size ,
1346if not
1347.Dv NULL ,
1348will contain the number of bytes required to read all of
1349the attribute data upon return.
1350In most cases,
1351.Fa uio
1352will be
1353.Dv NULL
1354when
1355.Fa size
1356is not, and vice versa.
1357The argument
1358.Fa cred
1359specifies the user credentials to use when authorizing the request.
1360.It Fn VOP_SETEXTATTR "vp" "attrnamespace" "name" "uio" "cred"
1361Set an extended attribute.
1362The argument
1363.Fa vp
1364is the locked vnode of the file or directory to which to store the
1365attribute.
1366The argument
1367.Fa namespace
1368specifies the extended attribute namespace.
1369The argument
1370.Fa name
1371is a nul-terminated character string naming the attribute to store.
1372The argument
1373.Fa uio
1374specifies the source of the extended attribute data.
1375The argument
1376.Fa cred
1377specifies the user credentials to use when authorizing the request.
1378.It Fn VOP_LISTEXTATTR "vp" "attrnamespace" "uio" "size" "cred"
1379Retrieve the list of extended attributes.
1380The argument
1381.Fa vp
1382is the locked vnode of the file or directory whose attributes are to be listed.
1383The argument
1384.Fa attrnamespace
1385specifies the extended attribute namespace.
1386The argument
1387.Fa uio ,
1388if not
1389.Dv NULL ,
1390specifies where the extended attribute list is to be written.
1391The argument
1392.Fa size ,
1393if not
1394.Dv NULL ,
1395will contain the number of bytes required to read all of
1396the attribute names upon return.
1397In most cases,
1398.Fa uio
1399will be
1400.Dv NULL
1401when
1402.Fa size
1403is not, and vice versa.
1404The argument
1405.Fa cred
1406specifies the user credentials to use when authorizing the request.
1407.El
1408.Sh ERRORS
1409.Bl -tag -width Er
1410.It Bq Er ENOATTR
1411The requested attribute is not defined for this vnode.
1412.It Bq Er ENOTDIR
1413The vnode does not represent a directory.
1414.It Bq Er ENOENT
1415The component was not found in the directory.
1416.It Bq Er ENOSPC
1417The file system is full.
1418.It Bq Er EDQUOT
1419Quota exceeded.
1420.It Bq Er EACCES
1421Access for the specified operation is denied.
1422.It Bq Er EJUSTRETURN
1423A CREATE or RENAME operation would be successful.
1424.It Bq Er EPERM
1425an attempt was made to change an immutable file
1426.It Bq Er ENOTEMPTY
1427attempt to remove a directory which is not empty
1428.It Bq Er EINVAL
1429attempt to read from an illegal offset in the directory; unrecognized
1430input
1431.It Bq Er EIO
1432a read error occurred while reading the directory or reading the
1433contents of a symbolic link
1434.It Bq Er EROFS
1435the file system is read-only
1436.El
1437.Sh SEE ALSO
1438.Xr extattr 9 ,
1439.Xr intro 9 ,
1440.Xr lock 9 ,
1441.Xr namei 9 ,
1442.Xr vattr 9 ,
1443.Xr vfs 9 ,
1444.Xr vfsops 9 ,
1445.Xr vnode 9
1446.Sh HISTORY
1447The vnode operations vector, its functions and the corresponding
1448macros appeared in
1449.Bx 4.3 .
1450