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