vnode_if.src revision 1.19 1 1.19 wrstuden # $NetBSD: vnode_if.src,v 1.19 1999/08/03 18:19:08 wrstuden Exp $
2 1.1 mycroft #
3 1.1 mycroft # Copyright (c) 1992, 1993
4 1.1 mycroft # The Regents of the University of California. All rights reserved.
5 1.1 mycroft #
6 1.1 mycroft # Redistribution and use in source and binary forms, with or without
7 1.1 mycroft # modification, are permitted provided that the following conditions
8 1.1 mycroft # are met:
9 1.1 mycroft # 1. Redistributions of source code must retain the above copyright
10 1.1 mycroft # notice, this list of conditions and the following disclaimer.
11 1.1 mycroft # 2. Redistributions in binary form must reproduce the above copyright
12 1.1 mycroft # notice, this list of conditions and the following disclaimer in the
13 1.1 mycroft # documentation and/or other materials provided with the distribution.
14 1.1 mycroft # 3. All advertising materials mentioning features or use of this software
15 1.1 mycroft # must display the following acknowledgement:
16 1.1 mycroft # This product includes software developed by the University of
17 1.1 mycroft # California, Berkeley and its contributors.
18 1.1 mycroft # 4. Neither the name of the University nor the names of its contributors
19 1.1 mycroft # may be used to endorse or promote products derived from this software
20 1.1 mycroft # without specific prior written permission.
21 1.1 mycroft #
22 1.1 mycroft # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 1.1 mycroft # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 1.1 mycroft # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 1.1 mycroft # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 1.1 mycroft # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 1.1 mycroft # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 1.1 mycroft # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 1.1 mycroft # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 1.1 mycroft # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 1.1 mycroft # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 1.1 mycroft # SUCH DAMAGE.
33 1.1 mycroft #
34 1.13 fvdl # @(#)vnode_if.src 8.14 (Berkeley) 8/6/95
35 1.13 fvdl #
36 1.13 fvdl #
37 1.13 fvdl
38 1.13 fvdl #
39 1.13 fvdl # Above each of the vop descriptors is a specification of the locking
40 1.13 fvdl # protocol used by each vop call. The first column is the name of
41 1.13 fvdl # the variable, the remaining three columns are in, out and error
42 1.13 fvdl # respectively. The "in" column defines the lock state on input,
43 1.13 fvdl # the "out" column defines the state on succesful return, and the
44 1.13 fvdl # "error" column defines the locking state on error exit.
45 1.13 fvdl #
46 1.13 fvdl # The locking value can take the following values:
47 1.13 fvdl # L: locked.
48 1.13 fvdl # U: unlocked/
49 1.13 fvdl # -: not applicable. vnode does not yet (or no longer) exists.
50 1.13 fvdl # =: the same on input and output, may be either L or U.
51 1.13 fvdl # X: locked if not nil.
52 1.13 fvdl #
53 1.13 fvdl
54 1.13 fvdl #
55 1.13 fvdl #% lookup dvp L ? ?
56 1.13 fvdl #% lookup vpp - L -
57 1.13 fvdl #
58 1.13 fvdl # XXX - the lookup locking protocol defies simple description and depends
59 1.13 fvdl # on the flags and operation fields in the (cnp) structure. Note
60 1.13 fvdl # especially that *vpp may equal dvp and both may be locked.
61 1.16 sommerfe #
62 1.16 sommerfe # More details:
63 1.16 sommerfe # On success, adds a reference to *vpp so it doesn't evaporate.
64 1.17 sommerfe # On failure, *vpp is NULL, and *dvp is left locked.
65 1.17 sommerfe # If LOCKPARENT is set in cnp, dvp is returned locked even on success.
66 1.16 sommerfe # otherwise it is unlocked (unless *vpp == dvp on return)
67 1.16 sommerfe #
68 1.16 sommerfe # *vpp is always locked on return if the operation succeeds.
69 1.16 sommerfe # typically, if *vpp == dvp, you need to release twice, but unlock once.
70 1.16 sommerfe #
71 1.16 sommerfe # If ISDOTDOT is set, dvp is unlocked before *vpp is
72 1.16 sommerfe # locked; dvp is then relocked. this is done to avoid deadlocking
73 1.16 sommerfe # another process concurrently scanning downwards.
74 1.1 mycroft #
75 1.1 mycroft vop_lookup {
76 1.1 mycroft IN struct vnode *dvp;
77 1.1 mycroft INOUT struct vnode **vpp;
78 1.1 mycroft IN struct componentname *cnp;
79 1.1 mycroft };
80 1.1 mycroft
81 1.13 fvdl #
82 1.13 fvdl #% create dvp L U U
83 1.13 fvdl #% create vpp - L -
84 1.13 fvdl #
85 1.1 mycroft vop_create {
86 1.18 wrstuden IN WILLPUT struct vnode *dvp;
87 1.1 mycroft OUT struct vnode **vpp;
88 1.1 mycroft IN struct componentname *cnp;
89 1.1 mycroft IN struct vattr *vap;
90 1.1 mycroft };
91 1.1 mycroft
92 1.13 fvdl #
93 1.13 fvdl #% mknod dvp L U U
94 1.13 fvdl #% mknod vpp - X -
95 1.13 fvdl #
96 1.1 mycroft vop_mknod {
97 1.18 wrstuden IN WILLPUT struct vnode *dvp;
98 1.1 mycroft OUT WILLRELE struct vnode **vpp;
99 1.1 mycroft IN struct componentname *cnp;
100 1.1 mycroft IN struct vattr *vap;
101 1.1 mycroft };
102 1.1 mycroft
103 1.13 fvdl #
104 1.13 fvdl #% open vp L L L
105 1.13 fvdl #
106 1.1 mycroft vop_open {
107 1.1 mycroft IN struct vnode *vp;
108 1.1 mycroft IN int mode;
109 1.1 mycroft IN struct ucred *cred;
110 1.1 mycroft IN struct proc *p;
111 1.1 mycroft };
112 1.1 mycroft
113 1.13 fvdl #
114 1.15 wrstuden #% close vp L L L
115 1.13 fvdl #
116 1.1 mycroft vop_close {
117 1.1 mycroft IN struct vnode *vp;
118 1.1 mycroft IN int fflag;
119 1.1 mycroft IN struct ucred *cred;
120 1.1 mycroft IN struct proc *p;
121 1.1 mycroft };
122 1.1 mycroft
123 1.13 fvdl #
124 1.13 fvdl #% access vp L L L
125 1.13 fvdl #
126 1.1 mycroft vop_access {
127 1.1 mycroft IN struct vnode *vp;
128 1.1 mycroft IN int mode;
129 1.1 mycroft IN struct ucred *cred;
130 1.1 mycroft IN struct proc *p;
131 1.1 mycroft };
132 1.1 mycroft
133 1.13 fvdl #
134 1.13 fvdl #% getattr vp = = =
135 1.13 fvdl #
136 1.1 mycroft vop_getattr {
137 1.1 mycroft IN struct vnode *vp;
138 1.1 mycroft IN struct vattr *vap;
139 1.1 mycroft IN struct ucred *cred;
140 1.1 mycroft IN struct proc *p;
141 1.1 mycroft };
142 1.1 mycroft
143 1.13 fvdl #
144 1.13 fvdl #% setattr vp L L L
145 1.13 fvdl #
146 1.1 mycroft vop_setattr {
147 1.1 mycroft IN struct vnode *vp;
148 1.1 mycroft IN struct vattr *vap;
149 1.1 mycroft IN struct ucred *cred;
150 1.1 mycroft IN struct proc *p;
151 1.1 mycroft };
152 1.1 mycroft
153 1.13 fvdl #
154 1.13 fvdl #% read vp L L L
155 1.13 fvdl #
156 1.1 mycroft vop_read {
157 1.1 mycroft IN struct vnode *vp;
158 1.1 mycroft INOUT struct uio *uio;
159 1.1 mycroft IN int ioflag;
160 1.1 mycroft IN struct ucred *cred;
161 1.1 mycroft };
162 1.1 mycroft
163 1.13 fvdl #
164 1.13 fvdl #% write vp L L L
165 1.13 fvdl #
166 1.1 mycroft vop_write {
167 1.1 mycroft IN struct vnode *vp;
168 1.1 mycroft INOUT struct uio *uio;
169 1.1 mycroft IN int ioflag;
170 1.1 mycroft IN struct ucred *cred;
171 1.1 mycroft };
172 1.1 mycroft
173 1.13 fvdl #
174 1.13 fvdl #% ioctl vp U U U
175 1.13 fvdl #
176 1.1 mycroft vop_ioctl {
177 1.1 mycroft IN struct vnode *vp;
178 1.4 cgd IN u_long command;
179 1.19 wrstuden IN caddr_t data;
180 1.19 wrstuden IN int fflag;
181 1.19 wrstuden IN struct ucred *cred;
182 1.19 wrstuden IN struct proc *p;
183 1.19 wrstuden };
184 1.19 wrstuden
185 1.19 wrstuden #
186 1.19 wrstuden #% fcntl vp L L L
187 1.19 wrstuden #
188 1.19 wrstuden vop_fcntl {
189 1.19 wrstuden IN struct vnode *vp;
190 1.19 wrstuden IN u_int command;
191 1.1 mycroft IN caddr_t data;
192 1.1 mycroft IN int fflag;
193 1.1 mycroft IN struct ucred *cred;
194 1.1 mycroft IN struct proc *p;
195 1.1 mycroft };
196 1.1 mycroft
197 1.13 fvdl #
198 1.13 fvdl #% poll vp U U U
199 1.13 fvdl #
200 1.11 mycroft vop_poll {
201 1.1 mycroft IN struct vnode *vp;
202 1.11 mycroft IN int events;
203 1.1 mycroft IN struct proc *p;
204 1.1 mycroft };
205 1.1 mycroft
206 1.13 fvdl #
207 1.13 fvdl #% revoke vp U U U
208 1.13 fvdl #
209 1.13 fvdl vop_revoke {
210 1.13 fvdl IN struct vnode *vp;
211 1.13 fvdl IN int flags;
212 1.13 fvdl };
213 1.13 fvdl
214 1.13 fvdl #
215 1.13 fvdl # XXX - not used
216 1.13 fvdl #
217 1.1 mycroft vop_mmap {
218 1.1 mycroft IN struct vnode *vp;
219 1.1 mycroft IN int fflags;
220 1.1 mycroft IN struct ucred *cred;
221 1.1 mycroft IN struct proc *p;
222 1.1 mycroft };
223 1.1 mycroft
224 1.13 fvdl #
225 1.13 fvdl #% fsync vp L L L
226 1.13 fvdl #
227 1.1 mycroft vop_fsync {
228 1.1 mycroft IN struct vnode *vp;
229 1.1 mycroft IN struct ucred *cred;
230 1.14 kleink IN int flags;
231 1.1 mycroft IN struct proc *p;
232 1.1 mycroft };
233 1.1 mycroft
234 1.13 fvdl #
235 1.13 fvdl # Needs work: Is newoff right? What's it mean?
236 1.13 fvdl #
237 1.1 mycroft vop_seek {
238 1.1 mycroft IN struct vnode *vp;
239 1.1 mycroft IN off_t oldoff;
240 1.1 mycroft IN off_t newoff;
241 1.1 mycroft IN struct ucred *cred;
242 1.1 mycroft };
243 1.1 mycroft
244 1.13 fvdl #
245 1.13 fvdl #% remove dvp L U U
246 1.13 fvdl #% remove vp L U U
247 1.13 fvdl #
248 1.1 mycroft vop_remove {
249 1.18 wrstuden IN WILLPUT struct vnode *dvp;
250 1.18 wrstuden IN WILLPUT struct vnode *vp;
251 1.1 mycroft IN struct componentname *cnp;
252 1.1 mycroft };
253 1.1 mycroft
254 1.13 fvdl #
255 1.13 fvdl #% link vp U U U
256 1.13 fvdl #% link tdvp L U U
257 1.13 fvdl #
258 1.1 mycroft vop_link {
259 1.18 wrstuden IN WILLPUT struct vnode *dvp;
260 1.9 mycroft IN struct vnode *vp;
261 1.1 mycroft IN struct componentname *cnp;
262 1.1 mycroft };
263 1.1 mycroft
264 1.13 fvdl #
265 1.13 fvdl #% rename fdvp U U U
266 1.13 fvdl #% rename fvp U U U
267 1.13 fvdl #% rename tdvp L U U
268 1.13 fvdl #% rename tvp X U U
269 1.13 fvdl #
270 1.1 mycroft vop_rename {
271 1.1 mycroft IN WILLRELE struct vnode *fdvp;
272 1.1 mycroft IN WILLRELE struct vnode *fvp;
273 1.1 mycroft IN struct componentname *fcnp;
274 1.18 wrstuden IN WILLPUT struct vnode *tdvp;
275 1.1 mycroft IN WILLRELE struct vnode *tvp;
276 1.1 mycroft IN struct componentname *tcnp;
277 1.1 mycroft };
278 1.1 mycroft
279 1.13 fvdl #
280 1.13 fvdl #% mkdir dvp L U U
281 1.13 fvdl #% mkdir vpp - L -
282 1.13 fvdl #
283 1.1 mycroft vop_mkdir {
284 1.18 wrstuden IN WILLPUT struct vnode *dvp;
285 1.1 mycroft OUT struct vnode **vpp;
286 1.1 mycroft IN struct componentname *cnp;
287 1.1 mycroft IN struct vattr *vap;
288 1.1 mycroft };
289 1.1 mycroft
290 1.13 fvdl #
291 1.13 fvdl #% rmdir dvp L U U
292 1.13 fvdl #% rmdir vp L U U
293 1.13 fvdl #
294 1.1 mycroft vop_rmdir {
295 1.18 wrstuden IN WILLPUT struct vnode *dvp;
296 1.18 wrstuden IN WILLPUT struct vnode *vp;
297 1.1 mycroft IN struct componentname *cnp;
298 1.1 mycroft };
299 1.1 mycroft
300 1.13 fvdl #
301 1.13 fvdl #% symlink dvp L U U
302 1.13 fvdl #% symlink vpp - U -
303 1.13 fvdl #
304 1.13 fvdl # XXX - note that the return vnode has already been VRELE'ed
305 1.13 fvdl # by the filesystem layer. To use it you must use vget,
306 1.13 fvdl # possibly with a further namei.
307 1.13 fvdl #
308 1.1 mycroft vop_symlink {
309 1.18 wrstuden IN WILLPUT struct vnode *dvp;
310 1.1 mycroft OUT WILLRELE struct vnode **vpp;
311 1.1 mycroft IN struct componentname *cnp;
312 1.1 mycroft IN struct vattr *vap;
313 1.1 mycroft IN char *target;
314 1.1 mycroft };
315 1.1 mycroft
316 1.13 fvdl #
317 1.13 fvdl #% readdir vp L L L
318 1.13 fvdl #
319 1.1 mycroft vop_readdir {
320 1.1 mycroft IN struct vnode *vp;
321 1.1 mycroft INOUT struct uio *uio;
322 1.1 mycroft IN struct ucred *cred;
323 1.1 mycroft OUT int *eofflag;
324 1.13 fvdl OUT off_t **cookies;
325 1.13 fvdl IN int *ncookies;
326 1.1 mycroft };
327 1.1 mycroft
328 1.13 fvdl #
329 1.13 fvdl #% readlink vp L L L
330 1.13 fvdl #
331 1.1 mycroft vop_readlink {
332 1.1 mycroft IN struct vnode *vp;
333 1.1 mycroft INOUT struct uio *uio;
334 1.1 mycroft IN struct ucred *cred;
335 1.1 mycroft };
336 1.1 mycroft
337 1.13 fvdl #
338 1.13 fvdl #% abortop dvp = = =
339 1.13 fvdl #
340 1.1 mycroft vop_abortop {
341 1.1 mycroft IN struct vnode *dvp;
342 1.1 mycroft IN struct componentname *cnp;
343 1.1 mycroft };
344 1.1 mycroft
345 1.13 fvdl #
346 1.13 fvdl #% inactive vp L U U
347 1.13 fvdl #
348 1.1 mycroft vop_inactive {
349 1.18 wrstuden IN WILLUNLOCK struct vnode *vp;
350 1.13 fvdl IN struct proc *p;
351 1.1 mycroft };
352 1.1 mycroft
353 1.13 fvdl #
354 1.13 fvdl #% reclaim vp U U U
355 1.13 fvdl #
356 1.1 mycroft vop_reclaim {
357 1.1 mycroft IN struct vnode *vp;
358 1.13 fvdl IN struct proc *p;
359 1.1 mycroft };
360 1.1 mycroft
361 1.13 fvdl #
362 1.13 fvdl #% lock vp U L U
363 1.13 fvdl #
364 1.1 mycroft vop_lock {
365 1.1 mycroft IN struct vnode *vp;
366 1.13 fvdl IN int flags;
367 1.1 mycroft };
368 1.1 mycroft
369 1.13 fvdl #
370 1.13 fvdl #% unlock vp L U L
371 1.13 fvdl #
372 1.1 mycroft vop_unlock {
373 1.1 mycroft IN struct vnode *vp;
374 1.13 fvdl IN int flags;
375 1.1 mycroft };
376 1.1 mycroft
377 1.13 fvdl #
378 1.13 fvdl #% bmap vp L L L
379 1.13 fvdl #% bmap vpp - U -
380 1.13 fvdl #
381 1.1 mycroft vop_bmap {
382 1.1 mycroft IN struct vnode *vp;
383 1.1 mycroft IN daddr_t bn;
384 1.1 mycroft OUT struct vnode **vpp;
385 1.1 mycroft IN daddr_t *bnp;
386 1.1 mycroft OUT int *runp;
387 1.1 mycroft };
388 1.1 mycroft
389 1.13 fvdl #
390 1.13 fvdl # Needs work: no vp?
391 1.13 fvdl #
392 1.1 mycroft #vop_strategy {
393 1.1 mycroft # IN struct buf *bp;
394 1.1 mycroft #};
395 1.1 mycroft
396 1.13 fvdl #
397 1.13 fvdl #% print vp = = =
398 1.13 fvdl #
399 1.1 mycroft vop_print {
400 1.1 mycroft IN struct vnode *vp;
401 1.1 mycroft };
402 1.1 mycroft
403 1.13 fvdl #
404 1.13 fvdl #% islocked vp = = =
405 1.13 fvdl #
406 1.1 mycroft vop_islocked {
407 1.1 mycroft IN struct vnode *vp;
408 1.1 mycroft };
409 1.1 mycroft
410 1.13 fvdl #
411 1.13 fvdl #% pathconf vp L L L
412 1.13 fvdl #
413 1.1 mycroft vop_pathconf {
414 1.1 mycroft IN struct vnode *vp;
415 1.1 mycroft IN int name;
416 1.3 cgd OUT register_t *retval;
417 1.1 mycroft };
418 1.1 mycroft
419 1.13 fvdl #
420 1.13 fvdl #% advlock vp U U U
421 1.13 fvdl #
422 1.1 mycroft vop_advlock {
423 1.1 mycroft IN struct vnode *vp;
424 1.1 mycroft IN caddr_t id;
425 1.1 mycroft IN int op;
426 1.1 mycroft IN struct flock *fl;
427 1.1 mycroft IN int flags;
428 1.1 mycroft };
429 1.1 mycroft
430 1.13 fvdl #
431 1.13 fvdl #% blkatoff vp L L L
432 1.13 fvdl #
433 1.1 mycroft vop_blkatoff {
434 1.1 mycroft IN struct vnode *vp;
435 1.1 mycroft IN off_t offset;
436 1.1 mycroft OUT char **res;
437 1.1 mycroft OUT struct buf **bpp;
438 1.1 mycroft };
439 1.1 mycroft
440 1.13 fvdl #
441 1.13 fvdl #% valloc pvp L L L
442 1.13 fvdl #
443 1.1 mycroft vop_valloc {
444 1.1 mycroft IN struct vnode *pvp;
445 1.1 mycroft IN int mode;
446 1.1 mycroft IN struct ucred *cred;
447 1.1 mycroft OUT struct vnode **vpp;
448 1.1 mycroft };
449 1.1 mycroft
450 1.13 fvdl #
451 1.13 fvdl #% reallocblks vp L L L
452 1.13 fvdl #
453 1.1 mycroft vop_reallocblks {
454 1.1 mycroft IN struct vnode *vp;
455 1.1 mycroft IN struct cluster_save *buflist;
456 1.1 mycroft };
457 1.1 mycroft
458 1.13 fvdl #
459 1.13 fvdl #% vfree pvp L L L
460 1.13 fvdl #
461 1.1 mycroft vop_vfree {
462 1.1 mycroft IN struct vnode *pvp;
463 1.1 mycroft IN ino_t ino;
464 1.1 mycroft IN int mode;
465 1.1 mycroft };
466 1.1 mycroft
467 1.13 fvdl #
468 1.13 fvdl #% truncate vp L L L
469 1.13 fvdl #
470 1.1 mycroft vop_truncate {
471 1.1 mycroft IN struct vnode *vp;
472 1.1 mycroft IN off_t length;
473 1.1 mycroft IN int flags;
474 1.1 mycroft IN struct ucred *cred;
475 1.1 mycroft IN struct proc *p;
476 1.1 mycroft };
477 1.1 mycroft
478 1.13 fvdl #
479 1.13 fvdl #% update vp L L L
480 1.13 fvdl #
481 1.1 mycroft vop_update {
482 1.1 mycroft IN struct vnode *vp;
483 1.10 mycroft IN struct timespec *access;
484 1.10 mycroft IN struct timespec *modify;
485 1.1 mycroft IN int waitfor;
486 1.6 mycroft };
487 1.6 mycroft
488 1.13 fvdl #
489 1.13 fvdl #% lease vp = = =
490 1.13 fvdl #
491 1.6 mycroft vop_lease {
492 1.6 mycroft IN struct vnode *vp;
493 1.6 mycroft IN struct proc *p;
494 1.6 mycroft IN struct ucred *cred;
495 1.6 mycroft IN int flag;
496 1.7 mycroft };
497 1.7 mycroft
498 1.13 fvdl #
499 1.13 fvdl #% whiteout dvp L L L
500 1.13 fvdl #% whiteout cnp - - -
501 1.13 fvdl #% whiteout flag - - -
502 1.13 fvdl #
503 1.7 mycroft vop_whiteout {
504 1.7 mycroft IN struct vnode *dvp;
505 1.7 mycroft IN struct componentname *cnp;
506 1.7 mycroft IN int flags;
507 1.1 mycroft };
508 1.1 mycroft
509 1.13 fvdl #
510 1.1 mycroft # Needs work: no vp?
511 1.13 fvdl #
512 1.1 mycroft #vop_bwrite {
513 1.1 mycroft # IN struct buf *bp;
514 1.1 mycroft #};
515