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