xref: /freebsd-13-stable/sys/kern/vnode_if.src (revision 62ed7f98a2db5018a5336398df37f60cb157ec6d)
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	IN struct thread *td;
196};
197
198
199%% getattr	vp	L L L
200
201vop_getattr {
202	IN struct vnode *vp;
203	OUT struct vattr *vap;
204	IN struct ucred *cred;
205};
206
207
208%% setattr	vp	E E E
209%! setattr	pre	vop_setattr_pre
210%! setattr	post	vop_setattr_post
211
212vop_setattr {
213	IN struct vnode *vp;
214	IN struct vattr *vap;
215	IN struct ucred *cred;
216};
217
218
219%% mmapped	vp	L L L
220
221vop_mmapped {
222	IN struct vnode *vp;
223};
224
225
226%% read		vp	L L L
227%! read		post	vop_read_post
228
229vop_read {
230	IN struct vnode *vp;
231	INOUT struct uio *uio;
232	IN int ioflag;
233	IN struct ucred *cred;
234};
235
236
237%% read_pgcache	vp	- - -
238%! read_pgcache	post	vop_read_pgcache_post
239
240vop_read_pgcache {
241	IN struct vnode *vp;
242	INOUT struct uio *uio;
243	IN int ioflag;
244	IN struct ucred *cred;
245};
246
247
248%% write	vp	L L L
249%! write	pre	VOP_WRITE_PRE
250%! write	post	VOP_WRITE_POST
251
252vop_write {
253	IN struct vnode *vp;
254	INOUT struct uio *uio;
255	IN int ioflag;
256	IN struct ucred *cred;
257};
258
259
260%% ioctl	vp	U U U
261
262vop_ioctl {
263	IN struct vnode *vp;
264	IN u_long command;
265	IN void *data;
266	IN int fflag;
267	IN struct ucred *cred;
268	IN struct thread *td;
269};
270
271
272%% poll		vp	U U U
273
274vop_poll {
275	IN struct vnode *vp;
276	IN int events;
277	IN struct ucred *cred;
278	IN struct thread *td;
279};
280
281
282%% kqfilter	vp	U U U
283
284vop_kqfilter {
285	IN struct vnode *vp;
286	IN struct knote *kn;
287};
288
289
290%% revoke	vp	L L L
291
292vop_revoke {
293	IN struct vnode *vp;
294	IN int flags;
295};
296
297
298%% fsync	vp	- - -
299%! fsync	pre	vop_fsync_debugpre
300%! fsync	post	vop_fsync_debugpost
301
302vop_fsync {
303	IN struct vnode *vp;
304	IN int waitfor;
305	IN struct thread *td;
306};
307
308
309%% remove	dvp	E E E
310%% remove	vp	E E E
311%! remove	pre	vop_remove_pre
312%! remove	post	vop_remove_post
313
314vop_remove {
315	IN struct vnode *dvp;
316	IN struct vnode *vp;
317	IN struct componentname *cnp;
318};
319
320
321%% link		tdvp	E E E
322%% link		vp	E E E
323%! link		pre	vop_link_pre
324%! link		post	vop_link_post
325
326vop_link {
327	IN struct vnode *tdvp;
328	IN struct vnode *vp;
329	IN struct componentname *cnp;
330};
331
332
333%! rename	pre	vop_rename_pre
334%! rename	post	vop_rename_post
335
336vop_rename {
337	IN WILLRELE struct vnode *fdvp;
338	IN WILLRELE struct vnode *fvp;
339	IN struct componentname *fcnp;
340	IN WILLRELE struct vnode *tdvp;
341	IN WILLRELE struct vnode *tvp;
342	IN struct componentname *tcnp;
343};
344
345
346%% mkdir	dvp	E E E
347%% mkdir	vpp	- E -
348%! mkdir	pre	vop_mkdir_pre
349%! mkdir	post	vop_mkdir_post
350%! mkdir	debugpost vop_mkdir_debugpost
351
352vop_mkdir {
353	IN struct vnode *dvp;
354	OUT struct vnode **vpp;
355	IN struct componentname *cnp;
356	IN struct vattr *vap;
357};
358
359
360%% rmdir	dvp	E E E
361%% rmdir	vp	E E E
362%! rmdir	pre	vop_rmdir_pre
363%! rmdir	post	vop_rmdir_post
364
365vop_rmdir {
366	IN struct vnode *dvp;
367	IN struct vnode *vp;
368	IN struct componentname *cnp;
369};
370
371
372%% symlink	dvp	E E E
373%% symlink	vpp	- E -
374%! symlink	pre	vop_symlink_pre
375%! symlink	post	vop_symlink_post
376
377vop_symlink {
378	IN struct vnode *dvp;
379	OUT struct vnode **vpp;
380	IN struct componentname *cnp;
381	IN struct vattr *vap;
382	IN const char *target;
383};
384
385
386%% readdir	vp	L L L
387%! readdir	post	vop_readdir_post
388
389vop_readdir {
390	IN struct vnode *vp;
391	INOUT struct uio *uio;
392	IN struct ucred *cred;
393	INOUT int *eofflag;
394	OUT int *ncookies;
395	INOUT u_long **cookies;
396};
397
398
399%% readlink	vp	L L L
400
401vop_readlink {
402	IN struct vnode *vp;
403	INOUT struct uio *uio;
404	IN struct ucred *cred;
405};
406
407
408%% inactive	vp	E E E
409
410vop_inactive {
411	IN struct vnode *vp;
412};
413
414%! need_inactive	debugpre	vop_need_inactive_debugpre
415%! need_inactive	debugpost	vop_need_inactive_debugpost
416
417vop_need_inactive {
418        IN struct vnode *vp;
419};
420
421%% reclaim	vp	E E E
422%! reclaim	post	vop_reclaim_post
423
424vop_reclaim {
425	IN struct vnode *vp;
426};
427
428
429%! lock1	debugpre	vop_lock_debugpre
430%! lock1	debugpost	vop_lock_debugpost
431
432vop_lock1 {
433	IN struct vnode *vp;
434	IN int flags;
435	IN const char *file;
436	IN int line;
437};
438
439
440%! unlock	debugpre	vop_unlock_debugpre
441
442vop_unlock {
443	IN struct vnode *vp;
444};
445
446
447%% bmap		vp	L L L
448
449vop_bmap {
450	IN struct vnode *vp;
451	IN daddr_t bn;
452	OUT struct bufobj **bop;
453	IN daddr_t *bnp;
454	OUT int *runp;
455	OUT int *runb;
456};
457
458
459%% strategy	vp	L L L
460%! strategy	debugpre	vop_strategy_debugpre
461
462vop_strategy {
463	IN struct vnode *vp;
464	IN struct buf *bp;
465};
466
467
468%% getwritemount vp	= = =
469
470vop_getwritemount {
471	IN struct vnode *vp;
472	OUT struct mount **mpp;
473};
474
475%% getwritevnode vp	= = =
476
477vop_getlowvnode {
478	IN struct vnode *vp;
479	OUT struct vnode **vplp;
480	IN int flags;
481};
482
483%% print	vp	- - -
484
485vop_print {
486	IN struct vnode *vp;
487};
488
489
490%% pathconf	vp	L L L
491
492vop_pathconf {
493	IN struct vnode *vp;
494	IN int name;
495	OUT long *retval;
496};
497
498
499%% advlock	vp	U U U
500
501vop_advlock {
502	IN struct vnode *vp;
503	IN void *id;
504	IN int op;
505	IN struct flock *fl;
506	IN int flags;
507};
508
509
510%% advlockasync	vp	U U U
511
512vop_advlockasync {
513	IN struct vnode *vp;
514	IN void *id;
515	IN int op;
516	IN struct flock *fl;
517	IN int flags;
518	IN struct task *task;
519	INOUT void **cookiep;
520};
521
522
523%% advlockpurge	vp	E E E
524
525vop_advlockpurge {
526	IN struct vnode *vp;
527};
528
529
530%% reallocblks	vp	E E E
531
532vop_reallocblks {
533	IN struct vnode *vp;
534	IN struct cluster_save *buflist;
535};
536
537
538%% getpages	vp	L L L
539
540vop_getpages {
541	IN struct vnode *vp;
542	IN vm_page_t *m;
543	IN int count;
544	IN int *rbehind;
545	IN int *rahead;
546};
547
548
549%% getpages_async	vp	L L L
550
551vop_getpages_async {
552	IN struct vnode *vp;
553	IN vm_page_t *m;
554	IN int count;
555	IN int *rbehind;
556	IN int *rahead;
557	IN vop_getpages_iodone_t *iodone;
558	IN void *arg;
559};
560
561
562%% putpages	vp	L L L
563
564vop_putpages {
565	IN struct vnode *vp;
566	IN vm_page_t *m;
567	IN int count;
568	IN int sync;
569	IN int *rtvals;
570};
571
572
573%% getacl	vp	L L L
574
575vop_getacl {
576	IN struct vnode *vp;
577	IN acl_type_t type;
578	OUT struct acl *aclp;
579	IN struct ucred *cred;
580	IN struct thread *td;
581};
582
583
584%% setacl	vp	E E E
585%! setacl	pre	vop_setacl_pre
586%! setacl	post	vop_setacl_post
587
588vop_setacl {
589	IN struct vnode *vp;
590	IN acl_type_t type;
591	IN struct acl *aclp;
592	IN struct ucred *cred;
593	IN struct thread *td;
594};
595
596
597%% aclcheck	vp	= = =
598
599vop_aclcheck {
600	IN struct vnode *vp;
601	IN acl_type_t type;
602	IN struct acl *aclp;
603	IN struct ucred *cred;
604	IN struct thread *td;
605};
606
607
608%% closeextattr	vp	L L L
609
610vop_closeextattr {
611	IN struct vnode *vp;
612	IN int commit;
613	IN struct ucred *cred;
614	IN struct thread *td;
615};
616
617
618%% getextattr	vp	L L L
619
620vop_getextattr {
621	IN struct vnode *vp;
622	IN int attrnamespace;
623	IN const char *name;
624	INOUT struct uio *uio;
625	OUT size_t *size;
626	IN struct ucred *cred;
627	IN struct thread *td;
628};
629
630
631%% listextattr	vp	L L L
632
633vop_listextattr {
634	IN struct vnode *vp;
635	IN int attrnamespace;
636	INOUT struct uio *uio;
637	OUT size_t *size;
638	IN struct ucred *cred;
639	IN struct thread *td;
640};
641
642
643%% openextattr	vp	L L L
644
645vop_openextattr {
646	IN struct vnode *vp;
647	IN struct ucred *cred;
648	IN struct thread *td;
649};
650
651
652%% deleteextattr	vp	E E E
653%! deleteextattr	pre	vop_deleteextattr_pre
654%! deleteextattr	post	vop_deleteextattr_post
655
656vop_deleteextattr {
657	IN struct vnode *vp;
658	IN int attrnamespace;
659	IN const char *name;
660	IN struct ucred *cred;
661	IN struct thread *td;
662};
663
664
665%% setextattr	vp	E E E
666%! setextattr	pre	vop_setextattr_pre
667%! setextattr	post	vop_setextattr_post
668
669vop_setextattr {
670	IN struct vnode *vp;
671	IN int attrnamespace;
672	IN const char *name;
673	INOUT struct uio *uio;
674	IN struct ucred *cred;
675	IN struct thread *td;
676};
677
678
679%% setlabel	vp	E E E
680
681vop_setlabel {
682	IN struct vnode *vp;
683	IN struct label *label;
684	IN struct ucred *cred;
685	IN struct thread *td;
686};
687
688
689%% vptofh	vp	= = =
690
691vop_vptofh {
692	IN struct vnode *vp;
693	IN struct fid *fhp;
694};
695
696
697%% vptocnp		vp	L L L
698%% vptocnp		vpp	- U -
699
700vop_vptocnp {
701	IN struct vnode *vp;
702	OUT struct vnode **vpp;
703	INOUT char *buf;
704	INOUT size_t *buflen;
705};
706
707
708%% allocate	vp	E E E
709
710vop_allocate {
711	IN struct vnode *vp;
712	INOUT off_t *offset;
713	INOUT off_t *len;
714	IN int ioflag;
715	IN struct ucred *cred;
716};
717
718
719%% advise	vp	U U U
720
721vop_advise {
722	IN struct vnode *vp;
723	IN off_t start;
724	IN off_t end;
725	IN int advice;
726};
727
728
729%% unp_bind	vp	E E E
730
731vop_unp_bind {
732	IN struct vnode *vp;
733	IN struct unpcb *unpcb;
734};
735
736
737%% unp_connect	vp	L L L
738
739vop_unp_connect {
740	IN struct vnode *vp;
741	OUT struct unpcb **unpcb;
742};
743
744
745%% unp_detach	vp	= = =
746
747vop_unp_detach {
748	IN struct vnode *vp;
749};
750
751
752%% is_text	vp	L L L
753
754vop_is_text {
755	IN struct vnode *vp;
756};
757
758
759%% set_text	vp	= = =
760
761vop_set_text {
762	IN struct vnode *vp;
763};
764
765
766%% vop_unset_text	vp	L L L
767
768vop_unset_text {
769	IN struct vnode *vp;
770};
771
772
773%% add_writecount	vp	L L L
774
775vop_add_writecount {
776	IN struct vnode *vp;
777	IN int inc;
778};
779
780
781%% fdatasync	vp	- - -
782%! fdatasync	pre	vop_fdatasync_debugpre
783%! fdatasync	post	vop_fdatasync_debugpost
784
785vop_fdatasync {
786	IN struct vnode *vp;
787	IN struct thread *td;
788};
789
790
791%% copy_file_range	invp	U U U
792%% copy_file_range	outvp	U U U
793
794vop_copy_file_range {
795	IN struct vnode *invp;
796	INOUT off_t *inoffp;
797	IN struct vnode *outvp;
798	INOUT off_t *outoffp;
799	INOUT size_t *lenp;
800	IN unsigned int flags;
801	IN struct ucred *incred;
802	IN struct ucred *outcred;
803	IN struct thread *fsizetd;
804};
805
806
807%% vput_pair	dvp	E - -
808
809vop_vput_pair {
810	IN struct vnode *dvp;
811	INOUT struct vnode **vpp;
812	IN bool unlock_vp;
813};
814
815
816# The VOPs below are spares at the end of the table to allow new VOPs to be
817# added in stable branches without breaking the KBI.  New VOPs in HEAD should
818# be added above these spares.  When merging a new VOP to a stable branch,
819# the new VOP should replace one of the spares.
820
821vop_spare1 {
822	IN struct vnode *vp;
823};
824
825vop_spare2 {
826	IN struct vnode *vp;
827};
828
829vop_spare3 {
830	IN struct vnode *vp;
831};
832
833vop_spare4 {
834	IN struct vnode *vp;
835};
836
837vop_spare5 {
838	IN struct vnode *vp;
839};
840