xref: /freebsd/sys/kern/vnode_if.src (revision bc531a96c9b28b1cabcd5deb0c9f8f6d815cfebc)
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	IN u_int flags;
340};
341
342
343%% mkdir	dvp	E E E
344%% mkdir	vpp	- E -
345%! mkdir	pre	vop_mkdir_pre
346%! mkdir	post	vop_mkdir_post
347%! mkdir	debugpost vop_mkdir_debugpost
348
349vop_mkdir {
350	IN struct vnode *dvp;
351	OUT struct vnode **vpp;
352	IN struct componentname *cnp;
353	IN struct vattr *vap;
354};
355
356
357%% rmdir	dvp	E E E
358%% rmdir	vp	E E E
359%! rmdir	pre	vop_rmdir_pre
360%! rmdir	post	vop_rmdir_post
361
362vop_rmdir {
363	IN struct vnode *dvp;
364	IN struct vnode *vp;
365	IN struct componentname *cnp;
366};
367
368
369%% symlink	dvp	E E E
370%% symlink	vpp	- E -
371%! symlink	pre	vop_symlink_pre
372%! symlink	post	vop_symlink_post
373
374vop_symlink {
375	IN struct vnode *dvp;
376	OUT struct vnode **vpp;
377	IN struct componentname *cnp;
378	IN struct vattr *vap;
379	IN const char *target;
380};
381
382
383%% readdir	vp	L L L
384%! readdir	pre	vop_readdir_pre
385%! readdir	post	vop_readdir_post
386
387vop_readdir {
388	IN struct vnode *vp;
389	INOUT struct uio *uio;
390	IN struct ucred *cred;
391	INOUT int *eofflag;
392	OUT int *ncookies;
393	INOUT uint64_t **cookies;
394};
395
396
397%% readlink	vp	L L L
398
399vop_readlink {
400	IN struct vnode *vp;
401	INOUT struct uio *uio;
402	IN struct ucred *cred;
403};
404
405
406%% inactive	vp	E E E
407
408vop_inactive {
409	IN struct vnode *vp;
410};
411
412%! need_inactive	debugpre	vop_need_inactive_debugpre
413%! need_inactive	debugpost	vop_need_inactive_debugpost
414
415vop_need_inactive {
416        IN struct vnode *vp;
417};
418
419%% reclaim	vp	E E E
420%! reclaim	post	vop_reclaim_post
421
422vop_reclaim {
423	IN struct vnode *vp;
424};
425
426
427%! lock1	debugpre	vop_lock_debugpre
428%! lock1	debugpost	vop_lock_debugpost
429
430vop_lock1 {
431	IN struct vnode *vp;
432	IN int flags;
433	IN const char *file;
434	IN int line;
435};
436
437
438%! unlock	debugpre	vop_unlock_debugpre
439
440vop_unlock {
441	IN struct vnode *vp;
442};
443
444
445%% bmap		vp	L L L
446
447vop_bmap {
448	IN struct vnode *vp;
449	IN daddr_t bn;
450	OUT struct bufobj **bop;
451	IN daddr_t *bnp;
452	OUT int *runp;
453	OUT int *runb;
454};
455
456
457%% strategy	vp	L L L
458%! strategy	debugpre	vop_strategy_debugpre
459
460vop_strategy {
461	IN struct vnode *vp;
462	IN struct buf *bp;
463};
464
465
466%% getwritemount vp	= = =
467
468vop_getwritemount {
469	IN struct vnode *vp;
470	OUT struct mount **mpp;
471};
472
473%% getlowvnode vp	= = =
474
475vop_getlowvnode {
476	IN struct vnode *vp;
477	OUT struct vnode **vplp;
478	IN int flags;
479};
480
481%% print	vp	- - -
482
483vop_print {
484	IN struct vnode *vp;
485};
486
487
488%% pathconf	vp	L L L
489
490vop_pathconf {
491	IN struct vnode *vp;
492	IN int name;
493	OUT long *retval;
494};
495
496
497%% advlock	vp	U U U
498
499vop_advlock {
500	IN struct vnode *vp;
501	IN void *id;
502	IN int op;
503	IN struct flock *fl;
504	IN int flags;
505};
506
507
508%% advlockasync	vp	U U U
509
510vop_advlockasync {
511	IN struct vnode *vp;
512	IN void *id;
513	IN int op;
514	IN struct flock *fl;
515	IN int flags;
516	IN struct task *task;
517	INOUT void **cookiep;
518};
519
520
521%% advlockpurge	vp	E E E
522
523vop_advlockpurge {
524	IN struct vnode *vp;
525};
526
527
528%% reallocblks	vp	E E E
529
530vop_reallocblks {
531	IN struct vnode *vp;
532	IN struct cluster_save *buflist;
533};
534
535
536%% getpages	vp	L L L
537
538vop_getpages {
539	IN struct vnode *vp;
540	IN vm_page_t *m;
541	IN int count;
542	IN int *rbehind;
543	IN int *rahead;
544};
545
546
547%% getpages_async	vp	L L L
548
549vop_getpages_async {
550	IN struct vnode *vp;
551	IN vm_page_t *m;
552	IN int count;
553	IN int *rbehind;
554	IN int *rahead;
555	IN vop_getpages_iodone_t *iodone;
556	IN void *arg;
557};
558
559
560%% putpages	vp	L L L
561
562vop_putpages {
563	IN struct vnode *vp;
564	IN vm_page_t *m;
565	IN int count;
566	IN int sync;
567	IN int *rtvals;
568};
569
570
571%% getacl	vp	L L L
572
573vop_getacl {
574	IN struct vnode *vp;
575	IN acl_type_t type;
576	OUT struct acl *aclp;
577	IN struct ucred *cred;
578	IN struct thread *td;
579};
580
581
582%% setacl	vp	E E E
583%! setacl	pre	vop_setacl_pre
584%! setacl	post	vop_setacl_post
585
586vop_setacl {
587	IN struct vnode *vp;
588	IN acl_type_t type;
589	IN struct acl *aclp;
590	IN struct ucred *cred;
591	IN struct thread *td;
592};
593
594
595%% aclcheck	vp	= = =
596
597vop_aclcheck {
598	IN struct vnode *vp;
599	IN acl_type_t type;
600	IN struct acl *aclp;
601	IN struct ucred *cred;
602	IN struct thread *td;
603};
604
605
606%% closeextattr	vp	L L L
607
608vop_closeextattr {
609	IN struct vnode *vp;
610	IN int commit;
611	IN struct ucred *cred;
612	IN struct thread *td;
613};
614
615
616%% getextattr	vp	L L L
617
618vop_getextattr {
619	IN struct vnode *vp;
620	IN int attrnamespace;
621	IN const char *name;
622	INOUT struct uio *uio;
623	OUT size_t *size;
624	IN struct ucred *cred;
625	IN struct thread *td;
626};
627
628
629%% listextattr	vp	L L L
630
631vop_listextattr {
632	IN struct vnode *vp;
633	IN int attrnamespace;
634	INOUT struct uio *uio;
635	OUT size_t *size;
636	IN struct ucred *cred;
637	IN struct thread *td;
638};
639
640
641%% openextattr	vp	L L L
642
643vop_openextattr {
644	IN struct vnode *vp;
645	IN struct ucred *cred;
646	IN struct thread *td;
647};
648
649
650%% deleteextattr	vp	E E E
651%! deleteextattr	pre	vop_deleteextattr_pre
652%! deleteextattr	post	vop_deleteextattr_post
653
654vop_deleteextattr {
655	IN struct vnode *vp;
656	IN int attrnamespace;
657	IN const char *name;
658	IN struct ucred *cred;
659	IN struct thread *td;
660};
661
662
663%% setextattr	vp	E E E
664%! setextattr	pre	vop_setextattr_pre
665%! setextattr	post	vop_setextattr_post
666
667vop_setextattr {
668	IN struct vnode *vp;
669	IN int attrnamespace;
670	IN const char *name;
671	INOUT struct uio *uio;
672	IN struct ucred *cred;
673	IN struct thread *td;
674};
675
676
677%% setlabel	vp	E E E
678
679vop_setlabel {
680	IN struct vnode *vp;
681	IN struct label *label;
682	IN struct ucred *cred;
683	IN struct thread *td;
684};
685
686
687%% vptofh	vp	= = =
688
689vop_vptofh {
690	IN struct vnode *vp;
691	IN struct fid *fhp;
692};
693
694
695%% vptocnp		vp	L L L
696%% vptocnp		vpp	- U -
697
698vop_vptocnp {
699	IN struct vnode *vp;
700	OUT struct vnode **vpp;
701	INOUT char *buf;
702	INOUT size_t *buflen;
703};
704
705
706%% allocate	vp	E E E
707%! allocate	post	vop_allocate_post
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%! copy_file_range	post	vop_copy_file_range_post
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%% deallocate	vp	L L L
817%! deallocate	post	vop_deallocate_post
818
819vop_deallocate {
820	IN struct vnode *vp;
821	INOUT off_t *offset;
822	INOUT off_t *len;
823	IN int flags;
824	IN int ioflag;
825	IN struct ucred *cred;
826};
827
828
829%% inotify	vp	- - -
830
831vop_inotify {
832	IN struct vnode *vp;
833	IN struct vnode *dvp;
834	IN struct componentname *cnp;
835	IN int event;
836	IN uint32_t cookie;
837};
838
839
840%% inotify_add_watch vp	L L L
841
842vop_inotify_add_watch {
843	IN struct vnode *vp;
844	IN struct inotify_softc *sc;
845	IN uint32_t mask;
846	OUT uint32_t *wdp;
847	IN struct thread *td;
848};
849
850
851%% delayed_setsize	vp	E E E
852
853vop_delayed_setsize {
854	IN struct vnode *vp;
855};
856
857
858# The VOPs below are spares at the end of the table to allow new VOPs to be
859# added in stable branches without breaking the KBI.  New VOPs in HEAD should
860# be added above these spares.  When merging a new VOP to a stable branch,
861# the new VOP should replace one of the spares.
862
863vop_spare1 {
864	IN struct vnode *vp;
865};
866
867vop_spare2 {
868	IN struct vnode *vp;
869};
870
871vop_spare3 {
872	IN struct vnode *vp;
873};
874
875vop_spare4 {
876	IN struct vnode *vp;
877};
878
879vop_spare5 {
880	IN struct vnode *vp;
881};
882