Home | History | Annotate | Line # | Download | only in kern
vnode_if.src revision 1.19
      1 #	$NetBSD: vnode_if.src,v 1.19 1999/08/03 18:19:08 wrstuden 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 WILLPUT 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 WILLPUT 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 #% fcntl      vp      L L L
    187 #
    188 vop_fcntl {
    189 	IN struct vnode *vp;
    190 	IN u_int command;
    191 	IN caddr_t data;
    192 	IN int fflag;
    193 	IN struct ucred *cred;
    194 	IN struct proc *p;
    195 };
    196 
    197 #
    198 #% poll     vp      U U U
    199 #
    200 vop_poll {
    201 	IN struct vnode *vp;
    202 	IN int events;
    203 	IN struct proc *p;
    204 };
    205 
    206 #
    207 #% revoke     vp      U U U
    208 #
    209 vop_revoke {
    210 	IN struct vnode *vp;
    211 	IN int flags;
    212 };
    213 
    214 #     
    215 # XXX - not used
    216 #
    217 vop_mmap {
    218 	IN struct vnode *vp;
    219 	IN int fflags;
    220 	IN struct ucred *cred;
    221 	IN struct proc *p;
    222 };
    223 
    224 #
    225 #% fsync      vp      L L L
    226 #
    227 vop_fsync {
    228 	IN struct vnode *vp;
    229 	IN struct ucred *cred;
    230 	IN int flags;
    231 	IN struct proc *p;
    232 };
    233 
    234 #
    235 # Needs work: Is newoff right?  What's it mean?
    236 #
    237 vop_seek {
    238 	IN struct vnode *vp;
    239 	IN off_t oldoff;
    240 	IN off_t newoff;
    241 	IN struct ucred *cred;
    242 };
    243 
    244 #
    245 #% remove     dvp     L U U
    246 #% remove     vp      L U U
    247 #
    248 vop_remove {
    249 	IN WILLPUT struct vnode *dvp;
    250 	IN WILLPUT struct vnode *vp;
    251 	IN struct componentname *cnp;
    252 };
    253 
    254 #
    255 #% link               vp      U U U
    256 #% link               tdvp    L U U
    257 #
    258 vop_link {
    259 	IN WILLPUT struct vnode *dvp;
    260 	IN struct vnode *vp;
    261 	IN struct componentname *cnp;
    262 };
    263 
    264 #
    265 #% rename     fdvp    U U U
    266 #% rename     fvp     U U U
    267 #% rename     tdvp    L U U
    268 #% rename     tvp     X U U
    269 #
    270 vop_rename {
    271 	IN WILLRELE struct vnode *fdvp;
    272 	IN WILLRELE struct vnode *fvp;
    273 	IN struct componentname *fcnp;
    274 	IN WILLPUT struct vnode *tdvp;
    275 	IN WILLRELE struct vnode *tvp;
    276 	IN struct componentname *tcnp;
    277 };
    278 
    279 #
    280 #% mkdir      dvp     L U U
    281 #% mkdir      vpp     - L - 
    282 #
    283 vop_mkdir {
    284 	IN WILLPUT struct vnode *dvp;
    285 	OUT struct vnode **vpp;
    286 	IN struct componentname *cnp;
    287 	IN struct vattr *vap;
    288 };
    289 
    290 #
    291 #% rmdir      dvp     L U U
    292 #% rmdir      vp      L U U
    293 #
    294 vop_rmdir {
    295 	IN WILLPUT struct vnode *dvp;
    296 	IN WILLPUT struct vnode *vp;
    297 	IN struct componentname *cnp;
    298 };
    299 
    300 #
    301 #% symlink    dvp     L U U
    302 #% symlink    vpp     - U -
    303 #
    304 # XXX - note that the return vnode has already been VRELE'ed
    305 #     by the filesystem layer.  To use it you must use vget,
    306 #     possibly with a further namei.
    307 #
    308 vop_symlink {
    309 	IN WILLPUT struct vnode *dvp;
    310 	OUT WILLRELE struct vnode **vpp;
    311 	IN struct componentname *cnp;
    312 	IN struct vattr *vap;
    313 	IN char *target;
    314 };
    315 
    316 #
    317 #% readdir    vp      L L L   
    318 #
    319 vop_readdir {
    320 	IN struct vnode *vp;
    321 	INOUT struct uio *uio;
    322 	IN struct ucred *cred;
    323 	OUT int *eofflag;
    324 	OUT off_t **cookies;
    325 	IN int *ncookies;
    326 };
    327 
    328 #
    329 #% readlink   vp      L L L
    330 #
    331 vop_readlink {
    332 	IN struct vnode *vp;
    333 	INOUT struct uio *uio;
    334 	IN struct ucred *cred;
    335 };
    336 
    337 #
    338 #% abortop    dvp     = = =
    339 #
    340 vop_abortop {
    341 	IN struct vnode *dvp;
    342 	IN struct componentname *cnp;
    343 };
    344 
    345 #
    346 #% inactive   vp      L U U  
    347 #
    348 vop_inactive {
    349 	IN WILLUNLOCK struct vnode *vp;
    350 	IN struct proc *p;
    351 };
    352 
    353 #
    354 #% reclaim    vp      U U U
    355 #
    356 vop_reclaim {
    357 	IN struct vnode *vp;
    358 	IN struct proc *p;
    359 };
    360 
    361 #
    362 #% lock               vp      U L U
    363 #
    364 vop_lock {
    365 	IN struct vnode *vp;
    366 	IN int flags;
    367 };
    368 
    369 #
    370 #% unlock     vp      L U L
    371 #
    372 vop_unlock {
    373 	IN struct vnode *vp;
    374 	IN int flags;
    375 };
    376 
    377 #
    378 #% bmap               vp      L L L
    379 #% bmap               vpp     - U -
    380 #
    381 vop_bmap {
    382 	IN struct vnode *vp;
    383 	IN daddr_t bn;
    384 	OUT struct vnode **vpp;
    385 	IN daddr_t *bnp;
    386 	OUT int *runp;
    387 };
    388 
    389 #
    390 # Needs work: no vp?
    391 #
    392 #vop_strategy {
    393 #	IN struct buf *bp;
    394 #};
    395 
    396 #
    397 #% print      vp      = = =
    398 #
    399 vop_print {
    400 	IN struct vnode *vp;
    401 };
    402 
    403 #
    404 #% islocked   vp      = = =
    405 #
    406 vop_islocked {
    407 	IN struct vnode *vp;
    408 };
    409 
    410 #
    411 #% pathconf   vp      L L L
    412 #
    413 vop_pathconf {
    414 	IN struct vnode *vp;
    415 	IN int name;
    416 	OUT register_t *retval;
    417 };
    418 
    419 #
    420 #% advlock    vp      U U U
    421 #
    422 vop_advlock {
    423 	IN struct vnode *vp;
    424 	IN caddr_t id;
    425 	IN int op;
    426 	IN struct flock *fl;
    427 	IN int flags;
    428 };
    429 
    430 #
    431 #% blkatoff   vp      L L L
    432 #
    433 vop_blkatoff {
    434 	IN struct vnode *vp;
    435 	IN off_t offset;
    436 	OUT char **res;
    437 	OUT struct buf **bpp;
    438 };
    439 
    440 #
    441 #% valloc     pvp     L L L
    442 #
    443 vop_valloc {
    444 	IN struct vnode *pvp;
    445 	IN int mode;
    446 	IN struct ucred *cred;
    447 	OUT struct vnode **vpp;
    448 };
    449 
    450 #
    451 #% reallocblks        vp      L L L
    452 #
    453 vop_reallocblks {
    454 	IN struct vnode *vp;
    455 	IN struct cluster_save *buflist;
    456 };
    457 
    458 #
    459 #% vfree      pvp     L L L
    460 #
    461 vop_vfree {
    462 	IN struct vnode *pvp;
    463 	IN ino_t ino;
    464 	IN int mode;
    465 };
    466 
    467 #
    468 #% truncate   vp      L L L
    469 #
    470 vop_truncate {
    471 	IN struct vnode *vp;
    472 	IN off_t length;
    473 	IN int flags;
    474 	IN struct ucred *cred;
    475 	IN struct proc *p;
    476 };
    477 
    478 #
    479 #% update     vp      L L L
    480 #
    481 vop_update {
    482 	IN struct vnode *vp;
    483 	IN struct timespec *access;
    484 	IN struct timespec *modify;
    485 	IN int waitfor;
    486 };
    487 
    488 # 
    489 #% lease      vp      = = =
    490 # 
    491 vop_lease {
    492 	IN struct vnode *vp;
    493 	IN struct proc *p;
    494 	IN struct ucred *cred;
    495 	IN int flag;
    496 };
    497 
    498 #
    499 #% whiteout   dvp     L L L
    500 #% whiteout   cnp     - - -
    501 #% whiteout   flag    - - -
    502 # 
    503 vop_whiteout {
    504 	IN struct vnode *dvp;
    505 	IN struct componentname *cnp;
    506 	IN int flags;
    507 };
    508 
    509 #
    510 # Needs work: no vp?
    511 #
    512 #vop_bwrite {
    513 #	IN struct buf *bp;
    514 #};
    515