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