Protect v_usecount with a critical section for now (we depend on the BGL),
[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 # $DragonFly: src/sys/kern/Attic/vnode_if.src,v 1.6 2004/03/01 06:33:17 dillon Exp $
36 #
37
38 #
39 # Above each of the vop descriptors is a specification of the locking
40 # protocol used by each vop call.  The first column is the name of
41 # the variable, the remaining three columns are in, out and error
42 # respectively.  The "in" column defines the lock state on input,
43 # the "out" column defines the state on succesful return, and the
44 # "error" column defines the locking state on error exit.
45 #
46 # The locking value can take the following values:
47 # L: locked; not converted to type of lock.
48 # A: any lock type.
49 # S: locked with shared lock.
50 # E: locked with exclusive lock for this process.
51 # O: locked with exclusive lock for other process.
52 # U: unlocked.
53 # -: not applicable.  vnode does not yet (or no longer) exists.
54 # =: the same on input and output, may be either L or U.
55 # X: locked if not nil.
56 #
57
58 #
59 #% islocked     vp      = = =
60 #
61 vop_islocked {
62         IN struct vnode *vp;
63         IN struct thread *td;
64 };
65
66 #
67 #% lookup       dvp     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 #
74 vop_lookup {
75         IN struct vnode *dvp;
76         IN struct namecache *par;
77         INOUT struct vnode **vpp;
78         INOUT struct namecache **ncpp;
79         IN struct componentname *cnp;
80 };
81
82 #
83 #% cachedlookup dvp     L ? ?
84 #% cachedlookup vpp     - L -
85 #
86 # This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
87 #
88 vop_cachedlookup {
89         IN struct vnode *dvp;
90         IN struct namecache *par;
91         INOUT struct vnode **vpp;
92         INOUT struct namecache **ncpp;
93         IN struct componentname *cnp;
94 };
95
96 #
97 #% create       dvp     L L L
98 #% create       vpp     - L -
99 #
100 vop_create {
101         IN struct vnode *dvp;
102         IN struct namecache *par;
103         OUT struct vnode **vpp;
104         IN struct componentname *cnp;
105         IN struct vattr *vap;
106 };
107
108 #
109 #% whiteout     dvp     L L L
110 #
111 vop_whiteout {
112         IN struct vnode *dvp;
113         IN struct namecache *par;
114         IN struct componentname *cnp;
115         IN int flags;
116 };
117
118 #
119 #% mknod        dvp     L L L
120 #% mknod        vpp     - X -
121 #
122 vop_mknod {
123         IN struct vnode *dvp;
124         IN struct namecache *par;
125         OUT struct vnode **vpp;
126         IN struct componentname *cnp;
127         IN struct vattr *vap;
128 };
129
130 #
131 #% open         vp      L L L
132 #
133 vop_open {
134         IN struct vnode *vp;
135         IN int mode;
136         IN struct ucred *cred;
137         IN struct thread *td;
138 };
139
140 #
141 #% close        vp      U U U
142 #
143 vop_close {
144         IN struct vnode *vp;
145         IN int fflag;
146         IN struct thread *td;
147 };
148
149 #
150 #% access       vp      L L L
151 #
152 vop_access {
153         IN struct vnode *vp;
154         IN int mode;
155         IN struct ucred *cred;
156         IN struct thread *td;
157 };
158
159 #
160 #% getattr      vp      = = =
161 #
162 vop_getattr {
163         IN struct vnode *vp;
164         OUT struct vattr *vap;
165         IN struct thread *td;
166 };
167
168 #
169 #% setattr      vp      L L L
170 #
171 vop_setattr {
172         IN struct vnode *vp;
173         IN struct vattr *vap;
174         IN struct ucred *cred;
175         IN struct thread *td;
176 };
177
178 #
179 #% read         vp      L L L
180 #
181 vop_read {
182         IN struct vnode *vp;
183         INOUT struct uio *uio;
184         IN int ioflag;
185         IN struct ucred *cred;
186 };
187
188 #
189 #% write        vp      L L L
190 #
191 vop_write {
192         IN struct vnode *vp;
193         INOUT struct uio *uio;
194         IN int ioflag;
195         IN struct ucred *cred;
196 };
197
198 #
199 #% lease        vp      = = =
200 #
201 vop_lease {
202         IN struct vnode *vp;
203         IN struct thread *td;
204         IN struct ucred *cred;
205         IN int flag;
206 };
207
208 #
209 #% ioctl        vp      U U U
210 #
211 vop_ioctl {
212         IN struct vnode *vp;
213         IN u_long command;
214         IN caddr_t 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 #
223 vop_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 #
233 vop_kqfilter {
234         IN struct vnode *vp;
235         IN struct knote *kn;
236 };
237
238 #
239 #% revoke       vp      U U U
240 #
241 vop_revoke {
242         IN struct vnode *vp;
243         IN int flags;
244 };
245
246 #
247 # XXX - not used
248 #
249 vop_mmap {
250         IN struct vnode *vp;
251         IN int fflags;
252         IN struct ucred *cred;
253         IN struct thread *td;
254 };
255
256 #
257 #% fsync        vp      L L L
258 #
259 vop_fsync {
260         IN struct vnode *vp;
261         IN int waitfor;
262         IN struct thread *td;
263 };
264
265 #
266 #% remove       dvp     L L L
267 #% remove       vp      L L L
268 #
269 vop_remove {
270         IN struct vnode *dvp;
271         IN struct namecache *par;
272         IN struct vnode *vp;
273         IN struct componentname *cnp;
274 };
275
276 #
277 #% link         tdvp    L L L
278 #% link         vp      U U U
279 #
280 vop_link {
281         IN struct vnode *tdvp;
282         IN struct namecache *par;
283         IN struct vnode *vp;
284         IN struct componentname *cnp;
285 };
286
287 #
288 #% rename       fdvp    U U U
289 #% rename       fvp     U U U
290 #% rename       tdvp    L U U
291 #% rename       tvp     X U U
292 #
293 vop_rename {
294         IN WILLRELE struct vnode *fdvp;
295         IN struct namecache *fpar;
296         IN WILLRELE struct vnode *fvp;
297         IN struct componentname *fcnp;
298         IN WILLRELE struct vnode *tdvp;
299         IN struct namecache *tpar;
300         IN WILLRELE struct vnode *tvp;
301         IN struct componentname *tcnp;
302 };
303
304 #
305 #% mkdir        dvp     L L L
306 #% mkdir        vpp     - L -
307 #
308 vop_mkdir {
309         IN struct vnode *dvp;
310         IN struct namecache *par;
311         OUT struct vnode **vpp;
312         IN struct componentname *cnp;
313         IN struct vattr *vap;
314 };
315
316 #
317 #% rmdir        dvp     L L L
318 #% rmdir        vp      L L L
319 #
320 vop_rmdir {
321         IN struct vnode *dvp;
322         IN struct namecache *par;
323         IN struct vnode *vp;
324         IN struct componentname *cnp;
325 };
326
327 #
328 #% symlink      dvp     L L L
329 #% symlink      vpp     - U -
330 #
331 vop_symlink {
332         IN struct vnode *dvp;
333         IN struct namecache *par;
334         OUT struct vnode **vpp;
335         IN struct componentname *cnp;
336         IN struct vattr *vap;
337         IN char *target;
338 };
339
340 #
341 #% readdir      vp      L L L
342 #
343 vop_readdir {
344         IN struct vnode *vp;
345         INOUT struct uio *uio;
346         IN struct ucred *cred;
347         INOUT int *eofflag;
348         OUT int *ncookies;
349         INOUT u_long **cookies;
350 };
351
352 #
353 #% readlink     vp      L L L
354 #
355 vop_readlink {
356         IN struct vnode *vp;
357         INOUT struct uio *uio;
358         IN struct ucred *cred;
359 };
360
361 #
362 #% inactive     vp      L U U
363 #
364 vop_inactive {
365         IN struct vnode *vp;
366         IN struct thread *td;
367 };
368
369 #
370 #% reclaim      vp      U U U
371 #
372 vop_reclaim {
373         IN struct vnode *vp;
374         IN struct thread *td;
375 };
376
377 #
378 #% lock         vp      ? ? ?
379 #
380 vop_lock {
381         IN struct vnode *vp;
382         IN struct lwkt_tokref *vlock;
383         IN int flags;
384         IN struct thread *td;
385 };
386
387 #
388 #% unlock       vp      L U L
389 #
390 vop_unlock {
391         IN struct vnode *vp;
392         IN struct lwkt_tokref *vlock;
393         IN int flags;
394         IN struct thread *td;
395 };
396
397 #
398 #% bmap         vp      L L L
399 #% bmap         vpp     - U -
400 #
401 vop_bmap {
402         IN struct vnode *vp;
403         IN daddr_t bn;
404         OUT struct vnode **vpp;
405         IN daddr_t *bnp;
406         OUT int *runp;
407         OUT int *runb;
408 };
409
410 #
411 #% strategy     vp      L L L
412 #
413 vop_strategy {
414         IN struct vnode *vp;
415         IN struct buf *bp;
416 };
417
418 #
419 #% print        vp      = = =
420 #
421 vop_print {
422         IN struct vnode *vp;
423 };
424
425 #
426 #% pathconf     vp      L L L
427 #
428 vop_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 #
437 vop_advlock {
438         IN struct vnode *vp;
439         IN caddr_t id;
440         IN int op;
441         IN struct flock *fl;
442         IN int flags;
443 };
444
445 #
446 #% balloc       vp      L L L
447 #
448 vop_balloc {
449         IN struct vnode *vp;
450         IN off_t startoffset;
451         IN int size;
452         IN struct ucred *cred;
453         IN int flags;
454         OUT struct buf **bpp;
455 };
456
457 #
458 #% reallocblks  vp      L L L
459 #
460 vop_reallocblks {
461         IN struct vnode *vp;
462         IN struct cluster_save *buflist;
463 };
464
465 #
466 #% getpages     vp      L L L
467 #
468 vop_getpages {
469         IN struct vnode *vp;
470         IN vm_page_t *m;
471         IN int count;
472         IN int reqpage;
473         IN vm_ooffset_t offset;
474 };
475
476 #
477 #% putpages     vp      L L L
478 #
479 vop_putpages {
480         IN struct vnode *vp;
481         IN vm_page_t *m;
482         IN int count;
483         IN int sync;
484         IN int *rtvals;
485         IN vm_ooffset_t offset;
486 };
487
488 #
489 #% freeblks     vp      - - -
490 #
491 # This call is used by the filesystem to release blocks back to 
492 # device-driver.  This is useful if the driver has a lengthy 
493 # erase handling or similar.
494 #
495
496 vop_freeblks {
497         IN struct vnode *vp;
498         IN daddr_t addr;
499         IN daddr_t length;
500 };
501
502 #
503 #% bwrite       vp      L L L
504 #
505 vop_bwrite {
506         IN struct vnode *vp;
507         IN struct buf *bp;
508 };
509
510 #
511 #% getacl       vp      = = =
512 #
513 vop_getacl {
514         IN struct vnode *vp;
515         IN acl_type_t type;
516         OUT struct acl *aclp;
517         IN struct ucred *cred;
518         IN struct thread *td;
519 };
520
521 #
522 #% setacl       vp      L L L
523 #
524 vop_setacl {
525         IN struct vnode *vp;
526         IN acl_type_t type;
527         IN struct acl *aclp;
528         IN struct ucred *cred;
529         IN struct thread *td;
530 };
531
532 #
533 #% aclcheck     vp      = = =
534 #
535 vop_aclcheck {
536         IN struct vnode *vp;
537         IN acl_type_t type;
538         IN struct acl *aclp;
539         IN struct ucred *cred;
540         IN struct thread *td;
541 };
542
543 #
544 #% getextattr   vp      L L L
545 #
546 vop_getextattr {
547         IN struct vnode *vp;
548         IN char *name;
549         INOUT struct uio *uio;
550         IN struct ucred *cred;
551         IN struct thread *td;
552 };
553
554 #
555 #% setextattr   vp      L L L
556 #
557 vop_setextattr {
558         IN struct vnode *vp;
559         IN char *name;
560         INOUT struct uio *uio;
561         IN struct ucred *cred;
562         IN struct thread *td;
563 };
564
565 #
566 #% createvobject        vp      L L L
567 #
568 vop_createvobject {
569         IN struct vnode *vp;
570         IN struct thread *td;
571 };
572
573 #
574 #% destroyvobject       vp      L L L
575 #
576 vop_destroyvobject {
577         IN struct vnode *vp;
578 };
579
580 #
581 #% getvobject   vp      L L L
582 #
583 vop_getvobject {
584         IN struct vnode *vp;
585         OUT struct vm_object **objpp;
586 };