checkpoint
authorJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Tue, 8 Feb 1994 13:35:18 +0000 (05:35 -0800)
committerJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Tue, 8 Feb 1994 13:35:18 +0000 (05:35 -0800)
SCCS-vsn: sys/miscfs/union/union.h 1.8
SCCS-vsn: sys/miscfs/union/union_subr.c 1.8
SCCS-vsn: sys/miscfs/union/union_vnops.c 1.8
SCCS-vsn: sys/miscfs/union/union_vfsops.c 1.8

usr/src/sys/miscfs/union/union.h
usr/src/sys/miscfs/union/union_subr.c
usr/src/sys/miscfs/union/union_vfsops.c
usr/src/sys/miscfs/union/union_vnops.c

index f989af6..c8172a7 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)union.h     1.7 (Berkeley) %G%
+ *     @(#)union.h     1.8 (Berkeley) %G%
  */
 
 struct union_args {
  */
 
 struct union_args {
@@ -63,7 +63,10 @@ extern int union_mkshadow __P((struct union_mount *, struct vnode *,
                                struct componentname *, struct vnode **));
 extern int union_vn_create __P((struct vnode **, struct union_node *,
                                struct proc *));
                                struct componentname *, struct vnode **));
 extern int union_vn_create __P((struct vnode **, struct union_node *,
                                struct proc *));
+extern int union_cn_close __P((struct vnode *, int, struct ucred *,
+                               struct proc *));
 extern void union_removed_upper __P((struct union_node *un));
 extern void union_removed_upper __P((struct union_node *un));
+extern struct vnode *union_lowervp __P((struct vnode *));
 
 #define        MOUNTTOUNIONMOUNT(mp) ((struct union_mount *)((mp)->mnt_data))
 #define        VTOUNION(vp) ((struct union_node *)(vp)->v_data)
 
 #define        MOUNTTOUNIONMOUNT(mp) ((struct union_mount *)((mp)->mnt_data))
 #define        VTOUNION(vp) ((struct union_node *)(vp)->v_data)
index d34f594..3da44e3 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)union_subr.c        1.7 (Berkeley) %G%
+ *     @(#)union_subr.c        1.8 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -172,7 +172,7 @@ loop:
        un->un_next = 0;
        un->un_uppervp = uppervp;
        un->un_lowervp = lowervp;
        un->un_next = 0;
        un->un_uppervp = uppervp;
        un->un_lowervp = lowervp;
-       un->un_open = 0;
+       un->un_openl = 0;
        un->un_flags = 0;
        if (cnp && (lowervp != NULLVP) && (lowervp->v_type == VREG)) {
                un->un_hash = cnp->cn_hash;
        un->un_flags = 0;
        if (cnp && (lowervp != NULLVP) && (lowervp->v_type == VREG)) {
                un->un_hash = cnp->cn_hash;
@@ -472,9 +472,11 @@ bad:
 }
 
 int
 }
 
 int
-union_vn_close(vp, fmode)
+union_vn_close(vp, fmode, cred, p)
        struct vnode *vp;
        int fmode;
        struct vnode *vp;
        int fmode;
+       struct ucred *cred;
+       struct proc *p;
 {
        if (fmode & FWRITE)
                --vp->v_writecount;
 {
        if (fmode & FWRITE)
                --vp->v_writecount;
@@ -488,3 +490,17 @@ union_removed_upper(un)
        vrele(un->un_uppervp);
        un->un_uppervp = NULLVP;
 }
        vrele(un->un_uppervp);
        un->un_uppervp = NULLVP;
 }
+
+struct vnode *
+union_lowervp(vp)
+       struct vnode *vp;
+{
+       struct union_node *un = VTOUNION(vp);
+
+       if (un->un_lowervp && (vp->v_type == un->un_lowervp->v_type)) {
+               if (vget(un->un_lowervp, 0))
+                       return (NULLVP);
+       }
+
+       return (un->un_lowervp);
+}
index 49466ee..091f3ac 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)union_vfsops.c      1.7 (Berkeley) %G%
+ *     @(#)union_vfsops.c      1.8 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
index 65976d3..0885775 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)union_vnops.c       1.7 (Berkeley) %G%
+ *     @(#)union_vnops.c       1.8 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -402,7 +402,7 @@ union_open(ap)
                                        VOP_UNLOCK(tvp);
                                }
                                VOP_UNLOCK(un->un_uppervp);
                                        VOP_UNLOCK(tvp);
                                }
                                VOP_UNLOCK(un->un_uppervp);
-                               union_vn_close(un->un_uppervp, FWRITE);
+                               union_vn_close(un->un_uppervp, FWRITE, cred, p);
                                VOP_LOCK(un->un_uppervp);
                                if (!error)
                                        uprintf("union: copied up %s\n",
                                VOP_LOCK(un->un_uppervp);
                                if (!error)
                                        uprintf("union: copied up %s\n",
@@ -966,7 +966,7 @@ union_readdir(ap)
        struct union_node *un = VTOUNION(ap->a_vp);
 
        if (un->un_uppervp) {
        struct union_node *un = VTOUNION(ap->a_vp);
 
        if (un->un_uppervp) {
-               struct vnode *vp = OTHERVP(ap->a_vp);
+               struct vnode *vp = un->un_uppervp;
 
                VOP_LOCK(vp);
                error = VOP_READLINK(vp, ap->a_uio, ap->a_cred);
 
                VOP_LOCK(vp);
                error = VOP_READLINK(vp, ap->a_uio, ap->a_cred);
@@ -1102,6 +1102,8 @@ union_lock(ap)
        else
                un->un_pid = -1;
 #endif
        else
                un->un_pid = -1;
 #endif
+
+       return (0);
 }
 
 int
 }
 
 int
@@ -1127,6 +1129,8 @@ union_unlock(ap)
 #ifdef DIAGNOSTIC
        un->un_pid = 0;
 #endif
 #ifdef DIAGNOSTIC
        un->un_pid = 0;
 #endif
+
+       return (0);
 }
 
 int
 }
 
 int