FreeBSD/Linux Kernel Cross Reference
sys/kern/vnode_if.src
1 # $NetBSD: vnode_if.src,v 1.44 2005/02/26 22:14:39 perry Exp $
2 #
3 # Copyright (c) 1992, 1993
4 # The Regents of the University of California. All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # 3. All advertising materials mentioning features or use of this software
15 # must display the following acknowledgement:
16 # This product includes software developed by the University of
17 # California, Berkeley and its contributors.
18 # 4. Neither the name of the University nor the names of its contributors
19 # may be used to endorse or promote products derived from this software
20 # without specific prior written permission.
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 # SUCH DAMAGE.
33 #
34 # @(#)vnode_if.src 8.14 (Berkeley) 8/6/95
35 #
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 successful 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.
48 # U: unlocked.
49 # -: not applicable. vnode does not yet (or no longer) exists.
50 # =: the same on input and output, may be either L or U.
51 # X: locked if not nil.
52 #
53 # For operations other than VOP_LOOKUP which require a component name
54 # parameter, the flags required for the initial namei() call are listed.
55 # Additional flags may be added to the namei() call, but these are required.
56 #
57
58 #
59 #% lookup dvp L ? ?
60 #% lookup vpp - L -
61 #
62 # XXX - the lookup locking protocol defies simple description and depends
63 # on the flags and operation fields in the (cnp) structure. Note
64 # especially that *vpp may equal dvp and both may be locked.
65 #
66 # More details:
67 # There are three types of lookups: ".", ".." (ISDOTDOT), and other.
68 # On successful lookup of ".", a reference is added to dvp, and it
69 # is returned in *vpp.
70 # To look up ISDOTDOT, dvp is unlocked, the ".." node is locked, and
71 # then dvp is relocked iff LOCKPARENT is set and this is the last
72 # component name (ISLASTCN set). This preserves the
73 # protocol of always locking nodes from root ("/") downward and
74 # prevents deadlock.
75 # Other lookups find the named node (creating the vnode if needed) and
76 # return it, locked, in *vpp.
77 # For non-"." lookups, if LOCKPARENT is not set or this was not the
78 # last component name, dvp is returned unlocked on a successful
79 # lookup.
80 # On failure, *vpp is NULL, and *dvp is left locked. If there was
81 # an error re-locking dvp (for instance in the ISDOTDOT case),
82 # the error is returned with PDIRUNLOCK set.
83 #
84 # *vpp is always locked on return if the operation succeeds.
85 # typically, if *vpp == dvp, you need to release twice, but unlock once.
86 #
87 # The PDIRUNLOCK flag is set when dvp is unlocked in the lookup routine.
88 # It signals the caller that dvp's lock state changed. It will
89 # be set on exit if either a successful lookup unlocked the
90 # parrent, or there was an error re-locking dvp in the ISDOTDOT case.
91 #
92 # See sys/sys/namei.h for a description of the SAVENAME and SAVESTART
93 # flags.
94 #
95 vop_lookup {
96 IN struct vnode *dvp;
97 INOUT struct vnode **vpp;
98 IN struct componentname *cnp;
99 };
100
101 #
102 #% create dvp L U U
103 #% create vpp - L -
104 #
105 #! create cnp CREATE, LOCKPARENT
106 #
107 vop_create {
108 IN LOCKED=YES WILLPUT struct vnode *dvp;
109 OUT struct vnode **vpp;
110 IN struct componentname *cnp;
111 IN struct vattr *vap;
112 };
113
114 #
115 #% mknod dvp L U U
116 #% mknod vpp - L -
117 #
118 #! mknod cnp CREATE, LOCKPARENT
119 #
120 vop_mknod {
121 IN LOCKED=YES WILLPUT struct vnode *dvp;
122 OUT struct vnode **vpp;
123 IN struct componentname *cnp;
124 IN struct vattr *vap;
125 };
126
127 #
128 #% open vp L L L
129 #
130 vop_open {
131 IN LOCKED=YES struct vnode *vp;
132 IN int mode;
133 IN struct ucred *cred;
134 IN struct proc *p;
135 };
136
137 #
138 #% close vp L L L
139 #
140 vop_close {
141 IN LOCKED=YES struct vnode *vp;
142 IN int fflag;
143 IN struct ucred *cred;
144 IN struct proc *p;
145 };
146
147 #
148 #% access vp L L L
149 #
150 vop_access {
151 IN LOCKED=YES struct vnode *vp;
152 IN int mode;
153 IN struct ucred *cred;
154 IN struct proc *p;
155 };
156
157 #
158 #% getattr vp = = =
159 #
160 vop_getattr {
161 IN struct vnode *vp;
162 IN struct vattr *vap;
163 IN struct ucred *cred;
164 IN struct proc *p;
165 };
166
167 #
168 #% setattr vp L L L
169 #
170 vop_setattr {
171 IN LOCKED=YES struct vnode *vp;
172 IN struct vattr *vap;
173 IN struct ucred *cred;
174 IN struct proc *p;
175 };
176
177 #
178 #% read vp L L L
179 #
180 vop_read {
181 IN LOCKED=YES struct vnode *vp;
182 INOUT struct uio *uio;
183 IN int ioflag;
184 IN struct ucred *cred;
185 };
186
187 #
188 #% write vp L L L
189 #
190 vop_write {
191 IN LOCKED=YES struct vnode *vp;
192 INOUT struct uio *uio;
193 IN int ioflag;
194 IN struct ucred *cred;
195 };
196
197 #
198 #% ioctl vp U U U
199 #
200 vop_ioctl {
201 IN LOCKED=NO struct vnode *vp;
202 IN u_long command;
203 IN void *data;
204 IN int fflag;
205 IN struct ucred *cred;
206 IN struct proc *p;
207 };
208
209 #
210 #% fcntl vp L L L
211 #
212 vop_fcntl {
213 IN LOCKED=YES struct vnode *vp;
214 IN u_int command;
215 IN void *data;
216 IN int fflag;
217 IN struct ucred *cred;
218 IN struct proc *p;
219 };
220
221 #
222 #% poll vp U U U
223 #
224 vop_poll {
225 IN LOCKED=NO struct vnode *vp;
226 IN int events;
227 IN struct proc *p;
228 };
229
230 #
231 #% kqfilter vp U U U
232 #
233 vop_kqfilter {
234 IN LOCKED=NO struct vnode *vp;
235 IN struct knote *kn;
236 };
237
238 #
239 #% revoke vp U U U
240 #
241 vop_revoke {
242 IN LOCKED=NO struct vnode *vp;
243 IN int flags;
244 };
245
246 #
247 #% mmap vp = = =
248 #
249 vop_mmap {
250 IN struct vnode *vp;
251 IN int fflags;
252 IN struct ucred *cred;
253 IN struct proc *p;
254 };
255
256 #
257 #% fsync vp L L L
258 #
259 vop_fsync {
260 IN LOCKED=YES struct vnode *vp;
261 IN struct ucred *cred;
262 IN int flags;
263 IN off_t offlo;
264 IN off_t offhi;
265 IN struct proc *p;
266 };
267
268 #
269 # Needs work: Is newoff right? What's it mean?
270 # XXX Locking prototocl?
271 #
272 vop_seek {
273 IN struct vnode *vp;
274 IN off_t oldoff;
275 IN off_t newoff;
276 IN struct ucred *cred;
277 };
278
279 #
280 #% remove dvp L U U
281 #% remove vp L U U
282 #
283 #! remove cnp DELETE, LOCKPARENT | LOCKLEAF
284 #
285 vop_remove {
286 IN LOCKED=YES WILLPUT struct vnode *dvp;
287 IN LOCKED=YES WILLPUT struct vnode *vp;
288 IN struct componentname *cnp;
289 };
290
291 #
292 #% link vp U U U
293 #% link dvp L U U
294 #
295 #! link cnp CREATE, LOCKPARENT
296 #
297 vop_link {
298 IN LOCKED=YES WILLPUT struct vnode *dvp;
299 IN LOCKED=NO struct vnode *vp;
300 IN struct componentname *cnp;
301 };
302
303 #
304 #% rename fdvp U U U
305 #% rename fvp U U U
306 #% rename tdvp L U U
307 #% rename tvp X U U
308 #
309 #! rename fcnp DELETE, WANTPARENT | SAVESTART
310 #! rename tcnp RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART
311 #
312 # XXX the vop_rename routines should REALLY NOT be depending on SAVESTART!
313 #
314 vop_rename {
315 IN LOCKED=NO WILLRELE struct vnode *fdvp;
316 IN LOCKED=NO WILLRELE struct vnode *fvp;
317 IN struct componentname *fcnp;
318 IN LOCKED=YES WILLPUT struct vnode *tdvp;
319 IN WILLPUT struct vnode *tvp;
320 IN struct componentname *tcnp;
321 };
322
323 #
324 #% mkdir dvp L U U
325 #% mkdir vpp - L -
326 #
327 #! mkdir cnp CREATE, LOCKPARENT
328 #
329 vop_mkdir {
330 IN LOCKED=YES WILLPUT struct vnode *dvp;
331 OUT struct vnode **vpp;
332 IN struct componentname *cnp;
333 IN struct vattr *vap;
334 };
335
336 #
337 #% rmdir dvp L U U
338 #% rmdir vp L U U
339 #
340 #! rmdir cnp DELETE, LOCKPARENT | LOCKLEAF
341 #
342 vop_rmdir {
343 IN LOCKED=YES WILLPUT struct vnode *dvp;
344 IN LOCKED=YES WILLPUT struct vnode *vp;
345 IN struct componentname *cnp;
346 };
347
348 #
349 #% symlink dvp L U U
350 #% symlink vpp - L -
351 #
352 #! symlink cnp CREATE, LOCKPARENT
353 #
354 vop_symlink {
355 IN LOCKED=YES WILLPUT struct vnode *dvp;
356 OUT struct vnode **vpp;
357 IN struct componentname *cnp;
358 IN struct vattr *vap;
359 IN char *target;
360 };
361
362 #
363 #% readdir vp L L L
364 #
365 vop_readdir {
366 IN LOCKED=YES struct vnode *vp;
367 INOUT struct uio *uio;
368 IN struct ucred *cred;
369 OUT int *eofflag;
370 OUT off_t **cookies;
371 IN int *ncookies;
372 };
373
374 #
375 #% readlink vp L L L
376 #
377 vop_readlink {
378 IN LOCKED=YES struct vnode *vp;
379 INOUT struct uio *uio;
380 IN struct ucred *cred;
381 };
382
383 #
384 #% abortop dvp = = =
385 #
386 #! abortop cnp as appropriate.
387 #
388 vop_abortop {
389 IN struct vnode *dvp;
390 IN struct componentname *cnp;
391 };
392
393 #
394 #% inactive vp L U U
395 #
396 vop_inactive {
397 IN LOCKED=YES WILLUNLOCK struct vnode *vp;
398 IN struct proc *p;
399 };
400
401 #
402 #% reclaim vp U U U
403 #
404 vop_reclaim {
405 IN LOCKED=NO struct vnode *vp;
406 IN struct proc *p;
407 };
408
409 #
410 #% lock vp U L U
411 #
412 vop_lock {
413 IN LOCKED=NO struct vnode *vp;
414 IN int flags;
415 };
416
417 #
418 #% unlock vp L U L
419 #
420 vop_unlock {
421 IN LOCKED=YES struct vnode *vp;
422 IN int flags;
423 };
424
425 #
426 #% bmap vp = = =
427 #% bmap vpp - U -
428 #
429 vop_bmap {
430 IN LOCKED=YES struct vnode *vp;
431 IN daddr_t bn;
432 OUT struct vnode **vpp;
433 IN daddr_t *bnp;
434 OUT int *runp;
435 };
436
437 #
438 #% strategy vp = = =
439 #
440 vop_strategy {
441 IN struct vnode *vp;
442 IN struct buf *bp;
443 };
444
445 #
446 #% print vp = = =
447 #
448 vop_print {
449 IN struct vnode *vp;
450 };
451
452 #
453 #% islocked vp = = =
454 #
455 vop_islocked {
456 IN struct vnode *vp;
457 };
458
459 #
460 #% pathconf vp L L L
461 #
462 vop_pathconf {
463 IN LOCKED=YES struct vnode *vp;
464 IN int name;
465 OUT register_t *retval;
466 };
467
468 #
469 #% advlock vp U U U
470 #
471 vop_advlock {
472 IN LOCKED=NO struct vnode *vp;
473 IN void *id;
474 IN int op;
475 IN struct flock *fl;
476 IN int flags;
477 };
478
479 #
480 #% blkatoff vp L L L
481 #
482 vop_blkatoff {
483 IN LOCKED=YES struct vnode *vp;
484 IN off_t offset;
485 OUT char **res;
486 OUT struct buf **bpp;
487 };
488
489 #
490 #% valloc pvp L L L
491 #
492 vop_valloc {
493 IN LOCKED=YES struct vnode *pvp;
494 IN int mode;
495 IN struct ucred *cred;
496 OUT struct vnode **vpp;
497 };
498
499 #
500 #% balloc vp L L L
501 #
502 vop_balloc {
503 IN LOCKED=YES struct vnode *vp;
504 IN off_t startoffset;
505 IN int size;
506 IN struct ucred *cred;
507 IN int flags;
508 OUT struct buf **bpp;
509 };
510
511 #
512 #% reallocblks vp L L L
513 #
514 vop_reallocblks {
515 IN LOCKED=YES struct vnode *vp;
516 IN struct cluster_save *buflist;
517 };
518
519 #
520 #% vfree pvp L L L
521 #
522 vop_vfree {
523 IN LOCKED=YES struct vnode *pvp;
524 IN ino_t ino;
525 IN int mode;
526 };
527
528 #
529 #% truncate vp L L L
530 #
531 vop_truncate {
532 IN LOCKED=YES struct vnode *vp;
533 IN off_t length;
534 IN int flags;
535 IN struct ucred *cred;
536 IN struct proc *p;
537 };
538
539 #
540 #% update vp L L L
541 #
542 vop_update {
543 IN LOCKED=YES struct vnode *vp;
544 IN struct timespec *access;
545 IN struct timespec *modify;
546 IN int flags;
547 };
548
549 #
550 #% lease vp = = =
551 #
552 vop_lease {
553 IN struct vnode *vp;
554 IN struct proc *p;
555 IN struct ucred *cred;
556 IN int flag;
557 };
558
559 #
560 #% whiteout dvp L L L
561 #% whiteout cnp - - -
562 #% whiteout flag - - -
563 #
564 #! whiteout cnp CREATE, LOCKPARENT
565 #
566 vop_whiteout {
567 IN LOCKED=YES struct vnode *dvp;
568 IN struct componentname *cnp;
569 IN int flags;
570 };
571
572 #
573 # Needs work: no vp?
574 #
575 #vop_bwrite {
576 # IN struct buf *bp;
577 #};
578
579 #
580 #% getpages vp = = =
581 #
582 vop_getpages {
583 IN struct vnode *vp;
584 IN voff_t offset;
585 IN struct vm_page **m;
586 IN int *count;
587 IN int centeridx;
588 IN vm_prot_t access_type;
589 IN int advice;
590 IN int flags;
591 };
592
593 #
594 #% putpages vp = = =
595 #
596 vop_putpages {
597 IN struct vnode *vp;
598 IN voff_t offlo;
599 IN voff_t offhi;
600 IN int flags;
601 };
602
603 #
604 #% closeextattr vp L L L
605 #
606 vop_closeextattr {
607 IN LOCKED=YES struct vnode *vp;
608 IN int commit;
609 IN struct ucred *cred;
610 IN struct proc *p;
611 };
612
613 #
614 #% getextattr vp L L L
615 #
616 vop_getextattr {
617 IN LOCKED=YES struct vnode *vp;
618 IN int attrnamespace;
619 IN const char *name;
620 INOUT struct uio *uio;
621 OUT size_t *size;
622 IN struct ucred *cred;
623 IN struct proc *p;
624 };
625
626 #
627 #% listextattr vp L L L
628 #
629 vop_listextattr {
630 IN LOCKED=YES struct vnode *vp;
631 IN int attrnamespace;
632 INOUT struct uio *uio;
633 OUT size_t *size;
634 IN struct ucred *cred;
635 IN struct proc *p;
636 };
637
638 #
639 #% openextattr vp L L L
640 #
641 vop_openextattr {
642 IN LOCKED=YES struct vnode *vp;
643 IN struct ucred *cred;
644 IN struct proc *p;
645 };
646
647 #
648 #% deleteextattr vp L L L
649 #
650 vop_deleteextattr {
651 IN LOCKED=YES struct vnode *vp;
652 IN int attrnamespace;
653 IN const char *name;
654 IN struct ucred *cred;
655 IN struct proc *p;
656 };
657
658 #
659 #% setextattr vp L L L
660 #
661 vop_setextattr {
662 IN LOCKED=YES struct vnode *vp;
663 IN int attrnamespace;
664 IN const char *name;
665 INOUT struct uio *uio;
666 IN struct ucred *cred;
667 IN struct proc *p;
668 };
Cache object: 35f0d6d82d913386044d443d534c2b53
|