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