xref: /freebsd/sys/kern/vnode_if.src (revision d15f2551b25f79ddcbe289faa95e655100b952da)
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_update_atime {
218	IN struct vnode *vp;
219	IN struct timespec *ts;
220};
221
222
223%% read		vp	L L L
224%! read		post	vop_read_post
225
226vop_read {
227	IN struct vnode *vp;
228	INOUT struct uio *uio;
229	IN int ioflag;
230	IN struct ucred *cred;
231};
232
233
234%% read_pgcache	vp	- - -
235%! read_pgcache	post	vop_read_pgcache_post
236
237vop_read_pgcache {
238	IN struct vnode *vp;
239	INOUT struct uio *uio;
240	IN int ioflag;
241	IN struct ucred *cred;
242};
243
244
245%% write	vp	L L L
246%! write	pre	vop_write_pre
247%! write	post	vop_write_post
248
249vop_write {
250	IN struct vnode *vp;
251	INOUT struct uio *uio;
252	IN int ioflag;
253	IN struct ucred *cred;
254};
255
256
257%% ioctl	vp	U U U
258
259vop_ioctl {
260	IN struct vnode *vp;
261	IN u_long command;
262	IN void *data;
263	IN int fflag;
264	IN struct ucred *cred;
265	IN struct thread *td;
266};
267
268
269%% poll		vp	U U U
270
271vop_poll {
272	IN struct vnode *vp;
273	IN int events;
274	IN struct ucred *cred;
275	IN struct thread *td;
276};
277
278
279%% kqfilter	vp	U U U
280
281vop_kqfilter {
282	IN struct vnode *vp;
283	IN struct knote *kn;
284};
285
286
287%% revoke	vp	L L L
288
289vop_revoke {
290	IN struct vnode *vp;
291	IN int flags;
292};
293
294
295%% fsync	vp	- - -
296%! fsync	pre	vop_fsync_debugpre
297%! fsync	post	vop_fsync_debugpost
298
299vop_fsync {
300	IN struct vnode *vp;
301	IN int waitfor;
302	IN struct thread *td;
303};
304
305
306%% remove	dvp	E E E
307%% remove	vp	E E E
308%! remove	pre	vop_remove_pre
309%! remove	post	vop_remove_post
310
311vop_remove {
312	IN struct vnode *dvp;
313	IN struct vnode *vp;
314	IN struct componentname *cnp;
315};
316
317
318%% link		tdvp	E E E
319%% link		vp	E E E
320%! link		pre	vop_link_pre
321%! link		post	vop_link_post
322
323vop_link {
324	IN struct vnode *tdvp;
325	IN struct vnode *vp;
326	IN struct componentname *cnp;
327};
328
329
330%! rename	pre	vop_rename_pre
331%! rename	post	vop_rename_post
332
333vop_rename {
334	IN WILLRELE struct vnode *fdvp;
335	IN WILLRELE struct vnode *fvp;
336	IN struct componentname *fcnp;
337	IN WILLRELE struct vnode *tdvp;
338	IN WILLRELE struct vnode *tvp;
339	IN struct componentname *tcnp;
340	IN u_int flags;
341};
342
343
344%% mkdir	dvp	E E E
345%% mkdir	vpp	- E -
346%! mkdir	pre	vop_mkdir_pre
347%! mkdir	post	vop_mkdir_post
348%! mkdir	debugpost vop_mkdir_debugpost
349
350vop_mkdir {
351	IN struct vnode *dvp;
352	OUT struct vnode **vpp;
353	IN struct componentname *cnp;
354	IN struct vattr *vap;
355};
356
357
358%% rmdir	dvp	E E E
359%% rmdir	vp	E E E
360%! rmdir	pre	vop_rmdir_pre
361%! rmdir	post	vop_rmdir_post
362
363vop_rmdir {
364	IN struct vnode *dvp;
365	IN struct vnode *vp;
366	IN struct componentname *cnp;
367};
368
369
370%% symlink	dvp	E E E
371%% symlink	vpp	- E -
372%! symlink	pre	vop_symlink_pre
373%! symlink	post	vop_symlink_post
374
375vop_symlink {
376	IN struct vnode *dvp;
377	OUT struct vnode **vpp;
378	IN struct componentname *cnp;
379	IN struct vattr *vap;
380	IN const char *target;
381};
382
383
384%% readdir	vp	L L L
385%! readdir	pre	vop_readdir_pre
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%% getlowvnode 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%! allocate	post	vop_allocate_post
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%! copy_file_range	post	vop_copy_file_range_post
794
795vop_copy_file_range {
796	IN struct vnode *invp;
797	INOUT off_t *inoffp;
798	IN struct vnode *outvp;
799	INOUT off_t *outoffp;
800	INOUT size_t *lenp;
801	IN unsigned int flags;
802	IN struct ucred *incred;
803	IN struct ucred *outcred;
804	IN struct thread *fsizetd;
805};
806
807
808%% vput_pair	dvp	E - -
809
810vop_vput_pair {
811	IN struct vnode *dvp;
812	INOUT struct vnode **vpp;
813	IN bool unlock_vp;
814};
815
816
817%% deallocate	vp	L L L
818%! deallocate	post	vop_deallocate_post
819
820vop_deallocate {
821	IN struct vnode *vp;
822	INOUT off_t *offset;
823	INOUT off_t *len;
824	IN int flags;
825	IN int ioflag;
826	IN struct ucred *cred;
827};
828
829
830%% inotify	vp	- - -
831
832vop_inotify {
833	IN struct vnode *vp;
834	IN struct vnode *dvp;
835	IN struct componentname *cnp;
836	IN int event;
837	IN uint32_t cookie;
838};
839
840
841%% inotify_add_watch vp	L L L
842
843vop_inotify_add_watch {
844	IN struct vnode *vp;
845	IN struct inotify_softc *sc;
846	IN uint32_t mask;
847	OUT uint32_t *wdp;
848	IN struct thread *td;
849};
850
851
852%% delayed_setsize	vp	E E E
853
854vop_delayed_setsize {
855	IN struct vnode *vp;
856};
857
858
859# The VOPs below are spares at the end of the table to allow new VOPs to be
860# added in stable branches without breaking the KBI.  New VOPs in HEAD should
861# be added above these spares.  When merging a new VOP to a stable branch,
862# the new VOP should replace one of the spares.
863
864vop_spare1 {
865	IN struct vnode *vp;
866};
867
868vop_spare2 {
869	IN struct vnode *vp;
870};
871
872vop_spare3 {
873	IN struct vnode *vp;
874};
875
876vop_spare4 {
877	IN struct vnode *vp;
878};
879
880vop_spare5 {
881	IN struct vnode *vp;
882};
883