2 # Copyright (c) 1992, 1993
3 # The Regents of the University of California. All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
13 # 3. Neither the name of the University nor the names of its contributors
14 # may be used to endorse or promote products derived from this software
15 # without specific prior written permission.
17 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 # @(#)vnode_if.src 8.12 (Berkeley) 5/14/95
34 # Above each of the vop descriptors in lines starting with %%
35 # is a specification of the locking protocol used by each vop call.
36 # The first column is the name of the variable, the remaining three
37 # columns are in, out and error respectively. The "in" column defines
38 # the lock state on input, the "out" column defines the state on successful
39 # return, and the "error" column defines the locking state on error exit.
41 # The locking value can take the following values:
42 # L: locked; not converted to type of lock.
43 # E: locked with exclusive lock for this process.
45 # -: not applicable. vnode does not yet (or no longer) exists.
46 # =: the same on input and output, may be either L or U.
48 # The parameter named "vpp" is assumed to be always used with double
49 # indirection (**vpp) and that name is hard-coded in vnode_if.awk !
51 # Lines starting with %! specify a pre or post-condition function
52 # to call before/after the vop call.
54 # If other such parameters are introduced, they have to be added to
55 # the AWK script at the head of the definition of "add_debug_code()".
66 # XXX - the lookup locking protocol defies simple description and depends
67 # on the flags and operation fields in the (cnp) structure. Note
68 # especially that *vpp may equal dvp and both may be locked.
72 INOUT struct vnode **vpp;
73 IN struct componentname *cnp;
77 %% cachedlookup dvp L L L
78 %% cachedlookup vpp - L -
80 # This must be an exact copy of lookup. See kern/vfs_cache.c for details.
84 INOUT struct vnode **vpp;
85 IN struct componentname *cnp;
91 %! create pre vop_create_pre
92 %! create post vop_create_post
96 OUT struct vnode **vpp;
97 IN struct componentname *cnp;
102 %% whiteout dvp E E E
103 %! whiteout pre vop_whiteout_pre
104 %! whiteout post vop_whiteout_post
107 IN struct vnode *dvp;
108 IN struct componentname *cnp;
115 %! mknod pre vop_mknod_pre
116 %! mknod post vop_mknod_post
119 IN struct vnode *dvp;
120 OUT struct vnode **vpp;
121 IN struct componentname *cnp;
122 IN struct vattr *vap;
127 %! open post vop_open_post
132 IN struct ucred *cred;
133 IN struct thread *td;
139 %! close post vop_close_post
144 IN struct ucred *cred;
145 IN struct thread *td;
149 %% fplookup_vexec vp - - -
150 %! fplookup_vexec debugpre vop_fplookup_vexec_debugpre
151 %! fplookup_vexec debugpost vop_fplookup_vexec_debugpost
155 IN struct ucred *cred;
159 %% fplookup_symlink vp - - -
160 %! fplookup_symlink debugpre vop_fplookup_symlink_debugpre
161 %! fplookup_symlink debugpost vop_fplookup_symlink_debugpost
163 vop_fplookup_symlink {
165 IN struct cache_fpl *fpl;
173 IN accmode_t accmode;
174 IN struct ucred *cred;
175 IN struct thread *td;
183 IN accmode_t accmode;
184 IN struct ucred *cred;
185 IN struct thread *td;
194 IN struct ucred *active_cred;
195 IN struct ucred *file_cred;
196 IN struct thread *td;
204 OUT struct vattr *vap;
205 IN struct ucred *cred;
210 %! setattr pre vop_setattr_pre
211 %! setattr post vop_setattr_post
215 IN struct vattr *vap;
216 IN struct ucred *cred;
228 %! read post vop_read_post
232 INOUT struct uio *uio;
234 IN struct ucred *cred;
238 %% read_pgcache vp - - -
239 %! read_pgcache post vop_read_pgcache_post
243 INOUT struct uio *uio;
245 IN struct ucred *cred;
250 %! write pre VOP_WRITE_PRE
251 %! write post VOP_WRITE_POST
255 INOUT struct uio *uio;
257 IN struct ucred *cred;
268 IN struct ucred *cred;
269 IN struct thread *td;
278 IN struct ucred *cred;
279 IN struct thread *td;
300 %! fsync pre vop_fsync_debugpre
301 %! fsync post vop_fsync_debugpost
306 IN struct thread *td;
312 %! remove pre vop_remove_pre
313 %! remove post vop_remove_post
316 IN struct vnode *dvp;
318 IN struct componentname *cnp;
324 %! link pre vop_link_pre
325 %! link post vop_link_post
328 IN struct vnode *tdvp;
330 IN struct componentname *cnp;
334 %! rename pre vop_rename_pre
335 %! rename post vop_rename_post
338 IN WILLRELE struct vnode *fdvp;
339 IN WILLRELE struct vnode *fvp;
340 IN struct componentname *fcnp;
341 IN WILLRELE struct vnode *tdvp;
342 IN WILLRELE struct vnode *tvp;
343 IN struct componentname *tcnp;
349 %! mkdir pre vop_mkdir_pre
350 %! mkdir post vop_mkdir_post
351 %! mkdir debugpost vop_mkdir_debugpost
354 IN struct vnode *dvp;
355 OUT struct vnode **vpp;
356 IN struct componentname *cnp;
357 IN struct vattr *vap;
363 %! rmdir pre vop_rmdir_pre
364 %! rmdir post vop_rmdir_post
367 IN struct vnode *dvp;
369 IN struct componentname *cnp;
375 %! symlink pre vop_symlink_pre
376 %! symlink post vop_symlink_post
379 IN struct vnode *dvp;
380 OUT struct vnode **vpp;
381 IN struct componentname *cnp;
382 IN struct vattr *vap;
383 IN const char *target;
388 %! readdir post vop_readdir_post
392 INOUT struct uio *uio;
393 IN struct ucred *cred;
396 INOUT u_long **cookies;
404 INOUT struct uio *uio;
405 IN struct ucred *cred;
415 %! need_inactive debugpre vop_need_inactive_debugpre
416 %! need_inactive debugpost vop_need_inactive_debugpost
423 %! reclaim post vop_reclaim_post
430 %! lock1 debugpre vop_lock_debugpre
431 %! lock1 debugpost vop_lock_debugpost
441 %! unlock debugpre vop_unlock_debugpre
453 OUT struct bufobj **bop;
461 %! strategy debugpre vop_strategy_debugpre
469 %% getwritemount vp = = =
473 OUT struct mount **mpp;
504 %% advlockasync vp U U U
512 IN struct task *task;
513 INOUT void **cookiep;
517 %% advlockpurge vp E E E
524 %% reallocblks vp E E E
528 IN struct cluster_save *buflist;
543 %% getpages_async vp L L L
551 IN vop_getpages_iodone_t *iodone;
572 OUT struct acl *aclp;
573 IN struct ucred *cred;
574 IN struct thread *td;
579 %! setacl pre vop_setacl_pre
580 %! setacl post vop_setacl_post
586 IN struct ucred *cred;
587 IN struct thread *td;
597 IN struct ucred *cred;
598 IN struct thread *td;
602 %% closeextattr vp L L L
607 IN struct ucred *cred;
608 IN struct thread *td;
612 %% getextattr vp L L L
616 IN int attrnamespace;
618 INOUT struct uio *uio;
620 IN struct ucred *cred;
621 IN struct thread *td;
625 %% listextattr vp L L L
629 IN int attrnamespace;
630 INOUT struct uio *uio;
632 IN struct ucred *cred;
633 IN struct thread *td;
637 %% openextattr vp L L L
641 IN struct ucred *cred;
642 IN struct thread *td;
646 %% deleteextattr vp E E E
647 %! deleteextattr pre vop_deleteextattr_pre
648 %! deleteextattr post vop_deleteextattr_post
652 IN int attrnamespace;
654 IN struct ucred *cred;
655 IN struct thread *td;
659 %% setextattr vp E E E
660 %! setextattr pre vop_setextattr_pre
661 %! setextattr post vop_setextattr_post
665 IN int attrnamespace;
667 INOUT struct uio *uio;
668 IN struct ucred *cred;
669 IN struct thread *td;
677 IN struct label *label;
678 IN struct ucred *cred;
679 IN struct thread *td;
696 OUT struct vnode **vpp;
698 INOUT size_t *buflen;
709 IN struct ucred *cred;
727 IN struct unpcb *unpcb;
731 %% unp_connect vp L L L
735 OUT struct unpcb **unpcb;
739 %% unp_detach vp = = =
760 %% vop_unset_text vp L L L
767 %% add_writecount vp L L L
775 %% fdatasync vp - - -
776 %! fdatasync pre vop_fdatasync_debugpre
777 %! fdatasync post vop_fdatasync_debugpost
781 IN struct thread *td;
785 %% copy_file_range invp U U U
786 %% copy_file_range outvp U U U
788 vop_copy_file_range {
789 IN struct vnode *invp;
791 IN struct vnode *outvp;
792 INOUT off_t *outoffp;
794 IN unsigned int flags;
795 IN struct ucred *incred;
796 IN struct ucred *outcred;
797 IN struct thread *fsizetd;
801 %% vput_pair dvp E - -
804 IN struct vnode *dvp;
805 INOUT struct vnode **vpp;
810 # The VOPs below are spares at the end of the table to allow new VOPs to be
811 # added in stable branches without breaking the KBI. New VOPs in HEAD should
812 # be added above these spares. When merging a new VOP to a stable branch,
813 # the new VOP should replace one of the spares.