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
67%% lookup	dvp	L L L
68%% lookup	vpp	- L -
69
70# XXX - the lookup locking protocol defies simple description and depends
71#	on the flags and operation fields in the (cnp) structure.  Note
72#	especially that *vpp may equal dvp and both may be locked.
73
74vop_lookup {
75	IN struct vnode *dvp;
76	INOUT struct vnode **vpp;
77	IN struct componentname *cnp;
78};
79
80
81%% cachedlookup	dvp	L L L
82%% cachedlookup	vpp	- L -
83
84# This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
85
86vop_cachedlookup {
87	IN struct vnode *dvp;
88	INOUT struct vnode **vpp;
89	IN struct componentname *cnp;
90};
91
92
93%% create	dvp	E E E
94%% create	vpp	- L -
95%! create	post	vop_create_post
96
97vop_create {
98	IN struct vnode *dvp;
99	OUT struct vnode **vpp;
100	IN struct componentname *cnp;
101	IN struct vattr *vap;
102};
103
104
105%% whiteout	dvp	E E E
106
107vop_whiteout {
108	IN struct vnode *dvp;
109	IN struct componentname *cnp;
110	IN int flags;
111};
112
113
114%% mknod	dvp	E E E
115%% mknod	vpp	- L -
116%! mknod	post	vop_mknod_post
117
118vop_mknod {
119	IN struct vnode *dvp;
120	OUT struct vnode **vpp;
121	IN struct componentname *cnp;
122	IN struct vattr *vap;
123};
124
125
126%% open		vp	L L L
127%! open		post	vop_open_post
128
129vop_open {
130	IN struct vnode *vp;
131	IN int mode;
132	IN struct ucred *cred;
133	IN struct thread *td;
134	IN struct file *fp;
135};
136
137
138%% close	vp	L L L
139%! close	post	vop_close_post
140
141vop_close {
142	IN struct vnode *vp;
143	IN int fflag;
144	IN struct ucred *cred;
145	IN struct thread *td;
146};
147
148
149%% access	vp	L L L
150
151vop_access {
152	IN struct vnode *vp;
153	IN accmode_t accmode;
154	IN struct ucred *cred;
155	IN struct thread *td;
156};
157
158
159%% accessx	vp	L L L
160
161vop_accessx {
162	IN struct vnode *vp;
163	IN accmode_t accmode;
164	IN struct ucred *cred;
165	IN struct thread *td;
166};
167
168
169%% getattr	vp	L L L
170
171vop_getattr {
172	IN struct vnode *vp;
173	OUT struct vattr *vap;
174	IN struct ucred *cred;
175};
176
177
178%% setattr	vp	E E E
179%! setattr	post	vop_setattr_post
180
181vop_setattr {
182	IN struct vnode *vp;
183	IN struct vattr *vap;
184	IN struct ucred *cred;
185};
186
187
188%% markatime	vp	L L L
189
190vop_markatime {
191	IN struct vnode *vp;
192};
193
194
195%% read		vp	L L L
196%! read		post	vop_read_post
197
198vop_read {
199	IN struct vnode *vp;
200	INOUT struct uio *uio;
201	IN int ioflag;
202	IN struct ucred *cred;
203};
204
205
206%% write	vp	L L L
207%! write	pre	VOP_WRITE_PRE
208%! write	post	VOP_WRITE_POST
209
210vop_write {
211	IN struct vnode *vp;
212	INOUT struct uio *uio;
213	IN int ioflag;
214	IN struct ucred *cred;
215};
216
217
218%% ioctl	vp	U U U
219
220vop_ioctl {
221	IN struct vnode *vp;
222	IN u_long command;
223	IN void *data;
224	IN int fflag;
225	IN struct ucred *cred;
226	IN struct thread *td;
227};
228
229
230%% poll		vp	U U U
231
232vop_poll {
233	IN struct vnode *vp;
234	IN int events;
235	IN struct ucred *cred;
236	IN struct thread *td;
237};
238
239
240%% kqfilter	vp	U U U
241
242vop_kqfilter {
243	IN struct vnode *vp;
244	IN struct knote *kn;
245};
246
247
248%% revoke	vp	L L L
249
250vop_revoke {
251	IN struct vnode *vp;
252	IN int flags;
253};
254
255
256%% fsync	vp	L L L
257
258vop_fsync {
259	IN struct vnode *vp;
260	IN int waitfor;
261	IN struct thread *td;
262};
263
264
265%% remove	dvp	E E E
266%% remove	vp	E E E
267%! remove	post	vop_remove_post
268
269vop_remove {
270	IN struct vnode *dvp;
271	IN struct vnode *vp;
272	IN struct componentname *cnp;
273};
274
275
276%% link		tdvp	E E E
277%% link		vp	E E E
278%! link		post	vop_link_post
279
280vop_link {
281	IN struct vnode *tdvp;
282	IN struct vnode *vp;
283	IN struct componentname *cnp;
284};
285
286
287%! rename	pre	vop_rename_pre
288%! rename	post	vop_rename_post
289
290vop_rename {
291	IN WILLRELE struct vnode *fdvp;
292	IN WILLRELE struct vnode *fvp;
293	IN struct componentname *fcnp;
294	IN WILLRELE struct vnode *tdvp;
295	IN WILLRELE struct vnode *tvp;
296	IN struct componentname *tcnp;
297};
298
299
300%% mkdir	dvp	E E E
301%% mkdir	vpp	- E -
302%! mkdir	post	vop_mkdir_post
303
304vop_mkdir {
305	IN struct vnode *dvp;
306	OUT struct vnode **vpp;
307	IN struct componentname *cnp;
308	IN struct vattr *vap;
309};
310
311
312%% rmdir	dvp	E E E
313%% rmdir	vp	E E E
314%! rmdir	post	vop_rmdir_post
315
316vop_rmdir {
317	IN struct vnode *dvp;
318	IN struct vnode *vp;
319	IN struct componentname *cnp;
320};
321
322
323%% symlink	dvp	E E E
324%% symlink	vpp	- E -
325%! symlink	post	vop_symlink_post
326
327vop_symlink {
328	IN struct vnode *dvp;
329	OUT struct vnode **vpp;
330	IN struct componentname *cnp;
331	IN struct vattr *vap;
332	IN char *target;
333};
334
335
336%% readdir	vp	L L L
337%! readdir	post	vop_readdir_post
338
339vop_readdir {
340	IN struct vnode *vp;
341	INOUT struct uio *uio;
342	IN struct ucred *cred;
343	INOUT int *eofflag;
344	OUT int *ncookies;
345	INOUT u_long **cookies;
346};
347
348
349%% readlink	vp	L L L
350
351vop_readlink {
352	IN struct vnode *vp;
353	INOUT struct uio *uio;
354	IN struct ucred *cred;
355};
356
357
358%% inactive	vp	E E E
359
360vop_inactive {
361	IN struct vnode *vp;
362	IN struct thread *td;
363};
364
365
366%% reclaim	vp	E E E
367%! reclaim	post	vop_reclaim_post
368
369vop_reclaim {
370	IN struct vnode *vp;
371	IN struct thread *td;
372};
373
374
375%! lock1	pre	vop_lock_pre
376%! lock1	post	vop_lock_post
377
378vop_lock1 {
379	IN struct vnode *vp;
380	IN int flags;
381	IN char *file;
382	IN int line;
383};
384
385
386%! unlock	pre	vop_unlock_pre
387%! unlock	post	vop_unlock_post
388
389vop_unlock {
390	IN struct vnode *vp;
391	IN int flags;
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 register_t *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 int *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 socket *socket;
670};
671
672
673%% unp_connect	vp	L L L
674
675vop_unp_connect {
676	IN struct vnode *vp;
677	OUT struct socket **socket;
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	E E E
696
697vop_set_text {
698	IN struct vnode *vp;
699};
700
701
702%% vop_unset_text	vp	E E E
703
704vop_unset_text {
705	IN struct vnode *vp;
706};
707
708
709%% get_writecount	vp	L L L
710
711vop_get_writecount {
712	IN struct vnode *vp;
713	OUT int *writecount;
714};
715
716
717%% add_writecount	vp	E E E
718
719vop_add_writecount {
720	IN struct vnode *vp;
721	IN int inc;
722};
723
724
725%% fdatasync	vp	L L L
726
727vop_fdatasync {
728	IN struct vnode *vp;
729	IN struct thread *td;
730};
731
732
733# The VOPs below are spares at the end of the table to allow new VOPs to be
734# added in stable branches without breaking the KBI.  New VOPs in HEAD should
735# be added above these spares.  When merging a new VOP to a stable branch,
736# the new VOP should replace one of the spares.
737
738vop_spare1 {
739	IN struct vnode *vp;
740};
741
742vop_spare2 {
743	IN struct vnode *vp;
744};
745
746vop_spare3 {
747	IN struct vnode *vp;
748};
749
750vop_spare4 {
751	IN struct vnode *vp;
752};
753
754vop_spare5 {
755	IN struct vnode *vp;
756};
757