xref: /freebsd/sys/kern/vnode_if.src (revision ae477ca7da55f76d28859e1bd01cd1051e36f28f)
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};
340
341
342%% mkdir	dvp	E E E
343%% mkdir	vpp	- E -
344%! mkdir	pre	vop_mkdir_pre
345%! mkdir	post	vop_mkdir_post
346%! mkdir	debugpost vop_mkdir_debugpost
347
348vop_mkdir {
349	IN struct vnode *dvp;
350	OUT struct vnode **vpp;
351	IN struct componentname *cnp;
352	IN struct vattr *vap;
353};
354
355
356%% rmdir	dvp	E E E
357%% rmdir	vp	E E E
358%! rmdir	pre	vop_rmdir_pre
359%! rmdir	post	vop_rmdir_post
360
361vop_rmdir {
362	IN struct vnode *dvp;
363	IN struct vnode *vp;
364	IN struct componentname *cnp;
365};
366
367
368%% symlink	dvp	E E E
369%% symlink	vpp	- E -
370%! symlink	pre	vop_symlink_pre
371%! symlink	post	vop_symlink_post
372
373vop_symlink {
374	IN struct vnode *dvp;
375	OUT struct vnode **vpp;
376	IN struct componentname *cnp;
377	IN struct vattr *vap;
378	IN const char *target;
379};
380
381
382%% readdir	vp	L L L
383%! readdir	post	vop_readdir_post
384
385vop_readdir {
386	IN struct vnode *vp;
387	INOUT struct uio *uio;
388	IN struct ucred *cred;
389	INOUT int *eofflag;
390	OUT int *ncookies;
391	INOUT uint64_t **cookies;
392};
393
394
395%% readlink	vp	L L L
396
397vop_readlink {
398	IN struct vnode *vp;
399	INOUT struct uio *uio;
400	IN struct ucred *cred;
401};
402
403
404%% inactive	vp	E E E
405
406vop_inactive {
407	IN struct vnode *vp;
408};
409
410%! need_inactive	debugpre	vop_need_inactive_debugpre
411%! need_inactive	debugpost	vop_need_inactive_debugpost
412
413vop_need_inactive {
414        IN struct vnode *vp;
415};
416
417%% reclaim	vp	E E E
418%! reclaim	post	vop_reclaim_post
419
420vop_reclaim {
421	IN struct vnode *vp;
422};
423
424
425%! lock1	debugpre	vop_lock_debugpre
426%! lock1	debugpost	vop_lock_debugpost
427
428vop_lock1 {
429	IN struct vnode *vp;
430	IN int flags;
431	IN const char *file;
432	IN int line;
433};
434
435
436%! unlock	debugpre	vop_unlock_debugpre
437
438vop_unlock {
439	IN struct vnode *vp;
440};
441
442
443%% bmap		vp	L L L
444
445vop_bmap {
446	IN struct vnode *vp;
447	IN daddr_t bn;
448	OUT struct bufobj **bop;
449	IN daddr_t *bnp;
450	OUT int *runp;
451	OUT int *runb;
452};
453
454
455%% strategy	vp	L L L
456%! strategy	debugpre	vop_strategy_debugpre
457
458vop_strategy {
459	IN struct vnode *vp;
460	IN struct buf *bp;
461};
462
463
464%% getwritemount vp	= = =
465
466vop_getwritemount {
467	IN struct vnode *vp;
468	OUT struct mount **mpp;
469};
470
471
472%% print	vp	- - -
473
474vop_print {
475	IN struct vnode *vp;
476};
477
478
479%% pathconf	vp	L L L
480
481vop_pathconf {
482	IN struct vnode *vp;
483	IN int name;
484	OUT long *retval;
485};
486
487
488%% advlock	vp	U U U
489
490vop_advlock {
491	IN struct vnode *vp;
492	IN void *id;
493	IN int op;
494	IN struct flock *fl;
495	IN int flags;
496};
497
498
499%% advlockasync	vp	U U U
500
501vop_advlockasync {
502	IN struct vnode *vp;
503	IN void *id;
504	IN int op;
505	IN struct flock *fl;
506	IN int flags;
507	IN struct task *task;
508	INOUT void **cookiep;
509};
510
511
512%% advlockpurge	vp	E E E
513
514vop_advlockpurge {
515	IN struct vnode *vp;
516};
517
518
519%% reallocblks	vp	E E E
520
521vop_reallocblks {
522	IN struct vnode *vp;
523	IN struct cluster_save *buflist;
524};
525
526
527%% getpages	vp	L L L
528
529vop_getpages {
530	IN struct vnode *vp;
531	IN vm_page_t *m;
532	IN int count;
533	IN int *rbehind;
534	IN int *rahead;
535};
536
537
538%% getpages_async	vp	L L L
539
540vop_getpages_async {
541	IN struct vnode *vp;
542	IN vm_page_t *m;
543	IN int count;
544	IN int *rbehind;
545	IN int *rahead;
546	IN vop_getpages_iodone_t *iodone;
547	IN void *arg;
548};
549
550
551%% putpages	vp	L L L
552
553vop_putpages {
554	IN struct vnode *vp;
555	IN vm_page_t *m;
556	IN int count;
557	IN int sync;
558	IN int *rtvals;
559};
560
561
562%% getacl	vp	L L L
563
564vop_getacl {
565	IN struct vnode *vp;
566	IN acl_type_t type;
567	OUT struct acl *aclp;
568	IN struct ucred *cred;
569	IN struct thread *td;
570};
571
572
573%% setacl	vp	E E E
574%! setacl	pre	vop_setacl_pre
575%! setacl	post	vop_setacl_post
576
577vop_setacl {
578	IN struct vnode *vp;
579	IN acl_type_t type;
580	IN struct acl *aclp;
581	IN struct ucred *cred;
582	IN struct thread *td;
583};
584
585
586%% aclcheck	vp	= = =
587
588vop_aclcheck {
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%% closeextattr	vp	L L L
598
599vop_closeextattr {
600	IN struct vnode *vp;
601	IN int commit;
602	IN struct ucred *cred;
603	IN struct thread *td;
604};
605
606
607%% getextattr	vp	L L L
608
609vop_getextattr {
610	IN struct vnode *vp;
611	IN int attrnamespace;
612	IN const char *name;
613	INOUT struct uio *uio;
614	OUT size_t *size;
615	IN struct ucred *cred;
616	IN struct thread *td;
617};
618
619
620%% listextattr	vp	L L L
621
622vop_listextattr {
623	IN struct vnode *vp;
624	IN int attrnamespace;
625	INOUT struct uio *uio;
626	OUT size_t *size;
627	IN struct ucred *cred;
628	IN struct thread *td;
629};
630
631
632%% openextattr	vp	L L L
633
634vop_openextattr {
635	IN struct vnode *vp;
636	IN struct ucred *cred;
637	IN struct thread *td;
638};
639
640
641%% deleteextattr	vp	E E E
642%! deleteextattr	pre	vop_deleteextattr_pre
643%! deleteextattr	post	vop_deleteextattr_post
644
645vop_deleteextattr {
646	IN struct vnode *vp;
647	IN int attrnamespace;
648	IN const char *name;
649	IN struct ucred *cred;
650	IN struct thread *td;
651};
652
653
654%% setextattr	vp	E E E
655%! setextattr	pre	vop_setextattr_pre
656%! setextattr	post	vop_setextattr_post
657
658vop_setextattr {
659	IN struct vnode *vp;
660	IN int attrnamespace;
661	IN const char *name;
662	INOUT struct uio *uio;
663	IN struct ucred *cred;
664	IN struct thread *td;
665};
666
667
668%% setlabel	vp	E E E
669
670vop_setlabel {
671	IN struct vnode *vp;
672	IN struct label *label;
673	IN struct ucred *cred;
674	IN struct thread *td;
675};
676
677
678%% vptofh	vp	= = =
679
680vop_vptofh {
681	IN struct vnode *vp;
682	IN struct fid *fhp;
683};
684
685
686%% vptocnp		vp	L L L
687%% vptocnp		vpp	- U -
688
689vop_vptocnp {
690	IN struct vnode *vp;
691	OUT struct vnode **vpp;
692	INOUT char *buf;
693	INOUT size_t *buflen;
694};
695
696
697%% allocate	vp	E E E
698
699vop_allocate {
700	IN struct vnode *vp;
701	INOUT off_t *offset;
702	INOUT off_t *len;
703	IN int ioflag;
704	IN struct ucred *cred;
705};
706
707
708%% advise	vp	U U U
709
710vop_advise {
711	IN struct vnode *vp;
712	IN off_t start;
713	IN off_t end;
714	IN int advice;
715};
716
717
718%% unp_bind	vp	E E E
719
720vop_unp_bind {
721	IN struct vnode *vp;
722	IN struct unpcb *unpcb;
723};
724
725
726%% unp_connect	vp	L L L
727
728vop_unp_connect {
729	IN struct vnode *vp;
730	OUT struct unpcb **unpcb;
731};
732
733
734%% unp_detach	vp	= = =
735
736vop_unp_detach {
737	IN struct vnode *vp;
738};
739
740
741%% is_text	vp	L L L
742
743vop_is_text {
744	IN struct vnode *vp;
745};
746
747
748%% set_text	vp	= = =
749
750vop_set_text {
751	IN struct vnode *vp;
752};
753
754
755%% vop_unset_text	vp	L L L
756
757vop_unset_text {
758	IN struct vnode *vp;
759};
760
761
762%% add_writecount	vp	L L L
763
764vop_add_writecount {
765	IN struct vnode *vp;
766	IN int inc;
767};
768
769
770%% fdatasync	vp	- - -
771%! fdatasync	pre	vop_fdatasync_debugpre
772%! fdatasync	post	vop_fdatasync_debugpost
773
774vop_fdatasync {
775	IN struct vnode *vp;
776	IN struct thread *td;
777};
778
779
780%% copy_file_range	invp	U U U
781%% copy_file_range	outvp	U U U
782
783vop_copy_file_range {
784	IN struct vnode *invp;
785	INOUT off_t *inoffp;
786	IN struct vnode *outvp;
787	INOUT off_t *outoffp;
788	INOUT size_t *lenp;
789	IN unsigned int flags;
790	IN struct ucred *incred;
791	IN struct ucred *outcred;
792	IN struct thread *fsizetd;
793};
794
795
796%% vput_pair	dvp	E - -
797
798vop_vput_pair {
799	IN struct vnode *dvp;
800	INOUT struct vnode **vpp;
801	IN bool unlock_vp;
802};
803
804
805%% deallocate	vp	L L L
806
807vop_deallocate {
808	IN struct vnode *vp;
809	INOUT off_t *offset;
810	INOUT off_t *len;
811	IN int flags;
812	IN int ioflag;
813	IN struct ucred *cred;
814};
815
816
817# The VOPs below are spares at the end of the table to allow new VOPs to be
818# added in stable branches without breaking the KBI.  New VOPs in HEAD should
819# be added above these spares.  When merging a new VOP to a stable branch,
820# the new VOP should replace one of the spares.
821
822vop_spare1 {
823	IN struct vnode *vp;
824};
825
826vop_spare2 {
827	IN struct vnode *vp;
828};
829
830vop_spare3 {
831	IN struct vnode *vp;
832};
833
834vop_spare4 {
835	IN struct vnode *vp;
836};
837
838vop_spare5 {
839	IN struct vnode *vp;
840};
841