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