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