Home | History | Annotate | Line # | Download | only in kern
vnode_if.src revision 1.79
      1 #	$NetBSD: vnode_if.src,v 1.79 2020/05/16 18:31:50 christos 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. Neither the name of the University nor the names of its contributors
     15 #    may be used to endorse or promote products derived from this software
     16 #    without specific prior written permission.
     17 #
     18 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     19 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     20 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     21 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     22 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     23 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     24 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     25 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     26 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     27 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     28 # SUCH DAMAGE.
     29 #
     30 #	@(#)vnode_if.src	8.14 (Berkeley) 8/6/95
     31 #
     32 #
     33 
     34 # 
     35 # Above each of the vop descriptors is a specification of the locking
     36 # protocol used by each vop call.  The first column is the name of
     37 # the variable, the remaining three columns are in, out and error
     38 # respectively.  The "in" column defines the lock state on input,
     39 # the "out" column defines the state on successful return, and the
     40 # "error" column defines the locking state on error exit.
     41 #     
     42 # The locking value can take the following values:
     43 # L: locked.
     44 # U: unlocked.
     45 # -: not applicable.  vnode does not yet (or no longer) exists.
     46 # =: the same on input and output, may be either L or U.
     47 # X: locked if not nil.
     48 #
     49 # For operations other than VOP_LOOKUP which require a component name
     50 # parameter, the flags required for the initial namei() call are listed.
     51 # Additional flags may be added to the namei() call, but these are required.
     52 #     
     53 
     54 #
     55 #% bwrite     vp      = = =
     56 #
     57 vop_bwrite {
     58 	IN struct vnode *vp;
     59 	IN struct buf *bp;
     60 };
     61  
     62 #
     63 #% lookup     dvp     L L L
     64 #% lookup     vpp     - U -
     65 #
     66 #    Note especially that *vpp may equal dvp.
     67 #
     68 #    More details:
     69 #     All lookups find the named node (creating the vnode if needed) and
     70 #          return it, referenced and unlocked, in *vpp.
     71 #     On failure, *vpp is NULL, and *dvp is left locked.
     72 #
     73 vop_lookup {
     74 	VERSION 2
     75 	IN LOCKED=YES struct vnode *dvp;
     76 	OUT WILLMAKE struct vnode **vpp;
     77 	IN struct componentname *cnp;
     78 };
     79 
     80 #
     81 #% create     dvp     L L L
     82 #% create     vpp     - U -
     83 #
     84 #! create cnp	CREATE, LOCKPARENT
     85 #
     86 vop_create {
     87 	VERSION 3
     88 	IN LOCKED=YES struct vnode *dvp;
     89 	OUT WILLMAKE struct vnode **vpp;
     90 	IN struct componentname *cnp;
     91 	IN struct vattr *vap;
     92 };
     93 
     94 #
     95 #% mknod      dvp     L L L
     96 #% mknod      vpp     - U -
     97 #
     98 #! mknod cnp	CREATE, LOCKPARENT
     99 #
    100 vop_mknod {
    101 	VERSION 3
    102 	IN LOCKED=YES struct vnode *dvp;
    103 	OUT WILLMAKE struct vnode **vpp;
    104 	IN struct componentname *cnp;
    105 	IN struct vattr *vap;
    106 };
    107 
    108 #
    109 #% open               vp      L L L
    110 #
    111 vop_open {
    112 	IN LOCKED=YES struct vnode *vp;
    113 	IN int mode;
    114 	IN kauth_cred_t cred;
    115 };
    116 
    117 #
    118 #% close      vp      L L L
    119 #
    120 vop_close {
    121 	IN LOCKED=YES struct vnode *vp;
    122 	IN int fflag;
    123 	IN kauth_cred_t cred;
    124 };
    125 
    126 #
    127 #% access     vp      L L L
    128 #
    129 vop_access {
    130 	IN LOCKED=YES struct vnode *vp;
    131 	IN accmode_t accmode;
    132 	IN kauth_cred_t cred;
    133 };
    134 
    135 #
    136 #% accessx    vp      L L L
    137 #
    138 vop_accessx {
    139 	IN LOCKED=YES struct vnode *vp;
    140 	IN accmode_t accmode;
    141 	IN kauth_cred_t cred;
    142 };
    143 
    144 #
    145 #% getattr    vp      L L L
    146 #
    147 vop_getattr {
    148 	IN LOCKED=YES struct vnode *vp;
    149 	IN struct vattr *vap;
    150 	IN kauth_cred_t cred;
    151 };
    152 
    153 #
    154 #% setattr    vp      L L L
    155 #
    156 vop_setattr {
    157 	IN LOCKED=YES struct vnode *vp;
    158 	IN struct vattr *vap;
    159 	IN kauth_cred_t cred;
    160 };
    161 
    162 #
    163 #% read               vp      L L L
    164 #
    165 vop_read {
    166 	IN LOCKED=YES struct vnode *vp;
    167 	INOUT struct uio *uio;
    168 	IN int ioflag;
    169 	IN kauth_cred_t cred;
    170 };
    171 
    172 #
    173 #% write      vp      L L L
    174 #
    175 vop_write {
    176 	IN LOCKED=YES struct vnode *vp;
    177 	INOUT struct uio *uio;
    178 	IN int ioflag;
    179 	IN kauth_cred_t cred;
    180 };
    181 
    182 #
    183 #% fallocate  vp      L L L
    184 #
    185 vop_fallocate {
    186 	IN LOCKED=YES struct vnode *vp;
    187 	IN off_t pos;
    188 	IN off_t len;
    189 };
    190 
    191 #
    192 #% fdiscard   vp      L L L
    193 #
    194 vop_fdiscard {
    195 	IN LOCKED=YES struct vnode *vp;
    196 	IN off_t pos;
    197 	IN off_t len;
    198 };
    199 
    200 #
    201 #% ioctl      vp      U U U
    202 #
    203 vop_ioctl {
    204 	FSTRANS=NO
    205 	IN LOCKED=NO struct vnode *vp;
    206 	IN u_long command;
    207 	IN void *data;
    208 	IN int fflag;
    209 	IN kauth_cred_t cred;
    210 };
    211 
    212 #
    213 #% fcntl      vp      U U U
    214 #
    215 vop_fcntl {
    216 	FSTRANS=NO
    217 	IN LOCKED=NO struct vnode *vp;
    218 	IN u_int command;
    219 	IN void *data;
    220 	IN int fflag;
    221 	IN kauth_cred_t cred;
    222 };
    223 
    224 #
    225 #% poll     vp      U U U
    226 #
    227 vop_poll {
    228 	IN LOCKED=NO struct vnode *vp;
    229 	IN int events;
    230 };
    231 
    232 #
    233 #% kqfilter     vp      U U U
    234 #
    235 vop_kqfilter {
    236 	IN LOCKED=NO struct vnode *vp;
    237 	IN struct knote *kn;
    238 };
    239 
    240 #
    241 #% revoke     vp      U U U
    242 #
    243 vop_revoke {
    244 	FSTRANS=NO
    245 	IN LOCKED=NO struct vnode *vp;
    246 	IN int flags;
    247 };
    248 
    249 #     
    250 #% mmap      vp      = = =
    251 #
    252 vop_mmap {
    253 	IN struct vnode *vp;
    254 	IN vm_prot_t prot;
    255 	IN kauth_cred_t cred;
    256 };
    257 
    258 #
    259 #% fsync      vp      L L L
    260 #
    261 vop_fsync {
    262 	IN LOCKED=YES struct vnode *vp;
    263 	IN kauth_cred_t cred;
    264 	IN int flags;
    265 	IN off_t offlo;
    266 	IN off_t offhi;
    267 };
    268 
    269 #
    270 # Needs work: Is newoff right?  What's it mean?
    271 # XXX Locking protocol?
    272 #
    273 vop_seek {
    274 	IN struct vnode *vp;
    275 	IN off_t oldoff;
    276 	IN off_t newoff;
    277 	IN kauth_cred_t cred;
    278 };
    279 
    280 #
    281 #% remove     dvp     L L L
    282 #% remove     vp      L U U
    283 #
    284 #! remove cnp	DELETE, LOCKPARENT | LOCKLEAF
    285 #
    286 vop_remove {
    287 	VERSION 2
    288 	IN LOCKED=YES struct vnode *dvp;
    289 	IN LOCKED=YES WILLPUT struct vnode *vp;
    290 	IN struct componentname *cnp;
    291 };
    292 
    293 #
    294 #% link               dvp     L L L
    295 #% link               vp      U U U
    296 #
    297 #! link	 cnp	CREATE, LOCKPARENT
    298 #
    299 vop_link {
    300 	VERSION 2
    301 	IN LOCKED=YES struct vnode *dvp;
    302 	IN LOCKED=NO struct vnode *vp;
    303 	IN struct componentname *cnp;
    304 };
    305 
    306 #
    307 #% rename     fdvp    U U U
    308 #% rename     fvp     U U U
    309 #% rename     tdvp    L U U
    310 #% rename     tvp     X U U
    311 #
    312 #! rename fcnp	DELETE,	LOCKPARENT
    313 #! rename tcnp	RENAME, LOCKPARENT | LOCKLEAF | NOCACHE
    314 #
    315 vop_rename {
    316 	IN LOCKED=NO WILLRELE struct vnode *fdvp;
    317 	IN LOCKED=NO WILLRELE struct vnode *fvp;
    318 	IN struct componentname *fcnp;
    319 	IN LOCKED=YES WILLPUT struct vnode *tdvp;
    320 	IN WILLPUT struct vnode *tvp;
    321 	IN struct componentname *tcnp;
    322 };
    323 
    324 #
    325 #% mkdir      dvp     L L L
    326 #% mkdir      vpp     - U - 
    327 #
    328 #! mkdir cnp	CREATE, LOCKPARENT
    329 #
    330 vop_mkdir {
    331 	VERSION 3
    332 	IN LOCKED=YES struct vnode *dvp;
    333 	OUT WILLMAKE struct vnode **vpp;
    334 	IN struct componentname *cnp;
    335 	IN struct vattr *vap;
    336 };
    337 
    338 #
    339 #% rmdir      dvp     L L L
    340 #% rmdir      vp      L U U
    341 #
    342 #! rmdir cnp	DELETE, LOCKPARENT | LOCKLEAF
    343 #
    344 vop_rmdir {
    345 	VERSION 2
    346 	IN LOCKED=YES struct vnode *dvp;
    347 	IN LOCKED=YES WILLPUT struct vnode *vp;
    348 	IN struct componentname *cnp;
    349 };
    350 
    351 #
    352 #% symlink    dvp     L L L
    353 #% symlink    vpp     - U -
    354 #
    355 #! symlink cnp	CREATE, LOCKPARENT
    356 #
    357 vop_symlink {
    358 	VERSION 3
    359 	IN LOCKED=YES struct vnode *dvp;
    360 	OUT WILLMAKE struct vnode **vpp;
    361 	IN struct componentname *cnp;
    362 	IN struct vattr *vap;
    363 	IN char *target;
    364 };
    365 
    366 #
    367 #% readdir    vp      L L L   
    368 #
    369 vop_readdir {
    370 	IN LOCKED=YES struct vnode *vp;
    371 	INOUT struct uio *uio;
    372 	IN kauth_cred_t cred;
    373 	OUT int *eofflag;
    374 	OUT off_t **cookies;
    375 	IN int *ncookies;
    376 };
    377 
    378 #
    379 #% readlink   vp      L L L
    380 #
    381 vop_readlink {
    382 	IN LOCKED=YES struct vnode *vp;
    383 	INOUT struct uio *uio;
    384 	IN kauth_cred_t cred;
    385 };
    386 
    387 #
    388 #% abortop    dvp     = = =
    389 #
    390 #! abortop cnp	as appropriate.
    391 #
    392 vop_abortop {
    393 	IN struct vnode *dvp;
    394 	IN struct componentname *cnp;
    395 };
    396 
    397 #
    398 #% inactive   vp      L L L
    399 #
    400 vop_inactive {
    401 	VERSION 2
    402 	IN LOCKED=YES struct vnode *vp;
    403 	INOUT bool *recycle;
    404 };
    405 
    406 #
    407 #% reclaim    vp      L U U
    408 #
    409 vop_reclaim {
    410 	VERSION 2
    411 	FSTRANS=NO
    412 	IN LOCKED=YES struct vnode *vp;
    413 };
    414 
    415 #
    416 #% lock               vp      U L U
    417 #
    418 vop_lock {
    419 	FSTRANS=LOCK
    420 	IN LOCKED=NO struct vnode *vp;
    421 	IN int flags;
    422 };
    423 
    424 #
    425 #% unlock     vp      L U L
    426 #
    427 vop_unlock {
    428 	FSTRANS=UNLOCK
    429 	IN LOCKED=YES struct vnode *vp;
    430 };
    431 
    432 #
    433 #% bmap               vp      = = =
    434 #% bmap               vpp     - U -
    435 #
    436 vop_bmap {
    437 	IN struct vnode *vp;
    438 	IN daddr_t bn;
    439 	OUT struct vnode **vpp;
    440 	IN daddr_t *bnp;
    441 	OUT int *runp;
    442 };
    443 
    444 #
    445 #% strategy   vp      = = =
    446 #
    447 vop_strategy {
    448 	FSTRANS=LAZY
    449 	IN struct vnode *vp;
    450 	IN struct buf *bp;
    451 };
    452 
    453 #
    454 #% print      vp      = = =
    455 #
    456 vop_print {
    457 	IN struct vnode *vp;
    458 };
    459 
    460 #
    461 #% islocked   vp      = = =
    462 #
    463 vop_islocked {
    464 	FSTRANS=NO
    465 	IN struct vnode *vp;
    466 };
    467 
    468 #
    469 #% pathconf   vp      L L L
    470 #
    471 vop_pathconf {
    472 	IN LOCKED=YES struct vnode *vp;
    473 	IN int name;
    474 	OUT register_t *retval;
    475 };
    476 
    477 #
    478 #% advlock    vp      U U U
    479 #
    480 vop_advlock {
    481 	FSTRANS=NO
    482 	IN LOCKED=NO struct vnode *vp;
    483 	IN void *id;
    484 	IN int op;
    485 	IN struct flock *fl;
    486 	IN int flags;
    487 };
    488 
    489 #
    490 #% whiteout   dvp     L L L
    491 #% whiteout   cnp     - - -
    492 #% whiteout   flag    - - -
    493 #
    494 #! whiteout cnp	CREATE, LOCKPARENT
    495 # 
    496 vop_whiteout {
    497 	IN LOCKED=YES struct vnode *dvp;
    498 	IN struct componentname *cnp;
    499 	IN int flags;
    500 };
    501 
    502 #
    503 #% getpages	vp = = =
    504 #
    505 vop_getpages {
    506 	FSTRANS=NO
    507 	IN struct vnode *vp;
    508 	IN voff_t offset;
    509 	IN struct vm_page **m;
    510 	IN int *count;
    511 	IN int centeridx;
    512 	IN vm_prot_t access_type;
    513 	IN int advice;
    514 	IN int flags;
    515 };
    516 
    517 #
    518 #% putpages	vp = = =
    519 #
    520 vop_putpages {
    521 	FSTRANS=NO
    522 	IN struct vnode *vp;
    523 	IN voff_t offlo;
    524 	IN voff_t offhi;
    525 	IN int flags;
    526 };
    527 
    528 #
    529 #% getacl	vp L L L
    530 #
    531 vop_getacl {
    532 	IN struct vnode *vp;
    533 	IN acl_type_t type;
    534 	OUT struct acl *aclp;
    535 	IN kauth_cred_t cred;
    536 };
    537 
    538 #
    539 #% setacl	vp L L L
    540 #
    541 vop_setacl {
    542 	IN struct vnode *vp;
    543 	IN acl_type_t type;
    544 	IN struct acl *aclp;
    545 	IN kauth_cred_t cred;
    546 };
    547 
    548 #
    549 #% aclcheck	vp = = =
    550 #
    551 vop_aclcheck {
    552 	IN struct vnode *vp;
    553 	IN acl_type_t type;
    554 	IN struct acl *aclp;
    555 	IN kauth_cred_t cred;
    556 };
    557 
    558 #
    559 #% closeextattr	vp L L L
    560 #
    561 vop_closeextattr {
    562 	IN LOCKED=YES struct vnode *vp;
    563 	IN int commit;
    564 	IN kauth_cred_t cred;
    565 };
    566 
    567 #
    568 #% getextattr	vp L L L
    569 #
    570 vop_getextattr {
    571 	IN LOCKED=YES struct vnode *vp;
    572 	IN int attrnamespace;
    573 	IN const char *name;
    574 	INOUT struct uio *uio;
    575 	OUT size_t *size;
    576 	IN kauth_cred_t cred;
    577 };
    578 
    579 #
    580 #% listextattr	vp L L L
    581 #
    582 vop_listextattr {
    583 	IN LOCKED=YES struct vnode *vp;
    584 	IN int attrnamespace;
    585 	INOUT struct uio *uio;
    586 	OUT size_t *size;
    587 	IN int flag;
    588 	IN kauth_cred_t cred;
    589 };
    590 
    591 #
    592 #% openextattr	vp L L L
    593 #
    594 vop_openextattr {
    595 	IN LOCKED=YES struct vnode *vp;
    596 	IN kauth_cred_t cred;
    597 };
    598 
    599 #
    600 #% deleteextattr vp L L L
    601 #
    602 vop_deleteextattr {
    603 	IN LOCKED=YES struct vnode *vp;
    604 	IN int attrnamespace;
    605 	IN const char *name;
    606 	IN kauth_cred_t cred;
    607 };
    608 
    609 #
    610 #% setextattr	vp L L L
    611 #
    612 vop_setextattr {
    613 	IN LOCKED=YES struct vnode *vp;
    614 	IN int attrnamespace;
    615 	IN const char *name;
    616 	INOUT struct uio *uio;
    617 	IN kauth_cred_t cred;
    618 };
    619