Home | History | Annotate | Line # | Download | only in kern
vnode_if.src revision 1.17
      1 #	$NetBSD: vnode_if.src,v 1.17 1999/06/21 02:28:46 sommerfeld 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 succesful 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  
     54 #
     55 #% lookup     dvp     L ? ?
     56 #% lookup     vpp     - L -
     57 #
     58 # XXX - the lookup locking protocol defies simple description and depends
     59 #     on the flags and operation fields in the (cnp) structure.  Note
     60 #     especially that *vpp may equal dvp and both may be locked.
     61 #
     62 #    More details:
     63 #     On success, adds a reference to *vpp so it doesn't evaporate.
     64 #     On failure, *vpp is NULL, and *dvp is left locked.
     65 #     If LOCKPARENT is set in cnp, dvp is returned locked even on success.
     66 #     otherwise it is unlocked (unless *vpp == dvp on return)
     67 #	
     68 #     *vpp is always locked on return if the operation succeeds.
     69 #     typically, if *vpp == dvp, you need to release twice, but unlock once.
     70 #
     71 #     If ISDOTDOT is set, dvp is unlocked before *vpp is 
     72 #     locked; dvp is then relocked.  this is done to avoid deadlocking 
     73 #     another process concurrently scanning downwards.
     74 #
     75 vop_lookup {
     76 	IN struct vnode *dvp;
     77 	INOUT struct vnode **vpp;
     78 	IN struct componentname *cnp;
     79 };
     80 
     81 #
     82 #% create     dvp     L U U
     83 #% create     vpp     - L -
     84 #
     85 vop_create {
     86 	IN WILLRELE struct vnode *dvp;
     87 	OUT struct vnode **vpp;
     88 	IN struct componentname *cnp;
     89 	IN struct vattr *vap;
     90 };
     91 
     92 #
     93 #% mknod      dvp     L U U
     94 #% mknod      vpp     - X -
     95 #
     96 vop_mknod {
     97 	IN WILLRELE struct vnode *dvp;
     98 	OUT WILLRELE struct vnode **vpp;
     99 	IN struct componentname *cnp;
    100 	IN struct vattr *vap;
    101 };
    102 
    103 #
    104 #% open               vp      L L L
    105 #
    106 vop_open {
    107 	IN struct vnode *vp;
    108 	IN int mode;
    109 	IN struct ucred *cred;
    110 	IN struct proc *p;
    111 };
    112 
    113 #
    114 #% close      vp      L L L
    115 #
    116 vop_close {
    117 	IN struct vnode *vp;
    118 	IN int fflag;
    119 	IN struct ucred *cred;
    120 	IN struct proc *p;
    121 };
    122 
    123 #
    124 #% access     vp      L L L
    125 #
    126 vop_access {
    127 	IN struct vnode *vp;
    128 	IN int mode;
    129 	IN struct ucred *cred;
    130 	IN struct proc *p;
    131 };
    132 
    133 #
    134 #% getattr    vp      = = =
    135 #
    136 vop_getattr {
    137 	IN struct vnode *vp;
    138 	IN struct vattr *vap;
    139 	IN struct ucred *cred;
    140 	IN struct proc *p;
    141 };
    142 
    143 #
    144 #% setattr    vp      L L L
    145 #
    146 vop_setattr {
    147 	IN struct vnode *vp;
    148 	IN struct vattr *vap;
    149 	IN struct ucred *cred;
    150 	IN struct proc *p;
    151 };
    152 
    153 #
    154 #% read               vp      L L L
    155 #
    156 vop_read {
    157 	IN struct vnode *vp;
    158 	INOUT struct uio *uio;
    159 	IN int ioflag;
    160 	IN struct ucred *cred;
    161 };
    162 
    163 #
    164 #% write      vp      L L L
    165 #
    166 vop_write {
    167 	IN struct vnode *vp;
    168 	INOUT struct uio *uio;
    169 	IN int ioflag;
    170 	IN struct ucred *cred;
    171 };
    172 
    173 #
    174 #% ioctl      vp      U U U
    175 #
    176 vop_ioctl {
    177 	IN struct vnode *vp;
    178 	IN u_long command;
    179 	IN caddr_t data;
    180 	IN int fflag;
    181 	IN struct ucred *cred;
    182 	IN struct proc *p;
    183 };
    184 
    185 #
    186 #% poll     vp      U U U
    187 #
    188 vop_poll {
    189 	IN struct vnode *vp;
    190 	IN int events;
    191 	IN struct proc *p;
    192 };
    193 
    194 #
    195 #% revoke     vp      U U U
    196 #
    197 vop_revoke {
    198 	IN struct vnode *vp;
    199 	IN int flags;
    200 };
    201 
    202 #     
    203 # XXX - not used
    204 #
    205 vop_mmap {
    206 	IN struct vnode *vp;
    207 	IN int fflags;
    208 	IN struct ucred *cred;
    209 	IN struct proc *p;
    210 };
    211 
    212 #
    213 #% fsync      vp      L L L
    214 #
    215 vop_fsync {
    216 	IN struct vnode *vp;
    217 	IN struct ucred *cred;
    218 	IN int flags;
    219 	IN struct proc *p;
    220 };
    221 
    222 #
    223 # Needs work: Is newoff right?  What's it mean?
    224 #
    225 vop_seek {
    226 	IN struct vnode *vp;
    227 	IN off_t oldoff;
    228 	IN off_t newoff;
    229 	IN struct ucred *cred;
    230 };
    231 
    232 #
    233 #% remove     dvp     L U U
    234 #% remove     vp      L U U
    235 #
    236 vop_remove {
    237 	IN WILLRELE struct vnode *dvp;
    238 	IN WILLRELE struct vnode *vp;
    239 	IN struct componentname *cnp;
    240 };
    241 
    242 #
    243 #% link               vp      U U U
    244 #% link               tdvp    L U U
    245 #
    246 vop_link {
    247 	IN WILLRELE struct vnode *dvp;
    248 	IN struct vnode *vp;
    249 	IN struct componentname *cnp;
    250 };
    251 
    252 #
    253 #% rename     fdvp    U U U
    254 #% rename     fvp     U U U
    255 #% rename     tdvp    L U U
    256 #% rename     tvp     X U U
    257 #
    258 vop_rename {
    259 	IN WILLRELE struct vnode *fdvp;
    260 	IN WILLRELE struct vnode *fvp;
    261 	IN struct componentname *fcnp;
    262 	IN WILLRELE struct vnode *tdvp;
    263 	IN WILLRELE struct vnode *tvp;
    264 	IN struct componentname *tcnp;
    265 };
    266 
    267 #
    268 #% mkdir      dvp     L U U
    269 #% mkdir      vpp     - L - 
    270 #
    271 vop_mkdir {
    272 	IN WILLRELE struct vnode *dvp;
    273 	OUT struct vnode **vpp;
    274 	IN struct componentname *cnp;
    275 	IN struct vattr *vap;
    276 };
    277 
    278 #
    279 #% rmdir      dvp     L U U
    280 #% rmdir      vp      L U U
    281 #
    282 vop_rmdir {
    283 	IN WILLRELE struct vnode *dvp;
    284 	IN WILLRELE struct vnode *vp;
    285 	IN struct componentname *cnp;
    286 };
    287 
    288 #
    289 #% symlink    dvp     L U U
    290 #% symlink    vpp     - U -
    291 #
    292 # XXX - note that the return vnode has already been VRELE'ed
    293 #     by the filesystem layer.  To use it you must use vget,
    294 #     possibly with a further namei.
    295 #
    296 vop_symlink {
    297 	IN WILLRELE struct vnode *dvp;
    298 	OUT WILLRELE struct vnode **vpp;
    299 	IN struct componentname *cnp;
    300 	IN struct vattr *vap;
    301 	IN char *target;
    302 };
    303 
    304 #
    305 #% readdir    vp      L L L   
    306 #
    307 vop_readdir {
    308 	IN struct vnode *vp;
    309 	INOUT struct uio *uio;
    310 	IN struct ucred *cred;
    311 	OUT int *eofflag;
    312 	OUT off_t **cookies;
    313 	IN int *ncookies;
    314 };
    315 
    316 #
    317 #% readlink   vp      L L L
    318 #
    319 vop_readlink {
    320 	IN struct vnode *vp;
    321 	INOUT struct uio *uio;
    322 	IN struct ucred *cred;
    323 };
    324 
    325 #
    326 #% abortop    dvp     = = =
    327 #
    328 vop_abortop {
    329 	IN struct vnode *dvp;
    330 	IN struct componentname *cnp;
    331 };
    332 
    333 #
    334 #% inactive   vp      L U U  
    335 #
    336 vop_inactive {
    337 	IN struct vnode *vp;
    338 	IN struct proc *p;
    339 };
    340 
    341 #
    342 #% reclaim    vp      U U U
    343 #
    344 vop_reclaim {
    345 	IN struct vnode *vp;
    346 	IN struct proc *p;
    347 };
    348 
    349 #
    350 #% lock               vp      U L U
    351 #
    352 vop_lock {
    353 	IN struct vnode *vp;
    354 	IN int flags;
    355 };
    356 
    357 #
    358 #% unlock     vp      L U L
    359 #
    360 vop_unlock {
    361 	IN struct vnode *vp;
    362 	IN int flags;
    363 };
    364 
    365 #
    366 #% bmap               vp      L L L
    367 #% bmap               vpp     - U -
    368 #
    369 vop_bmap {
    370 	IN struct vnode *vp;
    371 	IN daddr_t bn;
    372 	OUT struct vnode **vpp;
    373 	IN daddr_t *bnp;
    374 	OUT int *runp;
    375 };
    376 
    377 #
    378 # Needs work: no vp?
    379 #
    380 #vop_strategy {
    381 #	IN struct buf *bp;
    382 #};
    383 
    384 #
    385 #% print      vp      = = =
    386 #
    387 vop_print {
    388 	IN struct vnode *vp;
    389 };
    390 
    391 #
    392 #% islocked   vp      = = =
    393 #
    394 vop_islocked {
    395 	IN struct vnode *vp;
    396 };
    397 
    398 #
    399 #% pathconf   vp      L L L
    400 #
    401 vop_pathconf {
    402 	IN struct vnode *vp;
    403 	IN int name;
    404 	OUT register_t *retval;
    405 };
    406 
    407 #
    408 #% advlock    vp      U U U
    409 #
    410 vop_advlock {
    411 	IN struct vnode *vp;
    412 	IN caddr_t id;
    413 	IN int op;
    414 	IN struct flock *fl;
    415 	IN int flags;
    416 };
    417 
    418 #
    419 #% blkatoff   vp      L L L
    420 #
    421 vop_blkatoff {
    422 	IN struct vnode *vp;
    423 	IN off_t offset;
    424 	OUT char **res;
    425 	OUT struct buf **bpp;
    426 };
    427 
    428 #
    429 #% valloc     pvp     L L L
    430 #
    431 vop_valloc {
    432 	IN struct vnode *pvp;
    433 	IN int mode;
    434 	IN struct ucred *cred;
    435 	OUT struct vnode **vpp;
    436 };
    437 
    438 #
    439 #% reallocblks        vp      L L L
    440 #
    441 vop_reallocblks {
    442 	IN struct vnode *vp;
    443 	IN struct cluster_save *buflist;
    444 };
    445 
    446 #
    447 #% vfree      pvp     L L L
    448 #
    449 vop_vfree {
    450 	IN struct vnode *pvp;
    451 	IN ino_t ino;
    452 	IN int mode;
    453 };
    454 
    455 #
    456 #% truncate   vp      L L L
    457 #
    458 vop_truncate {
    459 	IN struct vnode *vp;
    460 	IN off_t length;
    461 	IN int flags;
    462 	IN struct ucred *cred;
    463 	IN struct proc *p;
    464 };
    465 
    466 #
    467 #% update     vp      L L L
    468 #
    469 vop_update {
    470 	IN struct vnode *vp;
    471 	IN struct timespec *access;
    472 	IN struct timespec *modify;
    473 	IN int waitfor;
    474 };
    475 
    476 # 
    477 #% lease      vp      = = =
    478 # 
    479 vop_lease {
    480 	IN struct vnode *vp;
    481 	IN struct proc *p;
    482 	IN struct ucred *cred;
    483 	IN int flag;
    484 };
    485 
    486 #
    487 #% whiteout   dvp     L L L
    488 #% whiteout   cnp     - - -
    489 #% whiteout   flag    - - -
    490 # 
    491 vop_whiteout {
    492 	IN struct vnode *dvp;
    493 	IN struct componentname *cnp;
    494 	IN int flags;
    495 };
    496 
    497 #
    498 # Needs work: no vp?
    499 #
    500 #vop_bwrite {
    501 #	IN struct buf *bp;
    502 #};
    503