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.19 (Berkeley) 07/28/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 int 753 union_ioctl(ap) 754 struct vop_ioctl_args /* { 755 struct vnode *a_vp; 756 int a_command; 757 caddr_t a_data; 758 int a_fflag; 759 struct ucred *a_cred; 760 struct proc *a_p; 761 } */ *ap; 762 { 763 764 return (VOP_IOCTL(OTHERVP(ap->a_vp), ap->a_command, ap->a_data, 765 ap->a_fflag, ap->a_cred, ap->a_p)); 766 } 767 768 int 769 union_select(ap) 770 struct vop_select_args /* { 771 struct vnode *a_vp; 772 int a_which; 773 int a_fflags; 774 struct ucred *a_cred; 775 struct proc *a_p; 776 } */ *ap; 777 { 778 779 return (VOP_SELECT(OTHERVP(ap->a_vp), ap->a_which, ap->a_fflags, 780 ap->a_cred, ap->a_p)); 781 } 782 783 int 784 union_mmap(ap) 785 struct vop_mmap_args /* { 786 struct vnode *a_vp; 787 int a_fflags; 788 struct ucred *a_cred; 789 struct proc *a_p; 790 } */ *ap; 791 { 792 793 return (VOP_MMAP(OTHERVP(ap->a_vp), ap->a_fflags, 794 ap->a_cred, ap->a_p)); 795 } 796 797 int 798 union_fsync(ap) 799 struct vop_fsync_args /* { 800 struct vnode *a_vp; 801 struct ucred *a_cred; 802 int a_waitfor; 803 struct proc *a_p; 804 } */ *ap; 805 { 806 int error = 0; 807 struct vnode *targetvp = OTHERVP(ap->a_vp); 808 809 if (targetvp != NULLVP) { 810 int dolock = (targetvp == LOWERVP(ap->a_vp)); 811 812 if (dolock) 813 VOP_LOCK(targetvp); 814 else 815 FIXUP(VTOUNION(ap->a_vp)); 816 error = VOP_FSYNC(targetvp, ap->a_cred, 817 ap->a_waitfor, ap->a_p); 818 if (dolock) 819 VOP_UNLOCK(targetvp); 820 } 821 822 return (error); 823 } 824 825 int 826 union_seek(ap) 827 struct vop_seek_args /* { 828 struct vnode *a_vp; 829 off_t a_oldoff; 830 off_t a_newoff; 831 struct ucred *a_cred; 832 } */ *ap; 833 { 834 835 return (VOP_SEEK(OTHERVP(ap->a_vp), ap->a_oldoff, ap->a_newoff, ap->a_cred)); 836 } 837 838 int 839 union_remove(ap) 840 struct vop_remove_args /* { 841 struct vnode *a_dvp; 842 struct vnode *a_vp; 843 struct componentname *a_cnp; 844 } */ *ap; 845 { 846 int error; 847 struct union_node *dun = VTOUNION(ap->a_dvp); 848 struct union_node *un = VTOUNION(ap->a_vp); 849 850 if (dun->un_uppervp == NULLVP) 851 panic("union remove: null upper vnode"); 852 853 if (un->un_uppervp != NULLVP) { 854 struct vnode *dvp = dun->un_uppervp; 855 struct vnode *vp = un->un_uppervp; 856 857 FIXUP(dun); 858 VREF(dvp); 859 dun->un_flags |= UN_KLOCK; 860 vput(ap->a_dvp); 861 FIXUP(un); 862 VREF(vp); 863 un->un_flags |= UN_KLOCK; 864 vput(ap->a_vp); 865 866 if (un->un_lowervp != NULLVP) 867 ap->a_cnp->cn_flags |= DOWHITEOUT; 868 error = VOP_REMOVE(dvp, vp, ap->a_cnp); 869 if (!error) 870 union_removed_upper(un); 871 } else { 872 FIXUP(dun); 873 error = union_mkwhiteout( 874 MOUNTTOUNIONMOUNT(UNIONTOV(dun)->v_mount), 875 dun->un_uppervp, ap->a_cnp, un->un_path); 876 vput(ap->a_dvp); 877 vput(ap->a_vp); 878 } 879 880 return (error); 881 } 882 883 int 884 union_link(ap) 885 struct vop_link_args /* { 886 struct vnode *a_vp; 887 struct vnode *a_tdvp; 888 struct componentname *a_cnp; 889 } */ *ap; 890 { 891 int error = 0; 892 struct union_node *un; 893 struct vnode *vp; 894 struct vnode *tdvp; 895 896 un = VTOUNION(ap->a_vp); 897 898 if (ap->a_vp->v_op != ap->a_tdvp->v_op) { 899 tdvp = ap->a_tdvp; 900 } else { 901 struct union_node *tdun = VTOUNION(ap->a_tdvp); 902 if (tdun->un_uppervp == NULLVP) { 903 VOP_LOCK(ap->a_tdvp); 904 if (un->un_uppervp == tdun->un_dirvp) { 905 un->un_flags &= ~UN_ULOCK; 906 VOP_UNLOCK(un->un_uppervp); 907 } 908 error = union_copyup(tdun, 1, ap->a_cnp->cn_cred, 909 ap->a_cnp->cn_proc); 910 if (un->un_uppervp == tdun->un_dirvp) { 911 VOP_LOCK(un->un_uppervp); 912 un->un_flags |= UN_ULOCK; 913 } 914 VOP_UNLOCK(ap->a_tdvp); 915 } 916 tdvp = tdun->un_uppervp; 917 } 918 919 vp = un->un_uppervp; 920 if (vp == NULLVP) 921 error = EROFS; 922 923 if (error) { 924 vput(ap->a_vp); 925 return (error); 926 } 927 928 FIXUP(un); 929 VREF(vp); 930 un->un_flags |= UN_KLOCK; 931 vput(ap->a_vp); 932 933 return (VOP_LINK(vp, tdvp, ap->a_cnp)); 934 } 935 936 int 937 union_rename(ap) 938 struct vop_rename_args /* { 939 struct vnode *a_fdvp; 940 struct vnode *a_fvp; 941 struct componentname *a_fcnp; 942 struct vnode *a_tdvp; 943 struct vnode *a_tvp; 944 struct componentname *a_tcnp; 945 } */ *ap; 946 { 947 int error; 948 949 struct vnode *fdvp = ap->a_fdvp; 950 struct vnode *fvp = ap->a_fvp; 951 struct vnode *tdvp = ap->a_tdvp; 952 struct vnode *tvp = ap->a_tvp; 953 954 if (fdvp->v_op == union_vnodeop_p) { /* always true */ 955 struct union_node *un = VTOUNION(fdvp); 956 if (un->un_uppervp == NULLVP) { 957 /* 958 * this should never happen in normal 959 * operation but might if there was 960 * a problem creating the top-level shadow 961 * directory. 962 */ 963 error = EXDEV; 964 goto bad; 965 } 966 967 fdvp = un->un_uppervp; 968 VREF(fdvp); 969 vrele(ap->a_fdvp); 970 } 971 972 if (fvp->v_op == union_vnodeop_p) { /* always true */ 973 struct union_node *un = VTOUNION(fvp); 974 if (un->un_uppervp == NULLVP) { 975 /* XXX: should do a copyup */ 976 error = EXDEV; 977 goto bad; 978 } 979 980 if (un->un_lowervp != NULLVP) 981 ap->a_fcnp->cn_flags |= DOWHITEOUT; 982 983 fvp = un->un_uppervp; 984 VREF(fvp); 985 vrele(ap->a_fvp); 986 } 987 988 if (tdvp->v_op == union_vnodeop_p) { 989 struct union_node *un = VTOUNION(tdvp); 990 if (un->un_uppervp == NULLVP) { 991 /* 992 * this should never happen in normal 993 * operation but might if there was 994 * a problem creating the top-level shadow 995 * directory. 996 */ 997 error = EXDEV; 998 goto bad; 999 } 1000 1001 tdvp = un->un_uppervp; 1002 VREF(tdvp); 1003 un->un_flags |= UN_KLOCK; 1004 vput(ap->a_tdvp); 1005 } 1006 1007 if (tvp != NULLVP && tvp->v_op == union_vnodeop_p) { 1008 struct union_node *un = VTOUNION(tvp); 1009 1010 tvp = un->un_uppervp; 1011 if (tvp != NULLVP) { 1012 VREF(tvp); 1013 un->un_flags |= UN_KLOCK; 1014 } 1015 vput(ap->a_tvp); 1016 } 1017 1018 return (VOP_RENAME(fdvp, fvp, ap->a_fcnp, tdvp, tvp, ap->a_tcnp)); 1019 1020 bad: 1021 vrele(fdvp); 1022 vrele(fvp); 1023 vput(tdvp); 1024 if (tvp != NULLVP) 1025 vput(tvp); 1026 1027 return (error); 1028 } 1029 1030 int 1031 union_mkdir(ap) 1032 struct vop_mkdir_args /* { 1033 struct vnode *a_dvp; 1034 struct vnode **a_vpp; 1035 struct componentname *a_cnp; 1036 struct vattr *a_vap; 1037 } */ *ap; 1038 { 1039 struct union_node *un = VTOUNION(ap->a_dvp); 1040 struct vnode *dvp = un->un_uppervp; 1041 1042 if (dvp != NULLVP) { 1043 int error; 1044 struct vnode *vp; 1045 1046 FIXUP(un); 1047 VREF(dvp); 1048 un->un_flags |= UN_KLOCK; 1049 vput(ap->a_dvp); 1050 error = VOP_MKDIR(dvp, &vp, ap->a_cnp, ap->a_vap); 1051 if (error) 1052 return (error); 1053 1054 error = union_allocvp( 1055 ap->a_vpp, 1056 ap->a_dvp->v_mount, 1057 ap->a_dvp, 1058 NULLVP, 1059 ap->a_cnp, 1060 vp, 1061 NULLVP); 1062 if (error) 1063 vput(vp); 1064 return (error); 1065 } 1066 1067 vput(ap->a_dvp); 1068 return (EROFS); 1069 } 1070 1071 int 1072 union_rmdir(ap) 1073 struct vop_rmdir_args /* { 1074 struct vnode *a_dvp; 1075 struct vnode *a_vp; 1076 struct componentname *a_cnp; 1077 } */ *ap; 1078 { 1079 int error; 1080 struct union_node *dun = VTOUNION(ap->a_dvp); 1081 struct union_node *un = VTOUNION(ap->a_vp); 1082 1083 if (dun->un_uppervp == NULLVP) 1084 panic("union rmdir: null upper vnode"); 1085 1086 if (un->un_uppervp != NULLVP) { 1087 struct vnode *dvp = dun->un_uppervp; 1088 struct vnode *vp = un->un_uppervp; 1089 1090 FIXUP(dun); 1091 VREF(dvp); 1092 dun->un_flags |= UN_KLOCK; 1093 vput(ap->a_dvp); 1094 FIXUP(un); 1095 VREF(vp); 1096 un->un_flags |= UN_KLOCK; 1097 vput(ap->a_vp); 1098 1099 if (un->un_lowervp != NULLVP) 1100 ap->a_cnp->cn_flags |= DOWHITEOUT; 1101 error = VOP_RMDIR(dvp, vp, ap->a_cnp); 1102 if (!error) 1103 union_removed_upper(un); 1104 } else { 1105 FIXUP(dun); 1106 error = union_mkwhiteout( 1107 MOUNTTOUNIONMOUNT(UNIONTOV(dun)->v_mount), 1108 dun->un_uppervp, ap->a_cnp, un->un_path); 1109 vput(ap->a_dvp); 1110 vput(ap->a_vp); 1111 } 1112 1113 return (error); 1114 } 1115 1116 int 1117 union_symlink(ap) 1118 struct vop_symlink_args /* { 1119 struct vnode *a_dvp; 1120 struct vnode **a_vpp; 1121 struct componentname *a_cnp; 1122 struct vattr *a_vap; 1123 char *a_target; 1124 } */ *ap; 1125 { 1126 struct union_node *un = VTOUNION(ap->a_dvp); 1127 struct vnode *dvp = un->un_uppervp; 1128 1129 if (dvp != NULLVP) { 1130 int error; 1131 struct vnode *vp; 1132 struct mount *mp = ap->a_dvp->v_mount; 1133 1134 FIXUP(un); 1135 VREF(dvp); 1136 un->un_flags |= UN_KLOCK; 1137 vput(ap->a_dvp); 1138 error = VOP_SYMLINK(dvp, &vp, ap->a_cnp, 1139 ap->a_vap, ap->a_target); 1140 *ap->a_vpp = NULLVP; 1141 return (error); 1142 } 1143 1144 vput(ap->a_dvp); 1145 return (EROFS); 1146 } 1147 1148 /* 1149 * union_readdir works in concert with getdirentries and 1150 * readdir(3) to provide a list of entries in the unioned 1151 * directories. getdirentries is responsible for walking 1152 * down the union stack. readdir(3) is responsible for 1153 * eliminating duplicate names from the returned data stream. 1154 */ 1155 int 1156 union_readdir(ap) 1157 struct vop_readdir_args /* { 1158 struct vnodeop_desc *a_desc; 1159 struct vnode *a_vp; 1160 struct uio *a_uio; 1161 struct ucred *a_cred; 1162 int *a_eofflag; 1163 u_long *a_cookies; 1164 int a_ncookies; 1165 } */ *ap; 1166 { 1167 register struct union_node *un = VTOUNION(ap->a_vp); 1168 register struct vnode *uvp = un->un_uppervp; 1169 1170 if (uvp == NULLVP) 1171 return (0); 1172 1173 FIXUP(un); 1174 ap->a_vp = uvp; 1175 return (VOCALL(uvp->v_op, VOFFSET(vop_readdir), ap)); 1176 } 1177 1178 int 1179 union_readlink(ap) 1180 struct vop_readlink_args /* { 1181 struct vnode *a_vp; 1182 struct uio *a_uio; 1183 struct ucred *a_cred; 1184 } */ *ap; 1185 { 1186 int error; 1187 struct vnode *vp = OTHERVP(ap->a_vp); 1188 int dolock = (vp == LOWERVP(ap->a_vp)); 1189 1190 if (dolock) 1191 VOP_LOCK(vp); 1192 else 1193 FIXUP(VTOUNION(ap->a_vp)); 1194 error = VOP_READLINK(vp, ap->a_uio, ap->a_cred); 1195 if (dolock) 1196 VOP_UNLOCK(vp); 1197 1198 return (error); 1199 } 1200 1201 int 1202 union_abortop(ap) 1203 struct vop_abortop_args /* { 1204 struct vnode *a_dvp; 1205 struct componentname *a_cnp; 1206 } */ *ap; 1207 { 1208 int error; 1209 struct vnode *vp = OTHERVP(ap->a_dvp); 1210 struct union_node *un = VTOUNION(ap->a_dvp); 1211 int islocked = un->un_flags & UN_LOCKED; 1212 int dolock = (vp == LOWERVP(ap->a_dvp)); 1213 1214 if (islocked) { 1215 if (dolock) 1216 VOP_LOCK(vp); 1217 else 1218 FIXUP(VTOUNION(ap->a_dvp)); 1219 } 1220 error = VOP_ABORTOP(vp, ap->a_cnp); 1221 if (islocked && dolock) 1222 VOP_UNLOCK(vp); 1223 1224 return (error); 1225 } 1226 1227 int 1228 union_inactive(ap) 1229 struct vop_inactive_args /* { 1230 struct vnode *a_vp; 1231 } */ *ap; 1232 { 1233 struct union_node *un = VTOUNION(ap->a_vp); 1234 1235 /* 1236 * Do nothing (and _don't_ bypass). 1237 * Wait to vrele lowervp until reclaim, 1238 * so that until then our union_node is in the 1239 * cache and reusable. 1240 * 1241 * NEEDSWORK: Someday, consider inactive'ing 1242 * the lowervp and then trying to reactivate it 1243 * with capabilities (v_id) 1244 * like they do in the name lookup cache code. 1245 * That's too much work for now. 1246 */ 1247 1248 #ifdef UNION_DIAGNOSTIC 1249 if (un->un_flags & UN_LOCKED) 1250 panic("union: inactivating locked node"); 1251 if (un->un_flags & UN_ULOCK) 1252 panic("union: inactivating w/locked upper node"); 1253 #endif 1254 1255 if ((un->un_flags & UN_CACHED) == 0) 1256 vgone(ap->a_vp); 1257 1258 return (0); 1259 } 1260 1261 int 1262 union_reclaim(ap) 1263 struct vop_reclaim_args /* { 1264 struct vnode *a_vp; 1265 } */ *ap; 1266 { 1267 1268 union_freevp(ap->a_vp); 1269 1270 return (0); 1271 } 1272 1273 int 1274 union_lock(ap) 1275 struct vop_lock_args *ap; 1276 { 1277 struct vnode *vp = ap->a_vp; 1278 struct union_node *un; 1279 1280 start: 1281 while (vp->v_flag & VXLOCK) { 1282 vp->v_flag |= VXWANT; 1283 sleep((caddr_t)vp, PINOD); 1284 } 1285 1286 un = VTOUNION(vp); 1287 1288 if (un->un_uppervp != NULLVP) { 1289 if (((un->un_flags & UN_ULOCK) == 0) && 1290 (vp->v_usecount != 0)) { 1291 un->un_flags |= UN_ULOCK; 1292 VOP_LOCK(un->un_uppervp); 1293 } 1294 #ifdef DIAGNOSTIC 1295 if (un->un_flags & UN_KLOCK) 1296 panic("union: dangling upper lock"); 1297 #endif 1298 } 1299 1300 if (un->un_flags & UN_LOCKED) { 1301 #ifdef DIAGNOSTIC 1302 if (curproc && un->un_pid == curproc->p_pid && 1303 un->un_pid > -1 && curproc->p_pid > -1) 1304 panic("union: locking against myself"); 1305 #endif 1306 un->un_flags |= UN_WANT; 1307 sleep((caddr_t) &un->un_flags, PINOD); 1308 goto start; 1309 } 1310 1311 #ifdef DIAGNOSTIC 1312 if (curproc) 1313 un->un_pid = curproc->p_pid; 1314 else 1315 un->un_pid = -1; 1316 #endif 1317 1318 un->un_flags |= UN_LOCKED; 1319 return (0); 1320 } 1321 1322 int 1323 union_unlock(ap) 1324 struct vop_lock_args *ap; 1325 { 1326 struct union_node *un = VTOUNION(ap->a_vp); 1327 1328 #ifdef DIAGNOSTIC 1329 if ((un->un_flags & UN_LOCKED) == 0) 1330 panic("union: unlock unlocked node"); 1331 if (curproc && un->un_pid != curproc->p_pid && 1332 curproc->p_pid > -1 && un->un_pid > -1) 1333 panic("union: unlocking other process's union node"); 1334 #endif 1335 1336 un->un_flags &= ~UN_LOCKED; 1337 1338 if ((un->un_flags & (UN_ULOCK|UN_KLOCK)) == UN_ULOCK) 1339 VOP_UNLOCK(un->un_uppervp); 1340 1341 un->un_flags &= ~(UN_ULOCK|UN_KLOCK); 1342 1343 if (un->un_flags & UN_WANT) { 1344 un->un_flags &= ~UN_WANT; 1345 wakeup((caddr_t) &un->un_flags); 1346 } 1347 1348 #ifdef DIAGNOSTIC 1349 un->un_pid = 0; 1350 #endif 1351 1352 return (0); 1353 } 1354 1355 int 1356 union_bmap(ap) 1357 struct vop_bmap_args /* { 1358 struct vnode *a_vp; 1359 daddr_t a_bn; 1360 struct vnode **a_vpp; 1361 daddr_t *a_bnp; 1362 int *a_runp; 1363 } */ *ap; 1364 { 1365 int error; 1366 struct vnode *vp = OTHERVP(ap->a_vp); 1367 int dolock = (vp == LOWERVP(ap->a_vp)); 1368 1369 if (dolock) 1370 VOP_LOCK(vp); 1371 else 1372 FIXUP(VTOUNION(ap->a_vp)); 1373 error = VOP_BMAP(vp, ap->a_bn, ap->a_vpp, ap->a_bnp, ap->a_runp); 1374 if (dolock) 1375 VOP_UNLOCK(vp); 1376 1377 return (error); 1378 } 1379 1380 int 1381 union_print(ap) 1382 struct vop_print_args /* { 1383 struct vnode *a_vp; 1384 } */ *ap; 1385 { 1386 struct vnode *vp = ap->a_vp; 1387 1388 printf("\ttag VT_UNION, vp=%x, uppervp=%x, lowervp=%x\n", 1389 vp, UPPERVP(vp), LOWERVP(vp)); 1390 return (0); 1391 } 1392 1393 int 1394 union_islocked(ap) 1395 struct vop_islocked_args /* { 1396 struct vnode *a_vp; 1397 } */ *ap; 1398 { 1399 1400 return ((VTOUNION(ap->a_vp)->un_flags & UN_LOCKED) ? 1 : 0); 1401 } 1402 1403 int 1404 union_pathconf(ap) 1405 struct vop_pathconf_args /* { 1406 struct vnode *a_vp; 1407 int a_name; 1408 int *a_retval; 1409 } */ *ap; 1410 { 1411 int error; 1412 struct vnode *vp = OTHERVP(ap->a_vp); 1413 int dolock = (vp == LOWERVP(ap->a_vp)); 1414 1415 if (dolock) 1416 VOP_LOCK(vp); 1417 else 1418 FIXUP(VTOUNION(ap->a_vp)); 1419 error = VOP_PATHCONF(vp, ap->a_name, ap->a_retval); 1420 if (dolock) 1421 VOP_UNLOCK(vp); 1422 1423 return (error); 1424 } 1425 1426 int 1427 union_advlock(ap) 1428 struct vop_advlock_args /* { 1429 struct vnode *a_vp; 1430 caddr_t a_id; 1431 int a_op; 1432 struct flock *a_fl; 1433 int a_flags; 1434 } */ *ap; 1435 { 1436 1437 return (VOP_ADVLOCK(OTHERVP(ap->a_vp), ap->a_id, ap->a_op, 1438 ap->a_fl, ap->a_flags)); 1439 } 1440 1441 1442 /* 1443 * XXX - vop_strategy must be hand coded because it has no 1444 * vnode in its arguments. 1445 * This goes away with a merged VM/buffer cache. 1446 */ 1447 int 1448 union_strategy(ap) 1449 struct vop_strategy_args /* { 1450 struct buf *a_bp; 1451 } */ *ap; 1452 { 1453 struct buf *bp = ap->a_bp; 1454 int error; 1455 struct vnode *savedvp; 1456 1457 savedvp = bp->b_vp; 1458 bp->b_vp = OTHERVP(bp->b_vp); 1459 1460 #ifdef DIAGNOSTIC 1461 if (bp->b_vp == NULLVP) 1462 panic("union_strategy: nil vp"); 1463 if (((bp->b_flags & B_READ) == 0) && 1464 (bp->b_vp == LOWERVP(savedvp))) 1465 panic("union_strategy: writing to lowervp"); 1466 #endif 1467 1468 error = VOP_STRATEGY(bp); 1469 bp->b_vp = savedvp; 1470 1471 return (error); 1472 } 1473 1474 /* 1475 * Global vfs data structures 1476 */ 1477 int (**union_vnodeop_p)(); 1478 struct vnodeopv_entry_desc union_vnodeop_entries[] = { 1479 { &vop_default_desc, vn_default_error }, 1480 { &vop_lookup_desc, union_lookup }, /* lookup */ 1481 { &vop_create_desc, union_create }, /* create */ 1482 { &vop_whiteout_desc, union_whiteout }, /* whiteout */ 1483 { &vop_mknod_desc, union_mknod }, /* mknod */ 1484 { &vop_open_desc, union_open }, /* open */ 1485 { &vop_close_desc, union_close }, /* close */ 1486 { &vop_access_desc, union_access }, /* access */ 1487 { &vop_getattr_desc, union_getattr }, /* getattr */ 1488 { &vop_setattr_desc, union_setattr }, /* setattr */ 1489 { &vop_read_desc, union_read }, /* read */ 1490 { &vop_write_desc, union_write }, /* write */ 1491 { &vop_ioctl_desc, union_ioctl }, /* ioctl */ 1492 { &vop_select_desc, union_select }, /* select */ 1493 { &vop_mmap_desc, union_mmap }, /* mmap */ 1494 { &vop_fsync_desc, union_fsync }, /* fsync */ 1495 { &vop_seek_desc, union_seek }, /* seek */ 1496 { &vop_remove_desc, union_remove }, /* remove */ 1497 { &vop_link_desc, union_link }, /* link */ 1498 { &vop_rename_desc, union_rename }, /* rename */ 1499 { &vop_mkdir_desc, union_mkdir }, /* mkdir */ 1500 { &vop_rmdir_desc, union_rmdir }, /* rmdir */ 1501 { &vop_symlink_desc, union_symlink }, /* symlink */ 1502 { &vop_readdir_desc, union_readdir }, /* readdir */ 1503 { &vop_readlink_desc, union_readlink }, /* readlink */ 1504 { &vop_abortop_desc, union_abortop }, /* abortop */ 1505 { &vop_inactive_desc, union_inactive }, /* inactive */ 1506 { &vop_reclaim_desc, union_reclaim }, /* reclaim */ 1507 { &vop_lock_desc, union_lock }, /* lock */ 1508 { &vop_unlock_desc, union_unlock }, /* unlock */ 1509 { &vop_bmap_desc, union_bmap }, /* bmap */ 1510 { &vop_strategy_desc, union_strategy }, /* strategy */ 1511 { &vop_print_desc, union_print }, /* print */ 1512 { &vop_islocked_desc, union_islocked }, /* islocked */ 1513 { &vop_pathconf_desc, union_pathconf }, /* pathconf */ 1514 { &vop_advlock_desc, union_advlock }, /* advlock */ 1515 #ifdef notdef 1516 { &vop_blkatoff_desc, union_blkatoff }, /* blkatoff */ 1517 { &vop_valloc_desc, union_valloc }, /* valloc */ 1518 { &vop_vfree_desc, union_vfree }, /* vfree */ 1519 { &vop_truncate_desc, union_truncate }, /* truncate */ 1520 { &vop_update_desc, union_update }, /* update */ 1521 { &vop_bwrite_desc, union_bwrite }, /* bwrite */ 1522 #endif 1523 { (struct vnodeop_desc*)NULL, (int(*)())NULL } 1524 }; 1525 struct vnodeopv_desc union_vnodeop_opv_desc = 1526 { &union_vnodeop_p, union_vnodeop_entries }; 1527