xref: /netbsd-src/share/man/man9/vnodeops.9 (revision ce099b40997c43048fb78bd578195f81d2456523)
1.\"     $NetBSD: vnodeops.9,v 1.72 2008/03/20 18:56:28 mjf 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        uint32_t cn_nameiop;    /* namei operation */
307        uint32_t cn_flags;      /* flags to namei */
308        kauth_cred_t cn_cred;   /* credentials */
309        /*
310         * Shared between lookup and commit routines.
311         */
312        char    *cn_pnbuf;      /* pathname buffer */
313        const char *cn_nameptr; /* pointer to looked up name */
314        size_t  cn_namelen;     /* length of looked up component */
315        u_long  cn_hash;        /* hash value of looked up name */
316        size_t  cn_consume;     /* chars to consume in lookup() */
317};
318.Ed
319.Pp
320The top half of the structure is used exclusively for the pathname
321lookups using
322.Fn VOP_LOOKUP
323and is initialized by the caller.
324The semantics of the lookup are affected by the lookup operation
325specified in
326.Em cn_nameiop
327and the flags specified in
328.Em cn_flags .
329Valid operations are:
330.Pp
331.Bl  -tag -offset indent -width LOOKUP -compact
332.It LOOKUP
333perform name lookup only
334.It CREATE
335set up for file creation
336.It DELETE
337set up for file deletion
338.It RENAME
339set up for file renaming
340.It OPMASK
341mask for operation
342.El
343.Pp
344Valid values for
345.Em cn-\*[Gt]cn_flags
346are:
347.Pp
348.Bl  -tag -offset indent -width LOCKPARENT -compact
349.It LOCKLEAF
350lock inode on return
351.It LOCKPARENT
352want parent vnode returned locked
353.It NOCACHE
354name must not be left in name cache (see
355.Xr namecache 9 )
356.It FOLLOW
357follow symbolic links
358.It NOFOLLOW
359do not follow symbolic links (pseudo)
360.It MODMASK
361mask of operational modifiers
362.El
363.Pp
364No vnode operations may be called from interrupt context.
365Most operations also require the vnode to be locked on entry.
366To prevent deadlocks, when acquiring locks on multiple vnodes, the
367lock of parent directory must be acquired before the lock on the child
368directory.
369.Pp
370Vnode operations for a file system type generally should not be
371called directly from the kernel, but accessed indirectly through the
372high-level convenience functions discussed in
373.Xr vnsubr 9 .
374.Sh FUNCTIONS
375.Bl -tag -width compact
376.It Fn VOP_LOOKUP "dvp" "vpp" "cnp"
377Lookup a single pathname component in a given directory.
378The argument
379.Fa dvp
380is the locked vnode of the directory to search and
381.Fa cnp
382is the pathname component to be searched for.
383If the pathname component is found, the address of the resulting
384locked vnode is returned in
385.Fa vpp .
386The operation specified in
387.Em cnp-\*[Gt]cn_nameiop
388gives
389.Fn VOP_LOOKUP
390hints about the reason for requesting the lookup and uses it to cache
391file system type specific information in the vnode for subsequent
392operations.
393.Pp
394There are three types of lookups: ".", ".." (ISDOTDOT), and other.
395If the pathname component being searched for is ".", then
396.Fa dvp
397has an extra reference added to it and it is returned in
398.Fa *vpp .
399If the pathname component being search for is ".." (ISDOTDOT),
400.Fa dvp
401is unlocked, the ".." node is locked and then
402.Fa dvp
403is relocked.
404This process preserves the protocol of always locking nodes from root
405downward and prevents deadlock.
406For other pathname components,
407.Fn VOP_LOOKUP
408checks the accessibility of the directory and searches the name cache
409for the pathname component.
410See
411.Xr namecache 9 .
412If the pathname is not found in the name cache, the directory is
413searched for the pathname.
414The resulting locked vnode is returned in
415.Fa vpp .
416.Fa dvp
417is always returned locked.
418.Pp
419On failure
420.Fa *vpp
421is
422.Dv NULL ,
423and
424.Fa *dvp
425is left locked.
426If the operation is successful
427.Fa *vpp
428is locked and zero is returned.
429Typically, if
430.Fa *vpp
431and
432.Fa dvp
433are the same vnode the caller will need to release twice (decrement
434the reference count) and unlock once.
435.It Fn VOP_CREATE "dvp" "vpp" "cnp" "vap"
436Create a new file in a given directory.
437The argument
438.Fa dvp
439is the locked vnode of the directory to create the new file in and
440.Fa cnp
441is the pathname component of the new file.
442The argument
443.Fa vap
444specifies the attributes that the new file should be created with.
445If the file is successfully created, the address of the resulting
446locked vnode is returned in
447.Fa vpp
448and zero is returned.
449Regardless of the return value, the directory vnode
450.Fa dvp
451will be unlocked on return.
452.Pp
453This function is called after
454.Fn VOP_LOOKUP
455when a file is being created.
456Normally,
457.Fn VOP_LOOKUP
458will have set the SAVENAME flag in
459.Em cnp-\*[Gt]cn_flags
460to keep the memory pointed to by
461.Em cnp-\*[Gt]cn_pnbuf
462valid.
463If an error is detected when creating the file, this memory is
464released.
465If the file is created successfully it will be released unless the
466SAVESTART flags in specified in
467.Em cnp-\*[Gt]cn_flags .
468.It Fn VOP_MKNOD "dvp" "vpp" "cnp" "vap"
469Make a new device-special file in a given directory.
470The argument
471.Fa dvp
472is the locked vnode of the directory to create the new device-special
473file in and
474.Fa cnp
475is the pathname component of the new device-special file.
476The argument
477.Fa vap
478specifies the attributes that the new device-special file should be
479created with.
480If the file is successfully created, the address of the resulting
481locked vnode is returned in
482.Fa vpp
483and zero is returned.
484.Pp
485This function is called after
486.Fn VOP_LOOKUP
487when a device-special file is being created.
488Normally,
489.Fn VOP_LOOKUP
490will have set the SAVENAME flag in
491.Em cnp-\*[Gt]cn_flags
492to keep the memory pointed to by
493.Em cnp-\*[Gt]cn_pnbuf
494valid.
495If an error is detected when creating the device-special file,
496this memory is released.
497If the device-special file is created successfully it will be released
498unless the SAVESTART flags in specified in
499.Em cnp-\*[Gt]cn_flags .
500.It Fn VOP_OPEN "vp" "mode" "cred"
501Open a file.
502The argument
503.Fa vp
504is the vnode of the file to open and
505.Fa mode
506specifies the access mode required by the calling process.
507The calling credentials are specified by
508.Fa cred .
509The access mode is a set of flags, including FREAD, FWRITE,
510O_NONBLOCK, O_APPEND, etc.
511.Fn VOP_OPEN
512must be called before a file can be accessed by a thread.
513The vnode reference count is incremented.
514.Pp
515.Fn VOP_OPEN
516expects the vnode
517.Fa vp
518to be locked on entry and will leave it locked on return.
519If the operation is successful zero is returned, otherwise an
520appropriate error code is returned.
521.It Fn VOP_CLOSE "vp" "fflag" "cred"
522Close a file.
523The argument
524.Fa vp
525is the vnode of the file to close and
526.Fa fflag
527specifies the access mode by the calling process.
528The possible flags are
529.Dv FREAD ,
530.Dv FWRITE
531and
532.Dv FNONBLOCK .
533The calling credentials are specified by
534.Fa cred .
535.Fn VOP_CLOSE
536frees resources allocated by
537.Fn VOP_OPEN .
538.Pp
539The vnode
540.Fa vp
541will be locked on entry and should remain locked on return.
542.It Fn VOP_ACCESS "vp" "mode" "cred"
543Determine the accessibility (permissions) of the file against the
544specified credentials.
545The argument
546.Fa vp
547is the vnode of the file to check,
548.Fa mode
549is the type of access required and
550.Fa cred
551contains the user credentials to check.
552The argument
553.Fa mode
554is a mask which can contain VREAD, VWRITE or VEXEC.
555If the file is accessible in the specified way, zero is returned,
556otherwise an appropriate error code is returned.
557.Pp
558The vnode
559.Fa vp
560will be locked on entry and should remain locked on return.
561.It Fn VOP_GETATTR "vp" "vap" "cred"
562Get specific vnode attributes on a file.
563The argument
564.Fa vp
565is the vnode of the file to get the attributes for.
566The argument
567.Fa cred
568specifies the calling credentials.
569.Fn VOP_GETATTR
570uses the file system type specific data object
571.Em vp-\*[Gt]v_data
572to reference the underlying file attributes.
573Attributes associated with the file are collected by setting the
574required attribute bits in
575.Em vap-\*[Gt]va_mask .
576The attributes are returned in
577.Fa vap .
578Attributes which are not available are set to the value VNOVAL.
579.Pp
580For more information on vnode attributes see
581.Xr vattr 9 .
582.It Fn VOP_SETATTR "vp" "vap" "cred"
583Set specific vnode attributes on a file.
584The argument
585.Fa vp
586is the locked vnode of the file to set the attributes for.
587The argument
588.Fa cred
589specifies the calling credentials.
590.Fn VOP_SETATTR
591uses the file system type specific data object
592.Em vp-\*[Gt]v_data
593to reference the underlying file attributes.
594The new attributes are defined in
595.Fa vap .
596Attributes associated with the file are set by setting the required
597attribute bits in
598.Em vap-\*[Gt]va_mask .
599Attributes which are not being modified by
600.Fn VOP_SETATTR
601should be set to the value VNOVAL.
602If the operation is successful zero is returned, otherwise an
603appropriate error is returned.
604.Pp
605For more information on vnode attributes see
606.Xr vattr 9 .
607.It Fn VOP_READ "vp" "uio" "ioflag" "cred"
608Read the contents of a file.
609The argument
610.Fa vp
611is the vnode of the file to read from,
612.Fa uio
613is the location to read the data into,
614.Fa ioflag
615is a set of flags and
616.Fa cred
617are the credentials of the calling process.
618.Pp
619The
620.Fa ioflag
621argument is used to give directives and hints to the file system.
622When attempting a read, the high 16 bits are used to provide a
623read-ahead hint (in unit of file system blocks) that the file system
624should attempt.
625The low 16 bits are a bit mask which can contain the following flags:
626.Pp
627.Bl -tag -offset indent -width IO_ALTSEMANTICS -compact
628.It IO_UNIT
629do I/O as atomic unit
630.It IO_APPEND
631append write to end
632.It IO_SYNC
633sync I/O file integrity completion
634.It IO_NODELOCKED
635underlying node already locked
636.It IO_NDELAY
637FNDELAY flag set in file table
638.It IO_DSYNC
639sync I/O data integrity completion
640.It IO_ALTSEMANTICS
641use alternate I/O semantics
642.It IO_NORMAL
643operate on regular data
644.It IO_EXT
645operate on extended attributes
646.It IO_DIRECT
647do not buffer data in the kernel
648.El
649.Pp
650Zero is returned on success, otherwise an error is returned.
651The vnode should be locked on entry and remains locked on exit.
652.It Fn VOP_WRITE "vp" "uio" "ioflag" "cred"
653Write to a file.
654The argument
655.Fa vp
656is the vnode of the file to write to,
657.Fa uio
658is the location of the data to write,
659.Fa ioflag
660is a set of flags and
661.Fa cred
662are the credentials of the calling process.
663.Pp
664The
665.Fa ioflag
666argument is used to give directives and hints to the file system.
667The low 16 bits are a bit mask which can contain the same flags as
668.Fn VOP_READ .
669.Pp
670Zero is returned on success, otherwise an error is returned.
671The vnode should be locked on entry and remains locked on exit.
672.It Fn VOP_IOCTL "vp" "command" "data" "fflag" "cred"
673Perform device-specific I/O.
674The argument
675.Fa vp
676is the locked vnode of the file, normally representing a device.
677The argument
678.Fa command
679specifies the device-specific operation to perform and
680.Fa cnp
681provides extra data for the specified operation.
682The argument
683.Fa fflags
684is a set of flags.
685The argument
686.Fa cred
687is the caller's credentials.
688If the operation is successful, zero is
689returned, otherwise an appropriate error code is returned.
690.Pp
691Most file systems do not supply a function for
692.Fn VOP_IOCTL .
693This function implements the
694.Xr ioctl 2
695system call.
696.It Fn VOP_FCNTL "vp" "command" "data" "fflag" "cred"
697Perform file control.
698The argument
699.Fa vp
700is the locked vnode of the file.
701The argument
702.Fa command
703specifies the operation to perform and
704.Fa cnp
705provides extra data for the specified operation.
706The argument
707.Fa fflags
708is a set of flags.
709The argument
710.Fa cred
711is the caller's credentials.
712If the operation is successful, zero is returned, otherwise an
713appropriate error code is returned.
714.It Fn VOP_POLL "vp" "events"
715Test if a poll event has occurred.
716The argument
717.Fa vp
718is the vnode of the file to poll.
719It returns any events of interest as specified by
720.Fa events
721that may have occurred for the file.
722The argument
723.Fa events
724is a set of flags as specified by
725.Xr poll 2 .
726.It Fn VOP_KQFILTER "vp" "kn"
727Register a knote
728.Fa kn
729with the vnode
730.Fa vn .
731If the operation is successful zero is returned, otherwise an
732appropriate error code is returned.
733.It Fn VOP_REVOKE "vp" "flags"
734Eliminate all activity associated with the vnode
735.Fa vp .
736The argument
737.Fa flags
738is a set of flags.
739If REVOKEALL is set in
740.Fa flags
741all vnodes aliased to the vnode
742.Fa vp
743are also eliminated.
744If the operation is successful zero is returned, otherwise an
745appropriate error is returned.
746.It Fn VOP_MMAP "vp" "prot" "cred"
747Inform file system that
748.Fa vp
749is in the process of being memory mapped.
750The argument
751.Fa prot
752specifies the vm access protection the vnode is going to be mapped with.
753The argument
754.Fa cred
755is the caller's credentials.
756If the file system allows the memory mapping, zero is returned, otherwise
757an appropriate error code is returned.
758.Pp
759Most file systems do not supply a function for
760.Fn VOP_MMAP
761and use
762.Fn genfs_mmap
763to default for success.
764Only file systems which do not integrate with the page cache at all
765typically want to disallow memory mapping.
766.It Fn VOP_FSYNC "vp" "cred" "flags" "offlo" "offhi"
767Flush pending data buffers for a file to disk.
768The argument
769.Fa vp
770is the locked vnode of the file for flush.
771The argument
772.Fa cred
773is the caller's credentials.
774The argument
775.Fa flags
776is a set of flags.
777If FSYNC_WAIT is specified in
778.Fa flags ,
779the function should wait for I/O to complete before returning.
780The argument
781.Fa offlo
782and
783.Fa offhi
784specify the range of file to flush.
785If the operation is successful zero is returned, otherwise an
786appropriate error code is returned.
787.Pp
788This function implements the
789.Xr sync 2
790and
791.Xr fsync 2
792system calls.
793.It Fn VOP_SEEK "vp" "oldoff" "newoff" "cred"
794Test if the file is seekable for the specified offset
795.Fa newoff .
796The argument
797.Fa vp
798is the locked vnode of the file to test.
799For most file systems this function simply tests if
800.Fa newoff
801is valid.
802If the specified
803.Fa newoff
804is less than zero, the function returns error code EINVAL.
805.It Fn VOP_REMOVE "dvp" "vp" "cnp"
806Remove a file.
807The argument
808.Fa dvp
809is the locked vnode of the directory to remove the file from and
810.Fa vp
811is the locked vnode of the file to remove.
812The argument
813.Fa cnp
814is the pathname component about the file to remove.
815If the operation is successful zero is returned, otherwise an
816appropriate error code is returned.
817Both
818.Fa dvp
819and
820.Fa vp
821are locked on entry and are to be unlocked before returning.
822.It Fn VOP_LINK "dvp" "vp" "cnp"
823Link to a file.
824The argument
825.Fa dvp
826is the locked node of the directory to create the new link and
827.Fa vp
828is the vnode of the file to be linked.
829The argument
830.Fa cnp
831is the pathname component of the new link.
832If the operation is successful zero is returned, otherwise an error
833code is returned.
834The directory vnode
835.Fa dvp
836should be locked on entry and will be released and unlocked on return.
837The vnode
838.Fa vp
839should not be locked on entry and will remain unlocked on return.
840.It Fn VOP_RENAME "fdvp" "fvp" "fcnp" "tdvp" "tvp" "tcnp"
841Rename a file.
842The argument
843.Fa fdvp
844is the vnode of the old parent directory containing in the file to be
845renamed and
846.Fa fvp
847is the vnode of the file to be renamed.
848The argument
849.Fa fcnp
850is the pathname component about the file to be renamed.
851The argument
852.Fa tdvp
853is the vnode of the new directory of the target file and
854.Fa tvp
855is the vnode of the target file (if it exists).
856The argument
857.Fa tcnp
858is the pathname component about the file's new name.
859If the operation is successful zero is returned, otherwise and error
860code is returned.
861.Pp
862The source directory and file vnodes should be unlocked and their
863reference counts should be incremented before entry.
864The target directory and file vnodes should both be locked on entry.
865.Fn VOP_RENAME
866updates the reference counts prior to returning.
867.It Fn VOP_MKDIR "dvp" "vpp" "cnp" "vap"
868Make a new directory in a given directory.
869The argument
870.Fa dvp
871is the locked vnode of the directory to create the new directory in and
872.Fa cnp
873is the pathname component of the new directory.
874The argument
875.Fa vap
876specifies the attributes that the new directory should be created
877with.
878If the file is successfully created, the address of the resulting
879locked vnode is returned in
880.Fa vpp
881and zero is returned.
882.Pp
883This function is called after
884.Fn VOP_LOOKUP
885when a directory is being created.
886Normally,
887.Fn VOP_LOOKUP
888will have set the SAVENAME flag in
889.Em cnp-\*[Gt]cn_flags
890to keep the memory pointed to by
891.Em cnp-\*[Gt]cn_pnbuf
892valid.
893If an error is detected when creating the directory, this memory is
894released.
895If the directory is created successfully it will be released unless
896the SAVESTART flags in specified in
897.Em cnp-\*[Gt]cn_flags .
898.It Fn VOP_RMDIR "dvp" "vp" "cnp"
899Remove a directory in a given directory.
900The argument
901.Fa dvp
902is the locked vnode of the directory to remove the directory from and
903.Fa vp
904is the locked vnode of the directory to remove.
905The argument
906.Fa cnp
907is the pathname component of the directory.
908Zero is returned on success, otherwise an error code is returned.
909Both
910.Fa dvp
911and
912.Fa vp
913should be locked on entry and will be released and unlocked on return.
914.It Fn VOP_SYMLINK "dvp" "vpp" "cnp" "vap" "target"
915Create a symbolic link in a given directory.
916The argument
917.Fa dvp
918is the locked vnode of the directory to create the symbolic link in
919and
920.Fa cnp
921is the pathname component of the symbolic link.
922The argument
923.Fa vap
924specifies the attributes that the symbolic link should be created
925with and
926.Fa target
927specifies the pathname of the target of the symbolic link.
928If the symbolic link is successfully created, the address of the
929resulting locked vnode is returned in
930.Fa vpp
931and zero is returned.
932.Pp
933This function is called after
934.Fn VOP_LOOKUP
935when a symbolic link is being created.
936Normally,
937.Fn VOP_LOOKUP
938will have set the SAVENAME flag in
939.Em cnp-\*[Gt]cn_flags
940to keep the memory pointed to by
941.Em cnp-\*[Gt]cn_pnbuf
942valid.
943If an error is detected when creating the symbolic link, this memory
944is released.
945If the symbolic link is created successfully it will be released
946unless the SAVESTART flags in specified in
947.Em cnp-\*[Gt]cn_flags .
948.It Fn VOP_READDIR "vp" "uio" "cred" "eofflag" "cookies" "ncookies"
949Read directory entry.
950The argument
951.Fa vp
952is the vnode of the directory to read the contents of and
953.Fa uio
954is the destination location to read the contents into.
955The argument
956.Fa cred
957is the caller's credentials.
958The argument
959.Fa eofflag
960is the pointer to a flag which is set by
961.Fn VOP_READDIR
962to indicate an end-of-file condition.
963If
964.Fa eofflag
965is
966.Dv NULL ,
967the end-of-file condition is not returned.
968The arguments
969.Fa cookies
970and
971.Fa ncookies
972specify the addresses for the list and number of directory seek
973cookies generated for NFS.
974Both
975.Fa cookies
976and
977.Fa ncookies
978should be
979.Dv NULL
980if they aren't required to be returned by
981.Fn VOP_READDIR .
982The directory contents are read into struct dirent structures and
983.Fa uio-\*[Gt]uio_offset
984is set to the offset of the next unread directory entry.
985This offset may be used in a following invocation to continue a
986sequential read of the directory contents.
987If the operation is successful zero is returned, otherwise an
988appropriate error code is returned.
989.Pp
990The directory should be locked on entry and will remain locked on
991return.
992.Pp
993In case
994.Fa ncookies
995and
996.Fa cookies
997are supplied, one cookie should be returned per directory entry.
998The value of the cookie for each directory entry should be the offset
999within the directory where the on-disk version of the following
1000directory entry starts.
1001That is, for each directory entry
1002.Fa i ,
1003the corresponding cookie should refer to the offset of directory entry
1004.Fa i + 1 .
1005.Pp
1006Note that the
1007.Fa cookies
1008array must be allocated by the callee using the M_TEMP malloc type as
1009callers of
1010.Fn VOP_READDIR
1011must be able to free the allocation.
1012.It Fn VOP_READLINK "vp" "uio" "cred"
1013Read the contents of a symbolic link.
1014The argument
1015.Fa vp
1016is the locked vnode of the symlink and
1017.Fa uio
1018is the destination location to read the contents into.
1019The argument
1020.Fa cred
1021is the credentials of the caller.
1022If the operation is successful zero is returned, otherwise an error
1023code is returned.
1024.Pp
1025The vnode should be locked on entry and will remain locked on return.
1026.It Fn VOP_ABORTOP "dvp" "cnp"
1027Abort pending operation on vnode
1028.Fa dvp
1029and free resources allocated in
1030.Fa cnp .
1031.Pp
1032This operation is rarely implemented in file systems and
1033.Fn genfs_abortop
1034is typically used instead.
1035.It Fn VOP_INACTIVE "vp"
1036Release the inactive vnode.
1037.Fn VOP_INACTIVE
1038is called when the kernel is no longer using the vnode.
1039This may be because the reference count reaches zero or it may be that
1040the file system is being forcibly unmounted while there are open
1041files.
1042It can be used to reclaim space for open but deleted files.
1043The argument
1044.Fa vp
1045is the locked vnode to be released.
1046If the operation is successful zero is returned, otherwise an
1047appropriate error code is returned.
1048The vnode
1049.Fa vp
1050must be locked on entry, and will be unlocked on return.
1051.It Fn VOP_RECLAIM "vp"
1052Reclaim the vnode for another file system.
1053.Fn VOP_RECLAIM
1054is called when a vnode is being reused for a different file system.
1055Any file system specific resources associated with the vnode should be
1056freed.
1057The argument
1058.Fa vp
1059is the vnode to be reclaimed.
1060If the operation is successful zero is returned, otherwise an
1061appropriate error code is returned.
1062The vnode
1063.Fa vp
1064should not be locked on entry, and will remain unlocked on return.
1065.It Fn VOP_LOCK "vp" "flags"
1066Sleep until vnode lock is free.
1067The argument
1068.Fa vp
1069is the vnode of the file to be locked.
1070The argument
1071.Fa flags
1072is a set of
1073.Xr lockmgr 9
1074flags.
1075If the operation is successful zero is returned, otherwise an
1076appropriate error code is returned.
1077.Fn VOP_LOCK
1078is used to serialize access to the file system such as to prevent two
1079writes to the same file from happening at the same time.
1080Kernel code should use
1081.Xr vn_lock 9
1082to lock a vnode rather than calling
1083.Fn VOP_LOCK
1084directly.
1085.It Fn VOP_UNLOCK "vp" "flags"
1086Wake up process sleeping on lock.
1087The argument
1088.Fa vp
1089is the vnode of the file to be unlocked.
1090The argument
1091.Fa flags
1092is a set of
1093.Xr lockmgr 9
1094flags.
1095If the operation is successful zero is returned, otherwise an
1096appropriate error code is returned.
1097.Fn VOP_UNLOCK
1098is used to serialize access to the file system such as to prevent two
1099writes to the same file from happening at the same time.
1100.It Fn VOP_ISLOCKED "vp"
1101Test if the vnode
1102.Fa vp
1103is locked.
1104A non-zero value is returned if the vnode is not locked, otherwise
1105zero is returned.
1106.It Fn VOP_BMAP "vp" "bn" "vpp" "bnp" "runp"
1107Convert the logical block number
1108.Fa bn
1109of a file specified by vnode
1110.Fa vp
1111to its physical block number on the disk.
1112The physical block is returned in
1113.Fa bnp .
1114In case the logical block is not allocated, \-1 is used.
1115.Pp
1116If
1117.Fa vpp
1118is not
1119.Dv NULL ,
1120the vnode of the device vnode for the file system is
1121returned in the address specified by
1122.Fa vpp .
1123If
1124.Fa runp
1125is not
1126.Dv NULL ,
1127the number of contiguous blocks starting from the next block after
1128the queried block will be returned in
1129.Fa runp .
1130.It Fn VOP_PRINT "vp"
1131Print debugging information.
1132The argument
1133.Fa vp
1134is the vnode to print.
1135If the operation is successful zero is returned, otherwise an
1136appropriate error code is returned.
1137.It Fn VOP_PATHCONF "vp" "name" "retval"
1138Implement POSIX
1139.Xr pathconf 2
1140and
1141.Xr fpathconf 2
1142support.
1143The argument
1144.Fa vp
1145is the locked vnode to get information about.
1146The argument
1147.Fa name
1148specified the type of information to return.
1149The information is returned in the address specified by
1150.Fa retval .
1151Valid values for
1152.Fa name
1153are:
1154.Pp
1155.Bl -tag -offset indent -width _PC_CHOWN_RESTRICTED -compact
1156.It _PC_LINK_MAX
1157return the maximum number of links to a file
1158.It _PC_NAME_MAX
1159return the maximum number of bytes in a file name
1160.It _PC_PATH_MAX
1161return the maximum number of bytes in a pathname
1162.It _PC_PIPE_BUF
1163return the maximum number of bytes which will be written atomically to
1164a pipe
1165.It _PC_CHOWN_RESTRICTED
1166return 1 if appropriate privileges are required for the
1167.Xr chown 2
1168system call, otherwise zero
1169.It _PC_NO_TRUNC
1170return if file names longer than KERN_NAME_MAX are truncated
1171.El
1172.Pp
1173If
1174.Fa name
1175is recognized,
1176.Fa *retval
1177is set to the specified value and zero is returned, otherwise an
1178appropriate error is returned.
1179.It Fn VOP_ADVLOCK "vp" "id" "op" "fl" "flags"
1180Manipulate Advisory record locks on a vnode.
1181The argument
1182.Fa vp
1183is the vnode on which locks are manipulated.
1184The argument
1185.Fa id
1186is the id token which is changing the lock and
1187.Fa op
1188is the
1189.Xr fcntl 2
1190operation to perform.
1191Valid values are:
1192.Pp
1193.Bl -tag -offset indent -width F_UNLCK -compact
1194.It F_SETLK
1195set lock
1196.It F_GETLK
1197get the first conflicted lock
1198.It F_UNLCK
1199clear lock
1200.El
1201.Pp
1202The argument
1203.Fa fl
1204is a description of the lock.
1205In the case of
1206.Dv SEEK_CUR ,
1207The caller should add the current file offset to
1208fl-\*[Gt]l_start beforehand.
1209.Fn VOP_ADVLOCK
1210treats
1211.Dv SEEK_CUR
1212as
1213.Dv SEEK_SET .
1214.Pp
1215The argument
1216.Fa flags
1217is the set of flags.
1218Valid values are:
1219.Pp
1220.Bl -tag -offset indent -width F_FLOCK -compact
1221.It F_WAIT
1222wait until lock is granted
1223.It F_FLOCK
1224use
1225.Xr flock 2
1226semantics for lock
1227.It F_POSIX
1228use POSIX semantics for lock
1229.El
1230.Pp
1231If the operation is successful zero is returned, otherwise an
1232appropriate error is returned.
1233.It Fn VOP_LEASE "vp" "cred" "flags"
1234Validate vnode credentials and operation type.
1235The argument
1236.Fa vp
1237is the locked vnode of the file to validate credentials
1238.Fa cred .
1239The argument
1240.Fa flags
1241specifies the operation flags.
1242If the operation is successful zero is returned, otherwise an
1243appropriate error code is returned.
1244The vnode must be locked on entry and remains locked on return.
1245.It Fn VOP_WHITEOUT "dvp" "cnp" "flags"
1246Whiteout pathname component in directory with vnode
1247.Fa dvp .
1248The argument
1249.Fa cnp
1250specifies the pathname component to whiteout.
1251.It Fn VOP_GETPAGES "vp" "offset" "m" "count" "centeridx" "access_type" "advice" "flags"
1252Read VM pages from file.
1253The argument
1254.Fa vp
1255is the locked vnode to read the VM pages from.
1256The argument
1257.Fa offset
1258is offset in the file to start accessing and
1259.Fa m
1260is an array of VM pages.
1261The argument
1262.Fa count
1263points a variable that specifies the number of pages to read.
1264If the operation is successful zero is returned, otherwise an
1265appropriate error code is returned.
1266If PGO_LOCKED is specified in
1267.Em flags ,
1268.Fn VOP_GETPAGES
1269might return less pages than requested.
1270In that case, the variable pointed to by
1271.Em count
1272will be updated.
1273.Pp
1274This function is primarily used by the page-fault handing mechanism.
1275.It Fn VOP_PUTPAGES "vp" "offlo" "offhi" "flags"
1276Write modified (dirty) VM pages to file.
1277The argument
1278.Fa vp
1279is the vnode to write the VM pages to.
1280The vnode's vm object lock
1281.Va ( v_uobj.vmobjlock )
1282must be held by the caller and will be released upon return.
1283The arguments
1284.Fa offlo
1285and
1286.Fa offhi
1287specify the range of VM pages to write.
1288In case
1289.Fa offhi
1290is given as 0, all pages at and after the start offset
1291.Fa offlo
1292belonging the vnode
1293.Fa vp
1294will be written.
1295The argument
1296.Fa flags
1297controls the behavior of the routine and takes the vm pager's
1298flags
1299.Dv ( PGO_ -prefixed ) .
1300If the operation is successful zero is returned, otherwise an
1301appropriate error code is returned.
1302.Pp
1303The function is primarily used by the pageout handling mechanism and
1304is commonly implemented indirectly
1305by
1306.Fn genfs_putpages
1307with the help of
1308.Fn VOP_STRATEGY
1309and
1310.Fn VOP_BMAP .
1311.It Fn VOP_STRATEGY "vp" "bp"
1312Read/write a file system buffer.
1313The argument
1314.Fa vp
1315is the vnode to read/write to.
1316The argument
1317.Fa bp
1318is the buffer to be read or written.
1319.Fn VOP_STRATEGY
1320will either read or write data to the file depending on the value of
1321.Em bp-\*[Gt]b_flags .
1322If the operation is successful zero is returned, otherwise an
1323appropriate error code is returned.
1324.It Fn VOP_BWRITE "bp"
1325Write a file system buffer.
1326The argument
1327.Fa bp
1328specifies the buffer to be written.
1329If the operation is successful zero is returned, otherwise an
1330appropriate error code is returned.
1331.It Fn VOP_GETEXTATTR "vp" "attrnamespace" "name" "uio" "size" "cred"
1332Get an extended attribute.
1333The argument
1334.Fa vp
1335is the locked vnode of the file or directory from which to retrieve the
1336attribute.
1337The argument
1338.Fa attrnamespace
1339specifies the extended attribute namespace.
1340The argument
1341.Fa name
1342is a nul-terminated character string naming the attribute to retrieve.
1343The argument
1344.Fa uio ,
1345if not
1346.Dv NULL ,
1347specifies where the extended attribute value is to be written.
1348The argument
1349.Fa size ,
1350if not
1351.Dv NULL ,
1352will contain the number of bytes required to read all of
1353the attribute data upon return.
1354In most cases,
1355.Fa uio
1356will be
1357.Dv NULL
1358when
1359.Fa size
1360is not, and vice versa.
1361The argument
1362.Fa cred
1363specifies the user credentials to use when authorizing the request.
1364.It Fn VOP_SETEXTATTR "vp" "attrnamespace" "name" "uio" "cred"
1365Set an extended attribute.
1366The argument
1367.Fa vp
1368is the locked vnode of the file or directory to which to store the
1369attribute.
1370The argument
1371.Fa namespace
1372specifies the extended attribute namespace.
1373The argument
1374.Fa name
1375is a nul-terminated character string naming the attribute to store.
1376The argument
1377.Fa uio
1378specifies the source of the extended attribute data.
1379The argument
1380.Fa cred
1381specifies the user credentials to use when authorizing the request.
1382.It Fn VOP_LISTEXTATTR "vp" "attrnamespace" "uio" "size" "cred"
1383Retrieve the list of extended attributes.
1384The argument
1385.Fa vp
1386is the locked vnode of the file or directory whose attributes are to be listed.
1387The argument
1388.Fa attrnamespace
1389specifies the extended attribute namespace.
1390The argument
1391.Fa uio ,
1392if not
1393.Dv NULL ,
1394specifies where the extended attribute list is to be written.
1395The argument
1396.Fa size ,
1397if not
1398.Dv NULL ,
1399will contain the number of bytes required to read all of
1400the attribute names upon return.
1401In most cases,
1402.Fa uio
1403will be
1404.Dv NULL
1405when
1406.Fa size
1407is not, and vice versa.
1408The argument
1409.Fa cred
1410specifies the user credentials to use when authorizing the request.
1411.El
1412.Sh ERRORS
1413.Bl -tag -width Er
1414.It Bq Er ENOATTR
1415The requested attribute is not defined for this vnode.
1416.It Bq Er ENOTDIR
1417The vnode does not represent a directory.
1418.It Bq Er ENOENT
1419The component was not found in the directory.
1420.It Bq Er ENOSPC
1421The file system is full.
1422.It Bq Er EDQUOT
1423Quota exceeded.
1424.It Bq Er EACCES
1425Access for the specified operation is denied.
1426.It Bq Er EJUSTRETURN
1427A CREATE or RENAME operation would be successful.
1428.It Bq Er EPERM
1429an attempt was made to change an immutable file
1430.It Bq Er ENOTEMPTY
1431attempt to remove a directory which is not empty
1432.It Bq Er EINVAL
1433attempt to read from an illegal offset in the directory; unrecognized
1434input
1435.It Bq Er EIO
1436a read error occurred while reading the directory or reading the
1437contents of a symbolic link
1438.It Bq Er EROFS
1439the file system is read-only
1440.El
1441.Sh SEE ALSO
1442.Xr extattr 9 ,
1443.Xr intro 9 ,
1444.Xr lock 9 ,
1445.Xr namei 9 ,
1446.Xr vattr 9 ,
1447.Xr vfs 9 ,
1448.Xr vfsops 9 ,
1449.Xr vnode 9
1450.Sh HISTORY
1451The vnode operations vector, its functions and the corresponding
1452macros appeared in
1453.Bx 4.3 .
1454