1 # $NetBSD: vnode_if.src,v 1.85 2023/06/15 09:13:36 hannken 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 #% parsepath dvp = = = 64 # 65 vop_parsepath { 66 FSTRANS=NO 67 IN struct vnode *dvp; 68 IN const char *name; 69 OUT size_t *retval; 70 }; 71 72 # 73 #% lookup dvp L L L 74 #% lookup vpp - U - 75 # 76 # Note especially that *vpp may equal dvp. 77 # 78 # More details: 79 # All lookups find the named node (creating the vnode if needed) and 80 # return it, referenced and unlocked, in *vpp. 81 # On failure, *vpp is NULL, and *dvp is left locked. 82 # 83 vop_lookup { 84 VERSION 2 85 IN LOCKED=YES struct vnode *dvp; 86 OUT WILLMAKE struct vnode **vpp; 87 IN struct componentname *cnp; 88 }; 89 90 # 91 #% create dvp L L L 92 #% create vpp - U - 93 # 94 #! create cnp CREATE, LOCKPARENT 95 # 96 vop_create { 97 VERSION 3 98 POST=vop_create_post 99 IN LOCKED=EXCL struct vnode *dvp; 100 OUT WILLMAKE struct vnode **vpp; 101 IN struct componentname *cnp; 102 IN struct vattr *vap; 103 }; 104 105 # 106 #% mknod dvp L L L 107 #% mknod vpp - U - 108 # 109 #! mknod cnp CREATE, LOCKPARENT 110 # 111 vop_mknod { 112 VERSION 3 113 POST=vop_mknod_post 114 IN LOCKED=EXCL struct vnode *dvp; 115 OUT WILLMAKE struct vnode **vpp; 116 IN struct componentname *cnp; 117 IN struct vattr *vap; 118 }; 119 120 # 121 #% open vp L L L 122 # 123 vop_open { 124 POST=vop_open_post 125 IN LOCKED=YES struct vnode *vp; 126 IN int mode; 127 IN kauth_cred_t cred; 128 }; 129 130 # 131 #% close vp L L L 132 # 133 vop_close { 134 POST=vop_close_post 135 IN LOCKED=YES struct vnode *vp; 136 IN int fflag; 137 IN kauth_cred_t cred; 138 }; 139 140 # 141 #% access vp L L L 142 # 143 vop_access { 144 IN LOCKED=YES struct vnode *vp; 145 IN accmode_t accmode; 146 IN kauth_cred_t cred; 147 }; 148 149 # 150 #% accessx vp L L L 151 # 152 vop_accessx { 153 IN LOCKED=YES struct vnode *vp; 154 IN accmode_t accmode; 155 IN kauth_cred_t cred; 156 }; 157 158 # 159 #% getattr vp L L L 160 # 161 vop_getattr { 162 IN LOCKED=YES struct vnode *vp; 163 IN struct vattr *vap; 164 IN kauth_cred_t cred; 165 }; 166 167 # 168 #% setattr vp L L L 169 # 170 vop_setattr { 171 PRE=vop_setattr_pre 172 POST=vop_setattr_post 173 IN LOCKED=EXCL struct vnode *vp; 174 IN struct vattr *vap; 175 IN kauth_cred_t cred; 176 }; 177 178 # 179 #% read vp L L L 180 # 181 vop_read { 182 POST=vop_read_post 183 IN LOCKED=YES struct vnode *vp; 184 INOUT struct uio *uio; 185 IN int ioflag; 186 IN kauth_cred_t cred; 187 }; 188 189 # 190 #% write vp L L L 191 # 192 vop_write { 193 PRE=vop_write_pre 194 POST=vop_write_post 195 IN LOCKED=YES struct vnode *vp; 196 INOUT struct uio *uio; 197 IN int ioflag; 198 IN kauth_cred_t cred; 199 }; 200 201 # 202 #% fallocate vp L L L 203 # 204 vop_fallocate { 205 IN LOCKED=YES struct vnode *vp; 206 IN off_t pos; 207 IN off_t len; 208 }; 209 210 # 211 #% fdiscard vp L L L 212 # 213 vop_fdiscard { 214 IN LOCKED=YES struct vnode *vp; 215 IN off_t pos; 216 IN off_t len; 217 }; 218 219 # 220 #% ioctl vp = = = 221 # 222 vop_ioctl { 223 FSTRANS=NO 224 IN struct vnode *vp; 225 IN u_long command; 226 IN void *data; 227 IN int fflag; 228 IN kauth_cred_t cred; 229 }; 230 231 # 232 #% fcntl vp U U U 233 # 234 vop_fcntl { 235 FSTRANS=NO 236 IN LOCKED=NO struct vnode *vp; 237 IN u_int command; 238 IN void *data; 239 IN int fflag; 240 IN kauth_cred_t cred; 241 }; 242 243 # 244 #% poll vp U U U 245 # 246 vop_poll { 247 IN LOCKED=NO struct vnode *vp; 248 IN int events; 249 }; 250 251 # 252 #% kqfilter vp U U U 253 # 254 vop_kqfilter { 255 IN LOCKED=NO struct vnode *vp; 256 IN struct knote *kn; 257 }; 258 259 # 260 #% revoke vp U U U 261 # 262 vop_revoke { 263 FSTRANS=NO 264 IN LOCKED=NO struct vnode *vp; 265 IN int flags; 266 }; 267 268 # 269 #% mmap vp = = = 270 # 271 vop_mmap { 272 IN struct vnode *vp; 273 IN vm_prot_t prot; 274 IN kauth_cred_t cred; 275 }; 276 277 # 278 #% fsync vp L L L 279 # 280 vop_fsync { 281 IN LOCKED=YES struct vnode *vp; 282 IN kauth_cred_t cred; 283 IN int flags; 284 IN off_t offlo; 285 IN off_t offhi; 286 }; 287 288 # 289 # Needs work: Is newoff right? What's it mean? 290 # XXX Locking protocol? 291 # 292 vop_seek { 293 IN struct vnode *vp; 294 IN off_t oldoff; 295 IN off_t newoff; 296 IN kauth_cred_t cred; 297 }; 298 299 # 300 #% remove dvp L L L 301 #% remove vp L U U 302 # 303 #! remove cnp DELETE, LOCKPARENT | LOCKLEAF 304 # 305 vop_remove { 306 VERSION 3 307 PRE=vop_remove_pre 308 POST=vop_remove_post 309 IN LOCKED=EXCL struct vnode *dvp; 310 IN LOCKED=YES WILLPUT struct vnode *vp; 311 IN struct componentname *cnp; 312 CONTEXT nlink_t vp_new_nlink; 313 }; 314 315 # 316 #% link dvp L L L 317 #% link vp U U U 318 # 319 #! link cnp CREATE, LOCKPARENT 320 # 321 vop_link { 322 VERSION 2 323 POST=vop_link_post 324 IN LOCKED=EXCL struct vnode *dvp; 325 IN LOCKED=NO struct vnode *vp; 326 IN struct componentname *cnp; 327 }; 328 329 # 330 #% rename fdvp U U U 331 #% rename fvp U U U 332 #% rename tdvp L U U 333 #% rename tvp X U U 334 # 335 #! rename fcnp DELETE, LOCKPARENT 336 #! rename tcnp RENAME, LOCKPARENT | LOCKLEAF | NOCACHE 337 # 338 vop_rename { 339 IN WILLRELE struct vnode *fdvp; 340 IN WILLRELE struct vnode *fvp; 341 IN struct componentname *fcnp; 342 IN LOCKED=YES WILLPUT struct vnode *tdvp; 343 IN WILLPUT struct vnode *tvp; 344 IN struct componentname *tcnp; 345 }; 346 347 # 348 #% mkdir dvp L L L 349 #% mkdir vpp - U - 350 # 351 #! mkdir cnp CREATE, LOCKPARENT 352 # 353 vop_mkdir { 354 VERSION 3 355 POST=vop_mkdir_post 356 IN LOCKED=EXCL struct vnode *dvp; 357 OUT WILLMAKE struct vnode **vpp; 358 IN struct componentname *cnp; 359 IN struct vattr *vap; 360 }; 361 362 # 363 #% rmdir dvp L L L 364 #% rmdir vp L U U 365 # 366 #! rmdir cnp DELETE, LOCKPARENT | LOCKLEAF 367 # 368 vop_rmdir { 369 VERSION 2 370 PRE=vop_rmdir_pre 371 POST=vop_rmdir_post 372 IN LOCKED=EXCL struct vnode *dvp; 373 IN LOCKED=EXCL WILLPUT struct vnode *vp; 374 IN struct componentname *cnp; 375 }; 376 377 # 378 #% symlink dvp L L L 379 #% symlink vpp - U - 380 # 381 #! symlink cnp CREATE, LOCKPARENT 382 # 383 vop_symlink { 384 VERSION 3 385 POST=vop_symlink_post 386 IN LOCKED=EXCL struct vnode *dvp; 387 OUT WILLMAKE struct vnode **vpp; 388 IN struct componentname *cnp; 389 IN struct vattr *vap; 390 IN char *target; 391 }; 392 393 # 394 #% readdir vp L L L 395 # 396 vop_readdir { 397 IN LOCKED=YES struct vnode *vp; 398 INOUT struct uio *uio; 399 IN kauth_cred_t cred; 400 OUT int *eofflag; 401 OUT off_t **cookies; 402 IN int *ncookies; 403 }; 404 405 # 406 #% readlink vp L L L 407 # 408 vop_readlink { 409 IN LOCKED=YES struct vnode *vp; 410 INOUT struct uio *uio; 411 IN kauth_cred_t cred; 412 }; 413 414 # 415 #% abortop dvp = = = 416 # 417 #! abortop cnp as appropriate. 418 # 419 vop_abortop { 420 IN struct vnode *dvp; 421 IN struct componentname *cnp; 422 }; 423 424 # 425 #% inactive vp L L L 426 # 427 vop_inactive { 428 VERSION 2 429 IN LOCKED=EXCL struct vnode *vp; 430 INOUT bool *recycle; 431 }; 432 433 # 434 #% reclaim vp L U U 435 # 436 vop_reclaim { 437 VERSION 2 438 FSTRANS=NO 439 IN LOCKED=EXCL struct vnode *vp; 440 }; 441 442 # 443 #% lock vp U L U 444 # 445 vop_lock { 446 FSTRANS=LOCK 447 IN struct vnode *vp; 448 IN int flags; 449 }; 450 451 # 452 #% unlock vp L U L 453 # 454 vop_unlock { 455 FSTRANS=UNLOCK 456 IN LOCKED=YES struct vnode *vp; 457 }; 458 459 # 460 #% bmap vp = = = 461 #% bmap vpp - U - 462 # 463 vop_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 #% strategy vp = = = 473 # 474 vop_strategy { 475 FSTRANS=NO 476 IN struct vnode *vp; 477 IN struct buf *bp; 478 }; 479 480 # 481 #% print vp = = = 482 # 483 vop_print { 484 IN struct vnode *vp; 485 }; 486 487 # 488 #% islocked vp = = = 489 # 490 vop_islocked { 491 FSTRANS=NO 492 IN struct vnode *vp; 493 }; 494 495 # 496 #% pathconf vp L L L 497 # 498 vop_pathconf { 499 IN LOCKED=YES struct vnode *vp; 500 IN int name; 501 OUT register_t *retval; 502 }; 503 504 # 505 #% advlock vp U U U 506 # 507 vop_advlock { 508 FSTRANS=NO 509 IN LOCKED=NO struct vnode *vp; 510 IN void *id; 511 IN int op; 512 IN struct flock *fl; 513 IN int flags; 514 }; 515 516 # 517 #% whiteout dvp L L L 518 #% whiteout cnp - - - 519 #% whiteout flag - - - 520 # 521 #! whiteout cnp CREATE, LOCKPARENT 522 # 523 vop_whiteout { 524 IN LOCKED=EXCL struct vnode *dvp; 525 IN struct componentname *cnp; 526 IN int flags; 527 }; 528 529 # 530 #% getpages vp = = = 531 # 532 vop_getpages { 533 FSTRANS=NO 534 IN struct vnode *vp; 535 IN voff_t offset; 536 IN struct vm_page **m; 537 IN int *count; 538 IN int centeridx; 539 IN vm_prot_t access_type; 540 IN int advice; 541 IN int flags; 542 }; 543 544 # 545 #% putpages vp = = = 546 # 547 vop_putpages { 548 FSTRANS=NO 549 IN struct vnode *vp; 550 IN voff_t offlo; 551 IN voff_t offhi; 552 IN int flags; 553 }; 554 555 # 556 #% getacl vp L L L 557 # 558 vop_getacl { 559 IN struct vnode *vp; 560 IN acl_type_t type; 561 OUT struct acl *aclp; 562 IN kauth_cred_t cred; 563 }; 564 565 # 566 #% setacl vp L L L 567 # 568 vop_setacl { 569 POST=vop_setacl_post 570 IN LOCKED=EXCL struct vnode *vp; 571 IN acl_type_t type; 572 IN struct acl *aclp; 573 IN kauth_cred_t cred; 574 }; 575 576 # 577 #% aclcheck vp = = = 578 # 579 vop_aclcheck { 580 IN struct vnode *vp; 581 IN acl_type_t type; 582 IN struct acl *aclp; 583 IN kauth_cred_t cred; 584 }; 585 586 # 587 #% closeextattr vp L L L 588 # 589 vop_closeextattr { 590 IN LOCKED=YES struct vnode *vp; 591 IN int commit; 592 IN kauth_cred_t cred; 593 }; 594 595 # 596 #% getextattr vp L L L 597 # 598 vop_getextattr { 599 IN LOCKED=YES struct vnode *vp; 600 IN int attrnamespace; 601 IN const char *name; 602 INOUT struct uio *uio; 603 OUT size_t *size; 604 IN kauth_cred_t cred; 605 }; 606 607 # 608 #% listextattr vp L L L 609 # 610 vop_listextattr { 611 IN LOCKED=YES struct vnode *vp; 612 IN int attrnamespace; 613 INOUT struct uio *uio; 614 OUT size_t *size; 615 IN int flag; 616 IN kauth_cred_t cred; 617 }; 618 619 # 620 #% openextattr vp L L L 621 # 622 vop_openextattr { 623 IN LOCKED=YES struct vnode *vp; 624 IN kauth_cred_t cred; 625 }; 626 627 # 628 #% deleteextattr vp L L L 629 # 630 vop_deleteextattr { 631 IN LOCKED=EXCL struct vnode *vp; 632 IN int attrnamespace; 633 IN const char *name; 634 IN kauth_cred_t cred; 635 }; 636 637 # 638 #% setextattr vp L L L 639 # 640 vop_setextattr { 641 IN LOCKED=EXCL struct vnode *vp; 642 IN int attrnamespace; 643 IN const char *name; 644 INOUT struct uio *uio; 645 IN kauth_cred_t cred; 646 }; 647