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