xref: /freebsd/sys/kern/vnode_if.src (revision 5ac01ce026aa871e24065f931b5b5c36024c96f9)
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	IN struct thread *td;
157};
158
159
160%% access	vp	L L L
161
162vop_access {
163	IN struct vnode *vp;
164	IN accmode_t accmode;
165	IN struct ucred *cred;
166	IN struct thread *td;
167};
168
169
170%% accessx	vp	L L L
171
172vop_accessx {
173	IN struct vnode *vp;
174	IN accmode_t accmode;
175	IN struct ucred *cred;
176	IN struct thread *td;
177};
178
179
180%% getattr	vp	L L L
181
182vop_getattr {
183	IN struct vnode *vp;
184	OUT struct vattr *vap;
185	IN struct ucred *cred;
186};
187
188
189%% setattr	vp	E E E
190%! setattr	pre	vop_setattr_pre
191%! setattr	post	vop_setattr_post
192
193vop_setattr {
194	IN struct vnode *vp;
195	IN struct vattr *vap;
196	IN struct ucred *cred;
197};
198
199
200%% mmapped	vp	L L L
201
202vop_mmapped {
203	IN struct vnode *vp;
204};
205
206
207%% read		vp	L L L
208%! read		post	vop_read_post
209
210vop_read {
211	IN struct vnode *vp;
212	INOUT struct uio *uio;
213	IN int ioflag;
214	IN struct ucred *cred;
215};
216
217
218%% write	vp	L L L
219%! write	pre	VOP_WRITE_PRE
220%! write	post	VOP_WRITE_POST
221
222vop_write {
223	IN struct vnode *vp;
224	INOUT struct uio *uio;
225	IN int ioflag;
226	IN struct ucred *cred;
227};
228
229
230%% ioctl	vp	U U U
231
232vop_ioctl {
233	IN struct vnode *vp;
234	IN u_long command;
235	IN void *data;
236	IN int fflag;
237	IN struct ucred *cred;
238	IN struct thread *td;
239};
240
241
242%% poll		vp	U U U
243
244vop_poll {
245	IN struct vnode *vp;
246	IN int events;
247	IN struct ucred *cred;
248	IN struct thread *td;
249};
250
251
252%% kqfilter	vp	U U U
253
254vop_kqfilter {
255	IN struct vnode *vp;
256	IN struct knote *kn;
257};
258
259
260%% revoke	vp	L L L
261
262vop_revoke {
263	IN struct vnode *vp;
264	IN int flags;
265};
266
267
268%% fsync	vp	L L L
269
270vop_fsync {
271	IN struct vnode *vp;
272	IN int waitfor;
273	IN struct thread *td;
274};
275
276
277%% remove	dvp	E E E
278%% remove	vp	E E E
279%! remove	pre	vop_remove_pre
280%! remove	post	vop_remove_post
281
282vop_remove {
283	IN struct vnode *dvp;
284	IN struct vnode *vp;
285	IN struct componentname *cnp;
286};
287
288
289%% link		tdvp	E E E
290%% link		vp	E E E
291%! link		pre	vop_link_pre
292%! link		post	vop_link_post
293
294vop_link {
295	IN struct vnode *tdvp;
296	IN struct vnode *vp;
297	IN struct componentname *cnp;
298};
299
300
301%! rename	pre	vop_rename_pre
302%! rename	post	vop_rename_post
303
304vop_rename {
305	IN WILLRELE struct vnode *fdvp;
306	IN WILLRELE struct vnode *fvp;
307	IN struct componentname *fcnp;
308	IN WILLRELE struct vnode *tdvp;
309	IN WILLRELE struct vnode *tvp;
310	IN struct componentname *tcnp;
311};
312
313
314%% mkdir	dvp	E E E
315%% mkdir	vpp	- E -
316%! mkdir	pre	vop_mkdir_pre
317%! mkdir	post	vop_mkdir_post
318
319vop_mkdir {
320	IN struct vnode *dvp;
321	OUT struct vnode **vpp;
322	IN struct componentname *cnp;
323	IN struct vattr *vap;
324};
325
326
327%% rmdir	dvp	E E E
328%% rmdir	vp	E E E
329%! rmdir	pre	vop_rmdir_pre
330%! rmdir	post	vop_rmdir_post
331
332vop_rmdir {
333	IN struct vnode *dvp;
334	IN struct vnode *vp;
335	IN struct componentname *cnp;
336};
337
338
339%% symlink	dvp	E E E
340%% symlink	vpp	- E -
341%! symlink	pre	vop_symlink_pre
342%! symlink	post	vop_symlink_post
343
344vop_symlink {
345	IN struct vnode *dvp;
346	OUT struct vnode **vpp;
347	IN struct componentname *cnp;
348	IN struct vattr *vap;
349	IN const char *target;
350};
351
352
353%% readdir	vp	L L L
354%! readdir	post	vop_readdir_post
355
356vop_readdir {
357	IN struct vnode *vp;
358	INOUT struct uio *uio;
359	IN struct ucred *cred;
360	INOUT int *eofflag;
361	OUT int *ncookies;
362	INOUT u_long **cookies;
363};
364
365
366%% readlink	vp	L L L
367
368vop_readlink {
369	IN struct vnode *vp;
370	INOUT struct uio *uio;
371	IN struct ucred *cred;
372};
373
374
375%% inactive	vp	E E E
376
377vop_inactive {
378	IN struct vnode *vp;
379	IN struct thread *td;
380};
381
382%! need_inactive	debugpre	vop_need_inactive_debugpre
383%! need_inactive	debugpost	vop_need_inactive_debugpost
384
385vop_need_inactive {
386        IN struct vnode *vp;
387};
388
389%% reclaim	vp	E E E
390%! reclaim	post	vop_reclaim_post
391
392vop_reclaim {
393	IN struct vnode *vp;
394	IN struct thread *td;
395};
396
397
398%! lock1	debugpre	vop_lock_debugpre
399%! lock1	debugpost	vop_lock_debugpost
400
401vop_lock1 {
402	IN struct vnode *vp;
403	IN int flags;
404	IN const char *file;
405	IN int line;
406};
407
408
409%! unlock	debugpre	vop_unlock_debugpre
410
411vop_unlock {
412	IN struct vnode *vp;
413};
414
415
416%% bmap		vp	L L L
417
418vop_bmap {
419	IN struct vnode *vp;
420	IN daddr_t bn;
421	OUT struct bufobj **bop;
422	IN daddr_t *bnp;
423	OUT int *runp;
424	OUT int *runb;
425};
426
427
428%% strategy	vp	L L L
429%! strategy	debugpre	vop_strategy_debugpre
430
431vop_strategy {
432	IN struct vnode *vp;
433	IN struct buf *bp;
434};
435
436
437%% getwritemount vp	= = =
438
439vop_getwritemount {
440	IN struct vnode *vp;
441	OUT struct mount **mpp;
442};
443
444
445%% print	vp	- - -
446
447vop_print {
448	IN struct vnode *vp;
449};
450
451
452%% pathconf	vp	L L L
453
454vop_pathconf {
455	IN struct vnode *vp;
456	IN int name;
457	OUT long *retval;
458};
459
460
461%% advlock	vp	U U U
462
463vop_advlock {
464	IN struct vnode *vp;
465	IN void *id;
466	IN int op;
467	IN struct flock *fl;
468	IN int flags;
469};
470
471
472%% advlockasync	vp	U U U
473
474vop_advlockasync {
475	IN struct vnode *vp;
476	IN void *id;
477	IN int op;
478	IN struct flock *fl;
479	IN int flags;
480	IN struct task *task;
481	INOUT void **cookiep;
482};
483
484
485%% advlockpurge	vp	E E E
486
487vop_advlockpurge {
488	IN struct vnode *vp;
489};
490
491
492%% reallocblks	vp	E E E
493
494vop_reallocblks {
495	IN struct vnode *vp;
496	IN struct cluster_save *buflist;
497};
498
499
500%% getpages	vp	L L L
501
502vop_getpages {
503	IN struct vnode *vp;
504	IN vm_page_t *m;
505	IN int count;
506	IN int *rbehind;
507	IN int *rahead;
508};
509
510
511%% getpages_async	vp	L L L
512
513vop_getpages_async {
514	IN struct vnode *vp;
515	IN vm_page_t *m;
516	IN int count;
517	IN int *rbehind;
518	IN int *rahead;
519	IN vop_getpages_iodone_t *iodone;
520	IN void *arg;
521};
522
523
524%% putpages	vp	L L L
525
526vop_putpages {
527	IN struct vnode *vp;
528	IN vm_page_t *m;
529	IN int count;
530	IN int sync;
531	IN int *rtvals;
532};
533
534
535%% getacl	vp	L L L
536
537vop_getacl {
538	IN struct vnode *vp;
539	IN acl_type_t type;
540	OUT struct acl *aclp;
541	IN struct ucred *cred;
542	IN struct thread *td;
543};
544
545
546%% setacl	vp	E E E
547%! setacl	pre	vop_setacl_pre
548%! setacl	post	vop_setacl_post
549
550vop_setacl {
551	IN struct vnode *vp;
552	IN acl_type_t type;
553	IN struct acl *aclp;
554	IN struct ucred *cred;
555	IN struct thread *td;
556};
557
558
559%% aclcheck	vp	= = =
560
561vop_aclcheck {
562	IN struct vnode *vp;
563	IN acl_type_t type;
564	IN struct acl *aclp;
565	IN struct ucred *cred;
566	IN struct thread *td;
567};
568
569
570%% closeextattr	vp	L L L
571
572vop_closeextattr {
573	IN struct vnode *vp;
574	IN int commit;
575	IN struct ucred *cred;
576	IN struct thread *td;
577};
578
579
580%% getextattr	vp	L L L
581
582vop_getextattr {
583	IN struct vnode *vp;
584	IN int attrnamespace;
585	IN const char *name;
586	INOUT struct uio *uio;
587	OUT size_t *size;
588	IN struct ucred *cred;
589	IN struct thread *td;
590};
591
592
593%% listextattr	vp	L L L
594
595vop_listextattr {
596	IN struct vnode *vp;
597	IN int attrnamespace;
598	INOUT struct uio *uio;
599	OUT size_t *size;
600	IN struct ucred *cred;
601	IN struct thread *td;
602};
603
604
605%% openextattr	vp	L L L
606
607vop_openextattr {
608	IN struct vnode *vp;
609	IN struct ucred *cred;
610	IN struct thread *td;
611};
612
613
614%% deleteextattr	vp	E E E
615%! deleteextattr	pre	vop_deleteextattr_pre
616%! deleteextattr	post	vop_deleteextattr_post
617
618vop_deleteextattr {
619	IN struct vnode *vp;
620	IN int attrnamespace;
621	IN const char *name;
622	IN struct ucred *cred;
623	IN struct thread *td;
624};
625
626
627%% setextattr	vp	E E E
628%! setextattr	pre	vop_setextattr_pre
629%! setextattr	post	vop_setextattr_post
630
631vop_setextattr {
632	IN struct vnode *vp;
633	IN int attrnamespace;
634	IN const char *name;
635	INOUT struct uio *uio;
636	IN struct ucred *cred;
637	IN struct thread *td;
638};
639
640
641%% setlabel	vp	E E E
642
643vop_setlabel {
644	IN struct vnode *vp;
645	IN struct label *label;
646	IN struct ucred *cred;
647	IN struct thread *td;
648};
649
650
651%% vptofh	vp	= = =
652
653vop_vptofh {
654	IN struct vnode *vp;
655	IN struct fid *fhp;
656};
657
658
659%% vptocnp		vp	L L L
660%% vptocnp		vpp	- U -
661
662vop_vptocnp {
663	IN struct vnode *vp;
664	OUT struct vnode **vpp;
665	IN struct ucred *cred;
666	INOUT char *buf;
667	INOUT size_t *buflen;
668};
669
670
671%% allocate	vp	E E E
672
673vop_allocate {
674	IN struct vnode *vp;
675	INOUT off_t *offset;
676	INOUT off_t *len;
677};
678
679
680%% advise	vp	U U U
681
682vop_advise {
683	IN struct vnode *vp;
684	IN off_t start;
685	IN off_t end;
686	IN int advice;
687};
688
689
690%% unp_bind	vp	E E E
691
692vop_unp_bind {
693	IN struct vnode *vp;
694	IN struct unpcb *unpcb;
695};
696
697
698%% unp_connect	vp	L L L
699
700vop_unp_connect {
701	IN struct vnode *vp;
702	OUT struct unpcb **unpcb;
703};
704
705
706%% unp_detach	vp	= = =
707
708vop_unp_detach {
709	IN struct vnode *vp;
710};
711
712
713%% is_text	vp	L L L
714
715vop_is_text {
716	IN struct vnode *vp;
717};
718
719
720%% set_text	vp	= = =
721
722vop_set_text {
723	IN struct vnode *vp;
724};
725
726
727%% vop_unset_text	vp	L L L
728
729vop_unset_text {
730	IN struct vnode *vp;
731};
732
733
734%% add_writecount	vp	L L L
735
736vop_add_writecount {
737	IN struct vnode *vp;
738	IN int inc;
739};
740
741
742%% fdatasync	vp	L L L
743
744vop_fdatasync {
745	IN struct vnode *vp;
746	IN struct thread *td;
747};
748
749
750%% copy_file_range	invp	U U U
751%% copy_file_range	outvp	U U U
752
753vop_copy_file_range {
754	IN struct vnode *invp;
755	INOUT off_t *inoffp;
756	IN struct vnode *outvp;
757	INOUT off_t *outoffp;
758	INOUT size_t *lenp;
759	IN unsigned int flags;
760	IN struct ucred *incred;
761	IN struct ucred *outcred;
762	IN struct thread *fsizetd;
763};
764
765
766# The VOPs below are spares at the end of the table to allow new VOPs to be
767# added in stable branches without breaking the KBI.  New VOPs in HEAD should
768# be added above these spares.  When merging a new VOP to a stable branch,
769# the new VOP should replace one of the spares.
770
771vop_spare1 {
772	IN struct vnode *vp;
773};
774
775vop_spare2 {
776	IN struct vnode *vp;
777};
778
779vop_spare3 {
780	IN struct vnode *vp;
781};
782
783vop_spare4 {
784	IN struct vnode *vp;
785};
786
787vop_spare5 {
788	IN struct vnode *vp;
789};
790