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