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