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