]> git.saurik.com Git - apple/xnu.git/blob - bsd/vfs/vnode_if.src
xnu-517.9.4.tar.gz
[apple/xnu.git] / bsd / vfs / vnode_if.src
1 #
2 # Copyright (c) 1995, 1997-1998 Apple Computer, Inc. All Rights Reserved.
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.12 (Berkeley) 5/14/95
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.
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
53 # If a vnode operation if likely to generate buffer cache IO
54 # for file data, add the word "UBC" on the line containing the
55 # name of the vnode operation. The word "UBC" must be the third
56 # word on the line, right after "{".
57
58
59 #
60 #% lookup dvp L ? ?
61 #% lookup vpp - L -
62 #
63 # XXX - the lookup locking protocol defies simple description and depends
64 # on the flags and operation fields in the (cnp) structure. Note
65 # ebly that *vpp may equal dvp and both may be locked.
66 #
67 vop_lookup {
68 IN struct vnode *dvp;
69 INOUT struct vnode **vpp;
70 IN struct componentname *cnp;
71 };
72
73 #
74 #% cachedlookup dvp L ? ?
75 #% cachedlookup vpp - L -
76 #
77 # This must be an exact copy of lookup. See kern/vfs_cache.c for details.
78 #
79 vop_cachedlookup {
80 IN struct vnode *dvp;
81 INOUT struct vnode **vpp;
82 IN struct componentname *cnp;
83 };
84
85 #
86 #% create dvp L L L
87 #% create vpp - L -
88 #
89 vop_create {
90 IN WILLRELE struct vnode *dvp;
91 OUT struct vnode **vpp;
92 IN struct componentname *cnp;
93 IN struct vattr *vap;
94 };
95
96 #
97 #% whiteout dvp L L L
98 #% whiteout cnp - - -
99 #% whiteout flag - - -
100 #
101 vop_whiteout {
102 IN WILLRELE struct vnode *dvp;
103 IN struct componentname *cnp;
104 IN int flags;
105 };
106
107 #
108 #% mknod dvp L U U
109 #% mknod vpp - X -
110 #
111 vop_mknod {
112 IN WILLRELE struct vnode *dvp;
113 OUT WILLRELE struct vnode **vpp;
114 IN struct componentname *cnp;
115 IN struct vattr *vap;
116 };
117
118 #
119 #% mkcomplex dvp L U U
120 #% mkcomplex vpp - X -
121 #
122 vop_mkcomplex {
123 IN WILLRELE struct vnode *dvp;
124 OUT WILLRELE struct vnode **vpp;
125 IN struct componentname *cnp;
126 IN struct vattr *vap;
127 IN u_long type;
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 proc *p;
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 ucred *cred;
147 IN struct proc *p;
148 };
149
150 #
151 #% access vp L L L
152 #
153 vop_access {
154 IN struct vnode *vp;
155 IN int mode;
156 IN struct ucred *cred;
157 IN struct proc *p;
158 };
159
160 #
161 #% getattr vp = = =
162 #
163 vop_getattr {
164 IN struct vnode *vp;
165 IN struct vattr *vap;
166 IN struct ucred *cred;
167 IN struct proc *p;
168 };
169
170 #
171 #% setattr vp L L L
172 #
173 vop_setattr {
174 IN struct vnode *vp;
175 IN struct vattr *vap;
176 IN struct ucred *cred;
177 IN struct proc *p;
178 };
179
180 #
181 #% getattrlist vp = = =
182 #
183 vop_getattrlist {
184 IN struct vnode *vp;
185 IN struct attrlist *alist;
186 INOUT struct uio *uio;
187 IN struct ucred *cred;
188 IN struct proc *p;
189 };
190
191 #
192 #% setattrlist vp L L L
193 #
194 vop_setattrlist {
195 IN struct vnode *vp;
196 IN struct attrlist *alist;
197 INOUT struct uio *uio;
198 IN struct ucred *cred;
199 IN struct proc *p;
200 };
201
202 #
203 #% read vp L L L
204 #
205 vop_read { UBC
206 IN struct vnode *vp;
207 INOUT struct uio *uio;
208 IN int ioflag;
209 IN struct ucred *cred;
210 };
211
212 #
213 #% write vp L L L
214 #
215 vop_write { UBC
216 IN struct vnode *vp;
217 INOUT struct uio *uio;
218 IN int ioflag;
219 IN struct ucred *cred;
220 };
221
222 #
223 #% lease vp = = =
224 #
225 vop_lease {
226 IN struct vnode *vp;
227 IN struct proc *p;
228 IN struct ucred *cred;
229 IN int flag;
230 };
231
232 #
233 #% ioctl vp U U U
234 #
235 vop_ioctl {
236 IN struct vnode *vp;
237 IN u_long command;
238 IN caddr_t data;
239 IN int fflag;
240 IN struct ucred *cred;
241 IN struct proc *p;
242 };
243
244 #
245 #% select vp U U U
246 #
247 # Needs work? (fflags)
248 #
249 vop_select {
250 IN struct vnode *vp;
251 IN int which;
252 IN int fflags;
253 IN struct ucred *cred;
254 IN void * wql;
255 IN struct proc *p;
256 };
257
258 #
259 #% exchange fvp L L L
260 #% exchange tvp L L L
261 #
262 vop_exchange {
263 IN struct vnode *fvp;
264 IN struct vnode *tvp;
265 IN struct ucred *cred;
266 IN struct proc *p;
267 };
268
269 #
270 #% kqfilt_add vp L L L
271 #
272 vop_kqfilt_add {
273 IN struct vnode *vp;
274 IN struct knote *kn;
275 IN struct proc *p;
276 };
277
278 #
279 #% kqfilt_remove vp L L L
280 #
281 vop_kqfilt_remove {
282 IN struct vnode *vp;
283 IN uintptr_t ident;
284 IN struct proc *p;
285 };
286
287 #
288 #% revoke vp U U U
289 #
290 vop_revoke {
291 IN struct vnode *vp;
292 IN int flags;
293 };
294
295 #
296 # XXX - not used
297 #
298 vop_mmap {
299 IN struct vnode *vp;
300 IN int fflags;
301 IN struct ucred *cred;
302 IN struct proc *p;
303 };
304
305 #
306 #% fsync vp L L L
307 #
308 vop_fsync { UBC
309 IN struct vnode *vp;
310 IN struct ucred *cred;
311 IN int waitfor;
312 IN struct proc *p;
313 };
314
315 #
316 # XXX - not used
317 # Needs work: Is newoff right? What's it mean?
318 #
319 vop_seek {
320 IN struct vnode *vp;
321 IN off_t oldoff;
322 IN off_t newoff;
323 IN struct ucred *cred;
324 };
325
326 #
327 #% remove dvp L U U
328 #% remove vp L U U
329 #
330 vop_remove {
331 IN WILLRELE struct vnode *dvp;
332 IN WILLRELE struct vnode *vp;
333 IN struct componentname *cnp;
334 };
335
336 #
337 #% link vp U U U
338 #% link tdvp L U U
339 #
340 vop_link {
341 IN struct vnode *vp;
342 IN WILLRELE struct vnode *tdvp;
343 IN struct componentname *cnp;
344 };
345
346 #
347 #% rename fdvp U U U
348 #% rename fvp U U U
349 #% rename tdvp L U U
350 #% rename tvp X U U
351 #
352 vop_rename {
353 IN WILLRELE struct vnode *fdvp;
354 IN WILLRELE struct vnode *fvp;
355 IN struct componentname *fcnp;
356 IN WILLRELE struct vnode *tdvp;
357 IN WILLRELE struct vnode *tvp;
358 IN struct componentname *tcnp;
359 };
360
361 #
362 #% mkdir dvp L U U
363 #% mkdir vpp - L -
364 #
365 vop_mkdir {
366 IN WILLRELE struct vnode *dvp;
367 OUT struct vnode **vpp;
368 IN struct componentname *cnp;
369 IN struct vattr *vap;
370 };
371
372 #
373 #% rmdir dvp L U U
374 #% rmdir vp L U U
375 #
376 vop_rmdir {
377 IN WILLRELE struct vnode *dvp;
378 IN WILLRELE struct vnode *vp;
379 IN struct componentname *cnp;
380 };
381
382 #
383 #% symlink dvp L U U
384 #% symlink vpp - U -
385 #
386 # XXX - note that the return vnode has already been VRELE'ed
387 # by the filesystem layer. To use it you must use vget,
388 # possibly with a further namei.
389 #
390 vop_symlink {
391 IN WILLRELE struct vnode *dvp;
392 OUT WILLRELE struct vnode **vpp;
393 IN struct componentname *cnp;
394 IN struct vattr *vap;
395 IN char *target;
396 };
397
398 #
399 #% readdir vp L L L
400 #
401 vop_readdir {
402 IN struct vnode *vp;
403 INOUT struct uio *uio;
404 IN struct ucred *cred;
405 INOUT int *eofflag;
406 OUT int *ncookies;
407 INOUT u_long **cookies;
408 };
409
410 #
411 #% readdirattr vp L L L
412 #
413 vop_readdirattr {
414 IN struct vnode *vp;
415 IN struct attrlist *alist;
416 INOUT struct uio *uio;
417 IN u_long maxcount;
418 IN u_long options;
419 OUT u_long *newstate;
420 OUT int *eofflag;
421 OUT u_long *actualcount;
422 OUT u_long **cookies;
423 IN struct ucred *cred;
424 };
425
426 #
427 #% readlink vp L L L
428 #
429 vop_readlink {
430 IN struct vnode *vp;
431 INOUT struct uio *uio;
432 IN struct ucred *cred;
433 };
434
435 #
436 #% abortop dvp = = =
437 #
438 vop_abortop {
439 IN struct vnode *dvp;
440 IN struct componentname *cnp;
441 };
442
443 #
444 #% inactive vp L U U
445 #
446 vop_inactive {
447 IN struct vnode *vp;
448 IN struct proc *p;
449 };
450
451 #
452 #% reclaim vp U U U
453 #
454 vop_reclaim {
455 IN struct vnode *vp;
456 IN struct proc *p;
457 };
458
459 #
460 #% lock vp U L U
461 #
462 vop_lock {
463 IN struct vnode *vp;
464 IN int flags;
465 IN struct proc *p;
466 };
467
468 #
469 #% unlock vp L U L
470 #
471 vop_unlock {
472 IN struct vnode *vp;
473 IN int flags;
474 IN struct proc *p;
475 };
476
477 #
478 #% bmap vp L L L
479 #% bmap vpp - U -
480 #
481 vop_bmap {
482 IN struct vnode *vp;
483 IN daddr_t bn;
484 OUT struct vnode **vpp;
485 IN daddr_t *bnp;
486 OUT int *runp;
487 };
488
489 #
490 # Needs work: no vp?
491 #
492 #vop_strategy {
493 # IN struct buf *bp;
494 #};
495
496 #
497 #% print vp = = =
498 #
499 vop_print {
500 IN struct vnode *vp;
501 };
502
503 #
504 #% islocked vp = = =
505 #
506 vop_islocked {
507 IN struct vnode *vp;
508 };
509
510 #
511 #% pathconf vp L L L
512 #
513 vop_pathconf {
514 IN struct vnode *vp;
515 IN int name;
516 OUT register_t *retval;
517 };
518
519 #
520 #% advlock vp U U U
521 #
522 vop_advlock {
523 IN struct vnode *vp;
524 IN caddr_t id;
525 IN int op;
526 IN struct flock *fl;
527 IN int flags;
528 };
529
530 #
531 #% blkatoff vp L L L
532 #
533 vop_blkatoff {
534 IN struct vnode *vp;
535 IN off_t offset;
536 OUT char **res;
537 OUT struct buf **bpp;
538 };
539
540 #
541 #% valloc pvp L L L
542 #
543 vop_valloc {
544 IN struct vnode *pvp;
545 IN int mode;
546 IN struct ucred *cred;
547 OUT struct vnode **vpp;
548 };
549
550 #
551 #% reallocblks vp L L L
552 #
553 vop_reallocblks {
554 IN struct vnode *vp;
555 IN struct cluster_save *buflist;
556 };
557
558 #
559 #% vfree pvp L L L
560 #
561 vop_vfree {
562 IN struct vnode *pvp;
563 IN ino_t ino;
564 IN int mode;
565 };
566
567 #
568 #% truncate vp L L L
569 #
570 vop_truncate { UBC
571 IN struct vnode *vp;
572 IN off_t length;
573 IN int flags;
574 IN struct ucred *cred;
575 IN struct proc *p;
576 };
577
578 #
579 #% allocate vp L L L
580 #
581 vop_allocate {
582 IN struct vnode *vp;
583 IN off_t length;
584 IN u_int32_t flags;
585 OUT off_t *bytesallocated;
586 IN off_t offset;
587 IN struct ucred *cred;
588 IN struct proc *p;
589 };
590
591 #
592 #% update vp L L L
593 #
594 vop_update {
595 IN struct vnode *vp;
596 IN struct timeval *access;
597 IN struct timeval *modify;
598 IN int waitfor;
599 };
600
601 #
602 #% pgrd vp L L L
603 #
604 vop_pgrd {
605 IN struct vnode *vp;
606 INOUT struct uio *uio;
607 IN struct ucred *cred;
608 };
609
610 #
611 #% pgwr vp L L L
612 #
613 vop_pgwr {
614 IN struct vnode *vp;
615 INOUT struct uio *uio;
616 IN struct ucred *cred;
617 IN vm_offset_t offset;
618 };
619
620 #
621 # Needs work: no vp?
622 #
623 #vop_bwrite {
624 # IN struct buf *bp;
625 #};
626
627 #
628 #% pagein vp = = =
629 #
630 vop_pagein {
631 IN struct vnode *vp;
632 IN upl_t pl;
633 IN vm_offset_t pl_offset;
634 IN off_t f_offset;
635 IN size_t size;
636 IN struct ucred *cred;
637 IN int flags;
638 };
639
640 #
641 #% pageout vp = = =
642 #
643 vop_pageout {
644 IN struct vnode *vp;
645 IN upl_t pl;
646 IN vm_offset_t pl_offset;
647 IN off_t f_offset;
648 IN size_t size;
649 IN struct ucred *cred;
650 IN int flags;
651 };
652
653 #
654 #% devblocksize vp = = =
655 #
656 vop_devblocksize {
657 IN struct vnode *vp;
658 OUT register_t *retval;
659 };
660
661 #
662 #% searchfs vp L L L
663 #
664 vop_searchfs {
665 IN struct vnode *vp;
666 IN void *searchparams1;
667 IN void *searchparams2;
668 IN struct attrlist *searchattrs;
669 IN u_long maxmatches;
670 IN struct timeval *timelimit;
671 OUT struct attrlist *returnattrs;
672 OUT u_long *nummatches;
673 IN u_long scriptcode;
674 IN u_long options;
675 INOUT struct uio *uio;
676 INOUT struct searchstate *searchstate;
677 };
678
679 #
680 #% copyfile fvp U U U
681 #% copyfile tdvp L U U
682 #% copyfile tvp X U U
683 #
684 vop_copyfile {
685 IN WILLRELE struct vnode *fvp;
686 IN WILLRELE struct vnode *tdvp;
687 IN WILLRELE struct vnode *tvp;
688 IN struct componentname *tcnp;
689 IN int mode;
690 IN int flags;
691 };
692
693 #
694 #% blktooff vp = = =
695 #
696 # Given a logical block number for a vnode
697 # return file offset
698 #
699 vop_blktooff {
700 IN struct vnode *vp;
701 IN daddr_t lblkno;
702 OUT off_t *offset;
703 };
704
705 #
706 #% offtoblk vp = = =
707 #
708 # Given a file offset for a vnode
709 # return logical block number
710 #
711 vop_offtoblk {
712 IN struct vnode *vp;
713 IN off_t offset;
714 OUT daddr_t *lblkno;
715 };
716
717 #
718 #% cmap vp L L L
719 #
720 # Given a file offset and size of IO for a vnode
721 # return physical block number and bytes physically
722 # contiguous at that physical block.
723 #
724 # An offset into the physical block may be returned [optional]
725 # This is needed to support 4K/1K UFS on the devices with 2K
726 # sector size.
727 vop_cmap {
728 IN struct vnode *vp;
729 IN off_t foffset;
730 IN size_t size;
731 OUT daddr_t *bpn;
732 OUT size_t *run;
733 OUT void *poff;
734 };
735