Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / kern / vnode_if.src
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. All advertising materials mentioning features or use of this software
14 #    must display the following acknowledgement:
15 #       This product includes software developed by the University of
16 #       California, Berkeley and its contributors.
17 # 4. Neither the name of the University nor the names of its contributors
18 #    may be used to endorse or promote products derived from this software
19 #    without specific prior written permission.
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 # SUCH DAMAGE.
32 #
33 #       @(#)vnode_if.src        8.12 (Berkeley) 5/14/95
34 # $FreeBSD: src/sys/kern/vnode_if.src,v 1.29.2.3 2001/05/18 09:58:45 bp Exp $
35 #
36
37 #
38 # Above each of the vop descriptors is a specification of the locking
39 # protocol used by each vop call.  The first column is the name of
40 # the variable, the remaining three columns are in, out and error
41 # respectively.  The "in" column defines the lock state on input,
42 # the "out" column defines the state on succesful return, and the
43 # "error" column defines the locking state on error exit.
44 #
45 # The locking value can take the following values:
46 # L: locked; not converted to type of lock.
47 # A: any lock type.
48 # S: locked with shared lock.
49 # E: locked with exclusive lock for this process.
50 # O: locked with exclusive lock for other process.
51 # U: unlocked.
52 # -: not applicable.  vnode does not yet (or no longer) exists.
53 # =: the same on input and output, may be either L or U.
54 # X: locked if not nil.
55 #
56
57 #
58 #% islocked     vp      = = =
59 #
60 vop_islocked {
61         IN struct vnode *vp;
62         IN struct proc *p;
63 };
64
65 #
66 #% lookup       dvp     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 #
73 vop_lookup {
74         IN struct vnode *dvp;
75         INOUT struct vnode **vpp;
76         IN struct componentname *cnp;
77 };
78
79 #
80 #% cachedlookup dvp     L ? ?
81 #% cachedlookup vpp     - L -
82 #
83 # This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
84 #
85 vop_cachedlookup {
86         IN struct vnode *dvp;
87         INOUT struct vnode **vpp;
88         IN struct componentname *cnp;
89 };
90
91 #
92 #% create       dvp     L L L
93 #% create       vpp     - L -
94 #
95 vop_create {
96         IN struct vnode *dvp;
97         OUT struct vnode **vpp;
98         IN struct componentname *cnp;
99         IN struct vattr *vap;
100 };
101
102 #
103 #% whiteout     dvp     L L L
104 #
105 vop_whiteout {
106         IN struct vnode *dvp;
107         IN struct componentname *cnp;
108         IN int flags;
109 };
110
111 #
112 #% mknod        dvp     L L L
113 #% mknod        vpp     - X -
114 #
115 vop_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 #
125 vop_open {
126         IN struct vnode *vp;
127         IN int mode;
128         IN struct ucred *cred;
129         IN struct proc *p;
130 };
131
132 #
133 #% close        vp      U U U
134 #
135 vop_close {
136         IN struct vnode *vp;
137         IN int fflag;
138         IN struct ucred *cred;
139         IN struct proc *p;
140 };
141
142 #
143 #% access       vp      L L L
144 #
145 vop_access {
146         IN struct vnode *vp;
147         IN int mode;
148         IN struct ucred *cred;
149         IN struct proc *p;
150 };
151
152 #
153 #% getattr      vp      = = =
154 #
155 vop_getattr {
156         IN struct vnode *vp;
157         OUT struct vattr *vap;
158         IN struct ucred *cred;
159         IN struct proc *p;
160 };
161
162 #
163 #% setattr      vp      L L L
164 #
165 vop_setattr {
166         IN struct vnode *vp;
167         IN struct vattr *vap;
168         IN struct ucred *cred;
169         IN struct proc *p;
170 };
171
172 #
173 #% read         vp      L L L
174 #
175 vop_read {
176         IN struct vnode *vp;
177         INOUT struct uio *uio;
178         IN int ioflag;
179         IN struct ucred *cred;
180 };
181
182 #
183 #% write        vp      L L L
184 #
185 vop_write {
186         IN struct vnode *vp;
187         INOUT struct uio *uio;
188         IN int ioflag;
189         IN struct ucred *cred;
190 };
191
192 #
193 #% lease        vp      = = =
194 #
195 vop_lease {
196         IN struct vnode *vp;
197         IN struct proc *p;
198         IN struct ucred *cred;
199         IN int flag;
200 };
201
202 #
203 #% ioctl        vp      U U U
204 #
205 vop_ioctl {
206         IN struct vnode *vp;
207         IN u_long command;
208         IN caddr_t data;
209         IN int fflag;
210         IN struct ucred *cred;
211         IN struct proc *p;
212 };
213
214 #
215 #% poll vp      U U U
216 #
217 vop_poll {
218         IN struct vnode *vp;
219         IN int events;
220         IN struct ucred *cred;
221         IN struct proc *p;
222 };
223
224 #
225 #% kqfilter     vp      U U U
226 #
227 vop_kqfilter {
228         IN struct vnode *vp;
229         IN struct knote *kn;
230 };
231
232 #
233 #% revoke       vp      U U U
234 #
235 vop_revoke {
236         IN struct vnode *vp;
237         IN int flags;
238 };
239
240 #
241 # XXX - not used
242 #
243 vop_mmap {
244         IN struct vnode *vp;
245         IN int fflags;
246         IN struct ucred *cred;
247         IN struct proc *p;
248 };
249
250 #
251 #% fsync        vp      L L L
252 #
253 vop_fsync {
254         IN struct vnode *vp;
255         IN struct ucred *cred;
256         IN int waitfor;
257         IN struct proc *p;
258 };
259
260 #
261 #% remove       dvp     L L L
262 #% remove       vp      L L L
263 #
264 vop_remove {
265         IN struct vnode *dvp;
266         IN struct vnode *vp;
267         IN struct componentname *cnp;
268 };
269
270 #
271 #% link         tdvp    L L L
272 #% link         vp      U U U
273 #
274 vop_link {
275         IN struct vnode *tdvp;
276         IN struct vnode *vp;
277         IN struct componentname *cnp;
278 };
279
280 #
281 #% rename       fdvp    U U U
282 #% rename       fvp     U U U
283 #% rename       tdvp    L U U
284 #% rename       tvp     X U U
285 #
286 vop_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     L L L
297 #% mkdir        vpp     - L -
298 #
299 vop_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     L L L
308 #% rmdir        vp      L L L
309 #
310 vop_rmdir {
311         IN struct vnode *dvp;
312         IN struct vnode *vp;
313         IN struct componentname *cnp;
314 };
315
316 #
317 #% symlink      dvp     L L L
318 #% symlink      vpp     - U -
319 #
320 vop_symlink {
321         IN struct vnode *dvp;
322         OUT struct vnode **vpp;
323         IN struct componentname *cnp;
324         IN struct vattr *vap;
325         IN char *target;
326 };
327
328 #
329 #% readdir      vp      L L L
330 #
331 vop_readdir {
332         IN struct vnode *vp;
333         INOUT struct uio *uio;
334         IN struct ucred *cred;
335         INOUT int *eofflag;
336         OUT int *ncookies;
337         INOUT u_long **cookies;
338 };
339
340 #
341 #% readlink     vp      L L L
342 #
343 vop_readlink {
344         IN struct vnode *vp;
345         INOUT struct uio *uio;
346         IN struct ucred *cred;
347 };
348
349 #
350 #% inactive     vp      L U U
351 #
352 vop_inactive {
353         IN struct vnode *vp;
354         IN struct proc *p;
355 };
356
357 #
358 #% reclaim      vp      U U U
359 #
360 vop_reclaim {
361         IN struct vnode *vp;
362         IN struct proc *p;
363 };
364
365 #
366 #% lock         vp      ? ? ?
367 #
368 vop_lock {
369         IN struct vnode *vp;
370         IN int flags;
371         IN struct proc *p;
372 };
373
374 #
375 #% unlock       vp      L U L
376 #
377 vop_unlock {
378         IN struct vnode *vp;
379         IN int flags;
380         IN struct proc *p;
381 };
382
383 #
384 #% bmap         vp      L L L
385 #% bmap         vpp     - U -
386 #
387 vop_bmap {
388         IN struct vnode *vp;
389         IN daddr_t bn;
390         OUT struct vnode **vpp;
391         IN daddr_t *bnp;
392         OUT int *runp;
393         OUT int *runb;
394 };
395
396 #
397 #% strategy     vp      L L L
398 #
399 vop_strategy {
400         IN struct vnode *vp;
401         IN struct buf *bp;
402 };
403
404 #
405 #% print        vp      = = =
406 #
407 vop_print {
408         IN struct vnode *vp;
409 };
410
411 #
412 #% pathconf     vp      L L L
413 #
414 vop_pathconf {
415         IN struct vnode *vp;
416         IN int name;
417         OUT register_t *retval;
418 };
419
420 #
421 #% advlock      vp      U U U
422 #
423 vop_advlock {
424         IN struct vnode *vp;
425         IN caddr_t id;
426         IN int op;
427         IN struct flock *fl;
428         IN int flags;
429 };
430
431 #
432 #% balloc       vp      L L L
433 #
434 vop_balloc {
435         IN struct vnode *vp;
436         IN off_t startoffset;
437         IN int size;
438         IN struct ucred *cred;
439         IN int flags;
440         OUT struct buf **bpp;
441 };
442
443 #
444 #% reallocblks  vp      L L L
445 #
446 vop_reallocblks {
447         IN struct vnode *vp;
448         IN struct cluster_save *buflist;
449 };
450
451 #
452 #% getpages     vp      L L L
453 #
454 vop_getpages {
455         IN struct vnode *vp;
456         IN vm_page_t *m;
457         IN int count;
458         IN int reqpage;
459         IN vm_ooffset_t offset;
460 };
461
462 #
463 #% putpages     vp      L L L
464 #
465 vop_putpages {
466         IN struct vnode *vp;
467         IN vm_page_t *m;
468         IN int count;
469         IN int sync;
470         IN int *rtvals;
471         IN vm_ooffset_t offset;
472 };
473
474 #
475 #% freeblks     vp      - - -
476 #
477 # This call is used by the filesystem to release blocks back to 
478 # device-driver.  This is useful if the driver has a lengthy 
479 # erase handling or similar.
480 #
481
482 vop_freeblks {
483         IN struct vnode *vp;
484         IN daddr_t addr;
485         IN daddr_t length;
486 };
487
488 #
489 #% bwrite       vp      L L L
490 #
491 vop_bwrite {
492         IN struct vnode *vp;
493         IN struct buf *bp;
494 };
495
496 #
497 #% getacl       vp      = = =
498 #
499 vop_getacl {
500         IN struct vnode *vp;
501         IN acl_type_t type;
502         OUT struct acl *aclp;
503         IN struct ucred *cred;
504         IN struct proc *p;
505 };
506
507 #
508 #% setacl       vp      L L L
509 #
510 vop_setacl {
511         IN struct vnode *vp;
512         IN acl_type_t type;
513         IN struct acl *aclp;
514         IN struct ucred *cred;
515         IN struct proc *p;
516 };
517
518 #
519 #% aclcheck     vp      = = =
520 #
521 vop_aclcheck {
522         IN struct vnode *vp;
523         IN acl_type_t type;
524         IN struct acl *aclp;
525         IN struct ucred *cred;
526         IN struct proc *p;
527 };
528
529 #
530 #% getextattr   vp      L L L
531 #
532 vop_getextattr {
533         IN struct vnode *vp;
534         IN char *name;
535         INOUT struct uio *uio;
536         IN struct ucred *cred;
537         IN struct proc *p;
538 };
539
540 #
541 #% setextattr   vp      L L L
542 #
543 vop_setextattr {
544         IN struct vnode *vp;
545         IN char *name;
546         INOUT struct uio *uio;
547         IN struct ucred *cred;
548         IN struct proc *p;
549 };
550
551 #
552 #% createvobject        vp      L L L
553 #
554 vop_createvobject {
555         IN struct vnode *vp;
556         IN struct ucred *cred;
557         IN struct proc *p;
558 };
559
560 #
561 #% destroyvobject       vp      L L L
562 #
563 vop_destroyvobject {
564         IN struct vnode *vp;
565 };
566
567 #
568 #% getvobject   vp      L L L
569 #
570 vop_getvobject {
571         IN struct vnode *vp;
572         OUT struct vm_object **objpp;
573 };