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