1#- 2# Copyright (c) 1992, 1993 3# The Regents of the University of California. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer. 10# 2. Redistributions in binary form must reproduce the above copyright 11# notice, this list of conditions and the following disclaimer in the 12# documentation and/or other materials provided with the distribution. 13# 3. Neither the name of the University nor the names of its contributors 14# may be used to endorse or promote products derived from this software 15# without specific prior written permission. 16# 17# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27# SUCH DAMAGE. 28 29# 30# Above each of the vop descriptors in lines starting with %% 31# is a specification of the locking protocol used by each vop call. 32# The first column is the name of the variable, the remaining three 33# columns are in, out and error respectively. The "in" column defines 34# the lock state on input, the "out" column defines the state on successful 35# return, and the "error" column defines the locking state on error exit. 36# 37# The locking value can take the following values: 38# L: locked; not converted to type of lock. 39# E: locked with exclusive lock for this process. 40# U: unlocked. 41# -: not applicable. vnode does not yet (or no longer) exists. 42# =: the same on input and output, may be either L or U. 43# 44# The parameter named "vpp" is assumed to be always used with double 45# indirection (**vpp) and that name is hard-coded in vnode_if.awk ! 46# 47# Lines starting with %! specify a pre or post-condition function 48# to call before/after the vop call. 49# 50# If other such parameters are introduced, they have to be added to 51# the AWK script at the head of the definition of "add_debug_code()". 52# 53 54vop_islocked { 55 IN struct vnode *vp; 56}; 57 58 59%% lookup dvp L L L 60%% lookup vpp - L - 61 62# XXX - the lookup locking protocol defies simple description and depends 63# on the flags and operation fields in the (cnp) structure. Note 64# especially that *vpp may equal dvp and both may be locked. 65 66vop_lookup { 67 IN struct vnode *dvp; 68 INOUT struct vnode **vpp; 69 IN struct componentname *cnp; 70}; 71 72 73%% cachedlookup dvp L L L 74%% cachedlookup vpp - L - 75 76# This must be an exact copy of lookup. See kern/vfs_cache.c for details. 77 78vop_cachedlookup { 79 IN struct vnode *dvp; 80 INOUT struct vnode **vpp; 81 IN struct componentname *cnp; 82}; 83 84 85%% create dvp E E E 86%% create vpp - L - 87%! create pre vop_create_pre 88%! create post vop_create_post 89 90vop_create { 91 IN struct vnode *dvp; 92 OUT struct vnode **vpp; 93 IN struct componentname *cnp; 94 IN struct vattr *vap; 95}; 96 97 98%% whiteout dvp E E E 99%! whiteout pre vop_whiteout_pre 100%! whiteout post vop_whiteout_post 101 102vop_whiteout { 103 IN struct vnode *dvp; 104 IN struct componentname *cnp; 105 IN int flags; 106}; 107 108 109%% mknod dvp E E E 110%% mknod vpp - L - 111%! mknod pre vop_mknod_pre 112%! mknod post vop_mknod_post 113 114vop_mknod { 115 IN struct vnode *dvp; 116 OUT struct vnode **vpp; 117 IN struct componentname *cnp; 118 IN struct vattr *vap; 119}; 120 121 122%% open vp L L L 123%! open post vop_open_post 124 125vop_open { 126 IN struct vnode *vp; 127 IN int mode; 128 IN struct ucred *cred; 129 IN struct thread *td; 130 IN struct file *fp; 131}; 132 133 134%% close vp L L L 135%! close post vop_close_post 136 137vop_close { 138 IN struct vnode *vp; 139 IN int fflag; 140 IN struct ucred *cred; 141 IN struct thread *td; 142}; 143 144 145%% fplookup_vexec vp - - - 146%! fplookup_vexec debugpre vop_fplookup_vexec_debugpre 147%! fplookup_vexec debugpost vop_fplookup_vexec_debugpost 148 149vop_fplookup_vexec { 150 IN struct vnode *vp; 151 IN struct ucred *cred; 152}; 153 154 155%% fplookup_symlink vp - - - 156%! fplookup_symlink debugpre vop_fplookup_symlink_debugpre 157%! fplookup_symlink debugpost vop_fplookup_symlink_debugpost 158 159vop_fplookup_symlink { 160 IN struct vnode *vp; 161 IN struct cache_fpl *fpl; 162}; 163 164 165%% access vp L L L 166 167vop_access { 168 IN struct vnode *vp; 169 IN accmode_t accmode; 170 IN struct ucred *cred; 171 IN struct thread *td; 172}; 173 174 175%% accessx vp L L L 176 177vop_accessx { 178 IN struct vnode *vp; 179 IN accmode_t accmode; 180 IN struct ucred *cred; 181 IN struct thread *td; 182}; 183 184 185%% stat vp L L L 186 187vop_stat { 188 IN struct vnode *vp; 189 OUT struct stat *sb; 190 IN struct ucred *active_cred; 191 IN struct ucred *file_cred; 192}; 193 194 195%% getattr vp L L L 196 197vop_getattr { 198 IN struct vnode *vp; 199 OUT struct vattr *vap; 200 IN struct ucred *cred; 201}; 202 203 204%% setattr vp E E E 205%! setattr pre vop_setattr_pre 206%! setattr post vop_setattr_post 207 208vop_setattr { 209 IN struct vnode *vp; 210 IN struct vattr *vap; 211 IN struct ucred *cred; 212}; 213 214 215%% mmapped vp L L L 216 217vop_mmapped { 218 IN struct vnode *vp; 219}; 220 221 222%% read vp L L L 223%! read post vop_read_post 224 225vop_read { 226 IN struct vnode *vp; 227 INOUT struct uio *uio; 228 IN int ioflag; 229 IN struct ucred *cred; 230}; 231 232 233%% read_pgcache vp - - - 234%! read_pgcache post vop_read_pgcache_post 235 236vop_read_pgcache { 237 IN struct vnode *vp; 238 INOUT struct uio *uio; 239 IN int ioflag; 240 IN struct ucred *cred; 241}; 242 243 244%% write vp L L L 245%! write pre vop_write_pre 246%! write post vop_write_post 247 248vop_write { 249 IN struct vnode *vp; 250 INOUT struct uio *uio; 251 IN int ioflag; 252 IN struct ucred *cred; 253}; 254 255 256%% ioctl vp U U U 257 258vop_ioctl { 259 IN struct vnode *vp; 260 IN u_long command; 261 IN void *data; 262 IN int fflag; 263 IN struct ucred *cred; 264 IN struct thread *td; 265}; 266 267 268%% poll vp U U U 269 270vop_poll { 271 IN struct vnode *vp; 272 IN int events; 273 IN struct ucred *cred; 274 IN struct thread *td; 275}; 276 277 278%% kqfilter vp U U U 279 280vop_kqfilter { 281 IN struct vnode *vp; 282 IN struct knote *kn; 283}; 284 285 286%% revoke vp L L L 287 288vop_revoke { 289 IN struct vnode *vp; 290 IN int flags; 291}; 292 293 294%% fsync vp - - - 295%! fsync pre vop_fsync_debugpre 296%! fsync post vop_fsync_debugpost 297 298vop_fsync { 299 IN struct vnode *vp; 300 IN int waitfor; 301 IN struct thread *td; 302}; 303 304 305%% remove dvp E E E 306%% remove vp E E E 307%! remove pre vop_remove_pre 308%! remove post vop_remove_post 309 310vop_remove { 311 IN struct vnode *dvp; 312 IN struct vnode *vp; 313 IN struct componentname *cnp; 314}; 315 316 317%% link tdvp E E E 318%% link vp E E E 319%! link pre vop_link_pre 320%! link post vop_link_post 321 322vop_link { 323 IN struct vnode *tdvp; 324 IN struct vnode *vp; 325 IN struct componentname *cnp; 326}; 327 328 329%! rename pre vop_rename_pre 330%! rename post vop_rename_post 331 332vop_rename { 333 IN WILLRELE struct vnode *fdvp; 334 IN WILLRELE struct vnode *fvp; 335 IN struct componentname *fcnp; 336 IN WILLRELE struct vnode *tdvp; 337 IN WILLRELE struct vnode *tvp; 338 IN struct componentname *tcnp; 339}; 340 341 342%% mkdir dvp E E E 343%% mkdir vpp - E - 344%! mkdir pre vop_mkdir_pre 345%! mkdir post vop_mkdir_post 346%! mkdir debugpost vop_mkdir_debugpost 347 348vop_mkdir { 349 IN struct vnode *dvp; 350 OUT struct vnode **vpp; 351 IN struct componentname *cnp; 352 IN struct vattr *vap; 353}; 354 355 356%% rmdir dvp E E E 357%% rmdir vp E E E 358%! rmdir pre vop_rmdir_pre 359%! rmdir post vop_rmdir_post 360 361vop_rmdir { 362 IN struct vnode *dvp; 363 IN struct vnode *vp; 364 IN struct componentname *cnp; 365}; 366 367 368%% symlink dvp E E E 369%% symlink vpp - E - 370%! symlink pre vop_symlink_pre 371%! symlink post vop_symlink_post 372 373vop_symlink { 374 IN struct vnode *dvp; 375 OUT struct vnode **vpp; 376 IN struct componentname *cnp; 377 IN struct vattr *vap; 378 IN const char *target; 379}; 380 381 382%% readdir vp L L L 383%! readdir pre vop_readdir_pre 384%! readdir post vop_readdir_post 385 386vop_readdir { 387 IN struct vnode *vp; 388 INOUT struct uio *uio; 389 IN struct ucred *cred; 390 INOUT int *eofflag; 391 OUT int *ncookies; 392 INOUT uint64_t **cookies; 393}; 394 395 396%% readlink vp L L L 397 398vop_readlink { 399 IN struct vnode *vp; 400 INOUT struct uio *uio; 401 IN struct ucred *cred; 402}; 403 404 405%% inactive vp E E E 406 407vop_inactive { 408 IN struct vnode *vp; 409}; 410 411%! need_inactive debugpre vop_need_inactive_debugpre 412%! need_inactive debugpost vop_need_inactive_debugpost 413 414vop_need_inactive { 415 IN struct vnode *vp; 416}; 417 418%% reclaim vp E E E 419%! reclaim post vop_reclaim_post 420 421vop_reclaim { 422 IN struct vnode *vp; 423}; 424 425 426%! lock1 debugpre vop_lock_debugpre 427%! lock1 debugpost vop_lock_debugpost 428 429vop_lock1 { 430 IN struct vnode *vp; 431 IN int flags; 432 IN const char *file; 433 IN int line; 434}; 435 436 437%! unlock debugpre vop_unlock_debugpre 438 439vop_unlock { 440 IN struct vnode *vp; 441}; 442 443 444%% bmap vp L L L 445 446vop_bmap { 447 IN struct vnode *vp; 448 IN daddr_t bn; 449 OUT struct bufobj **bop; 450 IN daddr_t *bnp; 451 OUT int *runp; 452 OUT int *runb; 453}; 454 455 456%% strategy vp L L L 457%! strategy debugpre vop_strategy_debugpre 458 459vop_strategy { 460 IN struct vnode *vp; 461 IN struct buf *bp; 462}; 463 464 465%% getwritemount vp = = = 466 467vop_getwritemount { 468 IN struct vnode *vp; 469 OUT struct mount **mpp; 470}; 471 472%% getwritevnode vp = = = 473 474vop_getlowvnode { 475 IN struct vnode *vp; 476 OUT struct vnode **vplp; 477 IN int flags; 478}; 479 480%% print vp - - - 481 482vop_print { 483 IN struct vnode *vp; 484}; 485 486 487%% pathconf vp L L L 488 489vop_pathconf { 490 IN struct vnode *vp; 491 IN int name; 492 OUT long *retval; 493}; 494 495 496%% advlock vp U U U 497 498vop_advlock { 499 IN struct vnode *vp; 500 IN void *id; 501 IN int op; 502 IN struct flock *fl; 503 IN int flags; 504}; 505 506 507%% advlockasync vp U U U 508 509vop_advlockasync { 510 IN struct vnode *vp; 511 IN void *id; 512 IN int op; 513 IN struct flock *fl; 514 IN int flags; 515 IN struct task *task; 516 INOUT void **cookiep; 517}; 518 519 520%% advlockpurge vp E E E 521 522vop_advlockpurge { 523 IN struct vnode *vp; 524}; 525 526 527%% reallocblks vp E E E 528 529vop_reallocblks { 530 IN struct vnode *vp; 531 IN struct cluster_save *buflist; 532}; 533 534 535%% getpages vp L L L 536 537vop_getpages { 538 IN struct vnode *vp; 539 IN vm_page_t *m; 540 IN int count; 541 IN int *rbehind; 542 IN int *rahead; 543}; 544 545 546%% getpages_async vp L L L 547 548vop_getpages_async { 549 IN struct vnode *vp; 550 IN vm_page_t *m; 551 IN int count; 552 IN int *rbehind; 553 IN int *rahead; 554 IN vop_getpages_iodone_t *iodone; 555 IN void *arg; 556}; 557 558 559%% putpages vp L L L 560 561vop_putpages { 562 IN struct vnode *vp; 563 IN vm_page_t *m; 564 IN int count; 565 IN int sync; 566 IN int *rtvals; 567}; 568 569 570%% getacl vp L L L 571 572vop_getacl { 573 IN struct vnode *vp; 574 IN acl_type_t type; 575 OUT struct acl *aclp; 576 IN struct ucred *cred; 577 IN struct thread *td; 578}; 579 580 581%% setacl vp E E E 582%! setacl pre vop_setacl_pre 583%! setacl post vop_setacl_post 584 585vop_setacl { 586 IN struct vnode *vp; 587 IN acl_type_t type; 588 IN struct acl *aclp; 589 IN struct ucred *cred; 590 IN struct thread *td; 591}; 592 593 594%% aclcheck vp = = = 595 596vop_aclcheck { 597 IN struct vnode *vp; 598 IN acl_type_t type; 599 IN struct acl *aclp; 600 IN struct ucred *cred; 601 IN struct thread *td; 602}; 603 604 605%% closeextattr vp L L L 606 607vop_closeextattr { 608 IN struct vnode *vp; 609 IN int commit; 610 IN struct ucred *cred; 611 IN struct thread *td; 612}; 613 614 615%% getextattr vp L L L 616 617vop_getextattr { 618 IN struct vnode *vp; 619 IN int attrnamespace; 620 IN const char *name; 621 INOUT struct uio *uio; 622 OUT size_t *size; 623 IN struct ucred *cred; 624 IN struct thread *td; 625}; 626 627 628%% listextattr vp L L L 629 630vop_listextattr { 631 IN struct vnode *vp; 632 IN int attrnamespace; 633 INOUT struct uio *uio; 634 OUT size_t *size; 635 IN struct ucred *cred; 636 IN struct thread *td; 637}; 638 639 640%% openextattr vp L L L 641 642vop_openextattr { 643 IN struct vnode *vp; 644 IN struct ucred *cred; 645 IN struct thread *td; 646}; 647 648 649%% deleteextattr vp E E E 650%! deleteextattr pre vop_deleteextattr_pre 651%! deleteextattr post vop_deleteextattr_post 652 653vop_deleteextattr { 654 IN struct vnode *vp; 655 IN int attrnamespace; 656 IN const char *name; 657 IN struct ucred *cred; 658 IN struct thread *td; 659}; 660 661 662%% setextattr vp E E E 663%! setextattr pre vop_setextattr_pre 664%! setextattr post vop_setextattr_post 665 666vop_setextattr { 667 IN struct vnode *vp; 668 IN int attrnamespace; 669 IN const char *name; 670 INOUT struct uio *uio; 671 IN struct ucred *cred; 672 IN struct thread *td; 673}; 674 675 676%% setlabel vp E E E 677 678vop_setlabel { 679 IN struct vnode *vp; 680 IN struct label *label; 681 IN struct ucred *cred; 682 IN struct thread *td; 683}; 684 685 686%% vptofh vp = = = 687 688vop_vptofh { 689 IN struct vnode *vp; 690 IN struct fid *fhp; 691}; 692 693 694%% vptocnp vp L L L 695%% vptocnp vpp - U - 696 697vop_vptocnp { 698 IN struct vnode *vp; 699 OUT struct vnode **vpp; 700 INOUT char *buf; 701 INOUT size_t *buflen; 702}; 703 704 705%% allocate vp E E E 706%! allocate post vop_allocate_post 707 708vop_allocate { 709 IN struct vnode *vp; 710 INOUT off_t *offset; 711 INOUT off_t *len; 712 IN int ioflag; 713 IN struct ucred *cred; 714}; 715 716 717%% advise vp U U U 718 719vop_advise { 720 IN struct vnode *vp; 721 IN off_t start; 722 IN off_t end; 723 IN int advice; 724}; 725 726 727%% unp_bind vp E E E 728 729vop_unp_bind { 730 IN struct vnode *vp; 731 IN struct unpcb *unpcb; 732}; 733 734 735%% unp_connect vp L L L 736 737vop_unp_connect { 738 IN struct vnode *vp; 739 OUT struct unpcb **unpcb; 740}; 741 742 743%% unp_detach vp = = = 744 745vop_unp_detach { 746 IN struct vnode *vp; 747}; 748 749 750%% is_text vp L L L 751 752vop_is_text { 753 IN struct vnode *vp; 754}; 755 756 757%% set_text vp = = = 758 759vop_set_text { 760 IN struct vnode *vp; 761}; 762 763 764%% vop_unset_text vp L L L 765 766vop_unset_text { 767 IN struct vnode *vp; 768}; 769 770 771%% add_writecount vp L L L 772 773vop_add_writecount { 774 IN struct vnode *vp; 775 IN int inc; 776}; 777 778 779%% fdatasync vp - - - 780%! fdatasync pre vop_fdatasync_debugpre 781%! fdatasync post vop_fdatasync_debugpost 782 783vop_fdatasync { 784 IN struct vnode *vp; 785 IN struct thread *td; 786}; 787 788 789%% copy_file_range invp U U U 790%% copy_file_range outvp U U U 791%! copy_file_range post vop_copy_file_range_post 792 793vop_copy_file_range { 794 IN struct vnode *invp; 795 INOUT off_t *inoffp; 796 IN struct vnode *outvp; 797 INOUT off_t *outoffp; 798 INOUT size_t *lenp; 799 IN unsigned int flags; 800 IN struct ucred *incred; 801 IN struct ucred *outcred; 802 IN struct thread *fsizetd; 803}; 804 805 806%% vput_pair dvp E - - 807 808vop_vput_pair { 809 IN struct vnode *dvp; 810 INOUT struct vnode **vpp; 811 IN bool unlock_vp; 812}; 813 814 815%% deallocate vp L L L 816%! deallocate post vop_deallocate_post 817 818vop_deallocate { 819 IN struct vnode *vp; 820 INOUT off_t *offset; 821 INOUT off_t *len; 822 IN int flags; 823 IN int ioflag; 824 IN struct ucred *cred; 825}; 826 827 828%% inotify vp - - - 829 830vop_inotify { 831 IN struct vnode *vp; 832 IN struct vnode *dvp; 833 IN struct componentname *cnp; 834 IN int event; 835 IN uint32_t cookie; 836}; 837 838 839%% inotify_add_watch vp L L L 840 841vop_inotify_add_watch { 842 IN struct vnode *vp; 843 IN struct inotify_softc *sc; 844 IN uint32_t mask; 845 OUT uint32_t *wdp; 846 IN struct thread *td; 847}; 848 849# The VOPs below are spares at the end of the table to allow new VOPs to be 850# added in stable branches without breaking the KBI. New VOPs in HEAD should 851# be added above these spares. When merging a new VOP to a stable branch, 852# the new VOP should replace one of the spares. 853 854vop_spare1 { 855 IN struct vnode *vp; 856}; 857 858vop_spare2 { 859 IN struct vnode *vp; 860}; 861 862vop_spare3 { 863 IN struct vnode *vp; 864}; 865 866vop_spare4 { 867 IN struct vnode *vp; 868}; 869 870vop_spare5 { 871 IN struct vnode *vp; 872}; 873