xref: /freebsd/sys/kern/vnode_if.src (revision 7899f917b1c0ea178f1d2be0cfb452086d079d23)
1#-
2# Copyright (c) 1992, 1993
3#	The Regents of the University of California.  All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
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.
16#
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
27# SUCH DAMAGE.
28
29#
30# Above each of the vop descriptors in lines starting with %%
31# is a specification of the locking protocol used by each vop call.
32# The first column is the name of the variable, the remaining three
33# columns are in, out and error respectively.  The "in" column defines
34# the lock state on input, the "out" column defines the state on successful
35# return, and the "error" column defines the locking state on error exit.
36#
37# The locking value can take the following values:
38# L: locked; not converted to type of lock.
39# E: locked with exclusive lock for this process.
40# U: unlocked.
41# -: not applicable.  vnode does not yet (or no longer) exists.
42# =: the same on input and output, may be either L or U.
43#
44# The parameter named "vpp" is assumed to be always used with double
45# indirection (**vpp) and that name is hard-coded in vnode_if.awk !
46#
47# Lines starting with %! specify a pre or post-condition function
48# to call before/after the vop call.
49#
50# If other such parameters are introduced, they have to be added to
51# the AWK script at the head of the definition of "add_debug_code()".
52#
53
54vop_islocked {
55	IN struct vnode *vp;
56};
57
58
59%% lookup	dvp	L L L
60%% lookup	vpp	- L -
61
62# XXX - the lookup locking protocol defies simple description and depends
63#	on the flags and operation fields in the (cnp) structure.  Note
64#	especially that *vpp may equal dvp and both may be locked.
65
66vop_lookup {
67	IN struct vnode *dvp;
68	INOUT struct vnode **vpp;
69	IN struct componentname *cnp;
70};
71
72
73%% cachedlookup	dvp	L L L
74%% cachedlookup	vpp	- L -
75
76# This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
77
78vop_cachedlookup {
79	IN struct vnode *dvp;
80	INOUT struct vnode **vpp;
81	IN struct componentname *cnp;
82};
83
84
85%% create	dvp	E E E
86%% create	vpp	- L -
87%! create	pre	vop_create_pre
88%! create	post	vop_create_post
89
90vop_create {
91	IN struct vnode *dvp;
92	OUT struct vnode **vpp;
93	IN struct componentname *cnp;
94	IN struct vattr *vap;
95};
96
97
98%% whiteout	dvp	E E E
99%! whiteout	pre	vop_whiteout_pre
100%! whiteout	post	vop_whiteout_post
101
102vop_whiteout {
103	IN struct vnode *dvp;
104	IN struct componentname *cnp;
105	IN int flags;
106};
107
108
109%% mknod	dvp	E E E
110%% mknod	vpp	- L -
111%! mknod	pre	vop_mknod_pre
112%! mknod	post	vop_mknod_post
113
114vop_mknod {
115	IN struct vnode *dvp;
116	OUT struct vnode **vpp;
117	IN struct componentname *cnp;
118	IN struct vattr *vap;
119};
120
121
122%% open		vp	L L L
123%! open		post	vop_open_post
124
125vop_open {
126	IN struct vnode *vp;
127	IN int mode;
128	IN struct ucred *cred;
129	IN struct thread *td;
130	IN struct file *fp;
131};
132
133
134%% close	vp	L L L
135%! close	post	vop_close_post
136
137vop_close {
138	IN struct vnode *vp;
139	IN int fflag;
140	IN struct ucred *cred;
141	IN struct thread *td;
142};
143
144
145%% fplookup_vexec	vp	- - -
146%! fplookup_vexec	debugpre	vop_fplookup_vexec_debugpre
147%! fplookup_vexec	debugpost	vop_fplookup_vexec_debugpost
148
149vop_fplookup_vexec {
150	IN struct vnode *vp;
151	IN struct ucred *cred;
152};
153
154
155%% fplookup_symlink	vp	- - -
156%! fplookup_symlink	debugpre	vop_fplookup_symlink_debugpre
157%! fplookup_symlink	debugpost	vop_fplookup_symlink_debugpost
158
159vop_fplookup_symlink {
160	IN struct vnode *vp;
161	IN struct cache_fpl *fpl;
162};
163
164
165%% access	vp	L L L
166
167vop_access {
168	IN struct vnode *vp;
169	IN accmode_t accmode;
170	IN struct ucred *cred;
171	IN struct thread *td;
172};
173
174
175%% accessx	vp	L L L
176
177vop_accessx {
178	IN struct vnode *vp;
179	IN accmode_t accmode;
180	IN struct ucred *cred;
181	IN struct thread *td;
182};
183
184
185%% stat	vp	L L L
186
187vop_stat {
188	IN struct vnode *vp;
189	OUT struct stat *sb;
190	IN struct ucred *active_cred;
191	IN struct ucred *file_cred;
192};
193
194
195%% getattr	vp	L L L
196
197vop_getattr {
198	IN struct vnode *vp;
199	OUT struct vattr *vap;
200	IN struct ucred *cred;
201};
202
203
204%% setattr	vp	E E E
205%! setattr	pre	vop_setattr_pre
206%! setattr	post	vop_setattr_post
207
208vop_setattr {
209	IN struct vnode *vp;
210	IN struct vattr *vap;
211	IN struct ucred *cred;
212};
213
214
215%% mmapped	vp	L L L
216
217vop_mmapped {
218	IN struct vnode *vp;
219};
220
221
222%% read		vp	L L L
223%! read		post	vop_read_post
224
225vop_read {
226	IN struct vnode *vp;
227	INOUT struct uio *uio;
228	IN int ioflag;
229	IN struct ucred *cred;
230};
231
232
233%% read_pgcache	vp	- - -
234%! read_pgcache	post	vop_read_pgcache_post
235
236vop_read_pgcache {
237	IN struct vnode *vp;
238	INOUT struct uio *uio;
239	IN int ioflag;
240	IN struct ucred *cred;
241};
242
243
244%% write	vp	L L L
245%! write	pre	VOP_WRITE_PRE
246%! write	post	VOP_WRITE_POST
247
248vop_write {
249	IN struct vnode *vp;
250	INOUT struct uio *uio;
251	IN int ioflag;
252	IN struct ucred *cred;
253};
254
255
256%% ioctl	vp	U U U
257
258vop_ioctl {
259	IN struct vnode *vp;
260	IN u_long command;
261	IN void *data;
262	IN int fflag;
263	IN struct ucred *cred;
264	IN struct thread *td;
265};
266
267
268%% poll		vp	U U U
269
270vop_poll {
271	IN struct vnode *vp;
272	IN int events;
273	IN struct ucred *cred;
274	IN struct thread *td;
275};
276
277
278%% kqfilter	vp	U U U
279
280vop_kqfilter {
281	IN struct vnode *vp;
282	IN struct knote *kn;
283};
284
285
286%% revoke	vp	L L L
287
288vop_revoke {
289	IN struct vnode *vp;
290	IN int flags;
291};
292
293
294%% fsync	vp	- - -
295%! fsync	pre	vop_fsync_debugpre
296%! fsync	post	vop_fsync_debugpost
297
298vop_fsync {
299	IN struct vnode *vp;
300	IN int waitfor;
301	IN struct thread *td;
302};
303
304
305%% remove	dvp	E E E
306%% remove	vp	E E E
307%! remove	pre	vop_remove_pre
308%! remove	post	vop_remove_post
309
310vop_remove {
311	IN struct vnode *dvp;
312	IN struct vnode *vp;
313	IN struct componentname *cnp;
314};
315
316
317%% link		tdvp	E E E
318%% link		vp	E E E
319%! link		pre	vop_link_pre
320%! link		post	vop_link_post
321
322vop_link {
323	IN struct vnode *tdvp;
324	IN struct vnode *vp;
325	IN struct componentname *cnp;
326};
327
328
329%! rename	pre	vop_rename_pre
330%! rename	post	vop_rename_post
331
332vop_rename {
333	IN WILLRELE struct vnode *fdvp;
334	IN WILLRELE struct vnode *fvp;
335	IN struct componentname *fcnp;
336	IN WILLRELE struct vnode *tdvp;
337	IN WILLRELE struct vnode *tvp;
338	IN struct componentname *tcnp;
339};
340
341
342%% mkdir	dvp	E E E
343%% mkdir	vpp	- E -
344%! mkdir	pre	vop_mkdir_pre
345%! mkdir	post	vop_mkdir_post
346%! mkdir	debugpost vop_mkdir_debugpost
347
348vop_mkdir {
349	IN struct vnode *dvp;
350	OUT struct vnode **vpp;
351	IN struct componentname *cnp;
352	IN struct vattr *vap;
353};
354
355
356%% rmdir	dvp	E E E
357%% rmdir	vp	E E E
358%! rmdir	pre	vop_rmdir_pre
359%! rmdir	post	vop_rmdir_post
360
361vop_rmdir {
362	IN struct vnode *dvp;
363	IN struct vnode *vp;
364	IN struct componentname *cnp;
365};
366
367
368%% symlink	dvp	E E E
369%% symlink	vpp	- E -
370%! symlink	pre	vop_symlink_pre
371%! symlink	post	vop_symlink_post
372
373vop_symlink {
374	IN struct vnode *dvp;
375	OUT struct vnode **vpp;
376	IN struct componentname *cnp;
377	IN struct vattr *vap;
378	IN const char *target;
379};
380
381
382%% readdir	vp	L L L
383%! readdir	post	vop_readdir_post
384
385vop_readdir {
386	IN struct vnode *vp;
387	INOUT struct uio *uio;
388	IN struct ucred *cred;
389	INOUT int *eofflag;
390	OUT int *ncookies;
391	INOUT uint64_t **cookies;
392};
393
394
395%% readlink	vp	L L L
396
397vop_readlink {
398	IN struct vnode *vp;
399	INOUT struct uio *uio;
400	IN struct ucred *cred;
401};
402
403
404%% inactive	vp	E E E
405
406vop_inactive {
407	IN struct vnode *vp;
408};
409
410%! need_inactive	debugpre	vop_need_inactive_debugpre
411%! need_inactive	debugpost	vop_need_inactive_debugpost
412
413vop_need_inactive {
414        IN struct vnode *vp;
415};
416
417%% reclaim	vp	E E E
418%! reclaim	post	vop_reclaim_post
419
420vop_reclaim {
421	IN struct vnode *vp;
422};
423
424
425%! lock1	debugpre	vop_lock_debugpre
426%! lock1	debugpost	vop_lock_debugpost
427
428vop_lock1 {
429	IN struct vnode *vp;
430	IN int flags;
431	IN const char *file;
432	IN int line;
433};
434
435
436%! unlock	debugpre	vop_unlock_debugpre
437
438vop_unlock {
439	IN struct vnode *vp;
440};
441
442
443%% bmap		vp	L L L
444
445vop_bmap {
446	IN struct vnode *vp;
447	IN daddr_t bn;
448	OUT struct bufobj **bop;
449	IN daddr_t *bnp;
450	OUT int *runp;
451	OUT int *runb;
452};
453
454
455%% strategy	vp	L L L
456%! strategy	debugpre	vop_strategy_debugpre
457
458vop_strategy {
459	IN struct vnode *vp;
460	IN struct buf *bp;
461};
462
463
464%% getwritemount vp	= = =
465
466vop_getwritemount {
467	IN struct vnode *vp;
468	OUT struct mount **mpp;
469};
470
471%% getwritevnode vp	= = =
472
473vop_getlowvnode {
474	IN struct vnode *vp;
475	OUT struct vnode **vplp;
476	IN int flags;
477};
478
479%% print	vp	- - -
480
481vop_print {
482	IN struct vnode *vp;
483};
484
485
486%% pathconf	vp	L L L
487
488vop_pathconf {
489	IN struct vnode *vp;
490	IN int name;
491	OUT long *retval;
492};
493
494
495%% advlock	vp	U U U
496
497vop_advlock {
498	IN struct vnode *vp;
499	IN void *id;
500	IN int op;
501	IN struct flock *fl;
502	IN int flags;
503};
504
505
506%% advlockasync	vp	U U U
507
508vop_advlockasync {
509	IN struct vnode *vp;
510	IN void *id;
511	IN int op;
512	IN struct flock *fl;
513	IN int flags;
514	IN struct task *task;
515	INOUT void **cookiep;
516};
517
518
519%% advlockpurge	vp	E E E
520
521vop_advlockpurge {
522	IN struct vnode *vp;
523};
524
525
526%% reallocblks	vp	E E E
527
528vop_reallocblks {
529	IN struct vnode *vp;
530	IN struct cluster_save *buflist;
531};
532
533
534%% getpages	vp	L L L
535
536vop_getpages {
537	IN struct vnode *vp;
538	IN vm_page_t *m;
539	IN int count;
540	IN int *rbehind;
541	IN int *rahead;
542};
543
544
545%% getpages_async	vp	L L L
546
547vop_getpages_async {
548	IN struct vnode *vp;
549	IN vm_page_t *m;
550	IN int count;
551	IN int *rbehind;
552	IN int *rahead;
553	IN vop_getpages_iodone_t *iodone;
554	IN void *arg;
555};
556
557
558%% putpages	vp	L L L
559
560vop_putpages {
561	IN struct vnode *vp;
562	IN vm_page_t *m;
563	IN int count;
564	IN int sync;
565	IN int *rtvals;
566};
567
568
569%% getacl	vp	L L L
570
571vop_getacl {
572	IN struct vnode *vp;
573	IN acl_type_t type;
574	OUT struct acl *aclp;
575	IN struct ucred *cred;
576	IN struct thread *td;
577};
578
579
580%% setacl	vp	E E E
581%! setacl	pre	vop_setacl_pre
582%! setacl	post	vop_setacl_post
583
584vop_setacl {
585	IN struct vnode *vp;
586	IN acl_type_t type;
587	IN struct acl *aclp;
588	IN struct ucred *cred;
589	IN struct thread *td;
590};
591
592
593%% aclcheck	vp	= = =
594
595vop_aclcheck {
596	IN struct vnode *vp;
597	IN acl_type_t type;
598	IN struct acl *aclp;
599	IN struct ucred *cred;
600	IN struct thread *td;
601};
602
603
604%% closeextattr	vp	L L L
605
606vop_closeextattr {
607	IN struct vnode *vp;
608	IN int commit;
609	IN struct ucred *cred;
610	IN struct thread *td;
611};
612
613
614%% getextattr	vp	L L L
615
616vop_getextattr {
617	IN struct vnode *vp;
618	IN int attrnamespace;
619	IN const char *name;
620	INOUT struct uio *uio;
621	OUT size_t *size;
622	IN struct ucred *cred;
623	IN struct thread *td;
624};
625
626
627%% listextattr	vp	L L L
628
629vop_listextattr {
630	IN struct vnode *vp;
631	IN int attrnamespace;
632	INOUT struct uio *uio;
633	OUT size_t *size;
634	IN struct ucred *cred;
635	IN struct thread *td;
636};
637
638
639%% openextattr	vp	L L L
640
641vop_openextattr {
642	IN struct vnode *vp;
643	IN struct ucred *cred;
644	IN struct thread *td;
645};
646
647
648%% deleteextattr	vp	E E E
649%! deleteextattr	pre	vop_deleteextattr_pre
650%! deleteextattr	post	vop_deleteextattr_post
651
652vop_deleteextattr {
653	IN struct vnode *vp;
654	IN int attrnamespace;
655	IN const char *name;
656	IN struct ucred *cred;
657	IN struct thread *td;
658};
659
660
661%% setextattr	vp	E E E
662%! setextattr	pre	vop_setextattr_pre
663%! setextattr	post	vop_setextattr_post
664
665vop_setextattr {
666	IN struct vnode *vp;
667	IN int attrnamespace;
668	IN const char *name;
669	INOUT struct uio *uio;
670	IN struct ucred *cred;
671	IN struct thread *td;
672};
673
674
675%% setlabel	vp	E E E
676
677vop_setlabel {
678	IN struct vnode *vp;
679	IN struct label *label;
680	IN struct ucred *cred;
681	IN struct thread *td;
682};
683
684
685%% vptofh	vp	= = =
686
687vop_vptofh {
688	IN struct vnode *vp;
689	IN struct fid *fhp;
690};
691
692
693%% vptocnp		vp	L L L
694%% vptocnp		vpp	- U -
695
696vop_vptocnp {
697	IN struct vnode *vp;
698	OUT struct vnode **vpp;
699	INOUT char *buf;
700	INOUT size_t *buflen;
701};
702
703
704%% allocate	vp	E E E
705
706vop_allocate {
707	IN struct vnode *vp;
708	INOUT off_t *offset;
709	INOUT off_t *len;
710	IN int ioflag;
711	IN struct ucred *cred;
712};
713
714
715%% advise	vp	U U U
716
717vop_advise {
718	IN struct vnode *vp;
719	IN off_t start;
720	IN off_t end;
721	IN int advice;
722};
723
724
725%% unp_bind	vp	E E E
726
727vop_unp_bind {
728	IN struct vnode *vp;
729	IN struct unpcb *unpcb;
730};
731
732
733%% unp_connect	vp	L L L
734
735vop_unp_connect {
736	IN struct vnode *vp;
737	OUT struct unpcb **unpcb;
738};
739
740
741%% unp_detach	vp	= = =
742
743vop_unp_detach {
744	IN struct vnode *vp;
745};
746
747
748%% is_text	vp	L L L
749
750vop_is_text {
751	IN struct vnode *vp;
752};
753
754
755%% set_text	vp	= = =
756
757vop_set_text {
758	IN struct vnode *vp;
759};
760
761
762%% vop_unset_text	vp	L L L
763
764vop_unset_text {
765	IN struct vnode *vp;
766};
767
768
769%% add_writecount	vp	L L L
770
771vop_add_writecount {
772	IN struct vnode *vp;
773	IN int inc;
774};
775
776
777%% fdatasync	vp	- - -
778%! fdatasync	pre	vop_fdatasync_debugpre
779%! fdatasync	post	vop_fdatasync_debugpost
780
781vop_fdatasync {
782	IN struct vnode *vp;
783	IN struct thread *td;
784};
785
786
787%% copy_file_range	invp	U U U
788%% copy_file_range	outvp	U U U
789
790vop_copy_file_range {
791	IN struct vnode *invp;
792	INOUT off_t *inoffp;
793	IN struct vnode *outvp;
794	INOUT off_t *outoffp;
795	INOUT size_t *lenp;
796	IN unsigned int flags;
797	IN struct ucred *incred;
798	IN struct ucred *outcred;
799	IN struct thread *fsizetd;
800};
801
802
803%% vput_pair	dvp	E - -
804
805vop_vput_pair {
806	IN struct vnode *dvp;
807	INOUT struct vnode **vpp;
808	IN bool unlock_vp;
809};
810
811
812%% deallocate	vp	L L L
813
814vop_deallocate {
815	IN struct vnode *vp;
816	INOUT off_t *offset;
817	INOUT off_t *len;
818	IN int flags;
819	IN int ioflag;
820	IN struct ucred *cred;
821};
822
823
824# The VOPs below are spares at the end of the table to allow new VOPs to be
825# added in stable branches without breaking the KBI.  New VOPs in HEAD should
826# be added above these spares.  When merging a new VOP to a stable branch,
827# the new VOP should replace one of the spares.
828
829vop_spare1 {
830	IN struct vnode *vp;
831};
832
833vop_spare2 {
834	IN struct vnode *vp;
835};
836
837vop_spare3 {
838	IN struct vnode *vp;
839};
840
841vop_spare4 {
842	IN struct vnode *vp;
843};
844
845vop_spare5 {
846	IN struct vnode *vp;
847};
848