xref: /openbsd-src/share/man/man9/VOP_LOOKUP.9 (revision 99fd087599a8791921855f21bd7e36130f39aadc)
1.\" $OpenBSD: VOP_LOOKUP.9,v 1.44 2018/10/06 23:08:13 beck Exp $
2.\"
3.\" Copyright (c) 2003 Ted Unangst
4.\" Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd $Mdocdate: October 6 2018 $
28.Dt VOP_LOOKUP 9
29.Os
30.Sh NAME
31.Nm VOP_LOOKUP ,
32.Nm VOP_ABORTOP ,
33.Nm VOP_ACCESS ,
34.Nm VOP_ADVLOCK ,
35.Nm VOP_BMAP ,
36.Nm VOP_BWRITE ,
37.Nm VOP_CLOSE ,
38.Nm VOP_CREATE ,
39.Nm VOP_FSYNC ,
40.Nm VOP_GETATTR ,
41.Nm VOP_INACTIVE ,
42.Nm VOP_IOCTL ,
43.Nm VOP_ISLOCKED ,
44.Nm VOP_KQFILTER ,
45.Nm VOP_LINK ,
46.Nm VOP_LOCK ,
47.Nm VOP_MKDIR ,
48.Nm VOP_MKNOD ,
49.Nm VOP_OPEN ,
50.Nm VOP_PATHCONF ,
51.Nm VOP_POLL ,
52.Nm VOP_PRINT ,
53.Nm VOP_READ ,
54.Nm VOP_READDIR ,
55.Nm VOP_READLINK ,
56.Nm VOP_RECLAIM ,
57.Nm VOP_REMOVE ,
58.Nm VOP_RENAME ,
59.Nm VOP_REVOKE ,
60.Nm VOP_RMDIR ,
61.Nm VOP_SETATTR ,
62.Nm VOP_STRATEGY ,
63.Nm VOP_SYMLINK ,
64.Nm VOP_UNLOCK ,
65.Nm VOP_WRITE
66.Nd vnode operations
67.Sh SYNOPSIS
68.In sys/vnode.h
69.Ft int
70.Fo VOP_ABORTOP
71.Fa "struct vnode *dvp"
72.Fa "struct componentname *cnp"
73.Fc
74.Ft int
75.Fo VOP_ACCESS
76.Fa "struct vnode *vp"
77.Fa "int mode"
78.Fa "struct ucred *cred"
79.Fa "struct proc *p"
80.Fc
81.Ft int
82.Fo VOP_ADVLOCK
83.Fa "struct vnode *vp"
84.Fa "void *id"
85.Fa "int op"
86.Fa "struct flock *fl"
87.Fa "int flags"
88.Fc
89.Ft int
90.Fo VOP_BMAP
91.Fa "struct vnode *vp"
92.Fa "daddr_t bn"
93.Fa "struct vnode **vpp"
94.Fa "daddr_t *bnp"
95.Fa "int *runp"
96.Fc
97.Ft int
98.Fo VOP_BWRITE
99.Fa "struct buf *bp"
100.Fc
101.Ft int
102.Fo VOP_CLOSE
103.Fa "struct vnode *vp"
104.Fa "int fflag"
105.Fa "struct ucred *cred"
106.Fa "struct proc *p"
107.Fc
108.Ft int
109.Fo VOP_CREATE
110.Fa "struct vnode *dvp"
111.Fa "struct vnode **vpp"
112.Fa "struct componentname *cnp"
113.Fa "struct vattr *vap"
114.Fc
115.Ft int
116.Fo VOP_FSYNC
117.Fa "struct vnode *vp"
118.Fa "struct ucred *cred"
119.Fa "int waitfor"
120.Fa "struct proc *p"
121.Fc
122.Ft int
123.Fo VOP_GETATTR
124.Fa "struct vnode *vp"
125.Fa "struct vattr *vap"
126.Fa "struct ucred *cred"
127.Fa "struct proc *p"
128.Fc
129.Ft int
130.Fo VOP_INACTIVE
131.Fa "struct vnode *vp"
132.Fa "struct proc *p"
133.Fc
134.Ft int
135.Fo VOP_IOCTL
136.Fa "struct vnode *vp"
137.Fa "u_long command"
138.Fa "void *data"
139.Fa "int fflag"
140.Fa "struct ucred *cred"
141.Fa "struct proc *p"
142.Fc
143.Ft int
144.Fo VOP_ISLOCKED
145.Fa "struct vnode *vp"
146.Fc
147.Ft int
148.Fo VOP_KQFILTER
149.Fa "struct vnode *vp"
150.Fa "struct knote *kn"
151.Fc
152.Ft int
153.Fo VOP_LINK
154.Fa "struct vnode *dvp"
155.Fa "struct vnode *vp"
156.Fa "struct componentname *cnp"
157.Fc
158.Ft int
159.Fo VOP_LOCK
160.Fa "struct vnode *vp"
161.Fa "int flags"
162.Fc
163.Ft int
164.Fo VOP_LOOKUP
165.Fa "struct vnode *dvp"
166.Fa "struct vnode **vpp"
167.Fa "struct componentname *cnp"
168.Fc
169.Ft int
170.Fo VOP_MKDIR
171.Fa "struct vnode *dvp"
172.Fa "struct vnode **vpp"
173.Fa "struct componentname *cnp"
174.Fa "struct vattr *vap"
175.Fc
176.Ft int
177.Fo VOP_MKNOD
178.Fa "struct vnode *dvp"
179.Fa "struct vnode **vpp"
180.Fa "struct componentname *cnp"
181.Fa "struct vattr *vap"
182.Fc
183.Ft int
184.Fo VOP_OPEN
185.Fa "struct vnode *vp"
186.Fa "int mode"
187.Fa "struct ucred *cred"
188.Fa "struct proc *p"
189.Fc
190.Ft int
191.Fo VOP_PATHCONF
192.Fa "struct vnode *vp"
193.Fa "int name"
194.Fa "register_t *retval"
195.Fc
196.Ft int
197.Fo VOP_POLL
198.Fa "struct vnode *vp"
199.Fa "int fflag"
200.Fa "int events"
201.Fa "struct proc *p"
202.Fc
203.Ft int
204.Fo VOP_PRINT
205.Fa "struct vnode *vp"
206.Fc
207.Ft int
208.Fo VOP_READ
209.Fa "struct vnode *vp"
210.Fa "struct uio *uio"
211.Fa "int ioflag"
212.Fa "struct ucred *cred"
213.Fc
214.Ft int
215.Fo VOP_READDIR
216.Fa "struct vnode *vp"
217.Fa "struct uio *uio"
218.Fa "struct ucred *cred"
219.Fa "int *eofflag"
220.Fc
221.Ft int
222.Fo VOP_READLINK
223.Fa "struct vnode *vp"
224.Fa "struct uio *uio"
225.Fa "struct ucred *cred"
226.Fc
227.Ft int
228.Fo VOP_RECLAIM
229.Fa "struct vnode *vp"
230.Fa "struct proc *p"
231.Fc
232.Ft int
233.Fo VOP_REMOVE
234.Fa "struct vnode *dvp"
235.Fa "struct vnode *vp"
236.Fa "struct componentname *cnp"
237.Fc
238.Ft int
239.Fo VOP_RENAME
240.Fa "struct vnode *fdvp"
241.Fa "struct vnode *fvp"
242.Fa "struct componentname *fcnp"
243.Fa "struct vnode *tdvp"
244.Fa "struct vnode *tvp"
245.Fa "struct componentname *tcnp"
246.Fc
247.Ft int
248.Fo VOP_REVOKE
249.Fa "struct vnode *vp"
250.Fa "int flags"
251.Fc
252.Ft int
253.Fo VOP_RMDIR
254.Fa "struct vnode *dvp"
255.Fa "struct vnode *vp"
256.Fa "struct componentname *cnp"
257.Fc
258.Ft int
259.Fo VOP_SETATTR
260.Fa "struct vnode *vp"
261.Fa "struct vattr *vap"
262.Fa "struct ucred *cred"
263.Fa "struct proc *p"
264.Fc
265.Ft int
266.Fo VOP_STRATEGY
267.Fa "struct buf *bp"
268.Fc
269.Ft int
270.Fo VOP_SYMLINK
271.Fa "struct vnode *dvp"
272.Fa "struct vnode **vpp"
273.Fa "struct componentname *cnp"
274.Fa "struct vattr *vap"
275.Fa "char *target"
276.Fc
277.Ft int
278.Fo VOP_UNLOCK
279.Fa "struct vnode *vp"
280.Fc
281.Ft int
282.Fo VOP_WRITE
283.Fa "struct vnode *vp"
284.Fa "struct uio *uio"
285.Fa "int ioflag"
286.Fa "struct ucred *cred"
287.Fc
288.Sh DESCRIPTION
289The
290.Nm VOP
291functions implement a generic way to perform operations on vnodes.
292The VOP function called passes the arguments to the correct file system
293specific function.
294Not all file systems implement all operations, in which case a generic
295method will be used.
296These functions exist to provide an abstract method to invoke vnode
297operations without needing to know anything about the underlying file system.
298Many system calls map directly to a specific VOP function.
299.Pp
300The arguments for each VOP
301function consist of one or more vnode pointers along with other data
302needed to perform the operation.
303Care must be taken to obey the vnode locking discipline when using
304VOP functions.
305Many VOP calls take a
306.Vt struct proc *p
307argument.
308This should be the current process.
309VOP calls are not safe to call in an interrupt context.
310.Pp
311The
312.Vt vattr
313structure used by
314.Fn VOP_CREATE ,
315.Fn VOP_GETATTR ,
316.Fn VOP_MKDIR ,
317.Fn VOP_MKNOD ,
318.Fn VOP_SETATTR ,
319and
320.Fn VOP_SYMLINK
321is:
322.Bd -literal
323struct vattr {
324	enum vtype      va_type;      /* vnode type */
325	mode_t          va_mode;      /* files access mode and type */
326	nlink_t         va_nlink;     /* number of references */
327	uid_t           va_uid;       /* owner user id */
328	gid_t           va_gid;       /* owner group id */
329	long            va_fsid;      /* file system id */
330	u_quad_t        va_fileid;    /* file id */
331	u_quad_t        va_size;      /* file size in bytes */
332	long            va_blocksize; /* blocksize preferred for i/o */
333	struct timespec va_atime;     /* time of last access */
334	struct timespec va_mtime;     /* time of last modification */
335	struct timespec va_ctime;     /* time file changed */
336	u_long          va_gen;       /* generation number of file */
337	u_long          va_flags;     /* flags defined for file */
338	dev_t           va_rdev;      /* device the vnode represents */
339	u_quad_t        va_bytes;     /* bytes of held disk space */
340	u_quad_t        va_filerev;   /* file modification number */
341	u_int           va_vaflags;   /* operations flags */
342	long            va_spare;     /* remain quad aligned */
343};
344.Ed
345.Pp
346The following sections comment on the VOP functions from the consumer's
347perspective.
348.Pp
349.Bl -tag -width Ds -compact
350.It Fn VOP_ABORTOP dvp cnp
351Abort any asynchronous operations pending on the vnode
352.Fa dvp
353associated with the path name
354.Fa cnp .
355This is mostly used by internal VFS code and should not be needed by
356file system implementors.
357.Pp
358.It Fn VOP_ACCESS vp mode cred p
359Determine if the locked vnode
360.Fa vp
361can be accessed by the calling process
362.Fa p
363with credentials
364.Fa cred
365for the given access
366.Fa mode .
367.Pp
368.Fa mode
369may contain any of the following values:
370.Pp
371.Bl -tag -width Ds -compact -offset indent
372.It Dv VWRITE
373check writeability
374.It Dv VREAD
375check readability
376.It Dv VEXEC
377check executability
378.El
379.Pp
380If the access check succeeds, zero is returned; otherwise, an
381appropriate error code is returned.
382.Pp
383.It Fn VOP_ADVLOCK vp id op fl flags
384Perform advisory locking on the vnode
385.Fa vp
386according to the operation
387.Fa op
388and lock specification
389.Fa fl .
390.Fa id
391identifies the resource holding the lock
392(typically a pointer to the holding process).
393.Pp
394.Fa op
395may be one of the following operations:
396.Pp
397.Bl -tag -width F_GETLK -compact -offset indent
398.It Dv F_GETLK
399Get the first lock that would block a lock request.
400.It Dv F_SETLK
401Set a lock.
402.It Dv F_UNLCK
403Release a lock.
404.El
405.Pp
406.Fa flags
407may contain the following flags:
408.Pp
409.Bl -tag -width F_POSIX -compact -offset indent
410.It Dv F_WAIT
411If required, block waiting to obtain an exclusive lock.
412.It Dv F_POSIX
413Follow POSIX locking semantics; see
414.Xr fcntl 2 .
415.It Dv F_FLOCK
416Follow
417.Xr flock 2
418locking semantics.
419.El
420.Pp
421Upon success, zero is returned; otherwise, an appropriate error code is
422returned.
423.Pp
424.It Fn VOP_BMAP vp bn vpp bnp runp
425Convert the logical block number
426.Fa bn
427of the file the locked vnode
428.Fa vp
429is associated with its physical number on-disk.
430The physical block number is stored in
431.Fa *bnp
432on return.
433.Fa vpp ,
434if
435.No non- Ns Dv NULL ,
436will be updated to point to the vnode of the block device of which
437.Fa vp
438is associated.
439.Fa runp ,
440if
441.No non- Ns Dv NULL ,
442will be updated to the number of contiguous disk blocks following
443.Fa *bnp .
444Upon success, zero is returned; otherwise, an appropriate error code is
445returned.
446.Pp
447.It Fn VOP_BWRITE bp
448Write a file system buffer to disk.
449Upon success, zero is returned; otherwise, an appropriate error code is
450returned.
451.Pp
452.It Fn VOP_CLOSE vp fflag cred p
453Close the file associated with the locked vnode
454.Fa vp
455with file flags
456.Fa fflag
457by the calling process
458.Fa p
459with credentials
460.Fa cred .
461This operation should be performed only when the file is no longer being
462used.
463Upon success, zero is returned; otherwise, an appropriate error code is
464returned.
465.Pp
466.It Fn VOP_CREATE dvp vpp cnp vap
467Create a new directory entry for a regular file in the directory
468.Fa dvp
469and return a locked, referenced vnode in
470.Fa vpp .
471The file name is in
472.Fa cnp
473and its permissions will be
474.Fa vap .
475.Fa dvp
476must be locked.
477.Pp
478.It Fn VOP_FSYNC vp cred waitfor p
479Flush any dirty buffers associated with
480.Fa vp
481to disk.
482The vnode is locked on entry and exit.
483.Fa waitfor
484can be set to
485.Dv MNT_WAIT
486to indicate that
487.Fn VOP_FSYNC
488should not return until all data is written.
489.Pp
490.It Fn VOP_GETATTR vp vap cred p
491.It Fn VOP_SETATTR vp vap cred p
492Access the vnode attributes
493.Fa vap
494of the vnode
495.Fa vp
496by the calling process
497.Fa p
498with credentials
499.Fa cred .
500.Fn VOP_SETATTR
501requires that
502.Fa vp
503be locked.
504A field value for any member of
505.Fa vap
506of
507.Dv VNOVAL
508represents that the information could not be obtained by
509.Fn VOP_GETATTR
510or should not be changed by
511.Fn VOP_SETATTR .
512Upon success of obtaining or changing the attributes, zero is returned;
513otherwise, an appropriate error code is returned.
514All attributes are held in the
515.Vt vattr
516structure shown above.
517.Pp
518.It Fn VOP_INACTIVE vp p
519Notify the underlying file system that the locked vnode
520.Fa vp
521is no longer in use.
522The vnode will be unlocked upon return.
523.Fa p
524specifies the calling process.
525This may happen when the vnode reference count reaches zero or
526when the underlying file system has disappeared or has been forcibly
527unmounted.
528.Pp
529Typically, the underlying file system will write any buffers associated
530with
531.Fa vp
532to disk or delete the file entry, if need be.
533The underlying file system may not necessarily release any buffers
534associated with
535.Fa vp
536so that it can be immediately reactivated in case the file is used again.
537Upon success, zero is returned; otherwise, an appropriate error code is
538returned.
539.Pp
540.It Fn VOP_IOCTL vp command data fflag cred p
541Perform the control operation
542.Fa command
543with additional information
544.Fa data
545on the vnode
546.Fa vp ,
547normally associated with a device,
548with file flags
549.Fa fflag
550by the calling process
551.Fa p
552with credentials
553.Fa cred .
554Upon success, zero is returned; otherwise, an appropriate error code is
555returned.
556.Pp
557.It Fn VOP_ISLOCKED vp
558.It Fn VOP_LOCK vp flags
559.It Fn VOP_UNLOCK vp
560.Fn VOP_LOCK
561is used internally by
562.Xr vn_lock 9
563to lock a vnode.
564It should not be used by other file system code.
565.Fn VOP_UNLOCK
566unlocks a vnode.
567Note the asymmetry between
568.Xr vn_lock 9
569and
570.Fn VOP_UNLOCK .
571.Pp
572.Fa flags
573may contain the following flags:
574.Pp
575.Bl -tag -width LK_RECURSEFAIL -compact -offset indent
576.It Dv LK_EXCLUSIVE
577Acquire an exclusive lock.
578.It Dv LK_SHARED
579Acquire a shared lock.
580.It Dv LK_NOWAIT
581Don't wait if the vnode lock is held by someone else
582(may still wait on reclamation lock).
583.It Dv LK_RECURSEFAIL
584Attempt at recursive lock fails.
585.It Dv LK_DRAIN
586Used to mean something else, but is now used abused as a flag to avoid a lock
587inversion deadlock in deadfs.
588Do not use this, it must die.
589.El
590.Pp
591.Fn VOP_ISLOCKED
592returns one of the following values:
593.Pp
594.Bl -tag -width LK_EXCLUSIVE -compact -offset indent
595.It Dv LK_EXCLUSIVE
596.Fa vp
597is locked for exclusive access by the calling thread.
598.It Dv LK_EXCLOTHER
599.Fa vp
600is locked for exclusive access by a different thread.
601.It Dv LK_SHARED
602.Fa vp
603is locked for shared access.
604The current thread may be one of the threads that have it locked.
605.It 0
606.Fa vp
607is not locked.
608.El
609.Pp
610.Fn VOP_ISLOCKED
611should be used cautiously, as not all file systems implement locks
612effectively.
613.Pp
614.It Fn VOP_KQFILTER vp kn
615Register the
616.Xr knote 9
617filtering information
618.Fa kn
619for the vnode
620.Fa vp .
621Only filters for
622.Dv EVFILT_READ ,
623.Dv EVFILT_WRITE ,
624and
625.Dv EVFILT_VNODE
626will invoke this operation.
627Upon success, zero is returned; otherwise, a non-zero value is returned.
628.Pp
629.It Fn VOP_LINK dvp vp cnp
630Increase the link count for the vnode
631.Fa vp .
632A new entry with name
633.Fa cnp
634should be added to the directory
635.Fa dvp .
636.Fa dvp
637is locked on entry and unlocked on exit.
638.Pp
639.It Fn VOP_LOOKUP dvp vpp cnp
640Find the file corresponding to the name
641.Fa cnp
642in the directory
643.Fa dvp
644and return a vnode in
645.Fa vpp .
646.Fa dvp
647must be locked and referenced on entry with
648.Xr vget 9 .
649On a successful return,
650.Fa vpp
651will be returned locked and referenced, and
652.Fa dvp
653will return with the same reference count, but may be returned locked
654or unlocked depending on the specific flags used in
655.Fa cnp->cn_flags .
656On error
657.Fa vpp
658will be
659.Dv NULL
660and
661.Fa cnp->cn_flags
662will be set to
663.Dv PDIRUNLOCK
664if
665.Fa dvp
666has been unlocked.
667.Pp
668.It Fn VOP_MKDIR dvp vpp cnp vap
669Create a new directory named by
670.Fa cnp
671with permissions
672.Fa vattr
673in the directory
674.Fa dvp .
675On success, the new vnode is returned locked in
676.Fa vpp .
677.Fa dvp
678must be locked on entry and is unlocked on exit.
679.Pp
680.It Fn VOP_MKNOD dvp vpp cnp vap
681Create a device special file with name
682.Fa cnp
683and attributes
684.Fa vap
685in the directory associated with the locked vnode
686.Fa dvp .
687A pointer to the new, locked vnode will be returned in
688.Fa *vpp
689if
690.Fa vpp
691is not
692.Dv NULL .
693Upon success, zero is returned; otherwise, an appropriate error code is
694returned.
695.Pp
696.It Fn VOP_OPEN vp mode cred p
697Open the file associated with the vnode
698.Fa vp
699with the access modes
700.Fa mode
701by the calling process
702.Fa p
703with credentials
704.Fa cred .
705.Fa mode
706takes the flags described in
707.Xr open 2 .
708.Pp
709For some underlying file systems, access permissions for the file by the
710process are checked; for others, this is a no-op.
711In any case, this must be called before a process can access the file.
712Upon success, zero is returned; otherwise, an appropriate error code is
713returned.
714.Pp
715.It Fn VOP_PATHCONF vp name retval
716Obtain the value of the applicable POSIX configurable pathname variable (see
717.Xr pathconf 2 )
718specified by
719.Fa name
720from the locked vnode
721.Fa vp .
722The result is placed in
723.Fa *retval .
724Upon success, zero is returned; otherwise, an appropriate error code is
725returned.
726.Pp
727.It Fn VOP_POLL vp fflag events p
728Determine whether the vnode
729.Fa vp
730is ready to perform the operations specified by
731.Fa events
732(see
733.Xr poll 2 )
734with file flags
735.Fa fflag
736for the calling process
737.Fa p .
738The
739.Fn selrecord
740routine may be used to detect selection collisions for multiple
741processes sleeping on the same file, waiting for I/O
742to become possible, although all file systems currently assume that
743I/O is always possible.
744The return value specifies which operations from
745.Fa events
746were found to be ready, which may be performed without the need for
747blocking.
748.Pp
749.It Fn VOP_PRINT vp
750Print information about the vnode to the kernel message buffer.
751It is not used normally, but exists only for debugging purposes.
752.Pp
753.It Fn VOP_READ vp uio ioflag cred
754Copy data from the locked vnode
755.Fa vp
756to the buffers specified by
757.Fa uio
758with calling process credentials
759.Fa cred .
760.Pp
761.Fa ioflag
762may contain the following flags:
763.Pp
764.Bl -tag -width IO_APPEND -offset indent -compact
765.It Dv IO_NDELAY
766Non-blocking I/O.
767.It Dv IO_UNIT
768Do I/O as an atomic unit.
769.El
770.Pp
771Upon success, zero is returned; otherwise, an appropriate error code is
772returned.
773.Pp
774.It Fn VOP_READDIR vp uio cred eofflag
775Read the contents of the directory associated with the locked vnode
776.Fa vp ,
777usually via
778.Fn VOP_READ ,
779and convert its file-system-specific format to that expected by the
780.Xr getdents 2
781system call, storing the result into the buffers specified by
782.Fa uio .
783.Fa cred
784specifies the credentials of the calling process.
785.Fa *eofflag
786is set to a non-zero value on return once successful end-of-file for the
787directory contents has been reached.
788.Pp
789Upon success, zero is returned; otherwise, an appropriate error code is
790returned.
791.Pp
792.It Fn VOP_READLINK vp uio cred
793Read a symbolic link and return the target's name in
794.Fa uio .
795.Fa vp
796is locked on entry and exit and must be a symlink.
797.Pp
798.It Fn VOP_RECLAIM vp p
799Used by
800.Xr vclean 9
801so that the file system has an opportunity to free memory
802and perform any other cleanup activity related to
803.Fa vp .
804.Fa vp
805is unlocked on entry and exit.
806.Fn VOP_RECLAIM
807should not be used by generic code.
808.Pp
809.It Fn VOP_REMOVE dvp vp cnp
810Remove the link named
811.Fa cnp
812from the directory
813.Fa dvp .
814This file corresponds to the vnode
815.Fa vp .
816Both
817.Fa dvp
818and
819.Fa vp
820are locked on entry and unlocked on exit, and
821each has its reference count decremented by one.
822.Fn VOP_REMOVE
823does not delete the file from disk unless its link count
824becomes zero (for file systems which support multiple links).
825.Pp
826.It Fn VOP_RENAME fdvp fvp fcnp tdvp tvp tcnp
827Remove the link to the file with associated vnode
828.Fa fvp
829and name
830.Fa fcnp
831in the directory with associated vnode
832.Fa fdvp ,
833and create a new link to the file with name
834.Fa tcnp
835(and associated locked vnode
836.Fa tvp ,
837if the file already exists) residing in the directory with the
838associated locked vnode
839.Fa tdvp .
840.Fa fdvp ,
841.Fa fvp ,
842and
843.Fa tvp
844(if not
845.Dv NULL )
846will be released (see
847.Xr vrele 9 )
848and
849.Fa tdvp
850will have its reference count decremented (see
851.Xr vput 9 )
852on return.
853If not
854.Dv NULL ,
855.Fa tvp
856will be unlocked on return (see
857.Xr vput 9 ) .
858Upon success, zero is returned; otherwise, an appropriate error code is
859returned.
860.Pp
861.It Fn VOP_REVOKE vp flags
862Used by the
863.Xr revoke 2
864system call to prevent any further access to a vnode.
865The vnode ops will be changed to those of deadfs, which returns only
866errors.
867.Ar vp
868must be unlocked.
869.Pp
870.It Fn VOP_RMDIR dvp vp cnp
871Remove the directory
872.Fa vp
873from the directory
874.Fa dvp .
875Both are locked on entry and unlocked on exit.
876The name of the directory for removal is additionally contained in
877.Fa cnp .
878.Pp
879.It Fn VOP_STRATEGY bp
880Call the appropriate strategy function for the device backing the
881buffer's vnode.
882.Pp
883.It Fn VOP_SYMLINK dvp vpp cnp vap target
884Create a symbolic link with name
885.Fa cnp
886in the directory
887.Fa dvp
888with mode
889.Fa vap .
890The link will point to
891.Fa target
892and a vnode for it is returned in
893.Fa vpp .
894The directory vnode is locked on entry and unlocked on exit.
895Note that unlike most VOP calls returning a vnode,
896.Fn VOP_SYMLINK
897does not lock or reference
898.Fa vpp .
899.Pp
900.It Fn VOP_WRITE vp uio ioflag cred
901Copy data from the buffers specified by
902.Fa uio
903to the locked vnode
904.Fa vp
905with calling process credentials
906.Fa cred .
907.Pp
908.Fa ioflag
909may contain the following flags:
910.Pp
911.Bl -tag -width IO_APPEND -offset indent -compact
912.It Dv IO_APPEND
913Perform write at the end of file.
914.It Dv IO_NDELAY
915Non-blocking I/O.
916.It Dv IO_SYNC
917Wait for I/O to complete.
918.It Dv IO_UNIT
919Do I/O as an atomic unit.
920.El
921.Pp
922Upon success, zero is returned; otherwise, an appropriate error code is
923returned.
924.El
925.Sh RETURN VALUES
926The
927.Nm VOP
928functions return 0 to indicate success and a non-zero error code
929to indicate failure.
930.Sh SEE ALSO
931.Xr errno 2 ,
932.Xr uiomove 9 ,
933.Xr vfs 9 ,
934.Xr vn_lock 9 ,
935.Xr vnode 9
936.Sh AUTHORS
937This man page was written by
938.An Ted Unangst
939for
940.Ox .
941.Sh BUGS
942The locking discipline is too complex.
943Refer to
944.Xr vn_lock 9 .
945