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# 4. 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 succesful 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# A: any lock type. 44# S: locked with shared lock. 45# E: locked with exclusive lock for this process. 46# O: locked with exclusive lock for other process. 47# U: unlocked. 48# -: not applicable. vnode does not yet (or no longer) exists. 49# =: the same on input and output, may be either L or U. 50# X: locked if not nil. 51# 52# The paramater named "vpp" is assumed to be always used with double 53# indirection (**vpp) and that name is hard-codeed in vnode_if.awk ! 54# 55# Lines starting with %! specify a pre or post-condition function 56# to call before/after the vop call. 57# 58# If other such parameters are introduced, they have to be added to 59# the AWK script at the head of the definition of "add_debug_code()". 60# 61 62vop_islocked { 63 IN struct vnode *vp; 64}; 65 66%% lookup dvp L ? ? 67%% lookup vpp - L - 68%! lookup pre vop_lookup_pre 69%! lookup post vop_lookup_post 70 71# XXX - the lookup locking protocol defies simple description and depends 72# on the flags and operation fields in the (cnp) structure. Note 73# especially that *vpp may equal dvp and both may be locked. 74 75vop_lookup { 76 IN struct vnode *dvp; 77 INOUT struct vnode **vpp; 78 IN struct componentname *cnp; 79}; 80 81%% cachedlookup dvp L ? ? 82%% cachedlookup vpp - L - 83 84# This must be an exact copy of lookup. See kern/vfs_cache.c for details. 85 86vop_cachedlookup { 87 IN struct vnode *dvp; 88 INOUT struct vnode **vpp; 89 IN struct componentname *cnp; 90}; 91 92%% create dvp E E E 93%% create vpp - L - 94%! create post vop_create_post 95 96vop_create { 97 IN struct vnode *dvp; 98 OUT struct vnode **vpp; 99 IN struct componentname *cnp; 100 IN struct vattr *vap; 101}; 102 103 104%% whiteout dvp E E E 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 post vop_mknod_post 116 117vop_mknod { 118 IN struct vnode *dvp; 119 OUT struct vnode **vpp; 120 IN struct componentname *cnp; 121 IN struct vattr *vap; 122}; 123 124 125%% open vp L L L 126 127vop_open { 128 IN struct vnode *vp; 129 IN int mode; 130 IN struct ucred *cred; 131 IN struct thread *td; 132 IN struct file *fp; 133}; 134 135 136%% close vp L L L 137 138vop_close { 139 IN struct vnode *vp; 140 IN int fflag; 141 IN struct ucred *cred; 142 IN struct thread *td; 143}; 144 145 146%% access vp L L L 147 148vop_access { 149 IN struct vnode *vp; 150 IN accmode_t accmode; 151 IN struct ucred *cred; 152 IN struct thread *td; 153}; 154 155 156%% accessx vp L L L 157 158vop_accessx { 159 IN struct vnode *vp; 160 IN accmode_t accmode; 161 IN struct ucred *cred; 162 IN struct thread *td; 163}; 164 165 166%% getattr vp L L L 167 168vop_getattr { 169 IN struct vnode *vp; 170 OUT struct vattr *vap; 171 IN struct ucred *cred; 172}; 173 174 175%% setattr vp E E E 176%! setattr post vop_setattr_post 177 178vop_setattr { 179 IN struct vnode *vp; 180 IN struct vattr *vap; 181 IN struct ucred *cred; 182}; 183 184%% markatime vp L L L 185 186vop_markatime { 187 IN struct vnode *vp; 188}; 189 190%% read vp L L L 191 192vop_read { 193 IN struct vnode *vp; 194 INOUT struct uio *uio; 195 IN int ioflag; 196 IN struct ucred *cred; 197}; 198 199 200%% write vp L L L 201%! write pre VOP_WRITE_PRE 202%! write post VOP_WRITE_POST 203 204vop_write { 205 IN struct vnode *vp; 206 INOUT struct uio *uio; 207 IN int ioflag; 208 IN struct ucred *cred; 209}; 210 211 212%% ioctl vp U U U 213 214vop_ioctl { 215 IN struct vnode *vp; 216 IN u_long command; 217 IN void *data; 218 IN int fflag; 219 IN struct ucred *cred; 220 IN struct thread *td; 221}; 222 223 224%% poll vp U U U 225 226vop_poll { 227 IN struct vnode *vp; 228 IN int events; 229 IN struct ucred *cred; 230 IN struct thread *td; 231}; 232 233 234%% kqfilter vp U U U 235 236vop_kqfilter { 237 IN struct vnode *vp; 238 IN struct knote *kn; 239}; 240 241 242%% revoke vp L L L 243 244vop_revoke { 245 IN struct vnode *vp; 246 IN int flags; 247}; 248 249 250%% fsync vp L L L 251 252vop_fsync { 253 IN struct vnode *vp; 254 IN int waitfor; 255 IN struct thread *td; 256}; 257 258 259%% remove dvp E E E 260%% remove vp E E E 261%! remove post vop_remove_post 262 263vop_remove { 264 IN struct vnode *dvp; 265 IN struct vnode *vp; 266 IN struct componentname *cnp; 267}; 268 269 270%% link tdvp E E E 271%% link vp E E E 272%! link post vop_link_post 273 274vop_link { 275 IN struct vnode *tdvp; 276 IN struct vnode *vp; 277 IN struct componentname *cnp; 278}; 279 280 281%! rename pre vop_rename_pre 282%! rename post vop_rename_post 283 284vop_rename { 285 IN WILLRELE struct vnode *fdvp; 286 IN WILLRELE struct vnode *fvp; 287 IN struct componentname *fcnp; 288 IN WILLRELE struct vnode *tdvp; 289 IN WILLRELE struct vnode *tvp; 290 IN struct componentname *tcnp; 291}; 292 293 294%% mkdir dvp E E E 295%% mkdir vpp - E - 296%! mkdir post vop_mkdir_post 297 298vop_mkdir { 299 IN struct vnode *dvp; 300 OUT struct vnode **vpp; 301 IN struct componentname *cnp; 302 IN struct vattr *vap; 303}; 304 305 306%% rmdir dvp E E E 307%% rmdir vp E E E 308%! rmdir post vop_rmdir_post 309 310vop_rmdir { 311 IN struct vnode *dvp; 312 IN struct vnode *vp; 313 IN struct componentname *cnp; 314}; 315 316 317%% symlink dvp E E E 318%% symlink vpp - E - 319%! symlink post vop_symlink_post 320 321vop_symlink { 322 IN struct vnode *dvp; 323 OUT struct vnode **vpp; 324 IN struct componentname *cnp; 325 IN struct vattr *vap; 326 IN char *target; 327}; 328 329 330%% readdir vp L L L 331 332vop_readdir { 333 IN struct vnode *vp; 334 INOUT struct uio *uio; 335 IN struct ucred *cred; 336 INOUT int *eofflag; 337 OUT int *ncookies; 338 INOUT u_long **cookies; 339}; 340 341 342%% readlink vp L L L 343 344vop_readlink { 345 IN struct vnode *vp; 346 INOUT struct uio *uio; 347 IN struct ucred *cred; 348}; 349 350 351%% inactive vp E E E 352 353vop_inactive { 354 IN struct vnode *vp; 355 IN struct thread *td; 356}; 357 358 359%% reclaim vp E E E 360 361vop_reclaim { 362 IN struct vnode *vp; 363 IN struct thread *td; 364}; 365 366 367%! lock1 pre vop_lock_pre 368%! lock1 post vop_lock_post 369 370vop_lock1 { 371 IN struct vnode *vp; 372 IN int flags; 373 IN char *file; 374 IN int line; 375}; 376 377 378%! unlock pre vop_unlock_pre 379%! unlock post vop_unlock_post 380 381vop_unlock { 382 IN struct vnode *vp; 383 IN int flags; 384}; 385 386 387%% bmap vp L L L 388 389vop_bmap { 390 IN struct vnode *vp; 391 IN daddr_t bn; 392 OUT struct bufobj **bop; 393 IN daddr_t *bnp; 394 OUT int *runp; 395 OUT int *runb; 396}; 397 398 399%% strategy vp L L L 400%! strategy pre vop_strategy_pre 401 402vop_strategy { 403 IN struct vnode *vp; 404 IN struct buf *bp; 405}; 406 407 408%% getwritemount vp = = = 409 410vop_getwritemount { 411 IN struct vnode *vp; 412 OUT struct mount **mpp; 413}; 414 415 416%% print vp - - - 417 418vop_print { 419 IN struct vnode *vp; 420}; 421 422 423%% pathconf vp L L L 424 425vop_pathconf { 426 IN struct vnode *vp; 427 IN int name; 428 OUT register_t *retval; 429}; 430 431 432%% advlock vp U U U 433 434vop_advlock { 435 IN struct vnode *vp; 436 IN void *id; 437 IN int op; 438 IN struct flock *fl; 439 IN int flags; 440}; 441 442 443%% advlockasync vp U U U 444 445vop_advlockasync { 446 IN struct vnode *vp; 447 IN void *id; 448 IN int op; 449 IN struct flock *fl; 450 IN int flags; 451 IN struct task *task; 452 INOUT void **cookiep; 453}; 454 455 456%% advlockpurge vp E E E 457 458vop_advlockpurge { 459 IN struct vnode *vp; 460}; 461 462 463%% reallocblks vp E E E 464 465vop_reallocblks { 466 IN struct vnode *vp; 467 IN struct cluster_save *buflist; 468}; 469 470 471%% getpages vp L L L 472 473vop_getpages { 474 IN struct vnode *vp; 475 IN vm_page_t *m; 476 IN int count; 477 IN int reqpage; 478 IN vm_ooffset_t offset; 479}; 480 481 482%% putpages vp E E E 483 484vop_putpages { 485 IN struct vnode *vp; 486 IN vm_page_t *m; 487 IN int count; 488 IN int sync; 489 IN int *rtvals; 490 IN vm_ooffset_t offset; 491}; 492 493 494%% getacl vp L L L 495 496vop_getacl { 497 IN struct vnode *vp; 498 IN acl_type_t type; 499 OUT struct acl *aclp; 500 IN struct ucred *cred; 501 IN struct thread *td; 502}; 503 504 505%% setacl vp E E E 506 507vop_setacl { 508 IN struct vnode *vp; 509 IN acl_type_t type; 510 IN struct acl *aclp; 511 IN struct ucred *cred; 512 IN struct thread *td; 513}; 514 515 516%% aclcheck vp = = = 517 518vop_aclcheck { 519 IN struct vnode *vp; 520 IN acl_type_t type; 521 IN struct acl *aclp; 522 IN struct ucred *cred; 523 IN struct thread *td; 524}; 525 526 527%% closeextattr vp L L L 528 529vop_closeextattr { 530 IN struct vnode *vp; 531 IN int commit; 532 IN struct ucred *cred; 533 IN struct thread *td; 534}; 535 536 537%% getextattr vp L L L 538 539vop_getextattr { 540 IN struct vnode *vp; 541 IN int attrnamespace; 542 IN const char *name; 543 INOUT struct uio *uio; 544 OUT size_t *size; 545 IN struct ucred *cred; 546 IN struct thread *td; 547}; 548 549 550%% listextattr vp L L L 551 552vop_listextattr { 553 IN struct vnode *vp; 554 IN int attrnamespace; 555 INOUT struct uio *uio; 556 OUT size_t *size; 557 IN struct ucred *cred; 558 IN struct thread *td; 559}; 560 561 562%% openextattr vp L L L 563 564vop_openextattr { 565 IN struct vnode *vp; 566 IN struct ucred *cred; 567 IN struct thread *td; 568}; 569 570 571%% deleteextattr vp E E E 572 573vop_deleteextattr { 574 IN struct vnode *vp; 575 IN int attrnamespace; 576 IN const char *name; 577 IN struct ucred *cred; 578 IN struct thread *td; 579}; 580 581 582%% setextattr vp E E E 583 584vop_setextattr { 585 IN struct vnode *vp; 586 IN int attrnamespace; 587 IN const char *name; 588 INOUT struct uio *uio; 589 IN struct ucred *cred; 590 IN struct thread *td; 591}; 592 593 594%% setlabel vp E E E 595 596vop_setlabel { 597 IN struct vnode *vp; 598 IN struct label *label; 599 IN struct ucred *cred; 600 IN struct thread *td; 601}; 602 603 604%% vptofh vp = = = 605 606vop_vptofh { 607 IN struct vnode *vp; 608 IN struct fid *fhp; 609}; 610 611 612%% vptocnp vp L L L 613%% vptocnp vpp - U - 614 615vop_vptocnp { 616 IN struct vnode *vp; 617 OUT struct vnode **vpp; 618 IN struct ucred *cred; 619 INOUT char *buf; 620 INOUT int *buflen; 621}; 622 623 624%% allocate vp E E E 625 626vop_allocate { 627 IN struct vnode *vp; 628 INOUT off_t *offset; 629 INOUT off_t *len; 630}; 631 632%% advise vp U U U 633 634vop_advise { 635 IN struct vnode *vp; 636 IN off_t start; 637 IN off_t end; 638 IN int advice; 639}; 640