2 * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry.
3 * Copyright (c) 1992, 1993, 1994, 1995
4 * The Regents of the University of California. All rights reserved.
6 * This code is derived from software contributed to Berkeley by
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the University of
20 * California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * @(#)union_vnops.c 8.32 (Berkeley) 6/23/95
38 * $FreeBSD: src/sys/miscfs/union/union_vnops.c,v 1.72 1999/12/15 23:02:14 eivind Exp $
39 * $DragonFly: src/sys/vfs/union/union_vnops.c,v 1.2 2003/06/17 04:28:43 dillon Exp $
42 #include <sys/param.h>
43 #include <sys/systm.h>
45 #include <sys/fcntl.h>
47 #include <sys/kernel.h>
48 #include <sys/vnode.h>
49 #include <sys/mount.h>
50 #include <sys/namei.h>
51 #include <sys/malloc.h>
54 #include <sys/sysctl.h>
55 #include <miscfs/union/union.h>
58 #include <vm/vnode_pager.h>
60 #include <vm/vm_page.h>
61 #include <vm/vm_object.h>
66 SYSCTL_INT(_vfs, OID_AUTO, uniondebug, CTLFLAG_RW, &uniondebug, 0, "");
68 SYSCTL_INT(_vfs, OID_AUTO, uniondebug, CTLFLAG_RD, &uniondebug, 0, "");
71 static int union_access __P((struct vop_access_args *ap));
72 static int union_advlock __P((struct vop_advlock_args *ap));
73 static int union_bmap __P((struct vop_bmap_args *ap));
74 static int union_close __P((struct vop_close_args *ap));
75 static int union_create __P((struct vop_create_args *ap));
76 static int union_fsync __P((struct vop_fsync_args *ap));
77 static int union_getattr __P((struct vop_getattr_args *ap));
78 static int union_inactive __P((struct vop_inactive_args *ap));
79 static int union_ioctl __P((struct vop_ioctl_args *ap));
80 static int union_lease __P((struct vop_lease_args *ap));
81 static int union_link __P((struct vop_link_args *ap));
82 static int union_lock __P((struct vop_lock_args *ap));
83 static int union_lookup __P((struct vop_lookup_args *ap));
84 static int union_lookup1 __P((struct vnode *udvp, struct vnode **dvp,
86 struct componentname *cnp));
87 static int union_mkdir __P((struct vop_mkdir_args *ap));
88 static int union_mknod __P((struct vop_mknod_args *ap));
89 static int union_mmap __P((struct vop_mmap_args *ap));
90 static int union_open __P((struct vop_open_args *ap));
91 static int union_pathconf __P((struct vop_pathconf_args *ap));
92 static int union_print __P((struct vop_print_args *ap));
93 static int union_read __P((struct vop_read_args *ap));
94 static int union_readdir __P((struct vop_readdir_args *ap));
95 static int union_readlink __P((struct vop_readlink_args *ap));
96 static int union_reclaim __P((struct vop_reclaim_args *ap));
97 static int union_remove __P((struct vop_remove_args *ap));
98 static int union_rename __P((struct vop_rename_args *ap));
99 static int union_revoke __P((struct vop_revoke_args *ap));
100 static int union_rmdir __P((struct vop_rmdir_args *ap));
101 static int union_poll __P((struct vop_poll_args *ap));
102 static int union_setattr __P((struct vop_setattr_args *ap));
103 static int union_strategy __P((struct vop_strategy_args *ap));
104 static int union_getpages __P((struct vop_getpages_args *ap));
105 static int union_putpages __P((struct vop_putpages_args *ap));
106 static int union_symlink __P((struct vop_symlink_args *ap));
107 static int union_unlock __P((struct vop_unlock_args *ap));
108 static int union_whiteout __P((struct vop_whiteout_args *ap));
109 static int union_write __P((struct vop_read_args *ap));
113 union_lock_upper(struct union_node *un, struct proc *p)
115 struct vnode *uppervp;
117 if ((uppervp = un->un_uppervp) != NULL) {
119 vn_lock(uppervp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY, p);
121 KASSERT((uppervp == NULL || uppervp->v_usecount > 0), ("uppervp usecount is 0"));
127 union_unlock_upper(struct vnode *uppervp, struct proc *p)
134 union_lock_other(struct union_node *un, struct proc *p)
138 if (un->un_uppervp != NULL) {
139 vp = union_lock_upper(un, p);
140 } else if ((vp = un->un_lowervp) != NULL) {
142 vn_lock(vp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY, p);
149 union_unlock_other(struct vnode *vp, struct proc *p)
157 * udvp must be exclusively locked on call and will remain
158 * exclusively locked on return. This is the mount point
159 * for out filesystem.
161 * dvp Our base directory, locked and referenced.
162 * The passed dvp will be dereferenced and unlocked on return
163 * and a new dvp will be returned which is locked and
164 * referenced in the same variable.
166 * vpp is filled in with the result if no error occured,
169 * If an error is returned, *vpp is set to NULLVP. If no
170 * error occurs, *vpp is returned with a reference and an
175 union_lookup1(udvp, pdvp, vpp, cnp)
179 struct componentname *cnp;
182 struct proc *p = cnp->cn_proc;
183 struct vnode *dvp = *pdvp;
188 * If stepping up the directory tree, check for going
189 * back across the mount point, in which case do what
190 * lookup would do by stepping back down the mount
193 if (cnp->cn_flags & ISDOTDOT) {
194 while ((dvp != udvp) && (dvp->v_flag & VROOT)) {
196 * Don't do the NOCROSSMOUNT check
197 * at this level. By definition,
198 * union fs deals with namespaces, not
202 dvp = dvp->v_mount->mnt_vnodecovered;
205 vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p);
210 * Set return dvp to be the upperdvp 'parent directory.
215 * If the VOP_LOOKUP call generates an error, tdvp is invalid and no
216 * changes will have been made to dvp, so we are set to return.
219 error = VOP_LOOKUP(dvp, &tdvp, cnp);
221 UDEBUG(("dvp %p error %d flags %lx\n", dvp, error, cnp->cn_flags));
227 * The parent directory will have been unlocked, unless lookup
228 * found the last component or if dvp == tdvp (tdvp must be locked).
230 * We want our dvp to remain locked and ref'd. We also want tdvp
231 * to remain locked and ref'd.
233 UDEBUG(("parentdir %p result %p flag %lx\n", dvp, tdvp, cnp->cn_flags));
235 if (dvp != tdvp && (cnp->cn_flags & ISLASTCN) == 0)
236 vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p);
239 * Lastly check if the current node is a mount point in
240 * which case walk up the mount hierarchy making sure not to
241 * bump into the root of the mount tree (ie. dvp != udvp).
243 * We use dvp as a temporary variable here, it is no longer related
244 * to the dvp above. However, we have to ensure that both *pdvp and
245 * tdvp are locked on return.
251 (dvp->v_type == VDIR) &&
252 (mp = dvp->v_mountedhere)
256 if (vfs_busy(mp, 0, 0, p))
263 error = VFS_ROOT(mp, &dvp);
268 vn_lock(*pdvp, LK_EXCLUSIVE | LK_RETRY, p);
281 struct vop_lookup_args /* {
282 struct vnodeop_desc *a_desc;
284 struct vnode **a_vpp;
285 struct componentname *a_cnp;
290 struct vnode *uppervp, *lowervp;
291 struct vnode *upperdvp, *lowerdvp;
292 struct vnode *dvp = ap->a_dvp; /* starting dir */
293 struct union_node *dun = VTOUNION(dvp); /* associated union node */
294 struct componentname *cnp = ap->a_cnp;
295 struct proc *p = cnp->cn_proc;
296 int lockparent = cnp->cn_flags & LOCKPARENT;
297 struct union_mount *um = MOUNTTOUNIONMOUNT(dvp->v_mount);
298 struct ucred *saved_cred = NULL;
305 * Disallow write attemps to the filesystem mounted read-only.
307 if ((cnp->cn_flags & ISLASTCN) &&
308 (dvp->v_mount->mnt_flag & MNT_RDONLY) &&
309 (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) {
314 * For any lookup's we do, always return with the parent locked
316 cnp->cn_flags |= LOCKPARENT;
318 lowerdvp = dun->un_lowervp;
327 * Get a private lock on uppervp and a reference, effectively
328 * taking it out of the union_node's control.
330 * We must lock upperdvp while holding our lock on dvp
331 * to avoid a deadlock.
333 upperdvp = union_lock_upper(dun, p);
336 * do the lookup in the upper level.
337 * if that level comsumes additional pathnames,
338 * then assume that something special is going
339 * on and just return that vnode.
341 if (upperdvp != NULLVP) {
343 * We do not have to worry about the DOTDOT case, we've
344 * already unlocked dvp.
346 UDEBUG(("A %p\n", upperdvp));
349 * Do the lookup. We must supply a locked and referenced
350 * upperdvp to the function and will get a new locked and
351 * referenced upperdvp back with the old having been
354 * If an error is returned, uppervp will be NULLVP. If no
355 * error occurs, uppervp will be the locked and referenced
356 * return vnode or possibly NULL, depending on what is being
357 * requested. It is possible that the returned uppervp
358 * will be the same as upperdvp.
360 uerror = union_lookup1(um->um_uppervp, &upperdvp, &uppervp, cnp);
362 "uerror %d upperdvp %p %d/%d, uppervp %p ref=%d/lck=%d\n",
365 upperdvp->v_usecount,
366 VOP_ISLOCKED(upperdvp, NULL),
368 (uppervp ? uppervp->v_usecount : -99),
369 (uppervp ? VOP_ISLOCKED(uppervp, NULL) : -99)
373 * Disallow write attemps to the filesystem mounted read-only.
375 if (uerror == EJUSTRETURN && (cnp->cn_flags & ISLASTCN) &&
376 (dvp->v_mount->mnt_flag & MNT_RDONLY) &&
377 (cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME)) {
383 * Special case. If cn_consume != 0 skip out. The result
384 * of the lookup is transfered to our return variable. If
385 * an error occured we have to throw away the results.
388 if (cnp->cn_consume != 0) {
389 if ((error = uerror) == 0) {
390 *ap->a_vpp = uppervp;
397 * Calculate whiteout, fall through
400 if (uerror == ENOENT || uerror == EJUSTRETURN) {
401 if (cnp->cn_flags & ISWHITEOUT) {
403 } else if (lowerdvp != NULLVP) {
406 terror = VOP_GETATTR(upperdvp, &va,
407 cnp->cn_cred, cnp->cn_proc);
408 if (terror == 0 && (va.va_flags & OPAQUE))
415 * in a similar way to the upper layer, do the lookup
416 * in the lower layer. this time, if there is some
417 * component magic going on, then vput whatever we got
418 * back from the upper layer and return the lower vnode
422 if (lowerdvp != NULLVP && !iswhiteout) {
425 UDEBUG(("B %p\n", lowerdvp));
428 * Force only LOOKUPs on the lower node, since
429 * we won't be making changes to it anyway.
431 nameiop = cnp->cn_nameiop;
432 cnp->cn_nameiop = LOOKUP;
433 if (um->um_op == UNMNT_BELOW) {
434 saved_cred = cnp->cn_cred;
435 cnp->cn_cred = um->um_cred;
439 * We shouldn't have to worry about locking interactions
440 * between the lower layer and our union layer (w.r.t.
441 * `..' processing) because we don't futz with lowervp
442 * locks in the union-node instantiation code path.
444 * union_lookup1() requires lowervp to be locked on entry,
445 * and it will be unlocked on return. The ref count will
446 * not change. On return lowervp doesn't represent anything
447 * to us so we NULL it out.
450 vn_lock(lowerdvp, LK_EXCLUSIVE | LK_RETRY, p);
451 lerror = union_lookup1(um->um_lowervp, &lowerdvp, &lowervp, cnp);
452 if (lowerdvp == lowervp)
456 lowerdvp = NULL; /* lowerdvp invalid after vput */
458 if (um->um_op == UNMNT_BELOW)
459 cnp->cn_cred = saved_cred;
460 cnp->cn_nameiop = nameiop;
462 if (cnp->cn_consume != 0 || lerror == EACCES) {
463 if ((error = lerror) == 0) {
464 *ap->a_vpp = lowervp;
470 UDEBUG(("C %p\n", lowerdvp));
471 if ((cnp->cn_flags & ISDOTDOT) && dun->un_pvp != NULLVP) {
472 if ((lowervp = LOWERVP(dun->un_pvp)) != NULL) {
474 vn_lock(lowervp, LK_EXCLUSIVE | LK_RETRY, p);
481 * Ok. Now we have uerror, uppervp, upperdvp, lerror, and lowervp.
483 * 1. If both layers returned an error, select the upper layer.
485 * 2. If the upper layer faile and the bottom layer succeeded,
486 * two subcases occur:
488 * a. The bottom vnode is not a directory, in which case
489 * just return a new union vnode referencing an
490 * empty top layer and the existing bottom layer.
492 * b. The button vnode is a directory, in which case
493 * create a new directory in the top layer and
494 * and fall through to case 3.
496 * 3. If the top layer succeeded then return a new union
497 * vnode referencing whatever the new top layer and
498 * whatever the bottom layer returned.
502 if ((uerror != 0) && (lerror != 0)) {
508 if (uerror != 0 /* && (lerror == 0) */ ) {
509 if (lowervp->v_type == VDIR) { /* case 2b. */
510 KASSERT(uppervp == NULL, ("uppervp unexpectedly non-NULL"));
512 * oops, uppervp has a problem, we may have to shadow.
514 uerror = union_mkshadow(um, upperdvp, cnp, &uppervp);
523 * Must call union_allocvp with both the upper and lower vnodes
524 * referenced and the upper vnode locked. ap->a_vpp is returned
525 * referenced and locked. lowervp, uppervp, and upperdvp are
526 * absorbed by union_allocvp() whether it succeeds or fails.
528 * upperdvp is the parent directory of uppervp which may be
529 * different, depending on the path, from dvp->un_uppervp. That's
530 * why it is a separate argument. Note that it must be unlocked.
532 * dvp must be locked on entry to the call and will be locked on
536 if (uppervp && uppervp != upperdvp)
537 VOP_UNLOCK(uppervp, 0, p);
539 VOP_UNLOCK(lowervp, 0, p);
541 VOP_UNLOCK(upperdvp, 0, p);
543 error = union_allocvp(ap->a_vpp, dvp->v_mount, dvp, upperdvp, cnp,
544 uppervp, lowervp, 1);
546 UDEBUG(("Create %p = %p %p refs=%d\n", *ap->a_vpp, uppervp, lowervp, (*ap->a_vpp) ? ((*ap->a_vpp)->v_usecount) : -99));
555 * - put away any extra junk laying around. Note that lowervp
556 * (if not NULL) will never be the same as *ap->a_vp and
557 * neither will uppervp, because when we set that state we
558 * NULL-out lowervp or uppervp. On the otherhand, upperdvp
559 * may match uppervp or *ap->a_vpp.
561 * - relock/unlock dvp if appropriate.
566 if (upperdvp == uppervp || upperdvp == *ap->a_vpp)
579 * Restore LOCKPARENT state
583 cnp->cn_flags &= ~LOCKPARENT;
585 UDEBUG(("Out %d vpp %p/%d lower %p upper %p\n", error, *ap->a_vpp,
586 ((*ap->a_vpp) ? (*ap->a_vpp)->v_usecount : -99),
590 * dvp lock state, determine whether to relock dvp. dvp is expected
591 * to be locked on return if:
593 * - there was an error (except not EJUSTRETURN), or
594 * - we hit the last component and lockparent is true
596 * dvp_is_locked is the current state of the dvp lock, not counting
597 * the possibility that *ap->a_vpp == dvp (in which case it is locked
598 * anyway). Note that *ap->a_vpp == dvp only if no error occured.
601 if (*ap->a_vpp != dvp) {
602 if ((error == 0 || error == EJUSTRETURN) &&
603 (!lockparent || (cnp->cn_flags & ISLASTCN) == 0)) {
604 VOP_UNLOCK(dvp, 0, p);
613 if (cnp->cn_namelen == 1 &&
614 cnp->cn_nameptr[0] == '.' &&
616 panic("union_lookup returning . (%p) not same as startdir (%p)", ap->a_vpp, dvp);
626 * a_dvp is locked on entry and remains locked on return. a_vpp is returned
627 * locked if no error occurs, otherwise it is garbage.
632 struct vop_create_args /* {
634 struct vnode **a_vpp;
635 struct componentname *a_cnp;
639 struct union_node *dun = VTOUNION(ap->a_dvp);
640 struct componentname *cnp = ap->a_cnp;
641 struct proc *p = cnp->cn_proc;
645 if ((dvp = union_lock_upper(dun, p)) != NULL) {
649 error = VOP_CREATE(dvp, &vp, cnp, ap->a_vap);
651 mp = ap->a_dvp->v_mount;
652 VOP_UNLOCK(vp, 0, p);
653 UDEBUG(("ALLOCVP-1 FROM %p REFS %d\n", vp, vp->v_usecount));
654 error = union_allocvp(ap->a_vpp, mp, NULLVP, NULLVP,
656 UDEBUG(("ALLOCVP-2B FROM %p REFS %d\n", *ap->a_vpp, vp->v_usecount));
658 union_unlock_upper(dvp, p);
665 struct vop_whiteout_args /* {
667 struct componentname *a_cnp;
671 struct union_node *un = VTOUNION(ap->a_dvp);
672 struct componentname *cnp = ap->a_cnp;
673 struct vnode *uppervp;
674 int error = EOPNOTSUPP;
676 if ((uppervp = union_lock_upper(un, cnp->cn_proc)) != NULLVP) {
677 error = VOP_WHITEOUT(un->un_uppervp, cnp, ap->a_flags);
678 union_unlock_upper(uppervp, cnp->cn_proc);
686 * a_dvp is locked on entry and should remain locked on return.
687 * a_vpp is garbagre whether an error occurs or not.
692 struct vop_mknod_args /* {
694 struct vnode **a_vpp;
695 struct componentname *a_cnp;
699 struct union_node *dun = VTOUNION(ap->a_dvp);
700 struct componentname *cnp = ap->a_cnp;
704 if ((dvp = union_lock_upper(dun, cnp->cn_proc)) != NULL) {
705 error = VOP_MKNOD(dvp, ap->a_vpp, cnp, ap->a_vap);
706 union_unlock_upper(dvp, cnp->cn_proc);
714 * run open VOP. When opening the underlying vnode we have to mimic
715 * vn_open. What we *really* need to do to avoid screwups if the
716 * open semantics change is to call vn_open(). For example, ufs blows
717 * up if you open a file but do not vmio it prior to writing.
722 struct vop_open_args /* {
723 struct vnodeop_desc *a_desc;
726 struct ucred *a_cred;
730 struct union_node *un = VTOUNION(ap->a_vp);
732 int mode = ap->a_mode;
733 struct ucred *cred = ap->a_cred;
734 struct proc *p = ap->a_p;
739 * If there is an existing upper vp then simply open that.
740 * The upper vp takes precedence over the lower vp. When opening
741 * a lower vp for writing copy it to the uppervp and then open the
744 * At the end of this section tvp will be left locked.
746 if ((tvp = union_lock_upper(un, p)) == NULLVP) {
748 * If the lower vnode is being opened for writing, then
749 * copy the file contents to the upper vnode and open that,
750 * otherwise can simply open the lower vnode.
752 tvp = un->un_lowervp;
753 if ((ap->a_mode & FWRITE) && (tvp->v_type == VREG)) {
754 int docopy = !(mode & O_TRUNC);
755 error = union_copyup(un, docopy, cred, p);
756 tvp = union_lock_upper(un, p);
760 vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, p);
766 * We are holding the correct vnode, open it
770 error = VOP_OPEN(tvp, mode, cred, p);
773 * Absolutely necessary or UFS will blowup
775 if (error == 0 && vn_canvmio(tvp) == TRUE) {
776 error = vfs_object_create(tvp, p, cred);
780 * Release any locks held
784 union_unlock_upper(tvp, p);
794 * It is unclear whether a_vp is passed locked or unlocked. Whatever
795 * the case we do not change it.
800 struct vop_close_args /* {
803 struct ucred *a_cred;
807 struct union_node *un = VTOUNION(ap->a_vp);
810 if ((vp = un->un_uppervp) == NULLVP) {
811 #ifdef UNION_DIAGNOSTIC
812 if (un->un_openl <= 0)
813 panic("union: un_openl cnt");
819 return (VCALL(vp, VOFFSET(vop_close), ap));
823 * Check access permission on the union vnode.
824 * The access check being enforced is to check
825 * against both the underlying vnode, and any
826 * copied vnode. This ensures that no additional
827 * file permissions are given away simply because
828 * the user caused an implicit file copy.
832 struct vop_access_args /* {
833 struct vnodeop_desc *a_desc;
836 struct ucred *a_cred;
840 struct union_node *un = VTOUNION(ap->a_vp);
841 struct proc *p = ap->a_p;
846 * Disallow write attempts on filesystems mounted read-only.
848 if ((ap->a_mode & VWRITE) &&
849 (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY)) {
850 switch (ap->a_vp->v_type) {
860 if ((vp = union_lock_upper(un, p)) != NULLVP) {
862 error = VCALL(vp, VOFFSET(vop_access), ap);
863 union_unlock_upper(vp, p);
867 if ((vp = un->un_lowervp) != NULLVP) {
868 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
872 * Remove VWRITE from a_mode if our mount point is RW, because
873 * we want to allow writes and lowervp may be read-only.
875 if ((un->un_vnode->v_mount->mnt_flag & MNT_RDONLY) == 0)
876 ap->a_mode &= ~VWRITE;
878 error = VCALL(vp, VOFFSET(vop_access), ap);
880 struct union_mount *um;
882 um = MOUNTTOUNIONMOUNT(un->un_vnode->v_mount);
884 if (um->um_op == UNMNT_BELOW) {
885 ap->a_cred = um->um_cred;
886 error = VCALL(vp, VOFFSET(vop_access), ap);
889 VOP_UNLOCK(vp, 0, p);
895 * We handle getattr only to change the fsid and
898 * It's not clear whether VOP_GETATTR is to be
899 * called with the vnode locked or not. stat() calls
900 * it with (vp) locked, and fstat calls it with
903 * Because of this we cannot use our normal locking functions
904 * if we do not intend to lock the main a_vp node. At the moment
905 * we are running without any specific locking at all, but beware
906 * to any programmer that care must be taken if locking is added
912 struct vop_getattr_args /* {
915 struct ucred *a_cred;
920 struct union_node *un = VTOUNION(ap->a_vp);
926 * Some programs walk the filesystem hierarchy by counting
927 * links to directories to avoid stat'ing all the time.
928 * This means the link count on directories needs to be "correct".
929 * The only way to do that is to call getattr on both layers
930 * and fix up the link count. The link count will not necessarily
931 * be accurate but will be large enough to defeat the tree walkers.
936 if ((vp = un->un_uppervp) != NULLVP) {
937 error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p);
940 /* XXX isn't this dangerouso without a lock? */
941 union_newsize(ap->a_vp, vap->va_size, VNOVAL);
946 } else if (vp->v_type == VDIR && un->un_lowervp != NULLVP) {
954 error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p);
957 /* XXX isn't this dangerous without a lock? */
958 union_newsize(ap->a_vp, VNOVAL, vap->va_size);
961 if ((vap != ap->a_vap) && (vap->va_type == VDIR))
962 ap->a_vap->va_nlink += vap->va_nlink;
968 struct vop_setattr_args /* {
971 struct ucred *a_cred;
975 struct union_node *un = VTOUNION(ap->a_vp);
976 struct proc *p = ap->a_p;
977 struct vattr *vap = ap->a_vap;
978 struct vnode *uppervp;
982 * Disallow write attempts on filesystems mounted read-only.
984 if ((ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) &&
985 (vap->va_flags != VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
986 vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL ||
987 vap->va_mtime.tv_sec != VNOVAL ||
988 vap->va_mode != (mode_t)VNOVAL)) {
993 * Handle case of truncating lower object to zero size,
994 * by creating a zero length upper object. This is to
995 * handle the case of open with O_TRUNC and O_CREAT.
997 if (un->un_uppervp == NULLVP && (un->un_lowervp->v_type == VREG)) {
998 error = union_copyup(un, (ap->a_vap->va_size != 0),
999 ap->a_cred, ap->a_p);
1005 * Try to set attributes in upper layer,
1006 * otherwise return read-only filesystem error.
1009 if ((uppervp = union_lock_upper(un, p)) != NULLVP) {
1010 error = VOP_SETATTR(un->un_uppervp, ap->a_vap,
1011 ap->a_cred, ap->a_p);
1012 if ((error == 0) && (ap->a_vap->va_size != VNOVAL))
1013 union_newsize(ap->a_vp, ap->a_vap->va_size, VNOVAL);
1014 union_unlock_upper(uppervp, p);
1024 union_getpages(struct vop_getpages_args *ap)
1028 r = vnode_pager_generic_getpages(ap->a_vp, ap->a_m,
1029 ap->a_count, ap->a_reqpage);
1038 union_putpages(struct vop_putpages_args *ap)
1042 r = vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count,
1043 ap->a_sync, ap->a_rtvals);
1049 struct vop_read_args /* {
1053 struct ucred *a_cred;
1056 struct union_node *un = VTOUNION(ap->a_vp);
1057 struct proc *p = ap->a_uio->uio_procp;
1061 uvp = union_lock_other(un, p);
1062 KASSERT(uvp != NULL, ("union_read: backing vnode missing!"));
1064 if (ap->a_vp->v_flag & VOBJBUF)
1065 union_vm_coherency(ap->a_vp, ap->a_uio, 0);
1067 error = VOP_READ(uvp, ap->a_uio, ap->a_ioflag, ap->a_cred);
1068 union_unlock_other(uvp, p);
1072 * perhaps the size of the underlying object has changed under
1073 * our feet. take advantage of the offset information present
1074 * in the uio structure.
1077 struct union_node *un = VTOUNION(ap->a_vp);
1078 off_t cur = ap->a_uio->uio_offset;
1080 if (uvp == un->un_uppervp) {
1081 if (cur > un->un_uppersz)
1082 union_newsize(ap->a_vp, cur, VNOVAL);
1084 if (cur > un->un_lowersz)
1085 union_newsize(ap->a_vp, VNOVAL, cur);
1093 struct vop_read_args /* {
1097 struct ucred *a_cred;
1100 struct union_node *un = VTOUNION(ap->a_vp);
1101 struct proc *p = ap->a_uio->uio_procp;
1102 struct vnode *uppervp;
1105 if ((uppervp = union_lock_upper(un, p)) == NULLVP)
1106 panic("union: missing upper layer in write");
1109 * Since our VM pages are associated with our vnode rather then
1110 * the real vnode, and since we do not run our reads and writes
1111 * through our own VM cache, we have a VM/VFS coherency problem.
1112 * We solve them by invalidating or flushing the associated VM
1113 * pages prior to allowing a normal read or write to occur.
1115 * VM-backed writes (UIO_NOCOPY) have to be converted to normal
1116 * writes because we are not cache-coherent. Normal writes need
1117 * to be made coherent with our VM-backing store, which we do by
1118 * first flushing any dirty VM pages associated with the write
1119 * range, and then destroying any clean VM pages associated with
1123 if (ap->a_uio->uio_segflg == UIO_NOCOPY) {
1124 ap->a_uio->uio_segflg = UIO_SYSSPACE;
1125 } else if (ap->a_vp->v_flag & VOBJBUF) {
1126 union_vm_coherency(ap->a_vp, ap->a_uio, 1);
1129 error = VOP_WRITE(uppervp, ap->a_uio, ap->a_ioflag, ap->a_cred);
1132 * the size of the underlying object may be changed by the
1136 off_t cur = ap->a_uio->uio_offset;
1138 if (cur > un->un_uppersz)
1139 union_newsize(ap->a_vp, cur, VNOVAL);
1141 union_unlock_upper(uppervp, p);
1147 struct vop_lease_args /* {
1150 struct ucred *a_cred;
1154 struct vnode *ovp = OTHERVP(ap->a_vp);
1157 return (VCALL(ovp, VOFFSET(vop_lease), ap));
1162 struct vop_ioctl_args /* {
1167 struct ucred *a_cred;
1171 struct vnode *ovp = OTHERVP(ap->a_vp);
1174 return (VCALL(ovp, VOFFSET(vop_ioctl), ap));
1179 struct vop_poll_args /* {
1182 struct ucred *a_cred;
1186 struct vnode *ovp = OTHERVP(ap->a_vp);
1189 return (VCALL(ovp, VOFFSET(vop_poll), ap));
1194 struct vop_revoke_args /* {
1200 struct vnode *vp = ap->a_vp;
1203 VOP_REVOKE(UPPERVP(vp), ap->a_flags);
1205 VOP_REVOKE(LOWERVP(vp), ap->a_flags);
1212 struct vop_mmap_args /* {
1215 struct ucred *a_cred;
1219 struct vnode *ovp = OTHERVP(ap->a_vp);
1222 return (VCALL(ovp, VOFFSET(vop_mmap), ap));
1227 struct vop_fsync_args /* {
1229 struct ucred *a_cred;
1235 struct proc *p = ap->a_p;
1236 struct vnode *targetvp;
1237 struct union_node *un = VTOUNION(ap->a_vp);
1239 if ((targetvp = union_lock_other(un, p)) != NULLVP) {
1240 error = VOP_FSYNC(targetvp, ap->a_cred, ap->a_waitfor, p);
1241 union_unlock_other(targetvp, p);
1250 * Remove the specified cnp. The dvp and vp are passed to us locked
1251 * and must remain locked on return.
1256 struct vop_remove_args /* {
1257 struct vnode *a_dvp;
1259 struct componentname *a_cnp;
1262 struct union_node *dun = VTOUNION(ap->a_dvp);
1263 struct union_node *un = VTOUNION(ap->a_vp);
1264 struct componentname *cnp = ap->a_cnp;
1265 struct proc *p = cnp->cn_proc;
1266 struct vnode *uppervp;
1267 struct vnode *upperdvp;
1270 if ((upperdvp = union_lock_upper(dun, p)) == NULLVP)
1271 panic("union remove: null upper vnode");
1273 if ((uppervp = union_lock_upper(un, p)) != NULLVP) {
1274 if (union_dowhiteout(un, cnp->cn_cred, p))
1275 cnp->cn_flags |= DOWHITEOUT;
1276 error = VOP_REMOVE(upperdvp, uppervp, cnp);
1280 union_removed_upper(un);
1282 union_unlock_upper(uppervp, p);
1284 error = union_mkwhiteout(
1285 MOUNTTOUNIONMOUNT(ap->a_dvp->v_mount),
1286 upperdvp, ap->a_cnp, un->un_path);
1288 union_unlock_upper(upperdvp, p);
1295 * tdvp will be locked on entry, vp will not be locked on entry.
1296 * tdvp should remain locked on return and vp should remain unlocked
1302 struct vop_link_args /* {
1303 struct vnode *a_tdvp;
1305 struct componentname *a_cnp;
1308 struct componentname *cnp = ap->a_cnp;
1309 struct proc *p = cnp->cn_proc;
1310 struct union_node *dun = VTOUNION(ap->a_tdvp);
1315 if (ap->a_tdvp->v_op != ap->a_vp->v_op) {
1318 struct union_node *tun = VTOUNION(ap->a_vp);
1320 if (tun->un_uppervp == NULLVP) {
1321 vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, p);
1323 if (dun->un_uppervp == tun->un_dirvp) {
1324 if (dun->un_flags & UN_ULOCK) {
1325 dun->un_flags &= ~UN_ULOCK;
1326 VOP_UNLOCK(dun->un_uppervp, 0, p);
1330 error = union_copyup(tun, 1, cnp->cn_cred, p);
1332 if (dun->un_uppervp == tun->un_dirvp) {
1333 vn_lock(dun->un_uppervp,
1334 LK_EXCLUSIVE | LK_RETRY, p);
1335 dun->un_flags |= UN_ULOCK;
1338 VOP_UNLOCK(ap->a_vp, 0, p);
1340 vp = tun->un_uppervp;
1347 * Make sure upper is locked, then unlock the union directory we were
1348 * called with to avoid a deadlock while we are calling VOP_LINK on
1349 * the upper (with tdvp locked and vp not locked). Our ap->a_tdvp
1350 * is expected to be locked on return.
1353 if ((tdvp = union_lock_upper(dun, p)) == NULLVP)
1356 VOP_UNLOCK(ap->a_tdvp, 0, p); /* unlock calling node */
1357 error = VOP_LINK(tdvp, vp, cnp); /* call link on upper */
1360 * We have to unlock tdvp prior to relocking our calling node in
1361 * order to avoid a deadlock.
1363 union_unlock_upper(tdvp, p);
1364 vn_lock(ap->a_tdvp, LK_EXCLUSIVE | LK_RETRY, p);
1370 struct vop_rename_args /* {
1371 struct vnode *a_fdvp;
1372 struct vnode *a_fvp;
1373 struct componentname *a_fcnp;
1374 struct vnode *a_tdvp;
1375 struct vnode *a_tvp;
1376 struct componentname *a_tcnp;
1380 struct vnode *fdvp = ap->a_fdvp;
1381 struct vnode *fvp = ap->a_fvp;
1382 struct vnode *tdvp = ap->a_tdvp;
1383 struct vnode *tvp = ap->a_tvp;
1386 * Figure out what fdvp to pass to our upper or lower vnode. If we
1387 * replace the fdvp, release the original one and ref the new one.
1390 if (fdvp->v_op == union_vnodeop_p) { /* always true */
1391 struct union_node *un = VTOUNION(fdvp);
1392 if (un->un_uppervp == NULLVP) {
1394 * this should never happen in normal
1395 * operation but might if there was
1396 * a problem creating the top-level shadow
1402 fdvp = un->un_uppervp;
1408 * Figure out what fvp to pass to our upper or lower vnode. If we
1409 * replace the fvp, release the original one and ref the new one.
1412 if (fvp->v_op == union_vnodeop_p) { /* always true */
1413 struct union_node *un = VTOUNION(fvp);
1415 struct union_mount *um = MOUNTTOUNIONMOUNT(fvp->v_mount);
1418 if (un->un_uppervp == NULLVP) {
1419 switch(fvp->v_type) {
1421 vn_lock(un->un_vnode, LK_EXCLUSIVE | LK_RETRY, ap->a_fcnp->cn_proc);
1422 error = union_copyup(un, 1, ap->a_fcnp->cn_cred, ap->a_fcnp->cn_proc);
1423 VOP_UNLOCK(un->un_vnode, 0, ap->a_fcnp->cn_proc);
1431 * There is only one way to rename a directory
1432 * based in the lowervp, and that is to copy
1433 * the entire directory hierarchy. Otherwise
1434 * it would not last across a reboot.
1439 vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY, ap->a_fcnp->cn_proc);
1440 error = union_mkshadow(um, fdvp,
1441 ap->a_fcnp, &un->un_uppervp);
1442 VOP_UNLOCK(fdvp, 0, ap->a_fcnp->cn_proc);
1444 VOP_UNLOCK(un->un_uppervp, 0, ap->a_fcnp->cn_proc);
1455 if (un->un_lowervp != NULLVP)
1456 ap->a_fcnp->cn_flags |= DOWHITEOUT;
1457 fvp = un->un_uppervp;
1463 * Figure out what tdvp (destination directory) to pass to the
1464 * lower level. If we replace it with uppervp, we need to vput the
1465 * old one. The exclusive lock is transfered to what we will pass
1466 * down in the VOP_RENAME and we replace uppervp with a simple
1470 if (tdvp->v_op == union_vnodeop_p) {
1471 struct union_node *un = VTOUNION(tdvp);
1473 if (un->un_uppervp == NULLVP) {
1475 * this should never happen in normal
1476 * operation but might if there was
1477 * a problem creating the top-level shadow
1485 * new tdvp is a lock and reference on uppervp, put away
1488 tdvp = union_lock_upper(un, ap->a_tcnp->cn_proc);
1493 * Figure out what tvp (destination file) to pass to the
1496 * If the uppervp file does not exist put away the (wrong)
1497 * file and change tvp to NULL.
1500 if (tvp != NULLVP && tvp->v_op == union_vnodeop_p) {
1501 struct union_node *un = VTOUNION(tvp);
1503 tvp = union_lock_upper(un, ap->a_tcnp->cn_proc);
1505 /* note: tvp may be NULL */
1509 * VOP_RENAME releases/vputs prior to returning, so we have no
1513 return (VOP_RENAME(fdvp, fvp, ap->a_fcnp, tdvp, tvp, ap->a_tcnp));
1516 * Error. We still have to release / vput the various elements.
1524 if (tvp != NULLVP) {
1535 struct vop_mkdir_args /* {
1536 struct vnode *a_dvp;
1537 struct vnode **a_vpp;
1538 struct componentname *a_cnp;
1539 struct vattr *a_vap;
1542 struct union_node *dun = VTOUNION(ap->a_dvp);
1543 struct componentname *cnp = ap->a_cnp;
1544 struct proc *p = cnp->cn_proc;
1545 struct vnode *upperdvp;
1548 if ((upperdvp = union_lock_upper(dun, p)) != NULLVP) {
1551 error = VOP_MKDIR(upperdvp, &vp, cnp, ap->a_vap);
1552 union_unlock_upper(upperdvp, p);
1555 VOP_UNLOCK(vp, 0, p);
1556 UDEBUG(("ALLOCVP-2 FROM %p REFS %d\n", vp, vp->v_usecount));
1557 error = union_allocvp(ap->a_vpp, ap->a_dvp->v_mount,
1558 ap->a_dvp, NULLVP, cnp, vp, NULLVP, 1);
1559 UDEBUG(("ALLOCVP-2B FROM %p REFS %d\n", *ap->a_vpp, vp->v_usecount));
1567 struct vop_rmdir_args /* {
1568 struct vnode *a_dvp;
1570 struct componentname *a_cnp;
1573 struct union_node *dun = VTOUNION(ap->a_dvp);
1574 struct union_node *un = VTOUNION(ap->a_vp);
1575 struct componentname *cnp = ap->a_cnp;
1576 struct proc *p = cnp->cn_proc;
1577 struct vnode *upperdvp;
1578 struct vnode *uppervp;
1581 if ((upperdvp = union_lock_upper(dun, p)) == NULLVP)
1582 panic("union rmdir: null upper vnode");
1584 if ((uppervp = union_lock_upper(un, p)) != NULLVP) {
1585 if (union_dowhiteout(un, cnp->cn_cred, p))
1586 cnp->cn_flags |= DOWHITEOUT;
1587 error = VOP_RMDIR(upperdvp, uppervp, ap->a_cnp);
1588 union_unlock_upper(uppervp, p);
1590 error = union_mkwhiteout(
1591 MOUNTTOUNIONMOUNT(ap->a_dvp->v_mount),
1592 dun->un_uppervp, ap->a_cnp, un->un_path);
1594 union_unlock_upper(upperdvp, p);
1601 * dvp is locked on entry and remains locked on return. a_vpp is garbage
1607 struct vop_symlink_args /* {
1608 struct vnode *a_dvp;
1609 struct vnode **a_vpp;
1610 struct componentname *a_cnp;
1611 struct vattr *a_vap;
1615 struct union_node *dun = VTOUNION(ap->a_dvp);
1616 struct componentname *cnp = ap->a_cnp;
1617 struct proc *p = cnp->cn_proc;
1621 if ((dvp = union_lock_upper(dun, p)) != NULLVP) {
1622 error = VOP_SYMLINK(dvp, ap->a_vpp, cnp, ap->a_vap,
1624 union_unlock_upper(dvp, p);
1630 * union_readdir works in concert with getdirentries and
1631 * readdir(3) to provide a list of entries in the unioned
1632 * directories. getdirentries is responsible for walking
1633 * down the union stack. readdir(3) is responsible for
1634 * eliminating duplicate names from the returned data stream.
1638 struct vop_readdir_args /* {
1641 struct ucred *a_cred;
1647 struct union_node *un = VTOUNION(ap->a_vp);
1648 struct proc *p = ap->a_uio->uio_procp;
1652 if ((uvp = union_lock_upper(un, p)) != NULLVP) {
1654 error = VCALL(uvp, VOFFSET(vop_readdir), ap);
1655 union_unlock_upper(uvp, p);
1662 struct vop_readlink_args /* {
1665 struct ucred *a_cred;
1669 struct union_node *un = VTOUNION(ap->a_vp);
1670 struct uio *uio = ap->a_uio;
1671 struct proc *p = uio->uio_procp;
1674 vp = union_lock_other(un, p);
1675 KASSERT(vp != NULL, ("union_readlink: backing vnode missing!"));
1678 error = VCALL(vp, VOFFSET(vop_readlink), ap);
1679 union_unlock_other(vp, p);
1687 * Called with the vnode locked. We are expected to unlock the vnode.
1692 struct vop_inactive_args /* {
1697 struct vnode *vp = ap->a_vp;
1698 struct proc *p = ap->a_p;
1699 struct union_node *un = VTOUNION(vp);
1703 * Do nothing (and _don't_ bypass).
1704 * Wait to vrele lowervp until reclaim,
1705 * so that until then our union_node is in the
1706 * cache and reusable.
1708 * NEEDSWORK: Someday, consider inactive'ing
1709 * the lowervp and then trying to reactivate it
1710 * with capabilities (v_id)
1711 * like they do in the name lookup cache code.
1712 * That's too much work for now.
1715 if (un->un_dircache != 0) {
1716 for (vpp = un->un_dircache; *vpp != NULLVP; vpp++)
1718 free (un->un_dircache, M_TEMP);
1719 un->un_dircache = 0;
1723 if ((un->un_flags & UN_ULOCK) && un->un_uppervp) {
1724 un->un_flags &= ~UN_ULOCK;
1725 VOP_UNLOCK(un->un_uppervp, 0, p);
1729 VOP_UNLOCK(vp, 0, p);
1731 if ((un->un_flags & UN_CACHED) == 0)
1739 struct vop_reclaim_args /* {
1743 union_freevp(ap->a_vp);
1750 struct vop_lock_args *ap;
1753 struct vnode *vp = ap->a_vp;
1754 struct proc *p = ap->a_p;
1755 int flags = ap->a_flags;
1756 struct union_node *un;
1760 error = vop_stdlock(ap);
1766 * Lock the upper if it exists and this is an exclusive lock
1769 if (un->un_uppervp != NULLVP &&
1770 (flags & LK_TYPE_MASK) == LK_EXCLUSIVE) {
1771 if ((un->un_flags & UN_ULOCK) == 0 && vp->v_usecount) {
1772 error = vn_lock(un->un_uppervp, flags, p);
1774 struct vop_unlock_args uap = { 0 };
1775 uap.a_vp = ap->a_vp;
1776 uap.a_flags = ap->a_flags;
1778 vop_stdunlock(&uap);
1781 un->un_flags |= UN_ULOCK;
1792 * Unlock our union node. This also unlocks uppervp.
1796 struct vop_unlock_args /* {
1802 struct union_node *un = VTOUNION(ap->a_vp);
1805 KASSERT((un->un_uppervp == NULL || un->un_uppervp->v_usecount > 0), ("uppervp usecount is 0"));
1807 error = vop_stdunlock(ap);
1811 * If no exclusive locks remain and we are holding an uppervp lock,
1812 * remove the uppervp lock.
1815 if ((un->un_flags & UN_ULOCK) &&
1816 lockstatus(&un->un_lock, NULL) != LK_EXCLUSIVE) {
1817 un->un_flags &= ~UN_ULOCK;
1818 VOP_UNLOCK(un->un_uppervp, LK_EXCLUSIVE, p);
1827 * There isn't much we can do. We cannot push through to the real vnode
1828 * to get to the underlying device because this will bypass data
1829 * cached by the real vnode.
1831 * For some reason we cannot return the 'real' vnode either, it seems
1832 * to blow up memory maps.
1837 struct vop_bmap_args /* {
1840 struct vnode **a_vpp;
1851 struct vop_print_args /* {
1855 struct vnode *vp = ap->a_vp;
1857 printf("\ttag VT_UNION, vp=%p, uppervp=%p, lowervp=%p\n",
1858 vp, UPPERVP(vp), LOWERVP(vp));
1859 if (UPPERVP(vp) != NULLVP)
1860 vprint("union: upper", UPPERVP(vp));
1861 if (LOWERVP(vp) != NULLVP)
1862 vprint("union: lower", LOWERVP(vp));
1869 struct vop_pathconf_args /* {
1876 struct proc *p = curproc; /* XXX */
1877 struct union_node *un = VTOUNION(ap->a_vp);
1880 vp = union_lock_other(un, p);
1881 KASSERT(vp != NULL, ("union_pathconf: backing vnode missing!"));
1884 error = VCALL(vp, VOFFSET(vop_pathconf), ap);
1885 union_unlock_other(vp, p);
1892 struct vop_advlock_args /* {
1900 register struct vnode *ovp = OTHERVP(ap->a_vp);
1903 return (VCALL(ovp, VOFFSET(vop_advlock), ap));
1908 * XXX - vop_strategy must be hand coded because it has no
1909 * YYY - and it is not coherent with anything
1911 * vnode in its arguments.
1912 * This goes away with a merged VM/buffer cache.
1916 struct vop_strategy_args /* {
1921 struct buf *bp = ap->a_bp;
1922 struct vnode *othervp = OTHERVP(bp->b_vp);
1925 if (othervp == NULLVP)
1926 panic("union_strategy: nil vp");
1927 if (((bp->b_flags & B_READ) == 0) &&
1928 (othervp == LOWERVP(bp->b_vp)))
1929 panic("union_strategy: writing to lowervp");
1931 return (VOP_STRATEGY(othervp, bp));
1935 * Global vfs data structures
1937 vop_t **union_vnodeop_p;
1938 static struct vnodeopv_entry_desc union_vnodeop_entries[] = {
1939 { &vop_default_desc, (vop_t *) vop_defaultop },
1940 { &vop_access_desc, (vop_t *) union_access },
1941 { &vop_advlock_desc, (vop_t *) union_advlock },
1942 { &vop_bmap_desc, (vop_t *) union_bmap },
1943 { &vop_close_desc, (vop_t *) union_close },
1944 { &vop_create_desc, (vop_t *) union_create },
1945 { &vop_fsync_desc, (vop_t *) union_fsync },
1946 { &vop_getpages_desc, (vop_t *) union_getpages },
1947 { &vop_putpages_desc, (vop_t *) union_putpages },
1948 { &vop_getattr_desc, (vop_t *) union_getattr },
1949 { &vop_inactive_desc, (vop_t *) union_inactive },
1950 { &vop_ioctl_desc, (vop_t *) union_ioctl },
1951 { &vop_islocked_desc, (vop_t *) vop_stdislocked },
1952 { &vop_lease_desc, (vop_t *) union_lease },
1953 { &vop_link_desc, (vop_t *) union_link },
1954 { &vop_lock_desc, (vop_t *) union_lock },
1955 { &vop_lookup_desc, (vop_t *) union_lookup },
1956 { &vop_mkdir_desc, (vop_t *) union_mkdir },
1957 { &vop_mknod_desc, (vop_t *) union_mknod },
1958 { &vop_mmap_desc, (vop_t *) union_mmap },
1959 { &vop_open_desc, (vop_t *) union_open },
1960 { &vop_pathconf_desc, (vop_t *) union_pathconf },
1961 { &vop_poll_desc, (vop_t *) union_poll },
1962 { &vop_print_desc, (vop_t *) union_print },
1963 { &vop_read_desc, (vop_t *) union_read },
1964 { &vop_readdir_desc, (vop_t *) union_readdir },
1965 { &vop_readlink_desc, (vop_t *) union_readlink },
1966 { &vop_reclaim_desc, (vop_t *) union_reclaim },
1967 { &vop_remove_desc, (vop_t *) union_remove },
1968 { &vop_rename_desc, (vop_t *) union_rename },
1969 { &vop_revoke_desc, (vop_t *) union_revoke },
1970 { &vop_rmdir_desc, (vop_t *) union_rmdir },
1971 { &vop_setattr_desc, (vop_t *) union_setattr },
1972 { &vop_strategy_desc, (vop_t *) union_strategy },
1973 { &vop_symlink_desc, (vop_t *) union_symlink },
1974 { &vop_unlock_desc, (vop_t *) union_unlock },
1975 { &vop_whiteout_desc, (vop_t *) union_whiteout },
1976 { &vop_write_desc, (vop_t *) union_write },
1979 static struct vnodeopv_desc union_vnodeop_opv_desc =
1980 { &union_vnodeop_p, union_vnodeop_entries };
1982 VNODEOP_SET(union_vnodeop_opv_desc);