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