vnode_if.src revision 190888
191714Sdes#-
2284345Ssjg# Copyright (c) 1992, 1993
341227Sjdp#	The Regents of the University of California.  All rights reserved.
492297Sdes#
591714Sdes# Redistribution and use in source and binary forms, with or without
641227Sjdp# modification, are permitted provided that the following conditions
791714Sdes# are met:
891714Sdes# 1. Redistributions of source code must retain the above copyright
991714Sdes#    notice, this list of conditions and the following disclaimer.
1091714Sdes# 2. Redistributions in binary form must reproduce the above copyright
1191714Sdes#    notice, this list of conditions and the following disclaimer in the
1241227Sjdp#    documentation and/or other materials provided with the distribution.
1341227Sjdp# 4. Neither the name of the University nor the names of its contributors
1441227Sjdp#    may be used to endorse or promote products derived from this software
1541227Sjdp#    without specific prior written permission.
1641227Sjdp#
1741227Sjdp# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1841227Sjdp# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1941227Sjdp# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2091714Sdes# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2191714Sdes# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2291714Sdes# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2341227Sjdp# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2441227Sjdp# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2541227Sjdp# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2641227Sjdp# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2741227Sjdp# SUCH DAMAGE.
2841227Sjdp#
2941227Sjdp#	@(#)vnode_if.src	8.12 (Berkeley) 5/14/95
3041227Sjdp# $FreeBSD: head/sys/kern/vnode_if.src 190888 2009-04-10 10:52:19Z rwatson $
3141227Sjdp#
3241227Sjdp
3341227Sjdp#
3441227Sjdp# Above each of the vop descriptors in lines starting with %%
3541227Sjdp# is a specification of the locking protocol used by each vop call.
3691714Sdes# The first column is the name of the variable, the remaining three
3741227Sjdp# columns are in, out and error respectively.  The "in" column defines
38313538Sngie# the lock state on input, the "out" column defines the state on succesful
3976242Smarkm# return, and the "error" column defines the locking state on error exit.
40297946Sbdrewery#
41297946Sbdrewery# The locking value can take the following values:
42297946Sbdrewery# L: locked; not converted to type of lock.
4341227Sjdp# A: any lock type.
44297946Sbdrewery# S: locked with shared lock.
45284345Ssjg# E: locked with exclusive lock for this process.
46297946Sbdrewery# O: locked with exclusive lock for other process.
47297946Sbdrewery# U: unlocked.
48297946Sbdrewery# -: not applicable.  vnode does not yet (or no longer) exists.
4941227Sjdp# =: the same on input and output, may be either L or U.
50226632Sdes# X: locked if not nil.
5191714Sdes#
52226632Sdes# The paramater named "vpp" is assumed to be always used with double
53226632Sdes# indirection (**vpp) and that name is hard-codeed in vnode_if.awk !
54226632Sdes#
55226632Sdes# Lines starting with %! specify a pre or post-condition function
56226632Sdes# to call before/after the vop call.
57226632Sdes#
58226632Sdes# If other such parameters are introduced, they have to be added to
59112044Sobrien# the AWK script at the head of the definition of "add_debug_code()".
6091714Sdes#
61112044Sobrien
62112044Sobrienvop_islocked {
63226632Sdes	IN struct vnode *vp;
64226632Sdes};
6542917Sjdp
6691714Sdes%% lookup	dvp	L ? ?
67337477Sbdrewery%% lookup	vpp	- L -
68337477Sbdrewery%! lookup	pre	vop_lookup_pre
6942917Sjdp%! lookup	post	vop_lookup_post
70313538Sngie
71# XXX - the lookup locking protocol defies simple description and depends
72#	on the flags and operation fields in the (cnp) structure.  Note
73#	especially that *vpp may equal dvp and both may be locked.
74
75vop_lookup {
76	IN struct vnode *dvp;
77	INOUT struct vnode **vpp;
78	IN struct componentname *cnp;
79};
80
81%% cachedlookup	dvp	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%% create	dvp	E E E
93%% create	vpp	- L -
94%! create	post	vop_create_post
95
96vop_create {
97	IN struct vnode *dvp;
98	OUT struct vnode **vpp;
99	IN struct componentname *cnp;
100	IN struct vattr *vap;
101};
102
103
104%% whiteout	dvp	E E E
105
106vop_whiteout {
107	IN struct vnode *dvp;
108	IN struct componentname *cnp;
109	IN int flags;
110};
111
112
113%% mknod	dvp	E E E
114%% mknod	vpp	- L -
115%! mknod	post	vop_mknod_post
116
117vop_mknod {
118	IN struct vnode *dvp;
119	OUT struct vnode **vpp;
120	IN struct componentname *cnp;
121	IN struct vattr *vap;
122};
123
124
125%% open		vp	L L L
126
127vop_open {
128	IN struct vnode *vp;
129	IN int mode;
130	IN struct ucred *cred;
131	IN struct thread *td;
132	IN struct file *fp;
133};
134
135
136%% close	vp	L L L
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%% getattr	vp	L L L
157
158vop_getattr {
159	IN struct vnode *vp;
160	OUT struct vattr *vap;
161	IN struct ucred *cred;
162};
163
164
165%% setattr	vp	E E E
166%! setattr	post	vop_setattr_post
167
168vop_setattr {
169	IN struct vnode *vp;
170	IN struct vattr *vap;
171	IN struct ucred *cred;
172};
173
174%% markatime	vp	L L L
175
176vop_markatime {
177	IN struct vnode *vp;
178};
179
180%% read		vp	L L L
181
182vop_read {
183	IN struct vnode *vp;
184	INOUT struct uio *uio;
185	IN int ioflag;
186	IN struct ucred *cred;
187};
188
189
190%% write	vp	E E E
191%! write	pre	VOP_WRITE_PRE
192%! write	post	VOP_WRITE_POST
193
194vop_write {
195	IN struct vnode *vp;
196	INOUT struct uio *uio;
197	IN int ioflag;
198	IN struct ucred *cred;
199};
200
201
202%% ioctl	vp	U U U
203
204vop_ioctl {
205	IN struct vnode *vp;
206	IN u_long command;
207	IN void *data;
208	IN int fflag;
209	IN struct ucred *cred;
210	IN struct thread *td;
211};
212
213
214%% poll		vp	U U U
215
216vop_poll {
217	IN struct vnode *vp;
218	IN int events;
219	IN struct ucred *cred;
220	IN struct thread *td;
221};
222
223
224%% kqfilter	vp	U U U
225
226vop_kqfilter {
227	IN struct vnode *vp;
228	IN struct knote *kn;
229};
230
231
232%% revoke	vp	L L L
233
234vop_revoke {
235	IN struct vnode *vp;
236	IN int flags;
237};
238
239
240%% fsync	vp	E E E
241
242vop_fsync {
243	IN struct vnode *vp;
244	IN int waitfor;
245	IN struct thread *td;
246};
247
248
249%% remove	dvp	E E E
250%% remove	vp	E E E
251%! remove	post	vop_remove_post
252
253vop_remove {
254	IN struct vnode *dvp;
255	IN struct vnode *vp;
256	IN struct componentname *cnp;
257};
258
259
260%% link		tdvp	E E E
261%% link		vp	E E E
262%! link		post	vop_link_post
263
264vop_link {
265	IN struct vnode *tdvp;
266	IN struct vnode *vp;
267	IN struct componentname *cnp;
268};
269
270
271%! rename	pre	vop_rename_pre
272%! rename	post	vop_rename_post
273
274vop_rename {
275	IN WILLRELE struct vnode *fdvp;
276	IN WILLRELE struct vnode *fvp;
277	IN struct componentname *fcnp;
278	IN WILLRELE struct vnode *tdvp;
279	IN WILLRELE struct vnode *tvp;
280	IN struct componentname *tcnp;
281};
282
283
284%% mkdir	dvp	E E E
285%% mkdir	vpp	- E -
286%! mkdir	post	vop_mkdir_post
287
288vop_mkdir {
289	IN struct vnode *dvp;
290	OUT struct vnode **vpp;
291	IN struct componentname *cnp;
292	IN struct vattr *vap;
293};
294
295
296%% rmdir	dvp	E E E
297%% rmdir	vp	E E E
298%! rmdir	post	vop_rmdir_post
299
300vop_rmdir {
301	IN struct vnode *dvp;
302	IN struct vnode *vp;
303	IN struct componentname *cnp;
304};
305
306
307%% symlink	dvp	E E E
308%% symlink	vpp	- E -
309%! symlink	post	vop_symlink_post
310
311vop_symlink {
312	IN struct vnode *dvp;
313	OUT struct vnode **vpp;
314	IN struct componentname *cnp;
315	IN struct vattr *vap;
316	IN char *target;
317};
318
319
320%% readdir	vp	L L L
321
322vop_readdir {
323	IN struct vnode *vp;
324	INOUT struct uio *uio;
325	IN struct ucred *cred;
326	INOUT int *eofflag;
327	OUT int *ncookies;
328	INOUT u_long **cookies;
329};
330
331
332%% readlink	vp	L L L
333
334vop_readlink {
335	IN struct vnode *vp;
336	INOUT struct uio *uio;
337	IN struct ucred *cred;
338};
339
340
341%% inactive	vp	E E E
342
343vop_inactive {
344	IN struct vnode *vp;
345	IN struct thread *td;
346};
347
348
349%% reclaim	vp	E E E
350
351vop_reclaim {
352	IN struct vnode *vp;
353	IN struct thread *td;
354};
355
356
357%! lock1	pre	vop_lock_pre
358%! lock1	post	vop_lock_post
359
360vop_lock1 {
361	IN struct vnode *vp;
362	IN int flags;
363	IN char *file;
364	IN int line;
365};
366
367
368%! unlock	pre	vop_unlock_pre
369%! unlock	post	vop_unlock_post
370
371vop_unlock {
372	IN struct vnode *vp;
373	IN int flags;
374};
375
376
377%% bmap		vp	L L L
378
379vop_bmap {
380	IN struct vnode *vp;
381	IN daddr_t bn;
382	OUT struct bufobj **bop;
383	IN daddr_t *bnp;
384	OUT int *runp;
385	OUT int *runb;
386};
387
388
389%% strategy	vp	L L L
390%! strategy	pre	vop_strategy_pre
391
392vop_strategy {
393	IN struct vnode *vp;
394	IN struct buf *bp;
395};
396
397
398%% getwritemount vp	= = =
399
400vop_getwritemount {
401	IN struct vnode *vp;
402	OUT struct mount **mpp;
403};
404
405
406%% print	vp	- - -
407
408vop_print {
409	IN struct vnode *vp;
410};
411
412
413%% pathconf	vp	L L L
414
415vop_pathconf {
416	IN struct vnode *vp;
417	IN int name;
418	OUT register_t *retval;
419};
420
421
422%% advlock	vp	U U U
423
424vop_advlock {
425	IN struct vnode *vp;
426	IN void *id;
427	IN int op;
428	IN struct flock *fl;
429	IN int flags;
430};
431
432
433%% advlockasync	vp	U U U
434
435vop_advlockasync {
436	IN struct vnode *vp;
437	IN void *id;
438	IN int op;
439	IN struct flock *fl;
440	IN int flags;
441	IN struct task *task;	
442	INOUT void **cookiep;
443};
444
445
446%% reallocblks	vp	E E E
447
448vop_reallocblks {
449	IN struct vnode *vp;
450	IN struct cluster_save *buflist;
451};
452
453
454%% getpages	vp	L L L
455
456vop_getpages {
457	IN struct vnode *vp;
458	IN vm_page_t *m;
459	IN int count;
460	IN int reqpage;
461	IN vm_ooffset_t offset;
462};
463
464
465%% putpages	vp	E E E
466
467vop_putpages {
468	IN struct vnode *vp;
469	IN vm_page_t *m;
470	IN int count;
471	IN int sync;
472	IN int *rtvals;
473	IN vm_ooffset_t offset;
474};
475
476
477%% getacl	vp	L L L
478
479vop_getacl {
480	IN struct vnode *vp;
481	IN acl_type_t type;
482	OUT struct acl *aclp;
483	IN struct ucred *cred;
484	IN struct thread *td;
485};
486
487
488%% setacl	vp	E E E
489
490vop_setacl {
491	IN struct vnode *vp;
492	IN acl_type_t type;
493	IN struct acl *aclp;
494	IN struct ucred *cred;
495	IN struct thread *td;
496};
497
498
499%% aclcheck	vp	= = =
500
501vop_aclcheck {
502	IN struct vnode *vp;
503	IN acl_type_t type;
504	IN struct acl *aclp;
505	IN struct ucred *cred;
506	IN struct thread *td;
507};
508
509
510%% closeextattr	vp	L L L
511
512vop_closeextattr {
513	IN struct vnode *vp;
514	IN int commit;
515	IN struct ucred *cred;
516	IN struct thread *td;
517};
518
519
520%% getextattr	vp	L L L
521
522vop_getextattr {
523	IN struct vnode *vp;
524	IN int attrnamespace;
525	IN const char *name;
526	INOUT struct uio *uio;
527	OUT size_t *size;
528	IN struct ucred *cred;
529	IN struct thread *td;
530};
531
532
533%% listextattr	vp	L L L
534
535vop_listextattr {
536	IN struct vnode *vp;
537	IN int attrnamespace;
538	INOUT struct uio *uio;
539	OUT size_t *size;
540	IN struct ucred *cred;
541	IN struct thread *td;
542};
543
544
545%% openextattr	vp	L L L
546
547vop_openextattr {
548	IN struct vnode *vp;
549	IN struct ucred *cred;
550	IN struct thread *td;
551};
552
553
554%% deleteextattr	vp	E E E
555
556vop_deleteextattr {
557	IN struct vnode *vp;
558	IN int attrnamespace;
559	IN const char *name;
560	IN struct ucred *cred;
561	IN struct thread *td;
562};
563
564
565%% setextattr	vp	E E E
566
567vop_setextattr {
568	IN struct vnode *vp;
569	IN int attrnamespace;
570	IN const char *name;
571	INOUT struct uio *uio;
572	IN struct ucred *cred;
573	IN struct thread *td;
574};
575
576
577%% setlabel	vp	E E E
578
579vop_setlabel {
580	IN struct vnode *vp;
581	IN struct label *label;
582	IN struct ucred *cred;
583	IN struct thread *td;
584};
585
586
587%% vptofh	vp	= = =
588
589vop_vptofh {
590	IN struct vnode *vp;
591	IN struct fid *fhp;
592};
593
594%% vptocnp		vp	L L L
595%% vptocnp		vpp	- U -
596
597vop_vptocnp {
598	IN struct vnode *vp;
599	OUT struct vnode **vpp;
600	INOUT char *buf;
601	INOUT int *buflen;
602};
603