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 E E E 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 int mode; 151 IN struct ucred *cred; 152 IN struct thread *td; 153}; 154 155 156%% getattr vp L L L 157 158vop_getattr { 159 IN struct vnode *vp; 160 OUT struct vattr *vap; 161 IN struct ucred *cred; 162 IN struct thread *td; 163}; 164 165 166%% setattr vp E E E 167%! setattr post vop_setattr_post 168 169vop_setattr { 170 IN struct vnode *vp; 171 IN struct vattr *vap; 172 IN struct ucred *cred; 173 IN struct thread *td; 174}; 175 176 177%% read vp L L L 178 179vop_read { 180 IN struct vnode *vp; 181 INOUT struct uio *uio; 182 IN int ioflag; 183 IN struct ucred *cred; 184}; 185 186 187%% write vp E E E 188%! write pre VOP_WRITE_PRE 189%! write post VOP_WRITE_POST 190 191vop_write { 192 IN struct vnode *vp; 193 INOUT struct uio *uio; 194 IN int ioflag; 195 IN struct ucred *cred; 196}; 197 198 199%% lease vp = = = 200 201vop_lease { 202 IN struct vnode *vp; 203 IN struct thread *td; 204 IN struct ucred *cred; 205 IN int flag; 206}; 207 208 209%% ioctl vp U U U 210 211vop_ioctl { 212 IN struct vnode *vp; 213 IN u_long command; 214 IN void *data; 215 IN int fflag; 216 IN struct ucred *cred; 217 IN struct thread *td; 218}; 219 220 221%% poll vp U U U 222 223vop_poll { 224 IN struct vnode *vp; 225 IN int events; 226 IN struct ucred *cred; 227 IN struct thread *td; 228}; 229 230 231%% kqfilter vp U U U 232 233vop_kqfilter { 234 IN struct vnode *vp; 235 IN struct knote *kn; 236}; 237 238 239%% revoke vp L L L 240 241vop_revoke { 242 IN struct vnode *vp; 243 IN int flags; 244}; 245 246 247%% fsync vp E E E 248 249vop_fsync { 250 IN struct vnode *vp; 251 IN int waitfor; 252 IN struct thread *td; 253}; 254 255 256%% remove dvp E E E 257%% remove vp E E E 258%! remove post vop_remove_post 259 260vop_remove { 261 IN struct vnode *dvp; 262 IN struct vnode *vp; 263 IN struct componentname *cnp; 264}; 265 266 267%% link tdvp E E E 268%% link vp E E E 269%! link post vop_link_post 270 271vop_link { 272 IN struct vnode *tdvp; 273 IN struct vnode *vp; 274 IN struct componentname *cnp; 275}; 276 277 278%! rename pre vop_rename_pre 279%! rename post vop_rename_post 280 281vop_rename { 282 IN WILLRELE struct vnode *fdvp; 283 IN WILLRELE struct vnode *fvp; 284 IN struct componentname *fcnp; 285 IN WILLRELE struct vnode *tdvp; 286 IN WILLRELE struct vnode *tvp; 287 IN struct componentname *tcnp; 288}; 289 290 291%% mkdir dvp E E E 292%% mkdir vpp - E - 293%! mkdir post vop_mkdir_post 294 295vop_mkdir { 296 IN struct vnode *dvp; 297 OUT struct vnode **vpp; 298 IN struct componentname *cnp; 299 IN struct vattr *vap; 300}; 301 302 303%% rmdir dvp E E E 304%% rmdir vp E E E 305%! rmdir post vop_rmdir_post 306 307vop_rmdir { 308 IN struct vnode *dvp; 309 IN struct vnode *vp; 310 IN struct componentname *cnp; 311}; 312 313 314%% symlink dvp E E E 315%% symlink vpp - E - 316%! symlink post vop_symlink_post 317 318vop_symlink { 319 IN struct vnode *dvp; 320 OUT struct vnode **vpp; 321 IN struct componentname *cnp; 322 IN struct vattr *vap; 323 IN char *target; 324}; 325 326 327%% readdir vp L L L 328 329vop_readdir { 330 IN struct vnode *vp; 331 INOUT struct uio *uio; 332 IN struct ucred *cred; 333 INOUT int *eofflag; 334 OUT int *ncookies; 335 INOUT u_long **cookies; 336}; 337 338 339%% readlink vp L L L 340 341vop_readlink { 342 IN struct vnode *vp; 343 INOUT struct uio *uio; 344 IN struct ucred *cred; 345}; 346 347 348%% inactive vp E E E 349 350vop_inactive { 351 IN struct vnode *vp; 352 IN struct thread *td; 353}; 354 355 356%% reclaim vp E E E 357 358vop_reclaim { 359 IN struct vnode *vp; 360 IN struct thread *td; 361}; 362 363 364%! lock1 pre vop_lock_pre 365%! lock1 post vop_lock_post 366 367vop_lock1 { 368 IN struct vnode *vp; 369 IN int flags; 370 IN char *file; 371 IN int line; 372}; 373 374 375%! unlock pre vop_unlock_pre 376%! unlock post vop_unlock_post 377 378vop_unlock { 379 IN struct vnode *vp; 380 IN int flags; 381}; 382 383 384%% bmap vp L L L 385 386vop_bmap { 387 IN struct vnode *vp; 388 IN daddr_t bn; 389 OUT struct bufobj **bop; 390 IN daddr_t *bnp; 391 OUT int *runp; 392 OUT int *runb; 393}; 394 395 396%% strategy vp L L L 397%! strategy pre vop_strategy_pre 398 399vop_strategy { 400 IN struct vnode *vp; 401 IN struct buf *bp; 402}; 403 404 405%% getwritemount vp = = = 406 407vop_getwritemount { 408 IN struct vnode *vp; 409 OUT struct mount **mpp; 410}; 411 412 413%% print vp - - - 414 415vop_print { 416 IN struct vnode *vp; 417}; 418 419 420%% pathconf vp L L L 421 422vop_pathconf { 423 IN struct vnode *vp; 424 IN int name; 425 OUT register_t *retval; 426}; 427 428 429%% advlock vp U U U 430 431vop_advlock { 432 IN struct vnode *vp; 433 IN void *id; 434 IN int op; 435 IN struct flock *fl; 436 IN int flags; 437}; 438 439 440%% advlockasync vp U U U 441 442vop_advlockasync { 443 IN struct vnode *vp; 444 IN void *id; 445 IN int op; 446 IN struct flock *fl; 447 IN int flags; 448 IN struct task *task; 449 INOUT void **cookiep; 450}; 451 452 453%% reallocblks vp E E E 454 455vop_reallocblks { 456 IN struct vnode *vp; 457 IN struct cluster_save *buflist; 458}; 459 460 461%% getpages vp L L L 462 463vop_getpages { 464 IN struct vnode *vp; 465 IN vm_page_t *m; 466 IN int count; 467 IN int reqpage; 468 IN vm_ooffset_t offset; 469}; 470 471 472%% putpages vp E E E 473 474vop_putpages { 475 IN struct vnode *vp; 476 IN vm_page_t *m; 477 IN int count; 478 IN int sync; 479 IN int *rtvals; 480 IN vm_ooffset_t offset; 481}; 482 483 484%% getacl vp L L L 485 486vop_getacl { 487 IN struct vnode *vp; 488 IN acl_type_t type; 489 OUT struct acl *aclp; 490 IN struct ucred *cred; 491 IN struct thread *td; 492}; 493 494 495%% setacl vp E E E 496 497vop_setacl { 498 IN struct vnode *vp; 499 IN acl_type_t type; 500 IN struct acl *aclp; 501 IN struct ucred *cred; 502 IN struct thread *td; 503}; 504 505 506%% aclcheck vp = = = 507 508vop_aclcheck { 509 IN struct vnode *vp; 510 IN acl_type_t type; 511 IN struct acl *aclp; 512 IN struct ucred *cred; 513 IN struct thread *td; 514}; 515 516 517%% closeextattr vp L L L 518 519vop_closeextattr { 520 IN struct vnode *vp; 521 IN int commit; 522 IN struct ucred *cred; 523 IN struct thread *td; 524}; 525 526 527%% getextattr vp L L L 528 529vop_getextattr { 530 IN struct vnode *vp; 531 IN int attrnamespace; 532 IN const char *name; 533 INOUT struct uio *uio; 534 OUT size_t *size; 535 IN struct ucred *cred; 536 IN struct thread *td; 537}; 538 539 540%% listextattr vp L L L 541 542vop_listextattr { 543 IN struct vnode *vp; 544 IN int attrnamespace; 545 INOUT struct uio *uio; 546 OUT size_t *size; 547 IN struct ucred *cred; 548 IN struct thread *td; 549}; 550 551 552%% openextattr vp L L L 553 554vop_openextattr { 555 IN struct vnode *vp; 556 IN struct ucred *cred; 557 IN struct thread *td; 558}; 559 560 561%% deleteextattr vp E E E 562 563vop_deleteextattr { 564 IN struct vnode *vp; 565 IN int attrnamespace; 566 IN const char *name; 567 IN struct ucred *cred; 568 IN struct thread *td; 569}; 570 571 572%% setextattr vp E E E 573 574vop_setextattr { 575 IN struct vnode *vp; 576 IN int attrnamespace; 577 IN const char *name; 578 INOUT struct uio *uio; 579 IN struct ucred *cred; 580 IN struct thread *td; 581}; 582 583 584%% setlabel vp E E E 585 586vop_setlabel { 587 IN struct vnode *vp; 588 IN struct label *label; 589 IN struct ucred *cred; 590 IN struct thread *td; 591}; 592 593 594%% setlabel vp = = = 595 596vop_vptofh { 597 IN struct vnode *vp; 598 IN struct fid *fhp; 599}; 600