xref: /freebsd/sys/kern/vnode_if.src (revision 4b50c451720d8b427757a6da1dd2bb4c52cd9e35)
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};
394
395
396%% bmap		vp	L L L
397
398vop_bmap {
399	IN struct vnode *vp;
400	IN daddr_t bn;
401	OUT struct bufobj **bop;
402	IN daddr_t *bnp;
403	OUT int *runp;
404	OUT int *runb;
405};
406
407
408%% strategy	vp	L L L
409%! strategy	pre	vop_strategy_pre
410
411vop_strategy {
412	IN struct vnode *vp;
413	IN struct buf *bp;
414};
415
416
417%% getwritemount vp	= = =
418
419vop_getwritemount {
420	IN struct vnode *vp;
421	OUT struct mount **mpp;
422};
423
424
425%% print	vp	- - -
426
427vop_print {
428	IN struct vnode *vp;
429};
430
431
432%% pathconf	vp	L L L
433
434vop_pathconf {
435	IN struct vnode *vp;
436	IN int name;
437	OUT long *retval;
438};
439
440
441%% advlock	vp	U U U
442
443vop_advlock {
444	IN struct vnode *vp;
445	IN void *id;
446	IN int op;
447	IN struct flock *fl;
448	IN int flags;
449};
450
451
452%% advlockasync	vp	U U U
453
454vop_advlockasync {
455	IN struct vnode *vp;
456	IN void *id;
457	IN int op;
458	IN struct flock *fl;
459	IN int flags;
460	IN struct task *task;
461	INOUT void **cookiep;
462};
463
464
465%% advlockpurge	vp	E E E
466
467vop_advlockpurge {
468	IN struct vnode *vp;
469};
470
471
472%% reallocblks	vp	E E E
473
474vop_reallocblks {
475	IN struct vnode *vp;
476	IN struct cluster_save *buflist;
477};
478
479
480%% getpages	vp	L L L
481
482vop_getpages {
483	IN struct vnode *vp;
484	IN vm_page_t *m;
485	IN int count;
486	IN int *rbehind;
487	IN int *rahead;
488};
489
490
491%% getpages_async	vp	L L L
492
493vop_getpages_async {
494	IN struct vnode *vp;
495	IN vm_page_t *m;
496	IN int count;
497	IN int *rbehind;
498	IN int *rahead;
499	IN vop_getpages_iodone_t *iodone;
500	IN void *arg;
501};
502
503
504%% putpages	vp	L L L
505
506vop_putpages {
507	IN struct vnode *vp;
508	IN vm_page_t *m;
509	IN int count;
510	IN int sync;
511	IN int *rtvals;
512};
513
514
515%% getacl	vp	L L L
516
517vop_getacl {
518	IN struct vnode *vp;
519	IN acl_type_t type;
520	OUT struct acl *aclp;
521	IN struct ucred *cred;
522	IN struct thread *td;
523};
524
525
526%% setacl	vp	E E E
527
528vop_setacl {
529	IN struct vnode *vp;
530	IN acl_type_t type;
531	IN struct acl *aclp;
532	IN struct ucred *cred;
533	IN struct thread *td;
534};
535
536
537%% aclcheck	vp	= = =
538
539vop_aclcheck {
540	IN struct vnode *vp;
541	IN acl_type_t type;
542	IN struct acl *aclp;
543	IN struct ucred *cred;
544	IN struct thread *td;
545};
546
547
548%% closeextattr	vp	L L L
549
550vop_closeextattr {
551	IN struct vnode *vp;
552	IN int commit;
553	IN struct ucred *cred;
554	IN struct thread *td;
555};
556
557
558%% getextattr	vp	L L L
559
560vop_getextattr {
561	IN struct vnode *vp;
562	IN int attrnamespace;
563	IN const char *name;
564	INOUT struct uio *uio;
565	OUT size_t *size;
566	IN struct ucred *cred;
567	IN struct thread *td;
568};
569
570
571%% listextattr	vp	L L L
572
573vop_listextattr {
574	IN struct vnode *vp;
575	IN int attrnamespace;
576	INOUT struct uio *uio;
577	OUT size_t *size;
578	IN struct ucred *cred;
579	IN struct thread *td;
580};
581
582
583%% openextattr	vp	L L L
584
585vop_openextattr {
586	IN struct vnode *vp;
587	IN struct ucred *cred;
588	IN struct thread *td;
589};
590
591
592%% deleteextattr	vp	E E E
593%! deleteextattr	post	vop_deleteextattr_post
594
595vop_deleteextattr {
596	IN struct vnode *vp;
597	IN int attrnamespace;
598	IN const char *name;
599	IN struct ucred *cred;
600	IN struct thread *td;
601};
602
603
604%% setextattr	vp	E E E
605%! setextattr	post	vop_setextattr_post
606
607vop_setextattr {
608	IN struct vnode *vp;
609	IN int attrnamespace;
610	IN const char *name;
611	INOUT struct uio *uio;
612	IN struct ucred *cred;
613	IN struct thread *td;
614};
615
616
617%% setlabel	vp	E E E
618
619vop_setlabel {
620	IN struct vnode *vp;
621	IN struct label *label;
622	IN struct ucred *cred;
623	IN struct thread *td;
624};
625
626
627%% vptofh	vp	= = =
628
629vop_vptofh {
630	IN struct vnode *vp;
631	IN struct fid *fhp;
632};
633
634
635%% vptocnp		vp	L L L
636%% vptocnp		vpp	- U -
637
638vop_vptocnp {
639	IN struct vnode *vp;
640	OUT struct vnode **vpp;
641	IN struct ucred *cred;
642	INOUT char *buf;
643	INOUT int *buflen;
644};
645
646
647%% allocate	vp	E E E
648
649vop_allocate {
650	IN struct vnode *vp;
651	INOUT off_t *offset;
652	INOUT off_t *len;
653};
654
655
656%% advise	vp	U U U
657
658vop_advise {
659	IN struct vnode *vp;
660	IN off_t start;
661	IN off_t end;
662	IN int advice;
663};
664
665
666%% unp_bind	vp	E E E
667
668vop_unp_bind {
669	IN struct vnode *vp;
670	IN struct unpcb *unpcb;
671};
672
673
674%% unp_connect	vp	L L L
675
676vop_unp_connect {
677	IN struct vnode *vp;
678	OUT struct unpcb **unpcb;
679};
680
681
682%% unp_detach	vp	= = =
683
684vop_unp_detach {
685	IN struct vnode *vp;
686};
687
688
689%% is_text	vp	L L L
690
691vop_is_text {
692	IN struct vnode *vp;
693};
694
695
696%% set_text	vp	= = =
697
698vop_set_text {
699	IN struct vnode *vp;
700};
701
702
703%% vop_unset_text	vp	L L L
704
705vop_unset_text {
706	IN struct vnode *vp;
707};
708
709
710%% add_writecount	vp	L L L
711
712vop_add_writecount {
713	IN struct vnode *vp;
714	IN int inc;
715};
716
717
718%% fdatasync	vp	L L L
719
720vop_fdatasync {
721	IN struct vnode *vp;
722	IN struct thread *td;
723};
724
725
726%% copy_file_range	invp	U U U
727%% copy_file_range	outvp	U U U
728
729vop_copy_file_range {
730	IN struct vnode *invp;
731	INOUT off_t *inoffp;
732	IN struct vnode *outvp;
733	INOUT off_t *outoffp;
734	INOUT size_t *lenp;
735	IN unsigned int flags;
736	IN struct ucred *incred;
737	IN struct ucred *outcred;
738	IN struct thread *fsizetd;
739};
740
741
742# The VOPs below are spares at the end of the table to allow new VOPs to be
743# added in stable branches without breaking the KBI.  New VOPs in HEAD should
744# be added above these spares.  When merging a new VOP to a stable branch,
745# the new VOP should replace one of the spares.
746
747vop_spare1 {
748	IN struct vnode *vp;
749};
750
751vop_spare2 {
752	IN struct vnode *vp;
753};
754
755vop_spare3 {
756	IN struct vnode *vp;
757};
758
759vop_spare4 {
760	IN struct vnode *vp;
761};
762
763vop_spare5 {
764	IN struct vnode *vp;
765};
766