]> git.saurik.com Git - apple/xnu.git/blob - bsd/vfs/vnode_if.src
309b052b4332012a0b9158151756da969582c221
[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 struct proc *p;
255 };
256
257 #
258 #% exchange fvp L L L
259 #% exchange tvp L L L
260 #
261 vop_exchange {
262 IN struct vnode *fvp;
263 IN struct vnode *tvp;
264 IN struct ucred *cred;
265 IN struct proc *p;
266 };
267
268 #
269 #% revoke vp U U U
270 #
271 vop_revoke {
272 IN struct vnode *vp;
273 IN int flags;
274 };
275
276 #
277 # XXX - not used
278 #
279 vop_mmap {
280 IN struct vnode *vp;
281 IN int fflags;
282 IN struct ucred *cred;
283 IN struct proc *p;
284 };
285
286 #
287 #% fsync vp L L L
288 #
289 vop_fsync { UBC
290 IN struct vnode *vp;
291 IN struct ucred *cred;
292 IN int waitfor;
293 IN struct proc *p;
294 };
295
296 #
297 # XXX - not used
298 # Needs work: Is newoff right? What's it mean?
299 #
300 vop_seek {
301 IN struct vnode *vp;
302 IN off_t oldoff;
303 IN off_t newoff;
304 IN struct ucred *cred;
305 };
306
307 #
308 #% remove dvp L U U
309 #% remove vp L U U
310 #
311 vop_remove {
312 IN WILLRELE struct vnode *dvp;
313 IN WILLRELE struct vnode *vp;
314 IN struct componentname *cnp;
315 };
316
317 #
318 #% link vp U U U
319 #% link tdvp L U U
320 #
321 vop_link {
322 IN WILLRELE struct vnode *vp;
323 IN struct vnode *tdvp;
324 IN struct componentname *cnp;
325 };
326
327 #
328 #% rename fdvp U U U
329 #% rename fvp U U U
330 #% rename tdvp L U U
331 #% rename tvp X U U
332 #
333 vop_rename {
334 IN WILLRELE struct vnode *fdvp;
335 IN WILLRELE struct vnode *fvp;
336 IN struct componentname *fcnp;
337 IN WILLRELE struct vnode *tdvp;
338 IN WILLRELE struct vnode *tvp;
339 IN struct componentname *tcnp;
340 };
341
342 #
343 #% mkdir dvp L U U
344 #% mkdir vpp - L -
345 #
346 vop_mkdir {
347 IN WILLRELE struct vnode *dvp;
348 OUT struct vnode **vpp;
349 IN struct componentname *cnp;
350 IN struct vattr *vap;
351 };
352
353 #
354 #% rmdir dvp L U U
355 #% rmdir vp L U U
356 #
357 vop_rmdir {
358 IN WILLRELE struct vnode *dvp;
359 IN WILLRELE struct vnode *vp;
360 IN struct componentname *cnp;
361 };
362
363 #
364 #% symlink dvp L U U
365 #% symlink vpp - U -
366 #
367 # XXX - note that the return vnode has already been VRELE'ed
368 # by the filesystem layer. To use it you must use vget,
369 # possibly with a further namei.
370 #
371 vop_symlink {
372 IN WILLRELE struct vnode *dvp;
373 OUT WILLRELE struct vnode **vpp;
374 IN struct componentname *cnp;
375 IN struct vattr *vap;
376 IN char *target;
377 };
378
379 #
380 #% readdir vp L L L
381 #
382 vop_readdir {
383 IN struct vnode *vp;
384 INOUT struct uio *uio;
385 IN struct ucred *cred;
386 INOUT int *eofflag;
387 OUT int *ncookies;
388 INOUT u_long **cookies;
389 };
390
391 #
392 #% readdirattr vp L L L
393 #
394 vop_readdirattr {
395 IN struct vnode *vp;
396 IN struct attrlist *alist;
397 INOUT struct uio *uio;
398 IN u_long maxcount;
399 IN u_long options;
400 OUT u_long *newstate;
401 OUT int *eofflag;
402 OUT u_long *actualcount;
403 OUT u_long **cookies;
404 IN struct ucred *cred;
405 };
406
407 #
408 #% readlink vp L L L
409 #
410 vop_readlink {
411 IN struct vnode *vp;
412 INOUT struct uio *uio;
413 IN struct ucred *cred;
414 };
415
416 #
417 #% abortop dvp = = =
418 #
419 vop_abortop {
420 IN struct vnode *dvp;
421 IN struct componentname *cnp;
422 };
423
424 #
425 #% inactive vp L U U
426 #
427 vop_inactive {
428 IN struct vnode *vp;
429 IN struct proc *p;
430 };
431
432 #
433 #% reclaim vp U U U
434 #
435 vop_reclaim {
436 IN struct vnode *vp;
437 IN struct proc *p;
438 };
439
440 #
441 #% lock vp U L U
442 #
443 vop_lock {
444 IN struct vnode *vp;
445 IN int flags;
446 IN struct proc *p;
447 };
448
449 #
450 #% unlock vp L U L
451 #
452 vop_unlock {
453 IN struct vnode *vp;
454 IN int flags;
455 IN struct proc *p;
456 };
457
458 #
459 #% bmap vp L L L
460 #% bmap vpp - U -
461 #
462 vop_bmap {
463 IN struct vnode *vp;
464 IN daddr_t bn;
465 OUT struct vnode **vpp;
466 IN daddr_t *bnp;
467 OUT int *runp;
468 };
469
470 #
471 # Needs work: no vp?
472 #
473 #vop_strategy {
474 # IN struct buf *bp;
475 #};
476
477 #
478 #% print vp = = =
479 #
480 vop_print {
481 IN struct vnode *vp;
482 };
483
484 #
485 #% islocked vp = = =
486 #
487 vop_islocked {
488 IN struct vnode *vp;
489 };
490
491 #
492 #% pathconf vp L L L
493 #
494 vop_pathconf {
495 IN struct vnode *vp;
496 IN int name;
497 OUT register_t *retval;
498 };
499
500 #
501 #% advlock vp U U U
502 #
503 vop_advlock {
504 IN struct vnode *vp;
505 IN caddr_t id;
506 IN int op;
507 IN struct flock *fl;
508 IN int flags;
509 };
510
511 #
512 #% blkatoff vp L L L
513 #
514 vop_blkatoff {
515 IN struct vnode *vp;
516 IN off_t offset;
517 OUT char **res;
518 OUT struct buf **bpp;
519 };
520
521 #
522 #% valloc pvp L L L
523 #
524 vop_valloc {
525 IN struct vnode *pvp;
526 IN int mode;
527 IN struct ucred *cred;
528 OUT struct vnode **vpp;
529 };
530
531 #
532 #% reallocblks vp L L L
533 #
534 vop_reallocblks {
535 IN struct vnode *vp;
536 IN struct cluster_save *buflist;
537 };
538
539 #
540 #% vfree pvp L L L
541 #
542 vop_vfree {
543 IN struct vnode *pvp;
544 IN ino_t ino;
545 IN int mode;
546 };
547
548 #
549 #% truncate vp L L L
550 #
551 vop_truncate { UBC
552 IN struct vnode *vp;
553 IN off_t length;
554 IN int flags;
555 IN struct ucred *cred;
556 IN struct proc *p;
557 };
558
559 #
560 #% allocate vp L L L
561 #
562 vop_allocate {
563 IN struct vnode *vp;
564 IN off_t length;
565 IN u_int32_t flags;
566 OUT off_t *bytesallocated;
567 IN struct ucred *cred;
568 IN struct proc *p;
569 };
570
571 #
572 #% update vp L L L
573 #
574 vop_update {
575 IN struct vnode *vp;
576 IN struct timeval *access;
577 IN struct timeval *modify;
578 IN int waitfor;
579 };
580
581 #
582 #% pgrd vp L L L
583 #
584 vop_pgrd {
585 IN struct vnode *vp;
586 INOUT struct uio *uio;
587 IN struct ucred *cred;
588 };
589
590 #
591 #% pgwr vp L L L
592 #
593 vop_pgwr {
594 IN struct vnode *vp;
595 INOUT struct uio *uio;
596 IN struct ucred *cred;
597 IN vm_offset_t offset;
598 };
599
600 #
601 # Needs work: no vp?
602 #
603 #vop_bwrite {
604 # IN struct buf *bp;
605 #};
606
607 #
608 #% pagein vp = = =
609 #
610 vop_pagein {
611 IN struct vnode *vp;
612 IN upl_t pl;
613 IN vm_offset_t pl_offset;
614 IN off_t f_offset;
615 IN size_t size;
616 IN struct ucred *cred;
617 IN int flags;
618 };
619
620 #
621 #% pageout vp = = =
622 #
623 vop_pageout {
624 IN struct vnode *vp;
625 IN upl_t pl;
626 IN vm_offset_t pl_offset;
627 IN off_t f_offset;
628 IN size_t size;
629 IN struct ucred *cred;
630 IN int flags;
631 };
632
633 #
634 #% devblocksize vp = = =
635 #
636 vop_devblocksize {
637 IN struct vnode *vp;
638 OUT register_t *retval;
639 };
640
641 #
642 #% searchfs vp L L L
643 #
644 vop_searchfs {
645 IN struct vnode *vp;
646 IN void *searchparams1;
647 IN void *searchparams2;
648 IN struct attrlist *searchattrs;
649 IN u_long maxmatches;
650 IN struct timeval *timelimit;
651 OUT struct attrlist *returnattrs;
652 OUT u_long *nummatches;
653 IN u_long scriptcode;
654 IN u_long options;
655 INOUT struct uio *uio;
656 INOUT struct searchstate *searchstate;
657 };
658
659 #
660 #% copyfile fvp U U U
661 #% copyfile tdvp L U U
662 #% copyfile tvp X U U
663 #
664 vop_copyfile {
665 IN WILLRELE struct vnode *fvp;
666 IN WILLRELE struct vnode *tdvp;
667 IN WILLRELE struct vnode *tvp;
668 IN struct componentname *tcnp;
669 IN int mode;
670 IN int flags;
671 };
672
673 #
674 #% blktooff vp = = =
675 #
676 # Given a logical block number for a vnode
677 # return file offset
678 #
679 vop_blktooff {
680 IN struct vnode *vp;
681 IN daddr_t lblkno;
682 OUT off_t *offset;
683 };
684
685 #
686 #% offtoblk vp = = =
687 #
688 # Given a file offset for a vnode
689 # return logical block number
690 #
691 vop_offtoblk {
692 IN struct vnode *vp;
693 IN off_t offset;
694 OUT daddr_t *lblkno;
695 };
696
697 #
698 #% cmap vp L L L
699 #
700 # Given a file offset and size of IO for a vnode
701 # return physical block number and bytes physically
702 # contiguous at that physical block.
703 #
704 # An offset into the physical block may be returned [optional]
705 # This is needed to support 4K/1K UFS on the devices with 2K
706 # sector size.
707 vop_cmap {
708 IN struct vnode *vp;
709 IN off_t foffset;
710 IN size_t size;
711 OUT daddr_t *bpn;
712 OUT size_t *run;
713 OUT void *poff;
714 };
715