1 /* 2 * Copyright (c) 1992, 1993, 1994 The Regents of the University of California. 3 * Copyright (c) 1992, 1993, 1994 Jan-Simon Pendry. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Jan-Simon Pendry. 8 * 9 * %sccs.include.redist.c% 10 * 11 * @(#)union_vnops.c 8.21 (Berkeley) 09/29/94 12 */ 13 14 #include <sys/param.h> 15 #include <sys/systm.h> 16 #include <sys/proc.h> 17 #include <sys/file.h> 18 #include <sys/time.h> 19 #include <sys/stat.h> 20 #include <sys/types.h> 21 #include <sys/vnode.h> 22 #include <sys/mount.h> 23 #include <sys/namei.h> 24 #include <sys/malloc.h> 25 #include <sys/buf.h> 26 #include <sys/queue.h> 27 #include <miscfs/union/union.h> 28 29 #define FIXUP(un) { \ 30 if (((un)->un_flags & UN_ULOCK) == 0) { \ 31 union_fixup(un); \ 32 } \ 33 } 34 35 static void 36 union_fixup(un) 37 struct union_node *un; 38 { 39 40 VOP_LOCK(un->un_uppervp); 41 un->un_flags |= UN_ULOCK; 42 } 43 44 static int 45 union_lookup1(udvp, dvpp, vpp, cnp) 46 struct vnode *udvp; 47 struct vnode **dvpp; 48 struct vnode **vpp; 49 struct componentname *cnp; 50 { 51 int error; 52 struct vnode *tdvp; 53 struct vnode *dvp; 54 struct mount *mp; 55 56 dvp = *dvpp; 57 58 /* 59 * If stepping up the directory tree, check for going 60 * back across the mount point, in which case do what 61 * lookup would do by stepping back down the mount 62 * hierarchy. 63 */ 64 if (cnp->cn_flags & ISDOTDOT) { 65 while ((dvp != udvp) && (dvp->v_flag & VROOT)) { 66 /* 67 * Don't do the NOCROSSMOUNT check 68 * at this level. By definition, 69 * union fs deals with namespaces, not 70 * filesystems. 71 */ 72 tdvp = dvp; 73 *dvpp = dvp = dvp->v_mount->mnt_vnodecovered; 74 vput(tdvp); 75 VREF(dvp); 76 VOP_LOCK(dvp); 77 } 78 } 79 80 error = VOP_LOOKUP(dvp, &tdvp, cnp); 81 if (error) 82 return (error); 83 84 /* 85 * The parent directory will have been unlocked, unless lookup 86 * found the last component. In which case, re-lock the node 87 * here to allow it to be unlocked again (phew) in union_lookup. 88 */ 89 if (dvp != tdvp && !(cnp->cn_flags & ISLASTCN)) 90 VOP_LOCK(dvp); 91 92 dvp = tdvp; 93 94 /* 95 * Lastly check if the current node is a mount point in 96 * which case walk up the mount hierarchy making sure not to 97 * bump into the root of the mount tree (ie. dvp != udvp). 98 */ 99 while (dvp != udvp && (dvp->v_type == VDIR) && 100 (mp = dvp->v_mountedhere)) { 101 102 if (mp->mnt_flag & MNT_MLOCK) { 103 mp->mnt_flag |= MNT_MWAIT; 104 sleep((caddr_t) mp, PVFS); 105 continue; 106 } 107 108 if (error = VFS_ROOT(mp, &tdvp)) { 109 vput(dvp); 110 return (error); 111 } 112 113 vput(dvp); 114 dvp = tdvp; 115 } 116 117 *vpp = dvp; 118 return (0); 119 } 120 121 int 122 union_lookup(ap) 123 struct vop_lookup_args /* { 124 struct vnodeop_desc *a_desc; 125 struct vnode *a_dvp; 126 struct vnode **a_vpp; 127 struct componentname *a_cnp; 128 } */ *ap; 129 { 130 int error; 131 int uerror, lerror; 132 struct vnode *uppervp, *lowervp; 133 struct vnode *upperdvp, *lowerdvp; 134 struct vnode *dvp = ap->a_dvp; 135 struct union_node *dun = VTOUNION(dvp); 136 struct componentname *cnp = ap->a_cnp; 137 int lockparent = cnp->cn_flags & LOCKPARENT; 138 int rdonly = cnp->cn_flags & RDONLY; 139 struct union_mount *um = MOUNTTOUNIONMOUNT(dvp->v_mount); 140 struct ucred *saved_cred; 141 int iswhiteout; 142 struct vattr va; 143 144 #ifdef notyet 145 if (cnp->cn_namelen == 3 && 146 cnp->cn_nameptr[2] == '.' && 147 cnp->cn_nameptr[1] == '.' && 148 cnp->cn_nameptr[0] == '.') { 149 dvp = *ap->a_vpp = LOWERVP(ap->a_dvp); 150 if (dvp == NULLVP) 151 return (ENOENT); 152 VREF(dvp); 153 VOP_LOCK(dvp); 154 if (!lockparent || !(cnp->cn_flags & ISLASTCN)) 155 VOP_UNLOCK(ap->a_dvp); 156 return (0); 157 } 158 #endif 159 160 cnp->cn_flags |= LOCKPARENT; 161 162 upperdvp = dun->un_uppervp; 163 lowerdvp = dun->un_lowervp; 164 uppervp = NULLVP; 165 lowervp = NULLVP; 166 iswhiteout = 0; 167 168 /* 169 * do the lookup in the upper level. 170 * if that level comsumes additional pathnames, 171 * then assume that something special is going 172 * on and just return that vnode. 173 */ 174 if (upperdvp != NULLVP) { 175 FIXUP(dun); 176 uerror = union_lookup1(um->um_uppervp, &upperdvp, 177 &uppervp, cnp); 178 /*if (uppervp == upperdvp) 179 dun->un_flags |= UN_KLOCK;*/ 180 181 if (cnp->cn_consume != 0) { 182 *ap->a_vpp = uppervp; 183 if (!lockparent) 184 cnp->cn_flags &= ~LOCKPARENT; 185 return (uerror); 186 } 187 if (uerror == ENOENT || uerror == EJUSTRETURN) { 188 if (cnp->cn_flags & ISWHITEOUT) { 189 iswhiteout = 1; 190 } else if (lowerdvp != NULLVP) { 191 lerror = VOP_GETATTR(upperdvp, &va, 192 cnp->cn_cred, cnp->cn_proc); 193 if (lerror == 0 && (va.va_flags & OPAQUE)) 194 iswhiteout = 1; 195 } 196 } 197 } else { 198 uerror = ENOENT; 199 } 200 201 /* 202 * in a similar way to the upper layer, do the lookup 203 * in the lower layer. this time, if there is some 204 * component magic going on, then vput whatever we got 205 * back from the upper layer and return the lower vnode 206 * instead. 207 */ 208 if (lowerdvp != NULLVP && !iswhiteout) { 209 int nameiop; 210 211 VOP_LOCK(lowerdvp); 212 213 /* 214 * Only do a LOOKUP on the bottom node, since 215 * we won't be making changes to it anyway. 216 */ 217 nameiop = cnp->cn_nameiop; 218 cnp->cn_nameiop = LOOKUP; 219 if (um->um_op == UNMNT_BELOW) { 220 saved_cred = cnp->cn_cred; 221 cnp->cn_cred = um->um_cred; 222 } 223 lerror = union_lookup1(um->um_lowervp, &lowerdvp, 224 &lowervp, cnp); 225 if (um->um_op == UNMNT_BELOW) 226 cnp->cn_cred = saved_cred; 227 cnp->cn_nameiop = nameiop; 228 229 if (lowervp != lowerdvp) 230 VOP_UNLOCK(lowerdvp); 231 232 if (cnp->cn_consume != 0) { 233 if (uppervp != NULLVP) { 234 if (uppervp == upperdvp) 235 vrele(uppervp); 236 else 237 vput(uppervp); 238 uppervp = NULLVP; 239 } 240 *ap->a_vpp = lowervp; 241 if (!lockparent) 242 cnp->cn_flags &= ~LOCKPARENT; 243 return (lerror); 244 } 245 } else { 246 lerror = ENOENT; 247 if ((cnp->cn_flags & ISDOTDOT) && dun->un_pvp != NULLVP) { 248 lowervp = LOWERVP(dun->un_pvp); 249 if (lowervp != NULLVP) { 250 VREF(lowervp); 251 VOP_LOCK(lowervp); 252 lerror = 0; 253 } 254 } 255 } 256 257 if (!lockparent) 258 cnp->cn_flags &= ~LOCKPARENT; 259 260 /* 261 * at this point, we have uerror and lerror indicating 262 * possible errors with the lookups in the upper and lower 263 * layers. additionally, uppervp and lowervp are (locked) 264 * references to existing vnodes in the upper and lower layers. 265 * 266 * there are now three cases to consider. 267 * 1. if both layers returned an error, then return whatever 268 * error the upper layer generated. 269 * 270 * 2. if the top layer failed and the bottom layer succeeded 271 * then two subcases occur. 272 * a. the bottom vnode is not a directory, in which 273 * case just return a new union vnode referencing 274 * an empty top layer and the existing bottom layer. 275 * b. the bottom vnode is a directory, in which case 276 * create a new directory in the top-level and 277 * continue as in case 3. 278 * 279 * 3. if the top layer succeeded then return a new union 280 * vnode referencing whatever the new top layer and 281 * whatever the bottom layer returned. 282 */ 283 284 *ap->a_vpp = NULLVP; 285 286 /* case 1. */ 287 if ((uerror != 0) && (lerror != 0)) { 288 return (uerror); 289 } 290 291 /* case 2. */ 292 if (uerror != 0 /* && (lerror == 0) */ ) { 293 if (lowervp->v_type == VDIR) { /* case 2b. */ 294 dun->un_flags &= ~UN_ULOCK; 295 VOP_UNLOCK(upperdvp); 296 uerror = union_mkshadow(um, upperdvp, cnp, &uppervp); 297 VOP_LOCK(upperdvp); 298 dun->un_flags |= UN_ULOCK; 299 300 if (uerror) { 301 if (lowervp != NULLVP) { 302 vput(lowervp); 303 lowervp = NULLVP; 304 } 305 return (uerror); 306 } 307 } 308 } 309 310 if (lowervp != NULLVP) 311 VOP_UNLOCK(lowervp); 312 313 error = union_allocvp(ap->a_vpp, dvp->v_mount, dvp, upperdvp, cnp, 314 uppervp, lowervp); 315 316 if (error) { 317 if (uppervp != NULLVP) 318 vput(uppervp); 319 if (lowervp != NULLVP) 320 vrele(lowervp); 321 } else { 322 if (*ap->a_vpp != dvp) 323 if (!lockparent || !(cnp->cn_flags & ISLASTCN)) 324 VOP_UNLOCK(dvp); 325 } 326 327 return (error); 328 } 329 330 int 331 union_create(ap) 332 struct vop_create_args /* { 333 struct vnode *a_dvp; 334 struct vnode **a_vpp; 335 struct componentname *a_cnp; 336 struct vattr *a_vap; 337 } */ *ap; 338 { 339 struct union_node *un = VTOUNION(ap->a_dvp); 340 struct vnode *dvp = un->un_uppervp; 341 342 if (dvp != NULLVP) { 343 int error; 344 struct vnode *vp; 345 346 FIXUP(un); 347 348 VREF(dvp); 349 un->un_flags |= UN_KLOCK; 350 vput(ap->a_dvp); 351 error = VOP_CREATE(dvp, &vp, ap->a_cnp, ap->a_vap); 352 if (error) 353 return (error); 354 355 error = union_allocvp( 356 ap->a_vpp, 357 ap->a_dvp->v_mount, 358 ap->a_dvp, 359 NULLVP, 360 ap->a_cnp, 361 vp, 362 NULLVP); 363 if (error) 364 vput(vp); 365 return (error); 366 } 367 368 vput(ap->a_dvp); 369 return (EROFS); 370 } 371 372 int 373 union_whiteout(ap) 374 struct vop_whiteout_args /* { 375 struct vnode *a_dvp; 376 struct componentname *a_cnp; 377 int a_flags; 378 } */ *ap; 379 { 380 struct union_node *un = VTOUNION(ap->a_dvp); 381 382 if (un->un_uppervp == NULLVP) 383 return (EOPNOTSUPP); 384 385 FIXUP(un); 386 return (VOP_WHITEOUT(un->un_uppervp, ap->a_cnp, ap->a_flags)); 387 } 388 389 int 390 union_mknod(ap) 391 struct vop_mknod_args /* { 392 struct vnode *a_dvp; 393 struct vnode **a_vpp; 394 struct componentname *a_cnp; 395 struct vattr *a_vap; 396 } */ *ap; 397 { 398 struct union_node *un = VTOUNION(ap->a_dvp); 399 struct vnode *dvp = un->un_uppervp; 400 401 if (dvp != NULLVP) { 402 int error; 403 struct vnode *vp; 404 405 FIXUP(un); 406 407 VREF(dvp); 408 un->un_flags |= UN_KLOCK; 409 vput(ap->a_dvp); 410 error = VOP_MKNOD(dvp, &vp, ap->a_cnp, ap->a_vap); 411 if (error) 412 return (error); 413 414 if (vp != NULLVP) { 415 error = union_allocvp( 416 ap->a_vpp, 417 ap->a_dvp->v_mount, 418 ap->a_dvp, 419 NULLVP, 420 ap->a_cnp, 421 vp, 422 NULLVP); 423 if (error) 424 vput(vp); 425 } 426 return (error); 427 } 428 429 vput(ap->a_dvp); 430 return (EROFS); 431 } 432 433 int 434 union_open(ap) 435 struct vop_open_args /* { 436 struct vnodeop_desc *a_desc; 437 struct vnode *a_vp; 438 int a_mode; 439 struct ucred *a_cred; 440 struct proc *a_p; 441 } */ *ap; 442 { 443 struct union_node *un = VTOUNION(ap->a_vp); 444 struct vnode *tvp; 445 int mode = ap->a_mode; 446 struct ucred *cred = ap->a_cred; 447 struct proc *p = ap->a_p; 448 int error; 449 450 /* 451 * If there is an existing upper vp then simply open that. 452 */ 453 tvp = un->un_uppervp; 454 if (tvp == NULLVP) { 455 /* 456 * If the lower vnode is being opened for writing, then 457 * copy the file contents to the upper vnode and open that, 458 * otherwise can simply open the lower vnode. 459 */ 460 tvp = un->un_lowervp; 461 if ((ap->a_mode & FWRITE) && (tvp->v_type == VREG)) { 462 error = union_copyup(un, (mode&O_TRUNC) == 0, cred, p); 463 if (error == 0) 464 error = VOP_OPEN(un->un_uppervp, mode, cred, p); 465 return (error); 466 } 467 468 /* 469 * Just open the lower vnode 470 */ 471 un->un_openl++; 472 VOP_LOCK(tvp); 473 error = VOP_OPEN(tvp, mode, cred, p); 474 VOP_UNLOCK(tvp); 475 476 return (error); 477 } 478 479 FIXUP(un); 480 481 error = VOP_OPEN(tvp, mode, cred, p); 482 483 return (error); 484 } 485 486 int 487 union_close(ap) 488 struct vop_close_args /* { 489 struct vnode *a_vp; 490 int a_fflag; 491 struct ucred *a_cred; 492 struct proc *a_p; 493 } */ *ap; 494 { 495 struct union_node *un = VTOUNION(ap->a_vp); 496 struct vnode *vp; 497 498 if (un->un_uppervp != NULLVP) { 499 vp = un->un_uppervp; 500 } else { 501 #ifdef UNION_DIAGNOSTIC 502 if (un->un_openl <= 0) 503 panic("union: un_openl cnt"); 504 #endif 505 --un->un_openl; 506 vp = un->un_lowervp; 507 } 508 509 return (VOP_CLOSE(vp, ap->a_fflag, ap->a_cred, ap->a_p)); 510 } 511 512 /* 513 * Check access permission on the union vnode. 514 * The access check being enforced is to check 515 * against both the underlying vnode, and any 516 * copied vnode. This ensures that no additional 517 * file permissions are given away simply because 518 * the user caused an implicit file copy. 519 */ 520 int 521 union_access(ap) 522 struct vop_access_args /* { 523 struct vnodeop_desc *a_desc; 524 struct vnode *a_vp; 525 int a_mode; 526 struct ucred *a_cred; 527 struct proc *a_p; 528 } */ *ap; 529 { 530 struct union_node *un = VTOUNION(ap->a_vp); 531 int error = EACCES; 532 struct vnode *vp; 533 534 if ((vp = un->un_uppervp) != NULLVP) { 535 FIXUP(un); 536 return (VOP_ACCESS(vp, ap->a_mode, ap->a_cred, ap->a_p)); 537 } 538 539 if ((vp = un->un_lowervp) != NULLVP) { 540 VOP_LOCK(vp); 541 error = VOP_ACCESS(vp, ap->a_mode, ap->a_cred, ap->a_p); 542 if (error == 0) { 543 struct union_mount *um = MOUNTTOUNIONMOUNT(vp->v_mount); 544 545 if (um->um_op == UNMNT_BELOW) 546 error = VOP_ACCESS(vp, ap->a_mode, 547 um->um_cred, ap->a_p); 548 } 549 VOP_UNLOCK(vp); 550 if (error) 551 return (error); 552 } 553 554 return (error); 555 } 556 557 /* 558 * We handle getattr only to change the fsid and 559 * track object sizes 560 */ 561 int 562 union_getattr(ap) 563 struct vop_getattr_args /* { 564 struct vnode *a_vp; 565 struct vattr *a_vap; 566 struct ucred *a_cred; 567 struct proc *a_p; 568 } */ *ap; 569 { 570 int error; 571 struct union_node *un = VTOUNION(ap->a_vp); 572 struct vnode *vp = un->un_uppervp; 573 struct vattr *vap; 574 struct vattr va; 575 576 577 /* 578 * Some programs walk the filesystem hierarchy by counting 579 * links to directories to avoid stat'ing all the time. 580 * This means the link count on directories needs to be "correct". 581 * The only way to do that is to call getattr on both layers 582 * and fix up the link count. The link count will not necessarily 583 * be accurate but will be large enough to defeat the tree walkers. 584 */ 585 586 vap = ap->a_vap; 587 588 vp = un->un_uppervp; 589 if (vp != NULLVP) { 590 /* 591 * It's not clear whether VOP_GETATTR is to be 592 * called with the vnode locked or not. stat() calls 593 * it with (vp) locked, and fstat calls it with 594 * (vp) unlocked. 595 * In the mean time, compensate here by checking 596 * the union_node's lock flag. 597 */ 598 if (un->un_flags & UN_LOCKED) 599 FIXUP(un); 600 601 error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p); 602 if (error) 603 return (error); 604 union_newsize(ap->a_vp, vap->va_size, VNOVAL); 605 } 606 607 if (vp == NULLVP) { 608 vp = un->un_lowervp; 609 } else if (vp->v_type == VDIR) { 610 vp = un->un_lowervp; 611 vap = &va; 612 } else { 613 vp = NULLVP; 614 } 615 616 if (vp != NULLVP) { 617 VOP_LOCK(vp); 618 error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p); 619 VOP_UNLOCK(vp); 620 if (error) 621 return (error); 622 union_newsize(ap->a_vp, VNOVAL, vap->va_size); 623 } 624 625 if ((vap != ap->a_vap) && (vap->va_type == VDIR)) 626 ap->a_vap->va_nlink += vap->va_nlink; 627 628 ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0]; 629 return (0); 630 } 631 632 int 633 union_setattr(ap) 634 struct vop_setattr_args /* { 635 struct vnode *a_vp; 636 struct vattr *a_vap; 637 struct ucred *a_cred; 638 struct proc *a_p; 639 } */ *ap; 640 { 641 struct union_node *un = VTOUNION(ap->a_vp); 642 int error; 643 644 /* 645 * Handle case of truncating lower object to zero size, 646 * by creating a zero length upper object. This is to 647 * handle the case of open with O_TRUNC and O_CREAT. 648 */ 649 if ((un->un_uppervp == NULLVP) && 650 /* assert(un->un_lowervp != NULLVP) */ 651 (un->un_lowervp->v_type == VREG)) { 652 error = union_copyup(un, (ap->a_vap->va_size != 0), 653 ap->a_cred, ap->a_p); 654 if (error) 655 return (error); 656 } 657 658 /* 659 * Try to set attributes in upper layer, 660 * otherwise return read-only filesystem error. 661 */ 662 if (un->un_uppervp != NULLVP) { 663 FIXUP(un); 664 error = VOP_SETATTR(un->un_uppervp, ap->a_vap, 665 ap->a_cred, ap->a_p); 666 if ((error == 0) && (ap->a_vap->va_size != VNOVAL)) 667 union_newsize(ap->a_vp, ap->a_vap->va_size, VNOVAL); 668 } else { 669 error = EROFS; 670 } 671 672 return (error); 673 } 674 675 int 676 union_read(ap) 677 struct vop_read_args /* { 678 struct vnode *a_vp; 679 struct uio *a_uio; 680 int a_ioflag; 681 struct ucred *a_cred; 682 } */ *ap; 683 { 684 int error; 685 struct vnode *vp = OTHERVP(ap->a_vp); 686 int dolock = (vp == LOWERVP(ap->a_vp)); 687 688 if (dolock) 689 VOP_LOCK(vp); 690 else 691 FIXUP(VTOUNION(ap->a_vp)); 692 error = VOP_READ(vp, ap->a_uio, ap->a_ioflag, ap->a_cred); 693 if (dolock) 694 VOP_UNLOCK(vp); 695 696 /* 697 * XXX 698 * perhaps the size of the underlying object has changed under 699 * our feet. take advantage of the offset information present 700 * in the uio structure. 701 */ 702 if (error == 0) { 703 struct union_node *un = VTOUNION(ap->a_vp); 704 off_t cur = ap->a_uio->uio_offset; 705 706 if (vp == un->un_uppervp) { 707 if (cur > un->un_uppersz) 708 union_newsize(ap->a_vp, cur, VNOVAL); 709 } else { 710 if (cur > un->un_lowersz) 711 union_newsize(ap->a_vp, VNOVAL, cur); 712 } 713 } 714 715 return (error); 716 } 717 718 int 719 union_write(ap) 720 struct vop_read_args /* { 721 struct vnode *a_vp; 722 struct uio *a_uio; 723 int a_ioflag; 724 struct ucred *a_cred; 725 } */ *ap; 726 { 727 int error; 728 struct vnode *vp; 729 struct union_node *un = VTOUNION(ap->a_vp); 730 731 vp = UPPERVP(ap->a_vp); 732 if (vp == NULLVP) 733 panic("union: missing upper layer in write"); 734 735 FIXUP(un); 736 error = VOP_WRITE(vp, ap->a_uio, ap->a_ioflag, ap->a_cred); 737 738 /* 739 * the size of the underlying object may be changed by the 740 * write. 741 */ 742 if (error == 0) { 743 off_t cur = ap->a_uio->uio_offset; 744 745 if (cur > un->un_uppersz) 746 union_newsize(ap->a_vp, cur, VNOVAL); 747 } 748 749 return (error); 750 } 751 752 union_lease(ap) 753 struct vop_lease_args /* { 754 struct vnode *a_vp; 755 struct proc *a_p; 756 struct ucred *a_cred; 757 int a_flag; 758 } */ *ap; 759 { 760 761 return (VOP_LEASE(OTHERVP(ap->a_vp), ap->a_p, ap->a_cred, ap->a_flag)); 762 } 763 764 int 765 union_ioctl(ap) 766 struct vop_ioctl_args /* { 767 struct vnode *a_vp; 768 int a_command; 769 caddr_t a_data; 770 int a_fflag; 771 struct ucred *a_cred; 772 struct proc *a_p; 773 } */ *ap; 774 { 775 776 return (VOP_IOCTL(OTHERVP(ap->a_vp), ap->a_command, ap->a_data, 777 ap->a_fflag, ap->a_cred, ap->a_p)); 778 } 779 780 int 781 union_select(ap) 782 struct vop_select_args /* { 783 struct vnode *a_vp; 784 int a_which; 785 int a_fflags; 786 struct ucred *a_cred; 787 struct proc *a_p; 788 } */ *ap; 789 { 790 791 return (VOP_SELECT(OTHERVP(ap->a_vp), ap->a_which, ap->a_fflags, 792 ap->a_cred, ap->a_p)); 793 } 794 795 int 796 union_mmap(ap) 797 struct vop_mmap_args /* { 798 struct vnode *a_vp; 799 int a_fflags; 800 struct ucred *a_cred; 801 struct proc *a_p; 802 } */ *ap; 803 { 804 805 return (VOP_MMAP(OTHERVP(ap->a_vp), ap->a_fflags, 806 ap->a_cred, ap->a_p)); 807 } 808 809 int 810 union_fsync(ap) 811 struct vop_fsync_args /* { 812 struct vnode *a_vp; 813 struct ucred *a_cred; 814 int a_waitfor; 815 struct proc *a_p; 816 } */ *ap; 817 { 818 int error = 0; 819 struct vnode *targetvp = OTHERVP(ap->a_vp); 820 821 if (targetvp != NULLVP) { 822 int dolock = (targetvp == LOWERVP(ap->a_vp)); 823 824 if (dolock) 825 VOP_LOCK(targetvp); 826 else 827 FIXUP(VTOUNION(ap->a_vp)); 828 error = VOP_FSYNC(targetvp, ap->a_cred, 829 ap->a_waitfor, ap->a_p); 830 if (dolock) 831 VOP_UNLOCK(targetvp); 832 } 833 834 return (error); 835 } 836 837 int 838 union_seek(ap) 839 struct vop_seek_args /* { 840 struct vnode *a_vp; 841 off_t a_oldoff; 842 off_t a_newoff; 843 struct ucred *a_cred; 844 } */ *ap; 845 { 846 847 return (VOP_SEEK(OTHERVP(ap->a_vp), ap->a_oldoff, ap->a_newoff, ap->a_cred)); 848 } 849 850 int 851 union_remove(ap) 852 struct vop_remove_args /* { 853 struct vnode *a_dvp; 854 struct vnode *a_vp; 855 struct componentname *a_cnp; 856 } */ *ap; 857 { 858 int error; 859 struct union_node *dun = VTOUNION(ap->a_dvp); 860 struct union_node *un = VTOUNION(ap->a_vp); 861 862 if (dun->un_uppervp == NULLVP) 863 panic("union remove: null upper vnode"); 864 865 if (un->un_uppervp != NULLVP) { 866 struct vnode *dvp = dun->un_uppervp; 867 struct vnode *vp = un->un_uppervp; 868 struct componentname *cnp = ap->a_cnp; 869 870 FIXUP(dun); 871 VREF(dvp); 872 dun->un_flags |= UN_KLOCK; 873 vput(ap->a_dvp); 874 FIXUP(un); 875 VREF(vp); 876 un->un_flags |= UN_KLOCK; 877 vput(ap->a_vp); 878 879 if (union_dowhiteout(un, cnp->cn_cred, cnp->cn_proc)) 880 cnp->cn_flags |= DOWHITEOUT; 881 error = VOP_REMOVE(dvp, vp, cnp); 882 if (!error) 883 union_removed_upper(un); 884 } else { 885 FIXUP(dun); 886 error = union_mkwhiteout( 887 MOUNTTOUNIONMOUNT(UNIONTOV(dun)->v_mount), 888 dun->un_uppervp, ap->a_cnp, un->un_path); 889 vput(ap->a_dvp); 890 vput(ap->a_vp); 891 } 892 893 return (error); 894 } 895 896 int 897 union_link(ap) 898 struct vop_link_args /* { 899 struct vnode *a_vp; 900 struct vnode *a_tdvp; 901 struct componentname *a_cnp; 902 } */ *ap; 903 { 904 int error = 0; 905 struct union_node *un; 906 struct vnode *vp; 907 struct vnode *tdvp; 908 909 un = VTOUNION(ap->a_vp); 910 911 if (ap->a_vp->v_op != ap->a_tdvp->v_op) { 912 tdvp = ap->a_tdvp; 913 } else { 914 struct union_node *tdun = VTOUNION(ap->a_tdvp); 915 if (tdun->un_uppervp == NULLVP) { 916 VOP_LOCK(ap->a_tdvp); 917 if (un->un_uppervp == tdun->un_dirvp) { 918 un->un_flags &= ~UN_ULOCK; 919 VOP_UNLOCK(un->un_uppervp); 920 } 921 error = union_copyup(tdun, 1, ap->a_cnp->cn_cred, 922 ap->a_cnp->cn_proc); 923 if (un->un_uppervp == tdun->un_dirvp) { 924 VOP_LOCK(un->un_uppervp); 925 un->un_flags |= UN_ULOCK; 926 } 927 VOP_UNLOCK(ap->a_tdvp); 928 } 929 tdvp = tdun->un_uppervp; 930 } 931 932 vp = un->un_uppervp; 933 if (vp == NULLVP) 934 error = EROFS; 935 936 if (error) { 937 vput(ap->a_vp); 938 return (error); 939 } 940 941 FIXUP(un); 942 VREF(vp); 943 un->un_flags |= UN_KLOCK; 944 vput(ap->a_vp); 945 946 return (VOP_LINK(vp, tdvp, ap->a_cnp)); 947 } 948 949 int 950 union_rename(ap) 951 struct vop_rename_args /* { 952 struct vnode *a_fdvp; 953 struct vnode *a_fvp; 954 struct componentname *a_fcnp; 955 struct vnode *a_tdvp; 956 struct vnode *a_tvp; 957 struct componentname *a_tcnp; 958 } */ *ap; 959 { 960 int error; 961 962 struct vnode *fdvp = ap->a_fdvp; 963 struct vnode *fvp = ap->a_fvp; 964 struct vnode *tdvp = ap->a_tdvp; 965 struct vnode *tvp = ap->a_tvp; 966 967 if (fdvp->v_op == union_vnodeop_p) { /* always true */ 968 struct union_node *un = VTOUNION(fdvp); 969 if (un->un_uppervp == NULLVP) { 970 /* 971 * this should never happen in normal 972 * operation but might if there was 973 * a problem creating the top-level shadow 974 * directory. 975 */ 976 error = EXDEV; 977 goto bad; 978 } 979 980 fdvp = un->un_uppervp; 981 VREF(fdvp); 982 vrele(ap->a_fdvp); 983 } 984 985 if (fvp->v_op == union_vnodeop_p) { /* always true */ 986 struct union_node *un = VTOUNION(fvp); 987 if (un->un_uppervp == NULLVP) { 988 /* XXX: should do a copyup */ 989 error = EXDEV; 990 goto bad; 991 } 992 993 if (un->un_lowervp != NULLVP) 994 ap->a_fcnp->cn_flags |= DOWHITEOUT; 995 996 fvp = un->un_uppervp; 997 VREF(fvp); 998 vrele(ap->a_fvp); 999 } 1000 1001 if (tdvp->v_op == union_vnodeop_p) { 1002 struct union_node *un = VTOUNION(tdvp); 1003 if (un->un_uppervp == NULLVP) { 1004 /* 1005 * this should never happen in normal 1006 * operation but might if there was 1007 * a problem creating the top-level shadow 1008 * directory. 1009 */ 1010 error = EXDEV; 1011 goto bad; 1012 } 1013 1014 tdvp = un->un_uppervp; 1015 VREF(tdvp); 1016 un->un_flags |= UN_KLOCK; 1017 vput(ap->a_tdvp); 1018 } 1019 1020 if (tvp != NULLVP && tvp->v_op == union_vnodeop_p) { 1021 struct union_node *un = VTOUNION(tvp); 1022 1023 tvp = un->un_uppervp; 1024 if (tvp != NULLVP) { 1025 VREF(tvp); 1026 un->un_flags |= UN_KLOCK; 1027 } 1028 vput(ap->a_tvp); 1029 } 1030 1031 return (VOP_RENAME(fdvp, fvp, ap->a_fcnp, tdvp, tvp, ap->a_tcnp)); 1032 1033 bad: 1034 vrele(fdvp); 1035 vrele(fvp); 1036 vput(tdvp); 1037 if (tvp != NULLVP) 1038 vput(tvp); 1039 1040 return (error); 1041 } 1042 1043 int 1044 union_mkdir(ap) 1045 struct vop_mkdir_args /* { 1046 struct vnode *a_dvp; 1047 struct vnode **a_vpp; 1048 struct componentname *a_cnp; 1049 struct vattr *a_vap; 1050 } */ *ap; 1051 { 1052 struct union_node *un = VTOUNION(ap->a_dvp); 1053 struct vnode *dvp = un->un_uppervp; 1054 1055 if (dvp != NULLVP) { 1056 int error; 1057 struct vnode *vp; 1058 1059 FIXUP(un); 1060 VREF(dvp); 1061 un->un_flags |= UN_KLOCK; 1062 vput(ap->a_dvp); 1063 error = VOP_MKDIR(dvp, &vp, ap->a_cnp, ap->a_vap); 1064 if (error) 1065 return (error); 1066 1067 error = union_allocvp( 1068 ap->a_vpp, 1069 ap->a_dvp->v_mount, 1070 ap->a_dvp, 1071 NULLVP, 1072 ap->a_cnp, 1073 vp, 1074 NULLVP); 1075 if (error) 1076 vput(vp); 1077 return (error); 1078 } 1079 1080 vput(ap->a_dvp); 1081 return (EROFS); 1082 } 1083 1084 int 1085 union_rmdir(ap) 1086 struct vop_rmdir_args /* { 1087 struct vnode *a_dvp; 1088 struct vnode *a_vp; 1089 struct componentname *a_cnp; 1090 } */ *ap; 1091 { 1092 int error; 1093 struct union_node *dun = VTOUNION(ap->a_dvp); 1094 struct union_node *un = VTOUNION(ap->a_vp); 1095 1096 if (dun->un_uppervp == NULLVP) 1097 panic("union rmdir: null upper vnode"); 1098 1099 if (un->un_uppervp != NULLVP) { 1100 struct vnode *dvp = dun->un_uppervp; 1101 struct vnode *vp = un->un_uppervp; 1102 struct componentname *cnp = ap->a_cnp; 1103 1104 FIXUP(dun); 1105 VREF(dvp); 1106 dun->un_flags |= UN_KLOCK; 1107 vput(ap->a_dvp); 1108 FIXUP(un); 1109 VREF(vp); 1110 un->un_flags |= UN_KLOCK; 1111 vput(ap->a_vp); 1112 1113 if (union_dowhiteout(un, cnp->cn_cred, cnp->cn_proc)) 1114 cnp->cn_flags |= DOWHITEOUT; 1115 error = VOP_RMDIR(dvp, vp, ap->a_cnp); 1116 if (!error) 1117 union_removed_upper(un); 1118 } else { 1119 FIXUP(dun); 1120 error = union_mkwhiteout( 1121 MOUNTTOUNIONMOUNT(UNIONTOV(dun)->v_mount), 1122 dun->un_uppervp, ap->a_cnp, un->un_path); 1123 vput(ap->a_dvp); 1124 vput(ap->a_vp); 1125 } 1126 1127 return (error); 1128 } 1129 1130 int 1131 union_symlink(ap) 1132 struct vop_symlink_args /* { 1133 struct vnode *a_dvp; 1134 struct vnode **a_vpp; 1135 struct componentname *a_cnp; 1136 struct vattr *a_vap; 1137 char *a_target; 1138 } */ *ap; 1139 { 1140 struct union_node *un = VTOUNION(ap->a_dvp); 1141 struct vnode *dvp = un->un_uppervp; 1142 1143 if (dvp != NULLVP) { 1144 int error; 1145 struct vnode *vp; 1146 struct mount *mp = ap->a_dvp->v_mount; 1147 1148 FIXUP(un); 1149 VREF(dvp); 1150 un->un_flags |= UN_KLOCK; 1151 vput(ap->a_dvp); 1152 error = VOP_SYMLINK(dvp, &vp, ap->a_cnp, 1153 ap->a_vap, ap->a_target); 1154 *ap->a_vpp = NULLVP; 1155 return (error); 1156 } 1157 1158 vput(ap->a_dvp); 1159 return (EROFS); 1160 } 1161 1162 /* 1163 * union_readdir works in concert with getdirentries and 1164 * readdir(3) to provide a list of entries in the unioned 1165 * directories. getdirentries is responsible for walking 1166 * down the union stack. readdir(3) is responsible for 1167 * eliminating duplicate names from the returned data stream. 1168 */ 1169 int 1170 union_readdir(ap) 1171 struct vop_readdir_args /* { 1172 struct vnodeop_desc *a_desc; 1173 struct vnode *a_vp; 1174 struct uio *a_uio; 1175 struct ucred *a_cred; 1176 int *a_eofflag; 1177 u_long *a_cookies; 1178 int a_ncookies; 1179 } */ *ap; 1180 { 1181 register struct union_node *un = VTOUNION(ap->a_vp); 1182 register struct vnode *uvp = un->un_uppervp; 1183 1184 if (uvp == NULLVP) 1185 return (0); 1186 1187 FIXUP(un); 1188 ap->a_vp = uvp; 1189 return (VOCALL(uvp->v_op, VOFFSET(vop_readdir), ap)); 1190 } 1191 1192 int 1193 union_readlink(ap) 1194 struct vop_readlink_args /* { 1195 struct vnode *a_vp; 1196 struct uio *a_uio; 1197 struct ucred *a_cred; 1198 } */ *ap; 1199 { 1200 int error; 1201 struct vnode *vp = OTHERVP(ap->a_vp); 1202 int dolock = (vp == LOWERVP(ap->a_vp)); 1203 1204 if (dolock) 1205 VOP_LOCK(vp); 1206 else 1207 FIXUP(VTOUNION(ap->a_vp)); 1208 error = VOP_READLINK(vp, ap->a_uio, ap->a_cred); 1209 if (dolock) 1210 VOP_UNLOCK(vp); 1211 1212 return (error); 1213 } 1214 1215 int 1216 union_abortop(ap) 1217 struct vop_abortop_args /* { 1218 struct vnode *a_dvp; 1219 struct componentname *a_cnp; 1220 } */ *ap; 1221 { 1222 int error; 1223 struct vnode *vp = OTHERVP(ap->a_dvp); 1224 struct union_node *un = VTOUNION(ap->a_dvp); 1225 int islocked = un->un_flags & UN_LOCKED; 1226 int dolock = (vp == LOWERVP(ap->a_dvp)); 1227 1228 if (islocked) { 1229 if (dolock) 1230 VOP_LOCK(vp); 1231 else 1232 FIXUP(VTOUNION(ap->a_dvp)); 1233 } 1234 error = VOP_ABORTOP(vp, ap->a_cnp); 1235 if (islocked && dolock) 1236 VOP_UNLOCK(vp); 1237 1238 return (error); 1239 } 1240 1241 int 1242 union_inactive(ap) 1243 struct vop_inactive_args /* { 1244 struct vnode *a_vp; 1245 } */ *ap; 1246 { 1247 struct union_node *un = VTOUNION(ap->a_vp); 1248 1249 /* 1250 * Do nothing (and _don't_ bypass). 1251 * Wait to vrele lowervp until reclaim, 1252 * so that until then our union_node is in the 1253 * cache and reusable. 1254 * 1255 * NEEDSWORK: Someday, consider inactive'ing 1256 * the lowervp and then trying to reactivate it 1257 * with capabilities (v_id) 1258 * like they do in the name lookup cache code. 1259 * That's too much work for now. 1260 */ 1261 1262 #ifdef UNION_DIAGNOSTIC 1263 if (un->un_flags & UN_LOCKED) 1264 panic("union: inactivating locked node"); 1265 if (un->un_flags & UN_ULOCK) 1266 panic("union: inactivating w/locked upper node"); 1267 #endif 1268 1269 if ((un->un_flags & UN_CACHED) == 0) 1270 vgone(ap->a_vp); 1271 1272 return (0); 1273 } 1274 1275 int 1276 union_reclaim(ap) 1277 struct vop_reclaim_args /* { 1278 struct vnode *a_vp; 1279 } */ *ap; 1280 { 1281 1282 union_freevp(ap->a_vp); 1283 1284 return (0); 1285 } 1286 1287 int 1288 union_lock(ap) 1289 struct vop_lock_args *ap; 1290 { 1291 struct vnode *vp = ap->a_vp; 1292 struct union_node *un; 1293 1294 start: 1295 while (vp->v_flag & VXLOCK) { 1296 vp->v_flag |= VXWANT; 1297 sleep((caddr_t)vp, PINOD); 1298 } 1299 1300 un = VTOUNION(vp); 1301 1302 if (un->un_uppervp != NULLVP) { 1303 if (((un->un_flags & UN_ULOCK) == 0) && 1304 (vp->v_usecount != 0)) { 1305 un->un_flags |= UN_ULOCK; 1306 VOP_LOCK(un->un_uppervp); 1307 } 1308 #ifdef DIAGNOSTIC 1309 if (un->un_flags & UN_KLOCK) 1310 panic("union: dangling upper lock"); 1311 #endif 1312 } 1313 1314 if (un->un_flags & UN_LOCKED) { 1315 #ifdef DIAGNOSTIC 1316 if (curproc && un->un_pid == curproc->p_pid && 1317 un->un_pid > -1 && curproc->p_pid > -1) 1318 panic("union: locking against myself"); 1319 #endif 1320 un->un_flags |= UN_WANT; 1321 sleep((caddr_t) &un->un_flags, PINOD); 1322 goto start; 1323 } 1324 1325 #ifdef DIAGNOSTIC 1326 if (curproc) 1327 un->un_pid = curproc->p_pid; 1328 else 1329 un->un_pid = -1; 1330 #endif 1331 1332 un->un_flags |= UN_LOCKED; 1333 return (0); 1334 } 1335 1336 int 1337 union_unlock(ap) 1338 struct vop_lock_args *ap; 1339 { 1340 struct union_node *un = VTOUNION(ap->a_vp); 1341 1342 #ifdef DIAGNOSTIC 1343 if ((un->un_flags & UN_LOCKED) == 0) 1344 panic("union: unlock unlocked node"); 1345 if (curproc && un->un_pid != curproc->p_pid && 1346 curproc->p_pid > -1 && un->un_pid > -1) 1347 panic("union: unlocking other process's union node"); 1348 #endif 1349 1350 un->un_flags &= ~UN_LOCKED; 1351 1352 if ((un->un_flags & (UN_ULOCK|UN_KLOCK)) == UN_ULOCK) 1353 VOP_UNLOCK(un->un_uppervp); 1354 1355 un->un_flags &= ~(UN_ULOCK|UN_KLOCK); 1356 1357 if (un->un_flags & UN_WANT) { 1358 un->un_flags &= ~UN_WANT; 1359 wakeup((caddr_t) &un->un_flags); 1360 } 1361 1362 #ifdef DIAGNOSTIC 1363 un->un_pid = 0; 1364 #endif 1365 1366 return (0); 1367 } 1368 1369 int 1370 union_bmap(ap) 1371 struct vop_bmap_args /* { 1372 struct vnode *a_vp; 1373 daddr_t a_bn; 1374 struct vnode **a_vpp; 1375 daddr_t *a_bnp; 1376 int *a_runp; 1377 } */ *ap; 1378 { 1379 int error; 1380 struct vnode *vp = OTHERVP(ap->a_vp); 1381 int dolock = (vp == LOWERVP(ap->a_vp)); 1382 1383 if (dolock) 1384 VOP_LOCK(vp); 1385 else 1386 FIXUP(VTOUNION(ap->a_vp)); 1387 error = VOP_BMAP(vp, ap->a_bn, ap->a_vpp, ap->a_bnp, ap->a_runp); 1388 if (dolock) 1389 VOP_UNLOCK(vp); 1390 1391 return (error); 1392 } 1393 1394 int 1395 union_print(ap) 1396 struct vop_print_args /* { 1397 struct vnode *a_vp; 1398 } */ *ap; 1399 { 1400 struct vnode *vp = ap->a_vp; 1401 1402 printf("\ttag VT_UNION, vp=%x, uppervp=%x, lowervp=%x\n", 1403 vp, UPPERVP(vp), LOWERVP(vp)); 1404 return (0); 1405 } 1406 1407 int 1408 union_islocked(ap) 1409 struct vop_islocked_args /* { 1410 struct vnode *a_vp; 1411 } */ *ap; 1412 { 1413 1414 return ((VTOUNION(ap->a_vp)->un_flags & UN_LOCKED) ? 1 : 0); 1415 } 1416 1417 int 1418 union_pathconf(ap) 1419 struct vop_pathconf_args /* { 1420 struct vnode *a_vp; 1421 int a_name; 1422 int *a_retval; 1423 } */ *ap; 1424 { 1425 int error; 1426 struct vnode *vp = OTHERVP(ap->a_vp); 1427 int dolock = (vp == LOWERVP(ap->a_vp)); 1428 1429 if (dolock) 1430 VOP_LOCK(vp); 1431 else 1432 FIXUP(VTOUNION(ap->a_vp)); 1433 error = VOP_PATHCONF(vp, ap->a_name, ap->a_retval); 1434 if (dolock) 1435 VOP_UNLOCK(vp); 1436 1437 return (error); 1438 } 1439 1440 int 1441 union_advlock(ap) 1442 struct vop_advlock_args /* { 1443 struct vnode *a_vp; 1444 caddr_t a_id; 1445 int a_op; 1446 struct flock *a_fl; 1447 int a_flags; 1448 } */ *ap; 1449 { 1450 1451 return (VOP_ADVLOCK(OTHERVP(ap->a_vp), ap->a_id, ap->a_op, 1452 ap->a_fl, ap->a_flags)); 1453 } 1454 1455 1456 /* 1457 * XXX - vop_strategy must be hand coded because it has no 1458 * vnode in its arguments. 1459 * This goes away with a merged VM/buffer cache. 1460 */ 1461 int 1462 union_strategy(ap) 1463 struct vop_strategy_args /* { 1464 struct buf *a_bp; 1465 } */ *ap; 1466 { 1467 struct buf *bp = ap->a_bp; 1468 int error; 1469 struct vnode *savedvp; 1470 1471 savedvp = bp->b_vp; 1472 bp->b_vp = OTHERVP(bp->b_vp); 1473 1474 #ifdef DIAGNOSTIC 1475 if (bp->b_vp == NULLVP) 1476 panic("union_strategy: nil vp"); 1477 if (((bp->b_flags & B_READ) == 0) && 1478 (bp->b_vp == LOWERVP(savedvp))) 1479 panic("union_strategy: writing to lowervp"); 1480 #endif 1481 1482 error = VOP_STRATEGY(bp); 1483 bp->b_vp = savedvp; 1484 1485 return (error); 1486 } 1487 1488 /* 1489 * Global vfs data structures 1490 */ 1491 int (**union_vnodeop_p)(); 1492 struct vnodeopv_entry_desc union_vnodeop_entries[] = { 1493 { &vop_default_desc, vn_default_error }, 1494 { &vop_lookup_desc, union_lookup }, /* lookup */ 1495 { &vop_create_desc, union_create }, /* create */ 1496 { &vop_whiteout_desc, union_whiteout }, /* whiteout */ 1497 { &vop_mknod_desc, union_mknod }, /* mknod */ 1498 { &vop_open_desc, union_open }, /* open */ 1499 { &vop_close_desc, union_close }, /* close */ 1500 { &vop_access_desc, union_access }, /* access */ 1501 { &vop_getattr_desc, union_getattr }, /* getattr */ 1502 { &vop_setattr_desc, union_setattr }, /* setattr */ 1503 { &vop_read_desc, union_read }, /* read */ 1504 { &vop_write_desc, union_write }, /* write */ 1505 { &vop_lease_desc, union_lease }, /* lease */ 1506 { &vop_ioctl_desc, union_ioctl }, /* ioctl */ 1507 { &vop_select_desc, union_select }, /* select */ 1508 { &vop_mmap_desc, union_mmap }, /* mmap */ 1509 { &vop_fsync_desc, union_fsync }, /* fsync */ 1510 { &vop_seek_desc, union_seek }, /* seek */ 1511 { &vop_remove_desc, union_remove }, /* remove */ 1512 { &vop_link_desc, union_link }, /* link */ 1513 { &vop_rename_desc, union_rename }, /* rename */ 1514 { &vop_mkdir_desc, union_mkdir }, /* mkdir */ 1515 { &vop_rmdir_desc, union_rmdir }, /* rmdir */ 1516 { &vop_symlink_desc, union_symlink }, /* symlink */ 1517 { &vop_readdir_desc, union_readdir }, /* readdir */ 1518 { &vop_readlink_desc, union_readlink }, /* readlink */ 1519 { &vop_abortop_desc, union_abortop }, /* abortop */ 1520 { &vop_inactive_desc, union_inactive }, /* inactive */ 1521 { &vop_reclaim_desc, union_reclaim }, /* reclaim */ 1522 { &vop_lock_desc, union_lock }, /* lock */ 1523 { &vop_unlock_desc, union_unlock }, /* unlock */ 1524 { &vop_bmap_desc, union_bmap }, /* bmap */ 1525 { &vop_strategy_desc, union_strategy }, /* strategy */ 1526 { &vop_print_desc, union_print }, /* print */ 1527 { &vop_islocked_desc, union_islocked }, /* islocked */ 1528 { &vop_pathconf_desc, union_pathconf }, /* pathconf */ 1529 { &vop_advlock_desc, union_advlock }, /* advlock */ 1530 #ifdef notdef 1531 { &vop_blkatoff_desc, union_blkatoff }, /* blkatoff */ 1532 { &vop_valloc_desc, union_valloc }, /* valloc */ 1533 { &vop_vfree_desc, union_vfree }, /* vfree */ 1534 { &vop_truncate_desc, union_truncate }, /* truncate */ 1535 { &vop_update_desc, union_update }, /* update */ 1536 { &vop_bwrite_desc, union_bwrite }, /* bwrite */ 1537 #endif 1538 { (struct vnodeop_desc*)NULL, (int(*)())NULL } 1539 }; 1540 struct vnodeopv_desc union_vnodeop_opv_desc = 1541 { &union_vnodeop_p, union_vnodeop_entries }; 1542