1 /* $NetBSD: vnode_if.c,v 1.85 2010/06/24 13:03:12 hannken Exp $ */ 2 3 /* 4 * Warning: DO NOT EDIT! This file is automatically generated! 5 * (Modifications made here may easily be lost!) 6 * 7 * Created from the file: 8 * NetBSD: vnode_if.src,v 1.59 2010/06/24 12:58:48 hannken Exp 9 * by the script: 10 * NetBSD: vnode_if.sh,v 1.56 2010/04/14 13:58:51 pooka Exp 11 */ 12 13 /* 14 * Copyright (c) 1992, 1993, 1994, 1995 15 * The Regents of the University of California. All rights reserved. 16 * 17 * Redistribution and use in source and binary forms, with or without 18 * modification, are permitted provided that the following conditions 19 * are met: 20 * 1. Redistributions of source code must retain the above copyright 21 * notice, this list of conditions and the following disclaimer. 22 * 2. Redistributions in binary form must reproduce the above copyright 23 * notice, this list of conditions and the following disclaimer in the 24 * documentation and/or other materials provided with the distribution. 25 * 3. Neither the name of the University nor the names of its contributors 26 * may be used to endorse or promote products derived from this software 27 * without specific prior written permission. 28 * 29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 */ 41 42 #include <sys/cdefs.h> 43 __KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.85 2010/06/24 13:03:12 hannken Exp $"); 44 45 #include <sys/param.h> 46 #include <sys/mount.h> 47 #include <sys/buf.h> 48 #include <sys/vnode.h> 49 #include <sys/lock.h> 50 51 const struct vnodeop_desc vop_default_desc = { 52 0, 53 "default", 54 0, 55 NULL, 56 VDESC_NO_OFFSET, 57 VDESC_NO_OFFSET, 58 VDESC_NO_OFFSET, 59 }; 60 61 62 /* Special cases: */ 63 64 const int vop_bwrite_vp_offsets[] = { 65 VDESC_NO_OFFSET 66 }; 67 const struct vnodeop_desc vop_bwrite_desc = { 68 VOP_BWRITE_DESCOFFSET, 69 "vop_bwrite", 70 0, 71 vop_bwrite_vp_offsets, 72 VDESC_NO_OFFSET, 73 VDESC_NO_OFFSET, 74 VDESC_NO_OFFSET, 75 }; 76 int 77 VOP_BWRITE(struct buf *bp) 78 { 79 int error; 80 bool mpsafe; 81 struct vop_bwrite_args a; 82 a.a_desc = VDESC(vop_bwrite); 83 a.a_bp = bp; 84 mpsafe = (bp->b_vp->v_vflag & VV_MPSAFE); 85 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 86 error = (VCALL(bp->b_vp, VOFFSET(vop_bwrite), &a)); 87 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 88 return error; 89 } 90 91 /* End of special cases */ 92 93 const int vop_lookup_vp_offsets[] = { 94 VOPARG_OFFSETOF(struct vop_lookup_args,a_dvp), 95 VDESC_NO_OFFSET 96 }; 97 const struct vnodeop_desc vop_lookup_desc = { 98 VOP_LOOKUP_DESCOFFSET, 99 "vop_lookup", 100 0, 101 vop_lookup_vp_offsets, 102 VOPARG_OFFSETOF(struct vop_lookup_args, a_vpp), 103 VDESC_NO_OFFSET, 104 VOPARG_OFFSETOF(struct vop_lookup_args, a_cnp), 105 }; 106 int 107 VOP_LOOKUP(struct vnode *dvp, 108 struct vnode **vpp, 109 struct componentname *cnp) 110 { 111 int error; 112 bool mpsafe; 113 struct vop_lookup_args a; 114 a.a_desc = VDESC(vop_lookup); 115 a.a_dvp = dvp; 116 a.a_vpp = vpp; 117 a.a_cnp = cnp; 118 mpsafe = (dvp->v_vflag & VV_MPSAFE); 119 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 120 error = (VCALL(dvp, VOFFSET(vop_lookup), &a)); 121 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 122 #ifdef DIAGNOSTIC 123 if (error == 0) 124 KASSERT((*vpp)->v_size != VSIZENOTSET 125 && (*vpp)->v_writesize != VSIZENOTSET); 126 #endif /* DIAGNOSTIC */ 127 return error; 128 } 129 130 const int vop_create_vp_offsets[] = { 131 VOPARG_OFFSETOF(struct vop_create_args,a_dvp), 132 VDESC_NO_OFFSET 133 }; 134 const struct vnodeop_desc vop_create_desc = { 135 VOP_CREATE_DESCOFFSET, 136 "vop_create", 137 0 | VDESC_VP0_WILLPUT, 138 vop_create_vp_offsets, 139 VOPARG_OFFSETOF(struct vop_create_args, a_vpp), 140 VDESC_NO_OFFSET, 141 VOPARG_OFFSETOF(struct vop_create_args, a_cnp), 142 }; 143 int 144 VOP_CREATE(struct vnode *dvp, 145 struct vnode **vpp, 146 struct componentname *cnp, 147 struct vattr *vap) 148 { 149 int error; 150 bool mpsafe; 151 struct vop_create_args a; 152 a.a_desc = VDESC(vop_create); 153 a.a_dvp = dvp; 154 a.a_vpp = vpp; 155 a.a_cnp = cnp; 156 a.a_vap = vap; 157 mpsafe = (dvp->v_vflag & VV_MPSAFE); 158 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 159 error = (VCALL(dvp, VOFFSET(vop_create), &a)); 160 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 161 #ifdef DIAGNOSTIC 162 if (error == 0) 163 KASSERT((*vpp)->v_size != VSIZENOTSET 164 && (*vpp)->v_writesize != VSIZENOTSET); 165 #endif /* DIAGNOSTIC */ 166 return error; 167 } 168 169 const int vop_mknod_vp_offsets[] = { 170 VOPARG_OFFSETOF(struct vop_mknod_args,a_dvp), 171 VDESC_NO_OFFSET 172 }; 173 const struct vnodeop_desc vop_mknod_desc = { 174 VOP_MKNOD_DESCOFFSET, 175 "vop_mknod", 176 0 | VDESC_VP0_WILLPUT, 177 vop_mknod_vp_offsets, 178 VOPARG_OFFSETOF(struct vop_mknod_args, a_vpp), 179 VDESC_NO_OFFSET, 180 VOPARG_OFFSETOF(struct vop_mknod_args, a_cnp), 181 }; 182 int 183 VOP_MKNOD(struct vnode *dvp, 184 struct vnode **vpp, 185 struct componentname *cnp, 186 struct vattr *vap) 187 { 188 int error; 189 bool mpsafe; 190 struct vop_mknod_args a; 191 a.a_desc = VDESC(vop_mknod); 192 a.a_dvp = dvp; 193 a.a_vpp = vpp; 194 a.a_cnp = cnp; 195 a.a_vap = vap; 196 mpsafe = (dvp->v_vflag & VV_MPSAFE); 197 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 198 error = (VCALL(dvp, VOFFSET(vop_mknod), &a)); 199 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 200 #ifdef DIAGNOSTIC 201 if (error == 0) 202 KASSERT((*vpp)->v_size != VSIZENOTSET 203 && (*vpp)->v_writesize != VSIZENOTSET); 204 #endif /* DIAGNOSTIC */ 205 return error; 206 } 207 208 const int vop_open_vp_offsets[] = { 209 VOPARG_OFFSETOF(struct vop_open_args,a_vp), 210 VDESC_NO_OFFSET 211 }; 212 const struct vnodeop_desc vop_open_desc = { 213 VOP_OPEN_DESCOFFSET, 214 "vop_open", 215 0, 216 vop_open_vp_offsets, 217 VDESC_NO_OFFSET, 218 VOPARG_OFFSETOF(struct vop_open_args, a_cred), 219 VDESC_NO_OFFSET, 220 }; 221 int 222 VOP_OPEN(struct vnode *vp, 223 int mode, 224 kauth_cred_t cred) 225 { 226 int error; 227 bool mpsafe; 228 struct vop_open_args a; 229 a.a_desc = VDESC(vop_open); 230 a.a_vp = vp; 231 a.a_mode = mode; 232 a.a_cred = cred; 233 mpsafe = (vp->v_vflag & VV_MPSAFE); 234 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 235 error = (VCALL(vp, VOFFSET(vop_open), &a)); 236 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 237 return error; 238 } 239 240 const int vop_close_vp_offsets[] = { 241 VOPARG_OFFSETOF(struct vop_close_args,a_vp), 242 VDESC_NO_OFFSET 243 }; 244 const struct vnodeop_desc vop_close_desc = { 245 VOP_CLOSE_DESCOFFSET, 246 "vop_close", 247 0, 248 vop_close_vp_offsets, 249 VDESC_NO_OFFSET, 250 VOPARG_OFFSETOF(struct vop_close_args, a_cred), 251 VDESC_NO_OFFSET, 252 }; 253 int 254 VOP_CLOSE(struct vnode *vp, 255 int fflag, 256 kauth_cred_t cred) 257 { 258 int error; 259 bool mpsafe; 260 struct vop_close_args a; 261 a.a_desc = VDESC(vop_close); 262 a.a_vp = vp; 263 a.a_fflag = fflag; 264 a.a_cred = cred; 265 mpsafe = (vp->v_vflag & VV_MPSAFE); 266 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 267 error = (VCALL(vp, VOFFSET(vop_close), &a)); 268 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 269 return error; 270 } 271 272 const int vop_access_vp_offsets[] = { 273 VOPARG_OFFSETOF(struct vop_access_args,a_vp), 274 VDESC_NO_OFFSET 275 }; 276 const struct vnodeop_desc vop_access_desc = { 277 VOP_ACCESS_DESCOFFSET, 278 "vop_access", 279 0, 280 vop_access_vp_offsets, 281 VDESC_NO_OFFSET, 282 VOPARG_OFFSETOF(struct vop_access_args, a_cred), 283 VDESC_NO_OFFSET, 284 }; 285 int 286 VOP_ACCESS(struct vnode *vp, 287 int mode, 288 kauth_cred_t cred) 289 { 290 int error; 291 bool mpsafe; 292 struct vop_access_args a; 293 a.a_desc = VDESC(vop_access); 294 a.a_vp = vp; 295 a.a_mode = mode; 296 a.a_cred = cred; 297 mpsafe = (vp->v_vflag & VV_MPSAFE); 298 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 299 error = (VCALL(vp, VOFFSET(vop_access), &a)); 300 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 301 return error; 302 } 303 304 const int vop_getattr_vp_offsets[] = { 305 VOPARG_OFFSETOF(struct vop_getattr_args,a_vp), 306 VDESC_NO_OFFSET 307 }; 308 const struct vnodeop_desc vop_getattr_desc = { 309 VOP_GETATTR_DESCOFFSET, 310 "vop_getattr", 311 0, 312 vop_getattr_vp_offsets, 313 VDESC_NO_OFFSET, 314 VOPARG_OFFSETOF(struct vop_getattr_args, a_cred), 315 VDESC_NO_OFFSET, 316 }; 317 int 318 VOP_GETATTR(struct vnode *vp, 319 struct vattr *vap, 320 kauth_cred_t cred) 321 { 322 int error; 323 bool mpsafe; 324 struct vop_getattr_args a; 325 a.a_desc = VDESC(vop_getattr); 326 a.a_vp = vp; 327 a.a_vap = vap; 328 a.a_cred = cred; 329 mpsafe = (vp->v_vflag & VV_MPSAFE); 330 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 331 error = (VCALL(vp, VOFFSET(vop_getattr), &a)); 332 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 333 return error; 334 } 335 336 const int vop_setattr_vp_offsets[] = { 337 VOPARG_OFFSETOF(struct vop_setattr_args,a_vp), 338 VDESC_NO_OFFSET 339 }; 340 const struct vnodeop_desc vop_setattr_desc = { 341 VOP_SETATTR_DESCOFFSET, 342 "vop_setattr", 343 0, 344 vop_setattr_vp_offsets, 345 VDESC_NO_OFFSET, 346 VOPARG_OFFSETOF(struct vop_setattr_args, a_cred), 347 VDESC_NO_OFFSET, 348 }; 349 int 350 VOP_SETATTR(struct vnode *vp, 351 struct vattr *vap, 352 kauth_cred_t cred) 353 { 354 int error; 355 bool mpsafe; 356 struct vop_setattr_args a; 357 a.a_desc = VDESC(vop_setattr); 358 a.a_vp = vp; 359 a.a_vap = vap; 360 a.a_cred = cred; 361 mpsafe = (vp->v_vflag & VV_MPSAFE); 362 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 363 error = (VCALL(vp, VOFFSET(vop_setattr), &a)); 364 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 365 return error; 366 } 367 368 const int vop_read_vp_offsets[] = { 369 VOPARG_OFFSETOF(struct vop_read_args,a_vp), 370 VDESC_NO_OFFSET 371 }; 372 const struct vnodeop_desc vop_read_desc = { 373 VOP_READ_DESCOFFSET, 374 "vop_read", 375 0, 376 vop_read_vp_offsets, 377 VDESC_NO_OFFSET, 378 VOPARG_OFFSETOF(struct vop_read_args, a_cred), 379 VDESC_NO_OFFSET, 380 }; 381 int 382 VOP_READ(struct vnode *vp, 383 struct uio *uio, 384 int ioflag, 385 kauth_cred_t cred) 386 { 387 int error; 388 bool mpsafe; 389 struct vop_read_args a; 390 a.a_desc = VDESC(vop_read); 391 a.a_vp = vp; 392 a.a_uio = uio; 393 a.a_ioflag = ioflag; 394 a.a_cred = cred; 395 mpsafe = (vp->v_vflag & VV_MPSAFE); 396 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 397 error = (VCALL(vp, VOFFSET(vop_read), &a)); 398 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 399 return error; 400 } 401 402 const int vop_write_vp_offsets[] = { 403 VOPARG_OFFSETOF(struct vop_write_args,a_vp), 404 VDESC_NO_OFFSET 405 }; 406 const struct vnodeop_desc vop_write_desc = { 407 VOP_WRITE_DESCOFFSET, 408 "vop_write", 409 0, 410 vop_write_vp_offsets, 411 VDESC_NO_OFFSET, 412 VOPARG_OFFSETOF(struct vop_write_args, a_cred), 413 VDESC_NO_OFFSET, 414 }; 415 int 416 VOP_WRITE(struct vnode *vp, 417 struct uio *uio, 418 int ioflag, 419 kauth_cred_t cred) 420 { 421 int error; 422 bool mpsafe; 423 struct vop_write_args a; 424 a.a_desc = VDESC(vop_write); 425 a.a_vp = vp; 426 a.a_uio = uio; 427 a.a_ioflag = ioflag; 428 a.a_cred = cred; 429 mpsafe = (vp->v_vflag & VV_MPSAFE); 430 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 431 error = (VCALL(vp, VOFFSET(vop_write), &a)); 432 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 433 return error; 434 } 435 436 const int vop_ioctl_vp_offsets[] = { 437 VOPARG_OFFSETOF(struct vop_ioctl_args,a_vp), 438 VDESC_NO_OFFSET 439 }; 440 const struct vnodeop_desc vop_ioctl_desc = { 441 VOP_IOCTL_DESCOFFSET, 442 "vop_ioctl", 443 0, 444 vop_ioctl_vp_offsets, 445 VDESC_NO_OFFSET, 446 VOPARG_OFFSETOF(struct vop_ioctl_args, a_cred), 447 VDESC_NO_OFFSET, 448 }; 449 int 450 VOP_IOCTL(struct vnode *vp, 451 u_long command, 452 void *data, 453 int fflag, 454 kauth_cred_t cred) 455 { 456 int error; 457 bool mpsafe; 458 struct vop_ioctl_args a; 459 a.a_desc = VDESC(vop_ioctl); 460 a.a_vp = vp; 461 a.a_command = command; 462 a.a_data = data; 463 a.a_fflag = fflag; 464 a.a_cred = cred; 465 mpsafe = (vp->v_vflag & VV_MPSAFE); 466 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 467 error = (VCALL(vp, VOFFSET(vop_ioctl), &a)); 468 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 469 return error; 470 } 471 472 const int vop_fcntl_vp_offsets[] = { 473 VOPARG_OFFSETOF(struct vop_fcntl_args,a_vp), 474 VDESC_NO_OFFSET 475 }; 476 const struct vnodeop_desc vop_fcntl_desc = { 477 VOP_FCNTL_DESCOFFSET, 478 "vop_fcntl", 479 0, 480 vop_fcntl_vp_offsets, 481 VDESC_NO_OFFSET, 482 VOPARG_OFFSETOF(struct vop_fcntl_args, a_cred), 483 VDESC_NO_OFFSET, 484 }; 485 int 486 VOP_FCNTL(struct vnode *vp, 487 u_int command, 488 void *data, 489 int fflag, 490 kauth_cred_t cred) 491 { 492 int error; 493 bool mpsafe; 494 struct vop_fcntl_args a; 495 a.a_desc = VDESC(vop_fcntl); 496 a.a_vp = vp; 497 a.a_command = command; 498 a.a_data = data; 499 a.a_fflag = fflag; 500 a.a_cred = cred; 501 mpsafe = (vp->v_vflag & VV_MPSAFE); 502 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 503 error = (VCALL(vp, VOFFSET(vop_fcntl), &a)); 504 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 505 return error; 506 } 507 508 const int vop_poll_vp_offsets[] = { 509 VOPARG_OFFSETOF(struct vop_poll_args,a_vp), 510 VDESC_NO_OFFSET 511 }; 512 const struct vnodeop_desc vop_poll_desc = { 513 VOP_POLL_DESCOFFSET, 514 "vop_poll", 515 0, 516 vop_poll_vp_offsets, 517 VDESC_NO_OFFSET, 518 VDESC_NO_OFFSET, 519 VDESC_NO_OFFSET, 520 }; 521 int 522 VOP_POLL(struct vnode *vp, 523 int events) 524 { 525 int error; 526 bool mpsafe; 527 struct vop_poll_args a; 528 a.a_desc = VDESC(vop_poll); 529 a.a_vp = vp; 530 a.a_events = events; 531 mpsafe = (vp->v_vflag & VV_MPSAFE); 532 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 533 error = (VCALL(vp, VOFFSET(vop_poll), &a)); 534 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 535 return error; 536 } 537 538 const int vop_kqfilter_vp_offsets[] = { 539 VOPARG_OFFSETOF(struct vop_kqfilter_args,a_vp), 540 VDESC_NO_OFFSET 541 }; 542 const struct vnodeop_desc vop_kqfilter_desc = { 543 VOP_KQFILTER_DESCOFFSET, 544 "vop_kqfilter", 545 0, 546 vop_kqfilter_vp_offsets, 547 VDESC_NO_OFFSET, 548 VDESC_NO_OFFSET, 549 VDESC_NO_OFFSET, 550 }; 551 int 552 VOP_KQFILTER(struct vnode *vp, 553 struct knote *kn) 554 { 555 int error; 556 bool mpsafe; 557 struct vop_kqfilter_args a; 558 a.a_desc = VDESC(vop_kqfilter); 559 a.a_vp = vp; 560 a.a_kn = kn; 561 mpsafe = (vp->v_vflag & VV_MPSAFE); 562 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 563 error = (VCALL(vp, VOFFSET(vop_kqfilter), &a)); 564 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 565 return error; 566 } 567 568 const int vop_revoke_vp_offsets[] = { 569 VOPARG_OFFSETOF(struct vop_revoke_args,a_vp), 570 VDESC_NO_OFFSET 571 }; 572 const struct vnodeop_desc vop_revoke_desc = { 573 VOP_REVOKE_DESCOFFSET, 574 "vop_revoke", 575 0, 576 vop_revoke_vp_offsets, 577 VDESC_NO_OFFSET, 578 VDESC_NO_OFFSET, 579 VDESC_NO_OFFSET, 580 }; 581 int 582 VOP_REVOKE(struct vnode *vp, 583 int flags) 584 { 585 int error; 586 bool mpsafe; 587 struct vop_revoke_args a; 588 a.a_desc = VDESC(vop_revoke); 589 a.a_vp = vp; 590 a.a_flags = flags; 591 mpsafe = (vp->v_vflag & VV_MPSAFE); 592 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 593 error = (VCALL(vp, VOFFSET(vop_revoke), &a)); 594 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 595 return error; 596 } 597 598 const int vop_mmap_vp_offsets[] = { 599 VOPARG_OFFSETOF(struct vop_mmap_args,a_vp), 600 VDESC_NO_OFFSET 601 }; 602 const struct vnodeop_desc vop_mmap_desc = { 603 VOP_MMAP_DESCOFFSET, 604 "vop_mmap", 605 0, 606 vop_mmap_vp_offsets, 607 VDESC_NO_OFFSET, 608 VOPARG_OFFSETOF(struct vop_mmap_args, a_cred), 609 VDESC_NO_OFFSET, 610 }; 611 int 612 VOP_MMAP(struct vnode *vp, 613 vm_prot_t prot, 614 kauth_cred_t cred) 615 { 616 int error; 617 bool mpsafe; 618 struct vop_mmap_args a; 619 a.a_desc = VDESC(vop_mmap); 620 a.a_vp = vp; 621 a.a_prot = prot; 622 a.a_cred = cred; 623 mpsafe = (vp->v_vflag & VV_MPSAFE); 624 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 625 error = (VCALL(vp, VOFFSET(vop_mmap), &a)); 626 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 627 return error; 628 } 629 630 const int vop_fsync_vp_offsets[] = { 631 VOPARG_OFFSETOF(struct vop_fsync_args,a_vp), 632 VDESC_NO_OFFSET 633 }; 634 const struct vnodeop_desc vop_fsync_desc = { 635 VOP_FSYNC_DESCOFFSET, 636 "vop_fsync", 637 0, 638 vop_fsync_vp_offsets, 639 VDESC_NO_OFFSET, 640 VOPARG_OFFSETOF(struct vop_fsync_args, a_cred), 641 VDESC_NO_OFFSET, 642 }; 643 int 644 VOP_FSYNC(struct vnode *vp, 645 kauth_cred_t cred, 646 int flags, 647 off_t offlo, 648 off_t offhi) 649 { 650 int error; 651 bool mpsafe; 652 struct vop_fsync_args a; 653 a.a_desc = VDESC(vop_fsync); 654 a.a_vp = vp; 655 a.a_cred = cred; 656 a.a_flags = flags; 657 a.a_offlo = offlo; 658 a.a_offhi = offhi; 659 mpsafe = (vp->v_vflag & VV_MPSAFE); 660 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 661 error = (VCALL(vp, VOFFSET(vop_fsync), &a)); 662 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 663 return error; 664 } 665 666 const int vop_seek_vp_offsets[] = { 667 VOPARG_OFFSETOF(struct vop_seek_args,a_vp), 668 VDESC_NO_OFFSET 669 }; 670 const struct vnodeop_desc vop_seek_desc = { 671 VOP_SEEK_DESCOFFSET, 672 "vop_seek", 673 0, 674 vop_seek_vp_offsets, 675 VDESC_NO_OFFSET, 676 VOPARG_OFFSETOF(struct vop_seek_args, a_cred), 677 VDESC_NO_OFFSET, 678 }; 679 int 680 VOP_SEEK(struct vnode *vp, 681 off_t oldoff, 682 off_t newoff, 683 kauth_cred_t cred) 684 { 685 int error; 686 bool mpsafe; 687 struct vop_seek_args a; 688 a.a_desc = VDESC(vop_seek); 689 a.a_vp = vp; 690 a.a_oldoff = oldoff; 691 a.a_newoff = newoff; 692 a.a_cred = cred; 693 mpsafe = (vp->v_vflag & VV_MPSAFE); 694 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 695 error = (VCALL(vp, VOFFSET(vop_seek), &a)); 696 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 697 return error; 698 } 699 700 const int vop_remove_vp_offsets[] = { 701 VOPARG_OFFSETOF(struct vop_remove_args,a_dvp), 702 VOPARG_OFFSETOF(struct vop_remove_args,a_vp), 703 VDESC_NO_OFFSET 704 }; 705 const struct vnodeop_desc vop_remove_desc = { 706 VOP_REMOVE_DESCOFFSET, 707 "vop_remove", 708 0 | VDESC_VP0_WILLPUT | VDESC_VP1_WILLPUT, 709 vop_remove_vp_offsets, 710 VDESC_NO_OFFSET, 711 VDESC_NO_OFFSET, 712 VOPARG_OFFSETOF(struct vop_remove_args, a_cnp), 713 }; 714 int 715 VOP_REMOVE(struct vnode *dvp, 716 struct vnode *vp, 717 struct componentname *cnp) 718 { 719 int error; 720 bool mpsafe; 721 struct vop_remove_args a; 722 a.a_desc = VDESC(vop_remove); 723 a.a_dvp = dvp; 724 a.a_vp = vp; 725 a.a_cnp = cnp; 726 mpsafe = (dvp->v_vflag & VV_MPSAFE); 727 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 728 error = (VCALL(dvp, VOFFSET(vop_remove), &a)); 729 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 730 return error; 731 } 732 733 const int vop_link_vp_offsets[] = { 734 VOPARG_OFFSETOF(struct vop_link_args,a_dvp), 735 VOPARG_OFFSETOF(struct vop_link_args,a_vp), 736 VDESC_NO_OFFSET 737 }; 738 const struct vnodeop_desc vop_link_desc = { 739 VOP_LINK_DESCOFFSET, 740 "vop_link", 741 0 | VDESC_VP0_WILLPUT, 742 vop_link_vp_offsets, 743 VDESC_NO_OFFSET, 744 VDESC_NO_OFFSET, 745 VOPARG_OFFSETOF(struct vop_link_args, a_cnp), 746 }; 747 int 748 VOP_LINK(struct vnode *dvp, 749 struct vnode *vp, 750 struct componentname *cnp) 751 { 752 int error; 753 bool mpsafe; 754 struct vop_link_args a; 755 a.a_desc = VDESC(vop_link); 756 a.a_dvp = dvp; 757 a.a_vp = vp; 758 a.a_cnp = cnp; 759 mpsafe = (dvp->v_vflag & VV_MPSAFE); 760 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 761 error = (VCALL(dvp, VOFFSET(vop_link), &a)); 762 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 763 return error; 764 } 765 766 const int vop_rename_vp_offsets[] = { 767 VOPARG_OFFSETOF(struct vop_rename_args,a_fdvp), 768 VOPARG_OFFSETOF(struct vop_rename_args,a_fvp), 769 VOPARG_OFFSETOF(struct vop_rename_args,a_tdvp), 770 VOPARG_OFFSETOF(struct vop_rename_args,a_tvp), 771 VDESC_NO_OFFSET 772 }; 773 const struct vnodeop_desc vop_rename_desc = { 774 VOP_RENAME_DESCOFFSET, 775 "vop_rename", 776 0 | VDESC_VP0_WILLRELE | VDESC_VP1_WILLRELE | VDESC_VP2_WILLPUT | VDESC_VP3_WILLPUT, 777 vop_rename_vp_offsets, 778 VDESC_NO_OFFSET, 779 VDESC_NO_OFFSET, 780 VOPARG_OFFSETOF(struct vop_rename_args, a_fcnp), 781 }; 782 int 783 VOP_RENAME(struct vnode *fdvp, 784 struct vnode *fvp, 785 struct componentname *fcnp, 786 struct vnode *tdvp, 787 struct vnode *tvp, 788 struct componentname *tcnp) 789 { 790 int error; 791 bool mpsafe; 792 struct vop_rename_args a; 793 a.a_desc = VDESC(vop_rename); 794 a.a_fdvp = fdvp; 795 a.a_fvp = fvp; 796 a.a_fcnp = fcnp; 797 a.a_tdvp = tdvp; 798 a.a_tvp = tvp; 799 a.a_tcnp = tcnp; 800 mpsafe = (fdvp->v_vflag & VV_MPSAFE); 801 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 802 error = (VCALL(fdvp, VOFFSET(vop_rename), &a)); 803 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 804 return error; 805 } 806 807 const int vop_mkdir_vp_offsets[] = { 808 VOPARG_OFFSETOF(struct vop_mkdir_args,a_dvp), 809 VDESC_NO_OFFSET 810 }; 811 const struct vnodeop_desc vop_mkdir_desc = { 812 VOP_MKDIR_DESCOFFSET, 813 "vop_mkdir", 814 0 | VDESC_VP0_WILLPUT, 815 vop_mkdir_vp_offsets, 816 VOPARG_OFFSETOF(struct vop_mkdir_args, a_vpp), 817 VDESC_NO_OFFSET, 818 VOPARG_OFFSETOF(struct vop_mkdir_args, a_cnp), 819 }; 820 int 821 VOP_MKDIR(struct vnode *dvp, 822 struct vnode **vpp, 823 struct componentname *cnp, 824 struct vattr *vap) 825 { 826 int error; 827 bool mpsafe; 828 struct vop_mkdir_args a; 829 a.a_desc = VDESC(vop_mkdir); 830 a.a_dvp = dvp; 831 a.a_vpp = vpp; 832 a.a_cnp = cnp; 833 a.a_vap = vap; 834 mpsafe = (dvp->v_vflag & VV_MPSAFE); 835 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 836 error = (VCALL(dvp, VOFFSET(vop_mkdir), &a)); 837 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 838 #ifdef DIAGNOSTIC 839 if (error == 0) 840 KASSERT((*vpp)->v_size != VSIZENOTSET 841 && (*vpp)->v_writesize != VSIZENOTSET); 842 #endif /* DIAGNOSTIC */ 843 return error; 844 } 845 846 const int vop_rmdir_vp_offsets[] = { 847 VOPARG_OFFSETOF(struct vop_rmdir_args,a_dvp), 848 VOPARG_OFFSETOF(struct vop_rmdir_args,a_vp), 849 VDESC_NO_OFFSET 850 }; 851 const struct vnodeop_desc vop_rmdir_desc = { 852 VOP_RMDIR_DESCOFFSET, 853 "vop_rmdir", 854 0 | VDESC_VP0_WILLPUT | VDESC_VP1_WILLPUT, 855 vop_rmdir_vp_offsets, 856 VDESC_NO_OFFSET, 857 VDESC_NO_OFFSET, 858 VOPARG_OFFSETOF(struct vop_rmdir_args, a_cnp), 859 }; 860 int 861 VOP_RMDIR(struct vnode *dvp, 862 struct vnode *vp, 863 struct componentname *cnp) 864 { 865 int error; 866 bool mpsafe; 867 struct vop_rmdir_args a; 868 a.a_desc = VDESC(vop_rmdir); 869 a.a_dvp = dvp; 870 a.a_vp = vp; 871 a.a_cnp = cnp; 872 mpsafe = (dvp->v_vflag & VV_MPSAFE); 873 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 874 error = (VCALL(dvp, VOFFSET(vop_rmdir), &a)); 875 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 876 return error; 877 } 878 879 const int vop_symlink_vp_offsets[] = { 880 VOPARG_OFFSETOF(struct vop_symlink_args,a_dvp), 881 VDESC_NO_OFFSET 882 }; 883 const struct vnodeop_desc vop_symlink_desc = { 884 VOP_SYMLINK_DESCOFFSET, 885 "vop_symlink", 886 0 | VDESC_VP0_WILLPUT, 887 vop_symlink_vp_offsets, 888 VOPARG_OFFSETOF(struct vop_symlink_args, a_vpp), 889 VDESC_NO_OFFSET, 890 VOPARG_OFFSETOF(struct vop_symlink_args, a_cnp), 891 }; 892 int 893 VOP_SYMLINK(struct vnode *dvp, 894 struct vnode **vpp, 895 struct componentname *cnp, 896 struct vattr *vap, 897 char *target) 898 { 899 int error; 900 bool mpsafe; 901 struct vop_symlink_args a; 902 a.a_desc = VDESC(vop_symlink); 903 a.a_dvp = dvp; 904 a.a_vpp = vpp; 905 a.a_cnp = cnp; 906 a.a_vap = vap; 907 a.a_target = target; 908 mpsafe = (dvp->v_vflag & VV_MPSAFE); 909 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 910 error = (VCALL(dvp, VOFFSET(vop_symlink), &a)); 911 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 912 #ifdef DIAGNOSTIC 913 if (error == 0) 914 KASSERT((*vpp)->v_size != VSIZENOTSET 915 && (*vpp)->v_writesize != VSIZENOTSET); 916 #endif /* DIAGNOSTIC */ 917 return error; 918 } 919 920 const int vop_readdir_vp_offsets[] = { 921 VOPARG_OFFSETOF(struct vop_readdir_args,a_vp), 922 VDESC_NO_OFFSET 923 }; 924 const struct vnodeop_desc vop_readdir_desc = { 925 VOP_READDIR_DESCOFFSET, 926 "vop_readdir", 927 0, 928 vop_readdir_vp_offsets, 929 VDESC_NO_OFFSET, 930 VOPARG_OFFSETOF(struct vop_readdir_args, a_cred), 931 VDESC_NO_OFFSET, 932 }; 933 int 934 VOP_READDIR(struct vnode *vp, 935 struct uio *uio, 936 kauth_cred_t cred, 937 int *eofflag, 938 off_t **cookies, 939 int *ncookies) 940 { 941 int error; 942 bool mpsafe; 943 struct vop_readdir_args a; 944 a.a_desc = VDESC(vop_readdir); 945 a.a_vp = vp; 946 a.a_uio = uio; 947 a.a_cred = cred; 948 a.a_eofflag = eofflag; 949 a.a_cookies = cookies; 950 a.a_ncookies = ncookies; 951 mpsafe = (vp->v_vflag & VV_MPSAFE); 952 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 953 error = (VCALL(vp, VOFFSET(vop_readdir), &a)); 954 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 955 return error; 956 } 957 958 const int vop_readlink_vp_offsets[] = { 959 VOPARG_OFFSETOF(struct vop_readlink_args,a_vp), 960 VDESC_NO_OFFSET 961 }; 962 const struct vnodeop_desc vop_readlink_desc = { 963 VOP_READLINK_DESCOFFSET, 964 "vop_readlink", 965 0, 966 vop_readlink_vp_offsets, 967 VDESC_NO_OFFSET, 968 VOPARG_OFFSETOF(struct vop_readlink_args, a_cred), 969 VDESC_NO_OFFSET, 970 }; 971 int 972 VOP_READLINK(struct vnode *vp, 973 struct uio *uio, 974 kauth_cred_t cred) 975 { 976 int error; 977 bool mpsafe; 978 struct vop_readlink_args a; 979 a.a_desc = VDESC(vop_readlink); 980 a.a_vp = vp; 981 a.a_uio = uio; 982 a.a_cred = cred; 983 mpsafe = (vp->v_vflag & VV_MPSAFE); 984 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 985 error = (VCALL(vp, VOFFSET(vop_readlink), &a)); 986 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 987 return error; 988 } 989 990 const int vop_abortop_vp_offsets[] = { 991 VOPARG_OFFSETOF(struct vop_abortop_args,a_dvp), 992 VDESC_NO_OFFSET 993 }; 994 const struct vnodeop_desc vop_abortop_desc = { 995 VOP_ABORTOP_DESCOFFSET, 996 "vop_abortop", 997 0, 998 vop_abortop_vp_offsets, 999 VDESC_NO_OFFSET, 1000 VDESC_NO_OFFSET, 1001 VOPARG_OFFSETOF(struct vop_abortop_args, a_cnp), 1002 }; 1003 int 1004 VOP_ABORTOP(struct vnode *dvp, 1005 struct componentname *cnp) 1006 { 1007 int error; 1008 bool mpsafe; 1009 struct vop_abortop_args a; 1010 a.a_desc = VDESC(vop_abortop); 1011 a.a_dvp = dvp; 1012 a.a_cnp = cnp; 1013 mpsafe = (dvp->v_vflag & VV_MPSAFE); 1014 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1015 error = (VCALL(dvp, VOFFSET(vop_abortop), &a)); 1016 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1017 return error; 1018 } 1019 1020 const int vop_inactive_vp_offsets[] = { 1021 VOPARG_OFFSETOF(struct vop_inactive_args,a_vp), 1022 VDESC_NO_OFFSET 1023 }; 1024 const struct vnodeop_desc vop_inactive_desc = { 1025 VOP_INACTIVE_DESCOFFSET, 1026 "vop_inactive", 1027 0 | VDESC_VP0_WILLUNLOCK, 1028 vop_inactive_vp_offsets, 1029 VDESC_NO_OFFSET, 1030 VDESC_NO_OFFSET, 1031 VDESC_NO_OFFSET, 1032 }; 1033 int 1034 VOP_INACTIVE(struct vnode *vp, 1035 bool *recycle) 1036 { 1037 int error; 1038 bool mpsafe; 1039 struct vop_inactive_args a; 1040 a.a_desc = VDESC(vop_inactive); 1041 a.a_vp = vp; 1042 a.a_recycle = recycle; 1043 mpsafe = (vp->v_vflag & VV_MPSAFE); 1044 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1045 error = (VCALL(vp, VOFFSET(vop_inactive), &a)); 1046 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1047 return error; 1048 } 1049 1050 const int vop_reclaim_vp_offsets[] = { 1051 VOPARG_OFFSETOF(struct vop_reclaim_args,a_vp), 1052 VDESC_NO_OFFSET 1053 }; 1054 const struct vnodeop_desc vop_reclaim_desc = { 1055 VOP_RECLAIM_DESCOFFSET, 1056 "vop_reclaim", 1057 0, 1058 vop_reclaim_vp_offsets, 1059 VDESC_NO_OFFSET, 1060 VDESC_NO_OFFSET, 1061 VDESC_NO_OFFSET, 1062 }; 1063 int 1064 VOP_RECLAIM(struct vnode *vp) 1065 { 1066 int error; 1067 bool mpsafe; 1068 struct vop_reclaim_args a; 1069 a.a_desc = VDESC(vop_reclaim); 1070 a.a_vp = vp; 1071 mpsafe = (vp->v_vflag & VV_MPSAFE); 1072 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1073 error = (VCALL(vp, VOFFSET(vop_reclaim), &a)); 1074 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1075 return error; 1076 } 1077 1078 const int vop_lock_vp_offsets[] = { 1079 VOPARG_OFFSETOF(struct vop_lock_args,a_vp), 1080 VDESC_NO_OFFSET 1081 }; 1082 const struct vnodeop_desc vop_lock_desc = { 1083 VOP_LOCK_DESCOFFSET, 1084 "vop_lock", 1085 0, 1086 vop_lock_vp_offsets, 1087 VDESC_NO_OFFSET, 1088 VDESC_NO_OFFSET, 1089 VDESC_NO_OFFSET, 1090 }; 1091 int 1092 VOP_LOCK(struct vnode *vp, 1093 int flags) 1094 { 1095 int error; 1096 bool mpsafe; 1097 struct vop_lock_args a; 1098 a.a_desc = VDESC(vop_lock); 1099 a.a_vp = vp; 1100 a.a_flags = flags; 1101 mpsafe = (vp->v_vflag & VV_MPSAFE); 1102 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1103 error = (VCALL(vp, VOFFSET(vop_lock), &a)); 1104 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1105 return error; 1106 } 1107 1108 const int vop_unlock_vp_offsets[] = { 1109 VOPARG_OFFSETOF(struct vop_unlock_args,a_vp), 1110 VDESC_NO_OFFSET 1111 }; 1112 const struct vnodeop_desc vop_unlock_desc = { 1113 VOP_UNLOCK_DESCOFFSET, 1114 "vop_unlock", 1115 0, 1116 vop_unlock_vp_offsets, 1117 VDESC_NO_OFFSET, 1118 VDESC_NO_OFFSET, 1119 VDESC_NO_OFFSET, 1120 }; 1121 int 1122 VOP_UNLOCK(struct vnode *vp) 1123 { 1124 int error; 1125 bool mpsafe; 1126 struct vop_unlock_args a; 1127 a.a_desc = VDESC(vop_unlock); 1128 a.a_vp = vp; 1129 mpsafe = (vp->v_vflag & VV_MPSAFE); 1130 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1131 error = (VCALL(vp, VOFFSET(vop_unlock), &a)); 1132 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1133 return error; 1134 } 1135 1136 const int vop_bmap_vp_offsets[] = { 1137 VOPARG_OFFSETOF(struct vop_bmap_args,a_vp), 1138 VDESC_NO_OFFSET 1139 }; 1140 const struct vnodeop_desc vop_bmap_desc = { 1141 VOP_BMAP_DESCOFFSET, 1142 "vop_bmap", 1143 0, 1144 vop_bmap_vp_offsets, 1145 VOPARG_OFFSETOF(struct vop_bmap_args, a_vpp), 1146 VDESC_NO_OFFSET, 1147 VDESC_NO_OFFSET, 1148 }; 1149 int 1150 VOP_BMAP(struct vnode *vp, 1151 daddr_t bn, 1152 struct vnode **vpp, 1153 daddr_t *bnp, 1154 int *runp) 1155 { 1156 int error; 1157 bool mpsafe; 1158 struct vop_bmap_args a; 1159 a.a_desc = VDESC(vop_bmap); 1160 a.a_vp = vp; 1161 a.a_bn = bn; 1162 a.a_vpp = vpp; 1163 a.a_bnp = bnp; 1164 a.a_runp = runp; 1165 mpsafe = (vp->v_vflag & VV_MPSAFE); 1166 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1167 error = (VCALL(vp, VOFFSET(vop_bmap), &a)); 1168 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1169 return error; 1170 } 1171 1172 const int vop_strategy_vp_offsets[] = { 1173 VOPARG_OFFSETOF(struct vop_strategy_args,a_vp), 1174 VDESC_NO_OFFSET 1175 }; 1176 const struct vnodeop_desc vop_strategy_desc = { 1177 VOP_STRATEGY_DESCOFFSET, 1178 "vop_strategy", 1179 0, 1180 vop_strategy_vp_offsets, 1181 VDESC_NO_OFFSET, 1182 VDESC_NO_OFFSET, 1183 VDESC_NO_OFFSET, 1184 }; 1185 int 1186 VOP_STRATEGY(struct vnode *vp, 1187 struct buf *bp) 1188 { 1189 int error; 1190 bool mpsafe; 1191 struct vop_strategy_args a; 1192 a.a_desc = VDESC(vop_strategy); 1193 a.a_vp = vp; 1194 a.a_bp = bp; 1195 mpsafe = (vp->v_vflag & VV_MPSAFE); 1196 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1197 error = (VCALL(vp, VOFFSET(vop_strategy), &a)); 1198 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1199 return error; 1200 } 1201 1202 const int vop_print_vp_offsets[] = { 1203 VOPARG_OFFSETOF(struct vop_print_args,a_vp), 1204 VDESC_NO_OFFSET 1205 }; 1206 const struct vnodeop_desc vop_print_desc = { 1207 VOP_PRINT_DESCOFFSET, 1208 "vop_print", 1209 0, 1210 vop_print_vp_offsets, 1211 VDESC_NO_OFFSET, 1212 VDESC_NO_OFFSET, 1213 VDESC_NO_OFFSET, 1214 }; 1215 int 1216 VOP_PRINT(struct vnode *vp) 1217 { 1218 int error; 1219 bool mpsafe; 1220 struct vop_print_args a; 1221 a.a_desc = VDESC(vop_print); 1222 a.a_vp = vp; 1223 mpsafe = (vp->v_vflag & VV_MPSAFE); 1224 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1225 error = (VCALL(vp, VOFFSET(vop_print), &a)); 1226 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1227 return error; 1228 } 1229 1230 const int vop_islocked_vp_offsets[] = { 1231 VOPARG_OFFSETOF(struct vop_islocked_args,a_vp), 1232 VDESC_NO_OFFSET 1233 }; 1234 const struct vnodeop_desc vop_islocked_desc = { 1235 VOP_ISLOCKED_DESCOFFSET, 1236 "vop_islocked", 1237 0, 1238 vop_islocked_vp_offsets, 1239 VDESC_NO_OFFSET, 1240 VDESC_NO_OFFSET, 1241 VDESC_NO_OFFSET, 1242 }; 1243 int 1244 VOP_ISLOCKED(struct vnode *vp) 1245 { 1246 int error; 1247 bool mpsafe; 1248 struct vop_islocked_args a; 1249 a.a_desc = VDESC(vop_islocked); 1250 a.a_vp = vp; 1251 mpsafe = (vp->v_vflag & VV_MPSAFE); 1252 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1253 error = (VCALL(vp, VOFFSET(vop_islocked), &a)); 1254 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1255 return error; 1256 } 1257 1258 const int vop_pathconf_vp_offsets[] = { 1259 VOPARG_OFFSETOF(struct vop_pathconf_args,a_vp), 1260 VDESC_NO_OFFSET 1261 }; 1262 const struct vnodeop_desc vop_pathconf_desc = { 1263 VOP_PATHCONF_DESCOFFSET, 1264 "vop_pathconf", 1265 0, 1266 vop_pathconf_vp_offsets, 1267 VDESC_NO_OFFSET, 1268 VDESC_NO_OFFSET, 1269 VDESC_NO_OFFSET, 1270 }; 1271 int 1272 VOP_PATHCONF(struct vnode *vp, 1273 int name, 1274 register_t *retval) 1275 { 1276 int error; 1277 bool mpsafe; 1278 struct vop_pathconf_args a; 1279 a.a_desc = VDESC(vop_pathconf); 1280 a.a_vp = vp; 1281 a.a_name = name; 1282 a.a_retval = retval; 1283 mpsafe = (vp->v_vflag & VV_MPSAFE); 1284 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1285 error = (VCALL(vp, VOFFSET(vop_pathconf), &a)); 1286 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1287 return error; 1288 } 1289 1290 const int vop_advlock_vp_offsets[] = { 1291 VOPARG_OFFSETOF(struct vop_advlock_args,a_vp), 1292 VDESC_NO_OFFSET 1293 }; 1294 const struct vnodeop_desc vop_advlock_desc = { 1295 VOP_ADVLOCK_DESCOFFSET, 1296 "vop_advlock", 1297 0, 1298 vop_advlock_vp_offsets, 1299 VDESC_NO_OFFSET, 1300 VDESC_NO_OFFSET, 1301 VDESC_NO_OFFSET, 1302 }; 1303 int 1304 VOP_ADVLOCK(struct vnode *vp, 1305 void *id, 1306 int op, 1307 struct flock *fl, 1308 int flags) 1309 { 1310 int error; 1311 bool mpsafe; 1312 struct vop_advlock_args a; 1313 a.a_desc = VDESC(vop_advlock); 1314 a.a_vp = vp; 1315 a.a_id = id; 1316 a.a_op = op; 1317 a.a_fl = fl; 1318 a.a_flags = flags; 1319 mpsafe = (vp->v_vflag & VV_MPSAFE); 1320 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1321 error = (VCALL(vp, VOFFSET(vop_advlock), &a)); 1322 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1323 return error; 1324 } 1325 1326 const int vop_whiteout_vp_offsets[] = { 1327 VOPARG_OFFSETOF(struct vop_whiteout_args,a_dvp), 1328 VDESC_NO_OFFSET 1329 }; 1330 const struct vnodeop_desc vop_whiteout_desc = { 1331 VOP_WHITEOUT_DESCOFFSET, 1332 "vop_whiteout", 1333 0, 1334 vop_whiteout_vp_offsets, 1335 VDESC_NO_OFFSET, 1336 VDESC_NO_OFFSET, 1337 VOPARG_OFFSETOF(struct vop_whiteout_args, a_cnp), 1338 }; 1339 int 1340 VOP_WHITEOUT(struct vnode *dvp, 1341 struct componentname *cnp, 1342 int flags) 1343 { 1344 int error; 1345 bool mpsafe; 1346 struct vop_whiteout_args a; 1347 a.a_desc = VDESC(vop_whiteout); 1348 a.a_dvp = dvp; 1349 a.a_cnp = cnp; 1350 a.a_flags = flags; 1351 mpsafe = (dvp->v_vflag & VV_MPSAFE); 1352 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1353 error = (VCALL(dvp, VOFFSET(vop_whiteout), &a)); 1354 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1355 return error; 1356 } 1357 1358 const int vop_getpages_vp_offsets[] = { 1359 VOPARG_OFFSETOF(struct vop_getpages_args,a_vp), 1360 VDESC_NO_OFFSET 1361 }; 1362 const struct vnodeop_desc vop_getpages_desc = { 1363 VOP_GETPAGES_DESCOFFSET, 1364 "vop_getpages", 1365 0, 1366 vop_getpages_vp_offsets, 1367 VDESC_NO_OFFSET, 1368 VDESC_NO_OFFSET, 1369 VDESC_NO_OFFSET, 1370 }; 1371 int 1372 VOP_GETPAGES(struct vnode *vp, 1373 voff_t offset, 1374 struct vm_page **m, 1375 int *count, 1376 int centeridx, 1377 vm_prot_t access_type, 1378 int advice, 1379 int flags) 1380 { 1381 int error; 1382 bool mpsafe; 1383 struct vop_getpages_args a; 1384 a.a_desc = VDESC(vop_getpages); 1385 a.a_vp = vp; 1386 a.a_offset = offset; 1387 a.a_m = m; 1388 a.a_count = count; 1389 a.a_centeridx = centeridx; 1390 a.a_access_type = access_type; 1391 a.a_advice = advice; 1392 a.a_flags = flags; 1393 mpsafe = (vp->v_vflag & VV_MPSAFE); 1394 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1395 error = (VCALL(vp, VOFFSET(vop_getpages), &a)); 1396 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1397 return error; 1398 } 1399 1400 const int vop_putpages_vp_offsets[] = { 1401 VOPARG_OFFSETOF(struct vop_putpages_args,a_vp), 1402 VDESC_NO_OFFSET 1403 }; 1404 const struct vnodeop_desc vop_putpages_desc = { 1405 VOP_PUTPAGES_DESCOFFSET, 1406 "vop_putpages", 1407 0, 1408 vop_putpages_vp_offsets, 1409 VDESC_NO_OFFSET, 1410 VDESC_NO_OFFSET, 1411 VDESC_NO_OFFSET, 1412 }; 1413 int 1414 VOP_PUTPAGES(struct vnode *vp, 1415 voff_t offlo, 1416 voff_t offhi, 1417 int flags) 1418 { 1419 int error; 1420 bool mpsafe; 1421 struct vop_putpages_args a; 1422 a.a_desc = VDESC(vop_putpages); 1423 a.a_vp = vp; 1424 a.a_offlo = offlo; 1425 a.a_offhi = offhi; 1426 a.a_flags = flags; 1427 mpsafe = (vp->v_vflag & VV_MPSAFE); 1428 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1429 error = (VCALL(vp, VOFFSET(vop_putpages), &a)); 1430 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1431 return error; 1432 } 1433 1434 const int vop_closeextattr_vp_offsets[] = { 1435 VOPARG_OFFSETOF(struct vop_closeextattr_args,a_vp), 1436 VDESC_NO_OFFSET 1437 }; 1438 const struct vnodeop_desc vop_closeextattr_desc = { 1439 VOP_CLOSEEXTATTR_DESCOFFSET, 1440 "vop_closeextattr", 1441 0, 1442 vop_closeextattr_vp_offsets, 1443 VDESC_NO_OFFSET, 1444 VOPARG_OFFSETOF(struct vop_closeextattr_args, a_cred), 1445 VDESC_NO_OFFSET, 1446 }; 1447 int 1448 VOP_CLOSEEXTATTR(struct vnode *vp, 1449 int commit, 1450 kauth_cred_t cred) 1451 { 1452 int error; 1453 bool mpsafe; 1454 struct vop_closeextattr_args a; 1455 a.a_desc = VDESC(vop_closeextattr); 1456 a.a_vp = vp; 1457 a.a_commit = commit; 1458 a.a_cred = cred; 1459 mpsafe = (vp->v_vflag & VV_MPSAFE); 1460 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1461 error = (VCALL(vp, VOFFSET(vop_closeextattr), &a)); 1462 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1463 return error; 1464 } 1465 1466 const int vop_getextattr_vp_offsets[] = { 1467 VOPARG_OFFSETOF(struct vop_getextattr_args,a_vp), 1468 VDESC_NO_OFFSET 1469 }; 1470 const struct vnodeop_desc vop_getextattr_desc = { 1471 VOP_GETEXTATTR_DESCOFFSET, 1472 "vop_getextattr", 1473 0, 1474 vop_getextattr_vp_offsets, 1475 VDESC_NO_OFFSET, 1476 VOPARG_OFFSETOF(struct vop_getextattr_args, a_cred), 1477 VDESC_NO_OFFSET, 1478 }; 1479 int 1480 VOP_GETEXTATTR(struct vnode *vp, 1481 int attrnamespace, 1482 const char *name, 1483 struct uio *uio, 1484 size_t *size, 1485 kauth_cred_t cred) 1486 { 1487 int error; 1488 bool mpsafe; 1489 struct vop_getextattr_args a; 1490 a.a_desc = VDESC(vop_getextattr); 1491 a.a_vp = vp; 1492 a.a_attrnamespace = attrnamespace; 1493 a.a_name = name; 1494 a.a_uio = uio; 1495 a.a_size = size; 1496 a.a_cred = cred; 1497 mpsafe = (vp->v_vflag & VV_MPSAFE); 1498 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1499 error = (VCALL(vp, VOFFSET(vop_getextattr), &a)); 1500 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1501 return error; 1502 } 1503 1504 const int vop_listextattr_vp_offsets[] = { 1505 VOPARG_OFFSETOF(struct vop_listextattr_args,a_vp), 1506 VDESC_NO_OFFSET 1507 }; 1508 const struct vnodeop_desc vop_listextattr_desc = { 1509 VOP_LISTEXTATTR_DESCOFFSET, 1510 "vop_listextattr", 1511 0, 1512 vop_listextattr_vp_offsets, 1513 VDESC_NO_OFFSET, 1514 VOPARG_OFFSETOF(struct vop_listextattr_args, a_cred), 1515 VDESC_NO_OFFSET, 1516 }; 1517 int 1518 VOP_LISTEXTATTR(struct vnode *vp, 1519 int attrnamespace, 1520 struct uio *uio, 1521 size_t *size, 1522 kauth_cred_t cred) 1523 { 1524 int error; 1525 bool mpsafe; 1526 struct vop_listextattr_args a; 1527 a.a_desc = VDESC(vop_listextattr); 1528 a.a_vp = vp; 1529 a.a_attrnamespace = attrnamespace; 1530 a.a_uio = uio; 1531 a.a_size = size; 1532 a.a_cred = cred; 1533 mpsafe = (vp->v_vflag & VV_MPSAFE); 1534 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1535 error = (VCALL(vp, VOFFSET(vop_listextattr), &a)); 1536 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1537 return error; 1538 } 1539 1540 const int vop_openextattr_vp_offsets[] = { 1541 VOPARG_OFFSETOF(struct vop_openextattr_args,a_vp), 1542 VDESC_NO_OFFSET 1543 }; 1544 const struct vnodeop_desc vop_openextattr_desc = { 1545 VOP_OPENEXTATTR_DESCOFFSET, 1546 "vop_openextattr", 1547 0, 1548 vop_openextattr_vp_offsets, 1549 VDESC_NO_OFFSET, 1550 VOPARG_OFFSETOF(struct vop_openextattr_args, a_cred), 1551 VDESC_NO_OFFSET, 1552 }; 1553 int 1554 VOP_OPENEXTATTR(struct vnode *vp, 1555 kauth_cred_t cred) 1556 { 1557 int error; 1558 bool mpsafe; 1559 struct vop_openextattr_args a; 1560 a.a_desc = VDESC(vop_openextattr); 1561 a.a_vp = vp; 1562 a.a_cred = cred; 1563 mpsafe = (vp->v_vflag & VV_MPSAFE); 1564 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1565 error = (VCALL(vp, VOFFSET(vop_openextattr), &a)); 1566 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1567 return error; 1568 } 1569 1570 const int vop_deleteextattr_vp_offsets[] = { 1571 VOPARG_OFFSETOF(struct vop_deleteextattr_args,a_vp), 1572 VDESC_NO_OFFSET 1573 }; 1574 const struct vnodeop_desc vop_deleteextattr_desc = { 1575 VOP_DELETEEXTATTR_DESCOFFSET, 1576 "vop_deleteextattr", 1577 0, 1578 vop_deleteextattr_vp_offsets, 1579 VDESC_NO_OFFSET, 1580 VOPARG_OFFSETOF(struct vop_deleteextattr_args, a_cred), 1581 VDESC_NO_OFFSET, 1582 }; 1583 int 1584 VOP_DELETEEXTATTR(struct vnode *vp, 1585 int attrnamespace, 1586 const char *name, 1587 kauth_cred_t cred) 1588 { 1589 int error; 1590 bool mpsafe; 1591 struct vop_deleteextattr_args a; 1592 a.a_desc = VDESC(vop_deleteextattr); 1593 a.a_vp = vp; 1594 a.a_attrnamespace = attrnamespace; 1595 a.a_name = name; 1596 a.a_cred = cred; 1597 mpsafe = (vp->v_vflag & VV_MPSAFE); 1598 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1599 error = (VCALL(vp, VOFFSET(vop_deleteextattr), &a)); 1600 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1601 return error; 1602 } 1603 1604 const int vop_setextattr_vp_offsets[] = { 1605 VOPARG_OFFSETOF(struct vop_setextattr_args,a_vp), 1606 VDESC_NO_OFFSET 1607 }; 1608 const struct vnodeop_desc vop_setextattr_desc = { 1609 VOP_SETEXTATTR_DESCOFFSET, 1610 "vop_setextattr", 1611 0, 1612 vop_setextattr_vp_offsets, 1613 VDESC_NO_OFFSET, 1614 VOPARG_OFFSETOF(struct vop_setextattr_args, a_cred), 1615 VDESC_NO_OFFSET, 1616 }; 1617 int 1618 VOP_SETEXTATTR(struct vnode *vp, 1619 int attrnamespace, 1620 const char *name, 1621 struct uio *uio, 1622 kauth_cred_t cred) 1623 { 1624 int error; 1625 bool mpsafe; 1626 struct vop_setextattr_args a; 1627 a.a_desc = VDESC(vop_setextattr); 1628 a.a_vp = vp; 1629 a.a_attrnamespace = attrnamespace; 1630 a.a_name = name; 1631 a.a_uio = uio; 1632 a.a_cred = cred; 1633 mpsafe = (vp->v_vflag & VV_MPSAFE); 1634 if (!mpsafe) { KERNEL_LOCK(1, curlwp); } 1635 error = (VCALL(vp, VOFFSET(vop_setextattr), &a)); 1636 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } 1637 return error; 1638 } 1639 1640 const struct vnodeop_desc * const vfs_op_descs[] = { 1641 &vop_default_desc, /* MUST BE FIRST */ 1642 &vop_bwrite_desc, /* XXX: SPECIAL CASE */ 1643 1644 &vop_lookup_desc, 1645 &vop_create_desc, 1646 &vop_mknod_desc, 1647 &vop_open_desc, 1648 &vop_close_desc, 1649 &vop_access_desc, 1650 &vop_getattr_desc, 1651 &vop_setattr_desc, 1652 &vop_read_desc, 1653 &vop_write_desc, 1654 &vop_ioctl_desc, 1655 &vop_fcntl_desc, 1656 &vop_poll_desc, 1657 &vop_kqfilter_desc, 1658 &vop_revoke_desc, 1659 &vop_mmap_desc, 1660 &vop_fsync_desc, 1661 &vop_seek_desc, 1662 &vop_remove_desc, 1663 &vop_link_desc, 1664 &vop_rename_desc, 1665 &vop_mkdir_desc, 1666 &vop_rmdir_desc, 1667 &vop_symlink_desc, 1668 &vop_readdir_desc, 1669 &vop_readlink_desc, 1670 &vop_abortop_desc, 1671 &vop_inactive_desc, 1672 &vop_reclaim_desc, 1673 &vop_lock_desc, 1674 &vop_unlock_desc, 1675 &vop_bmap_desc, 1676 &vop_strategy_desc, 1677 &vop_print_desc, 1678 &vop_islocked_desc, 1679 &vop_pathconf_desc, 1680 &vop_advlock_desc, 1681 &vop_whiteout_desc, 1682 &vop_getpages_desc, 1683 &vop_putpages_desc, 1684 &vop_closeextattr_desc, 1685 &vop_getextattr_desc, 1686 &vop_listextattr_desc, 1687 &vop_openextattr_desc, 1688 &vop_deleteextattr_desc, 1689 &vop_setextattr_desc, 1690 NULL 1691 }; 1692