xref: /freebsd/sys/kern/vnode_if.src (revision fed1ca4b719c56c930f2259d80663cd34be812bb)
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# 4. 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# A: any lock type.
44# S: locked with shared lock.
45# E: locked with exclusive lock for this process.
46# O: locked with exclusive lock for other process.
47# U: unlocked.
48# -: not applicable.  vnode does not yet (or no longer) exists.
49# =: the same on input and output, may be either L or U.
50# X: locked if not nil.
51#
52# The paramater named "vpp" is assumed to be always used with double
53# indirection (**vpp) and that name is hard-coded in vnode_if.awk !
54#
55# Lines starting with %! specify a pre or post-condition function
56# to call before/after the vop call.
57#
58# If other such parameters are introduced, they have to be added to
59# the AWK script at the head of the definition of "add_debug_code()".
60#
61
62vop_islocked {
63	IN struct vnode *vp;
64};
65
66%% lookup	dvp	L L L
67%% lookup	vpp	- L -
68
69# XXX - the lookup locking protocol defies simple description and depends
70#	on the flags and operation fields in the (cnp) structure.  Note
71#	especially that *vpp may equal dvp and both may be locked.
72
73vop_lookup {
74	IN struct vnode *dvp;
75	INOUT struct vnode **vpp;
76	IN struct componentname *cnp;
77};
78
79%% cachedlookup	dvp	L L L
80%% cachedlookup	vpp	- L -
81
82# This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
83
84vop_cachedlookup {
85	IN struct vnode *dvp;
86	INOUT struct vnode **vpp;
87	IN struct componentname *cnp;
88};
89
90%% create	dvp	E E E
91%% create	vpp	- L -
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
104vop_whiteout {
105	IN struct vnode *dvp;
106	IN struct componentname *cnp;
107	IN int flags;
108};
109
110
111%% mknod	dvp	E E E
112%% mknod	vpp	- L -
113%! mknod	post	vop_mknod_post
114
115vop_mknod {
116	IN struct vnode *dvp;
117	OUT struct vnode **vpp;
118	IN struct componentname *cnp;
119	IN struct vattr *vap;
120};
121
122
123%% open		vp	L L L
124%! open		post	vop_open_post
125
126vop_open {
127	IN struct vnode *vp;
128	IN int mode;
129	IN struct ucred *cred;
130	IN struct thread *td;
131	IN struct file *fp;
132};
133
134
135%% close	vp	L L L
136%! close	post	vop_close_post
137
138vop_close {
139	IN struct vnode *vp;
140	IN int fflag;
141	IN struct ucred *cred;
142	IN struct thread *td;
143};
144
145
146%% access	vp	L L L
147
148vop_access {
149	IN struct vnode *vp;
150	IN accmode_t accmode;
151	IN struct ucred *cred;
152	IN struct thread *td;
153};
154
155
156%% accessx	vp	L L L
157
158vop_accessx {
159	IN struct vnode *vp;
160	IN accmode_t accmode;
161	IN struct ucred *cred;
162	IN struct thread *td;
163};
164
165
166%% getattr	vp	L L L
167
168vop_getattr {
169	IN struct vnode *vp;
170	OUT struct vattr *vap;
171	IN struct ucred *cred;
172};
173
174
175%% setattr	vp	E E E
176%! setattr	post	vop_setattr_post
177
178vop_setattr {
179	IN struct vnode *vp;
180	IN struct vattr *vap;
181	IN struct ucred *cred;
182};
183
184%% markatime	vp	L L L
185
186vop_markatime {
187	IN struct vnode *vp;
188};
189
190%% read		vp	L L L
191%! read		post	vop_read_post
192
193vop_read {
194	IN struct vnode *vp;
195	INOUT struct uio *uio;
196	IN int ioflag;
197	IN struct ucred *cred;
198};
199
200
201%% write	vp	L L L
202%! write	pre	VOP_WRITE_PRE
203%! write	post	VOP_WRITE_POST
204
205vop_write {
206	IN struct vnode *vp;
207	INOUT struct uio *uio;
208	IN int ioflag;
209	IN struct ucred *cred;
210};
211
212
213%% ioctl	vp	U U U
214
215vop_ioctl {
216	IN struct vnode *vp;
217	IN u_long command;
218	IN void *data;
219	IN int fflag;
220	IN struct ucred *cred;
221	IN struct thread *td;
222};
223
224
225%% poll		vp	U U U
226
227vop_poll {
228	IN struct vnode *vp;
229	IN int events;
230	IN struct ucred *cred;
231	IN struct thread *td;
232};
233
234
235%% kqfilter	vp	U U U
236
237vop_kqfilter {
238	IN struct vnode *vp;
239	IN struct knote *kn;
240};
241
242
243%% revoke	vp	L L L
244
245vop_revoke {
246	IN struct vnode *vp;
247	IN int flags;
248};
249
250
251%% fsync	vp	L L L
252
253vop_fsync {
254	IN struct vnode *vp;
255	IN int waitfor;
256	IN struct thread *td;
257};
258
259
260%% remove	dvp	E E E
261%% remove	vp	E E E
262%! remove	post	vop_remove_post
263
264vop_remove {
265	IN struct vnode *dvp;
266	IN struct vnode *vp;
267	IN struct componentname *cnp;
268};
269
270
271%% link		tdvp	E E E
272%% link		vp	E E E
273%! link		post	vop_link_post
274
275vop_link {
276	IN struct vnode *tdvp;
277	IN struct vnode *vp;
278	IN struct componentname *cnp;
279};
280
281
282%! rename	pre	vop_rename_pre
283%! rename	post	vop_rename_post
284
285vop_rename {
286	IN WILLRELE struct vnode *fdvp;
287	IN WILLRELE struct vnode *fvp;
288	IN struct componentname *fcnp;
289	IN WILLRELE struct vnode *tdvp;
290	IN WILLRELE struct vnode *tvp;
291	IN struct componentname *tcnp;
292};
293
294
295%% mkdir	dvp	E E E
296%% mkdir	vpp	- E -
297%! mkdir	post	vop_mkdir_post
298
299vop_mkdir {
300	IN struct vnode *dvp;
301	OUT struct vnode **vpp;
302	IN struct componentname *cnp;
303	IN struct vattr *vap;
304};
305
306
307%% rmdir	dvp	E E E
308%% rmdir	vp	E E E
309%! rmdir	post	vop_rmdir_post
310
311vop_rmdir {
312	IN struct vnode *dvp;
313	IN struct vnode *vp;
314	IN struct componentname *cnp;
315};
316
317
318%% symlink	dvp	E E E
319%% symlink	vpp	- E -
320%! symlink	post	vop_symlink_post
321
322vop_symlink {
323	IN struct vnode *dvp;
324	OUT struct vnode **vpp;
325	IN struct componentname *cnp;
326	IN struct vattr *vap;
327	IN char *target;
328};
329
330
331%% readdir	vp	L L L
332%! readdir	post	vop_readdir_post
333
334vop_readdir {
335	IN struct vnode *vp;
336	INOUT struct uio *uio;
337	IN struct ucred *cred;
338	INOUT int *eofflag;
339	OUT int *ncookies;
340	INOUT u_long **cookies;
341};
342
343
344%% readlink	vp	L L L
345
346vop_readlink {
347	IN struct vnode *vp;
348	INOUT struct uio *uio;
349	IN struct ucred *cred;
350};
351
352
353%% inactive	vp	E E E
354
355vop_inactive {
356	IN struct vnode *vp;
357	IN struct thread *td;
358};
359
360
361%% reclaim	vp	E E E
362%! reclaim	post	vop_reclaim_post
363
364vop_reclaim {
365	IN struct vnode *vp;
366	IN struct thread *td;
367};
368
369
370%! lock1	pre	vop_lock_pre
371%! lock1	post	vop_lock_post
372
373vop_lock1 {
374	IN struct vnode *vp;
375	IN int flags;
376	IN char *file;
377	IN int line;
378};
379
380
381%! unlock	pre	vop_unlock_pre
382%! unlock	post	vop_unlock_post
383
384vop_unlock {
385	IN struct vnode *vp;
386	IN int flags;
387};
388
389
390%% bmap		vp	L L L
391
392vop_bmap {
393	IN struct vnode *vp;
394	IN daddr_t bn;
395	OUT struct bufobj **bop;
396	IN daddr_t *bnp;
397	OUT int *runp;
398	OUT int *runb;
399};
400
401
402%% strategy	vp	L L L
403%! strategy	pre	vop_strategy_pre
404
405vop_strategy {
406	IN struct vnode *vp;
407	IN struct buf *bp;
408};
409
410
411%% getwritemount vp	= = =
412
413vop_getwritemount {
414	IN struct vnode *vp;
415	OUT struct mount **mpp;
416};
417
418
419%% print	vp	- - -
420
421vop_print {
422	IN struct vnode *vp;
423};
424
425
426%% pathconf	vp	L L L
427
428vop_pathconf {
429	IN struct vnode *vp;
430	IN int name;
431	OUT register_t *retval;
432};
433
434
435%% advlock	vp	U U U
436
437vop_advlock {
438	IN struct vnode *vp;
439	IN void *id;
440	IN int op;
441	IN struct flock *fl;
442	IN int flags;
443};
444
445
446%% advlockasync	vp	U U U
447
448vop_advlockasync {
449	IN struct vnode *vp;
450	IN void *id;
451	IN int op;
452	IN struct flock *fl;
453	IN int flags;
454	IN struct task *task;
455	INOUT void **cookiep;
456};
457
458
459%% advlockpurge	vp	E E E
460
461vop_advlockpurge {
462	IN struct vnode *vp;
463};
464
465
466%% reallocblks	vp	E E E
467
468vop_reallocblks {
469	IN struct vnode *vp;
470	IN struct cluster_save *buflist;
471};
472
473
474%% getpages	vp	L L L
475
476vop_getpages {
477	IN struct vnode *vp;
478	IN vm_page_t *m;
479	IN int count;
480	IN int *rbehind;
481	IN int *rahead;
482};
483
484
485%% getpages_async	vp	L L L
486
487vop_getpages_async {
488	IN struct vnode *vp;
489	IN vm_page_t *m;
490	IN int count;
491	IN int *rbehind;
492	IN int *rahead;
493	IN vop_getpages_iodone_t *iodone;
494	IN void *arg;
495};
496
497
498%% putpages	vp	L L L
499
500vop_putpages {
501	IN struct vnode *vp;
502	IN vm_page_t *m;
503	IN int count;
504	IN int sync;
505	IN int *rtvals;
506};
507
508
509%% getacl	vp	L L L
510
511vop_getacl {
512	IN struct vnode *vp;
513	IN acl_type_t type;
514	OUT struct acl *aclp;
515	IN struct ucred *cred;
516	IN struct thread *td;
517};
518
519
520%% setacl	vp	E E E
521
522vop_setacl {
523	IN struct vnode *vp;
524	IN acl_type_t type;
525	IN struct acl *aclp;
526	IN struct ucred *cred;
527	IN struct thread *td;
528};
529
530
531%% aclcheck	vp	= = =
532
533vop_aclcheck {
534	IN struct vnode *vp;
535	IN acl_type_t type;
536	IN struct acl *aclp;
537	IN struct ucred *cred;
538	IN struct thread *td;
539};
540
541
542%% closeextattr	vp	L L L
543
544vop_closeextattr {
545	IN struct vnode *vp;
546	IN int commit;
547	IN struct ucred *cred;
548	IN struct thread *td;
549};
550
551
552%% getextattr	vp	L L L
553
554vop_getextattr {
555	IN struct vnode *vp;
556	IN int attrnamespace;
557	IN const char *name;
558	INOUT struct uio *uio;
559	OUT size_t *size;
560	IN struct ucred *cred;
561	IN struct thread *td;
562};
563
564
565%% listextattr	vp	L L L
566
567vop_listextattr {
568	IN struct vnode *vp;
569	IN int attrnamespace;
570	INOUT struct uio *uio;
571	OUT size_t *size;
572	IN struct ucred *cred;
573	IN struct thread *td;
574};
575
576
577%% openextattr	vp	L L L
578
579vop_openextattr {
580	IN struct vnode *vp;
581	IN struct ucred *cred;
582	IN struct thread *td;
583};
584
585
586%% deleteextattr	vp	E E E
587%! deleteextattr	post	vop_deleteextattr_post
588
589vop_deleteextattr {
590	IN struct vnode *vp;
591	IN int attrnamespace;
592	IN const char *name;
593	IN struct ucred *cred;
594	IN struct thread *td;
595};
596
597
598%% setextattr	vp	E E E
599%! setextattr	post	vop_setextattr_post
600
601vop_setextattr {
602	IN struct vnode *vp;
603	IN int attrnamespace;
604	IN const char *name;
605	INOUT struct uio *uio;
606	IN struct ucred *cred;
607	IN struct thread *td;
608};
609
610
611%% setlabel	vp	E E E
612
613vop_setlabel {
614	IN struct vnode *vp;
615	IN struct label *label;
616	IN struct ucred *cred;
617	IN struct thread *td;
618};
619
620
621%% vptofh	vp	= = =
622
623vop_vptofh {
624	IN struct vnode *vp;
625	IN struct fid *fhp;
626};
627
628
629%% vptocnp		vp	L L L
630%% vptocnp		vpp	- U -
631
632vop_vptocnp {
633	IN struct vnode *vp;
634	OUT struct vnode **vpp;
635	IN struct ucred *cred;
636	INOUT char *buf;
637	INOUT int *buflen;
638};
639
640
641%% allocate	vp	E E E
642
643vop_allocate {
644	IN struct vnode *vp;
645	INOUT off_t *offset;
646	INOUT off_t *len;
647};
648
649%% advise	vp	U U U
650
651vop_advise {
652	IN struct vnode *vp;
653	IN off_t start;
654	IN off_t end;
655	IN int advice;
656};
657
658%% unp_bind	vp	E E E
659
660vop_unp_bind {
661	IN struct vnode *vp;
662	IN struct socket *socket;
663};
664
665%% unp_connect	vp	L L L
666
667vop_unp_connect {
668	IN struct vnode *vp;
669	OUT struct socket **socket;
670};
671
672%% unp_detach	vp	= = =
673
674vop_unp_detach {
675	IN struct vnode *vp;
676};
677
678%% is_text	vp	L L L
679
680vop_is_text {
681	IN struct vnode *vp;
682};
683
684%% set_text	vp	E E E
685
686vop_set_text {
687	IN struct vnode *vp;
688};
689
690%% vop_unset_text	vp	E E E
691
692vop_unset_text {
693	IN struct vnode *vp;
694};
695
696%% get_writecount	vp	L L L
697
698vop_get_writecount {
699	IN struct vnode *vp;
700	OUT int *writecount;
701};
702
703%% add_writecount	vp	E E E
704
705vop_add_writecount {
706	IN struct vnode *vp;
707	IN int inc;
708};
709
710# The VOPs below are spares at the end of the table to allow new VOPs to be
711# added in stable branches without breaking the KBI.  New VOPs in HEAD should
712# be added above these spares.  When merging a new VOP to a stable branch,
713# the new VOP should replace one of the spares.
714
715vop_spare1 {
716	IN struct vnode *vp;
717};
718
719vop_spare2 {
720	IN struct vnode *vp;
721};
722
723vop_spare3 {
724	IN struct vnode *vp;
725};
726
727vop_spare4 {
728	IN struct vnode *vp;
729};
730
731vop_spare5 {
732	IN struct vnode *vp;
733};
734