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