xref: /freebsd/sys/kern/vnode_if.src (revision 2b68eb8e1dbbdaf6a0df1c83b26f5403ca52d4c3)
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 paramater 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	L L L
299
300vop_fsync {
301	IN struct vnode *vp;
302	IN int waitfor;
303	IN struct thread *td;
304};
305
306
307%% remove	dvp	E E E
308%% remove	vp	E E E
309%! remove	pre	vop_remove_pre
310%! remove	post	vop_remove_post
311
312vop_remove {
313	IN struct vnode *dvp;
314	IN struct vnode *vp;
315	IN struct componentname *cnp;
316};
317
318
319%% link		tdvp	E E E
320%% link		vp	E E E
321%! link		pre	vop_link_pre
322%! link		post	vop_link_post
323
324vop_link {
325	IN struct vnode *tdvp;
326	IN struct vnode *vp;
327	IN struct componentname *cnp;
328};
329
330
331%! rename	pre	vop_rename_pre
332%! rename	post	vop_rename_post
333
334vop_rename {
335	IN WILLRELE struct vnode *fdvp;
336	IN WILLRELE struct vnode *fvp;
337	IN struct componentname *fcnp;
338	IN WILLRELE struct vnode *tdvp;
339	IN WILLRELE struct vnode *tvp;
340	IN struct componentname *tcnp;
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	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 u_long **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
474%% print	vp	- - -
475
476vop_print {
477	IN struct vnode *vp;
478};
479
480
481%% pathconf	vp	L L L
482
483vop_pathconf {
484	IN struct vnode *vp;
485	IN int name;
486	OUT long *retval;
487};
488
489
490%% advlock	vp	U U U
491
492vop_advlock {
493	IN struct vnode *vp;
494	IN void *id;
495	IN int op;
496	IN struct flock *fl;
497	IN int flags;
498};
499
500
501%% advlockasync	vp	U U U
502
503vop_advlockasync {
504	IN struct vnode *vp;
505	IN void *id;
506	IN int op;
507	IN struct flock *fl;
508	IN int flags;
509	IN struct task *task;
510	INOUT void **cookiep;
511};
512
513
514%% advlockpurge	vp	E E E
515
516vop_advlockpurge {
517	IN struct vnode *vp;
518};
519
520
521%% reallocblks	vp	E E E
522
523vop_reallocblks {
524	IN struct vnode *vp;
525	IN struct cluster_save *buflist;
526};
527
528
529%% getpages	vp	L L L
530
531vop_getpages {
532	IN struct vnode *vp;
533	IN vm_page_t *m;
534	IN int count;
535	IN int *rbehind;
536	IN int *rahead;
537};
538
539
540%% getpages_async	vp	L L L
541
542vop_getpages_async {
543	IN struct vnode *vp;
544	IN vm_page_t *m;
545	IN int count;
546	IN int *rbehind;
547	IN int *rahead;
548	IN vop_getpages_iodone_t *iodone;
549	IN void *arg;
550};
551
552
553%% putpages	vp	L L L
554
555vop_putpages {
556	IN struct vnode *vp;
557	IN vm_page_t *m;
558	IN int count;
559	IN int sync;
560	IN int *rtvals;
561};
562
563
564%% getacl	vp	L L L
565
566vop_getacl {
567	IN struct vnode *vp;
568	IN acl_type_t type;
569	OUT struct acl *aclp;
570	IN struct ucred *cred;
571	IN struct thread *td;
572};
573
574
575%% setacl	vp	E E E
576%! setacl	pre	vop_setacl_pre
577%! setacl	post	vop_setacl_post
578
579vop_setacl {
580	IN struct vnode *vp;
581	IN acl_type_t type;
582	IN struct acl *aclp;
583	IN struct ucred *cred;
584	IN struct thread *td;
585};
586
587
588%% aclcheck	vp	= = =
589
590vop_aclcheck {
591	IN struct vnode *vp;
592	IN acl_type_t type;
593	IN struct acl *aclp;
594	IN struct ucred *cred;
595	IN struct thread *td;
596};
597
598
599%% closeextattr	vp	L L L
600
601vop_closeextattr {
602	IN struct vnode *vp;
603	IN int commit;
604	IN struct ucred *cred;
605	IN struct thread *td;
606};
607
608
609%% getextattr	vp	L L L
610
611vop_getextattr {
612	IN struct vnode *vp;
613	IN int attrnamespace;
614	IN const char *name;
615	INOUT struct uio *uio;
616	OUT size_t *size;
617	IN struct ucred *cred;
618	IN struct thread *td;
619};
620
621
622%% listextattr	vp	L L L
623
624vop_listextattr {
625	IN struct vnode *vp;
626	IN int attrnamespace;
627	INOUT struct uio *uio;
628	OUT size_t *size;
629	IN struct ucred *cred;
630	IN struct thread *td;
631};
632
633
634%% openextattr	vp	L L L
635
636vop_openextattr {
637	IN struct vnode *vp;
638	IN struct ucred *cred;
639	IN struct thread *td;
640};
641
642
643%% deleteextattr	vp	E E E
644%! deleteextattr	pre	vop_deleteextattr_pre
645%! deleteextattr	post	vop_deleteextattr_post
646
647vop_deleteextattr {
648	IN struct vnode *vp;
649	IN int attrnamespace;
650	IN const char *name;
651	IN struct ucred *cred;
652	IN struct thread *td;
653};
654
655
656%% setextattr	vp	E E E
657%! setextattr	pre	vop_setextattr_pre
658%! setextattr	post	vop_setextattr_post
659
660vop_setextattr {
661	IN struct vnode *vp;
662	IN int attrnamespace;
663	IN const char *name;
664	INOUT struct uio *uio;
665	IN struct ucred *cred;
666	IN struct thread *td;
667};
668
669
670%% setlabel	vp	E E E
671
672vop_setlabel {
673	IN struct vnode *vp;
674	IN struct label *label;
675	IN struct ucred *cred;
676	IN struct thread *td;
677};
678
679
680%% vptofh	vp	= = =
681
682vop_vptofh {
683	IN struct vnode *vp;
684	IN struct fid *fhp;
685};
686
687
688%% vptocnp		vp	L L L
689%% vptocnp		vpp	- U -
690
691vop_vptocnp {
692	IN struct vnode *vp;
693	OUT struct vnode **vpp;
694	INOUT char *buf;
695	INOUT size_t *buflen;
696};
697
698
699%% allocate	vp	E E E
700
701vop_allocate {
702	IN struct vnode *vp;
703	INOUT off_t *offset;
704	INOUT off_t *len;
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	L L L
771
772vop_fdatasync {
773	IN struct vnode *vp;
774	IN struct thread *td;
775};
776
777
778%% copy_file_range	invp	U U U
779%% copy_file_range	outvp	U U U
780
781vop_copy_file_range {
782	IN struct vnode *invp;
783	INOUT off_t *inoffp;
784	IN struct vnode *outvp;
785	INOUT off_t *outoffp;
786	INOUT size_t *lenp;
787	IN unsigned int flags;
788	IN struct ucred *incred;
789	IN struct ucred *outcred;
790	IN struct thread *fsizetd;
791};
792
793
794%% vput_pair	dvp	E - -
795
796vop_vput_pair {
797	IN struct vnode *dvp;
798	INOUT struct vnode **vpp;
799	IN bool unlock_vp;
800};
801
802
803%% deallocate	vp	L L L
804
805vop_deallocate {
806	IN struct vnode *vp;
807	INOUT off_t *offset;
808	INOUT off_t *len;
809	IN int flags;
810	IN int ioflag;
811	IN struct ucred *cred;
812};
813
814
815# The VOPs below are spares at the end of the table to allow new VOPs to be
816# added in stable branches without breaking the KBI.  New VOPs in HEAD should
817# be added above these spares.  When merging a new VOP to a stable branch,
818# the new VOP should replace one of the spares.
819
820vop_spare1 {
821	IN struct vnode *vp;
822};
823
824vop_spare2 {
825	IN struct vnode *vp;
826};
827
828vop_spare3 {
829	IN struct vnode *vp;
830};
831
832vop_spare4 {
833	IN struct vnode *vp;
834};
835
836vop_spare5 {
837	IN struct vnode *vp;
838};
839