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