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