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