xref: /freebsd/sys/kern/vnode_if.src (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
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# $FreeBSD$
31#
32
33#
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.
40#
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.
44# U: unlocked.
45# -: not applicable.  vnode does not yet (or no longer) exists.
46# =: the same on input and output, may be either L or U.
47#
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 !
50#
51# Lines starting with %! specify a pre or post-condition function
52# to call before/after the vop call.
53#
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()".
56#
57
58vop_islocked {
59	IN struct vnode *vp;
60};
61
62
63%% lookup	dvp	L L L
64%% lookup	vpp	- L -
65
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.
69
70vop_lookup {
71	IN struct vnode *dvp;
72	INOUT struct vnode **vpp;
73	IN struct componentname *cnp;
74};
75
76
77%% cachedlookup	dvp	L L L
78%% cachedlookup	vpp	- L -
79
80# This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
81
82vop_cachedlookup {
83	IN struct vnode *dvp;
84	INOUT struct vnode **vpp;
85	IN struct componentname *cnp;
86};
87
88
89%% create	dvp	E E E
90%% create	vpp	- L -
91%! create	pre	vop_create_pre
92%! create	post	vop_create_post
93
94vop_create {
95	IN struct vnode *dvp;
96	OUT struct vnode **vpp;
97	IN struct componentname *cnp;
98	IN struct vattr *vap;
99};
100
101
102%% whiteout	dvp	E E E
103%! whiteout	pre	vop_whiteout_pre
104%! whiteout	post	vop_whiteout_post
105
106vop_whiteout {
107	IN struct vnode *dvp;
108	IN struct componentname *cnp;
109	IN int flags;
110};
111
112
113%% mknod	dvp	E E E
114%% mknod	vpp	- L -
115%! mknod	pre	vop_mknod_pre
116%! mknod	post	vop_mknod_post
117
118vop_mknod {
119	IN struct vnode *dvp;
120	OUT struct vnode **vpp;
121	IN struct componentname *cnp;
122	IN struct vattr *vap;
123};
124
125
126%% open		vp	L L L
127%! open		post	vop_open_post
128
129vop_open {
130	IN struct vnode *vp;
131	IN int mode;
132	IN struct ucred *cred;
133	IN struct thread *td;
134	IN struct file *fp;
135};
136
137
138%% close	vp	L L L
139%! close	post	vop_close_post
140
141vop_close {
142	IN struct vnode *vp;
143	IN int fflag;
144	IN struct ucred *cred;
145	IN struct thread *td;
146};
147
148
149%% fplookup_vexec	vp	- - -
150%! fplookup_vexec	debugpre	vop_fplookup_vexec_debugpre
151%! fplookup_vexec	debugpost	vop_fplookup_vexec_debugpost
152
153vop_fplookup_vexec {
154	IN struct vnode *vp;
155	IN struct ucred *cred;
156};
157
158
159%% fplookup_symlink	vp	- - -
160%! fplookup_symlink	debugpre	vop_fplookup_symlink_debugpre
161%! fplookup_symlink	debugpost	vop_fplookup_symlink_debugpost
162
163vop_fplookup_symlink {
164	IN struct vnode *vp;
165	IN struct cache_fpl *fpl;
166};
167
168
169%% access	vp	L L L
170
171vop_access {
172	IN struct vnode *vp;
173	IN accmode_t accmode;
174	IN struct ucred *cred;
175	IN struct thread *td;
176};
177
178
179%% accessx	vp	L L L
180
181vop_accessx {
182	IN struct vnode *vp;
183	IN accmode_t accmode;
184	IN struct ucred *cred;
185	IN struct thread *td;
186};
187
188
189%% stat	vp	L L L
190
191vop_stat {
192	IN struct vnode *vp;
193	OUT struct stat *sb;
194	IN struct ucred *active_cred;
195	IN struct ucred *file_cred;
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 uint64_t **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
476%% print	vp	- - -
477
478vop_print {
479	IN struct vnode *vp;
480};
481
482
483%% pathconf	vp	L L L
484
485vop_pathconf {
486	IN struct vnode *vp;
487	IN int name;
488	OUT long *retval;
489};
490
491
492%% advlock	vp	U U U
493
494vop_advlock {
495	IN struct vnode *vp;
496	IN void *id;
497	IN int op;
498	IN struct flock *fl;
499	IN int flags;
500};
501
502
503%% advlockasync	vp	U U U
504
505vop_advlockasync {
506	IN struct vnode *vp;
507	IN void *id;
508	IN int op;
509	IN struct flock *fl;
510	IN int flags;
511	IN struct task *task;
512	INOUT void **cookiep;
513};
514
515
516%% advlockpurge	vp	E E E
517
518vop_advlockpurge {
519	IN struct vnode *vp;
520};
521
522
523%% reallocblks	vp	E E E
524
525vop_reallocblks {
526	IN struct vnode *vp;
527	IN struct cluster_save *buflist;
528};
529
530
531%% getpages	vp	L L L
532
533vop_getpages {
534	IN struct vnode *vp;
535	IN vm_page_t *m;
536	IN int count;
537	IN int *rbehind;
538	IN int *rahead;
539};
540
541
542%% getpages_async	vp	L L L
543
544vop_getpages_async {
545	IN struct vnode *vp;
546	IN vm_page_t *m;
547	IN int count;
548	IN int *rbehind;
549	IN int *rahead;
550	IN vop_getpages_iodone_t *iodone;
551	IN void *arg;
552};
553
554
555%% putpages	vp	L L L
556
557vop_putpages {
558	IN struct vnode *vp;
559	IN vm_page_t *m;
560	IN int count;
561	IN int sync;
562	IN int *rtvals;
563};
564
565
566%% getacl	vp	L L L
567
568vop_getacl {
569	IN struct vnode *vp;
570	IN acl_type_t type;
571	OUT struct acl *aclp;
572	IN struct ucred *cred;
573	IN struct thread *td;
574};
575
576
577%% setacl	vp	E E E
578%! setacl	pre	vop_setacl_pre
579%! setacl	post	vop_setacl_post
580
581vop_setacl {
582	IN struct vnode *vp;
583	IN acl_type_t type;
584	IN struct acl *aclp;
585	IN struct ucred *cred;
586	IN struct thread *td;
587};
588
589
590%% aclcheck	vp	= = =
591
592vop_aclcheck {
593	IN struct vnode *vp;
594	IN acl_type_t type;
595	IN struct acl *aclp;
596	IN struct ucred *cred;
597	IN struct thread *td;
598};
599
600
601%% closeextattr	vp	L L L
602
603vop_closeextattr {
604	IN struct vnode *vp;
605	IN int commit;
606	IN struct ucred *cred;
607	IN struct thread *td;
608};
609
610
611%% getextattr	vp	L L L
612
613vop_getextattr {
614	IN struct vnode *vp;
615	IN int attrnamespace;
616	IN const char *name;
617	INOUT struct uio *uio;
618	OUT size_t *size;
619	IN struct ucred *cred;
620	IN struct thread *td;
621};
622
623
624%% listextattr	vp	L L L
625
626vop_listextattr {
627	IN struct vnode *vp;
628	IN int attrnamespace;
629	INOUT struct uio *uio;
630	OUT size_t *size;
631	IN struct ucred *cred;
632	IN struct thread *td;
633};
634
635
636%% openextattr	vp	L L L
637
638vop_openextattr {
639	IN struct vnode *vp;
640	IN struct ucred *cred;
641	IN struct thread *td;
642};
643
644
645%% deleteextattr	vp	E E E
646%! deleteextattr	pre	vop_deleteextattr_pre
647%! deleteextattr	post	vop_deleteextattr_post
648
649vop_deleteextattr {
650	IN struct vnode *vp;
651	IN int attrnamespace;
652	IN const char *name;
653	IN struct ucred *cred;
654	IN struct thread *td;
655};
656
657
658%% setextattr	vp	E E E
659%! setextattr	pre	vop_setextattr_pre
660%! setextattr	post	vop_setextattr_post
661
662vop_setextattr {
663	IN struct vnode *vp;
664	IN int attrnamespace;
665	IN const char *name;
666	INOUT struct uio *uio;
667	IN struct ucred *cred;
668	IN struct thread *td;
669};
670
671
672%% setlabel	vp	E E E
673
674vop_setlabel {
675	IN struct vnode *vp;
676	IN struct label *label;
677	IN struct ucred *cred;
678	IN struct thread *td;
679};
680
681
682%% vptofh	vp	= = =
683
684vop_vptofh {
685	IN struct vnode *vp;
686	IN struct fid *fhp;
687};
688
689
690%% vptocnp		vp	L L L
691%% vptocnp		vpp	- U -
692
693vop_vptocnp {
694	IN struct vnode *vp;
695	OUT struct vnode **vpp;
696	INOUT char *buf;
697	INOUT size_t *buflen;
698};
699
700
701%% allocate	vp	E E E
702
703vop_allocate {
704	IN struct vnode *vp;
705	INOUT off_t *offset;
706	INOUT off_t *len;
707	IN int ioflag;
708	IN struct ucred *cred;
709};
710
711
712%% advise	vp	U U U
713
714vop_advise {
715	IN struct vnode *vp;
716	IN off_t start;
717	IN off_t end;
718	IN int advice;
719};
720
721
722%% unp_bind	vp	E E E
723
724vop_unp_bind {
725	IN struct vnode *vp;
726	IN struct unpcb *unpcb;
727};
728
729
730%% unp_connect	vp	L L L
731
732vop_unp_connect {
733	IN struct vnode *vp;
734	OUT struct unpcb **unpcb;
735};
736
737
738%% unp_detach	vp	= = =
739
740vop_unp_detach {
741	IN struct vnode *vp;
742};
743
744
745%% is_text	vp	L L L
746
747vop_is_text {
748	IN struct vnode *vp;
749};
750
751
752%% set_text	vp	= = =
753
754vop_set_text {
755	IN struct vnode *vp;
756};
757
758
759%% vop_unset_text	vp	L L L
760
761vop_unset_text {
762	IN struct vnode *vp;
763};
764
765
766%% add_writecount	vp	L L L
767
768vop_add_writecount {
769	IN struct vnode *vp;
770	IN int inc;
771};
772
773
774%% fdatasync	vp	- - -
775%! fdatasync	pre	vop_fdatasync_debugpre
776%! fdatasync	post	vop_fdatasync_debugpost
777
778vop_fdatasync {
779	IN struct vnode *vp;
780	IN struct thread *td;
781};
782
783
784%% copy_file_range	invp	U U U
785%% copy_file_range	outvp	U U U
786
787vop_copy_file_range {
788	IN struct vnode *invp;
789	INOUT off_t *inoffp;
790	IN struct vnode *outvp;
791	INOUT off_t *outoffp;
792	INOUT size_t *lenp;
793	IN unsigned int flags;
794	IN struct ucred *incred;
795	IN struct ucred *outcred;
796	IN struct thread *fsizetd;
797};
798
799
800%% vput_pair	dvp	E - -
801
802vop_vput_pair {
803	IN struct vnode *dvp;
804	INOUT struct vnode **vpp;
805	IN bool unlock_vp;
806};
807
808
809%% deallocate	vp	L L L
810
811vop_deallocate {
812	IN struct vnode *vp;
813	INOUT off_t *offset;
814	INOUT off_t *len;
815	IN int flags;
816	IN int ioflag;
817	IN struct ucred *cred;
818};
819
820
821# The VOPs below are spares at the end of the table to allow new VOPs to be
822# added in stable branches without breaking the KBI.  New VOPs in HEAD should
823# be added above these spares.  When merging a new VOP to a stable branch,
824# the new VOP should replace one of the spares.
825
826vop_spare1 {
827	IN struct vnode *vp;
828};
829
830vop_spare2 {
831	IN struct vnode *vp;
832};
833
834vop_spare3 {
835	IN struct vnode *vp;
836};
837
838vop_spare4 {
839	IN struct vnode *vp;
840};
841
842vop_spare5 {
843	IN struct vnode *vp;
844};
845