Deleted Added
full compact
union_subr.c (3396) union_subr.c (3496)
1/*
2 * Copyright (c) 1994 Jan-Simon Pendry
3 * Copyright (c) 1994
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 21 unchanged lines hidden (view full) ---

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
35 * SUCH DAMAGE.
36 *
37 * @(#)union_subr.c 8.4 (Berkeley) 2/17/94
1/*
2 * Copyright (c) 1994 Jan-Simon Pendry
3 * Copyright (c) 1994
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 21 unchanged lines hidden (view full) ---

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
35 * SUCH DAMAGE.
36 *
37 * @(#)union_subr.c 8.4 (Berkeley) 2/17/94
38 * $Id: union_subr.c,v 1.3 1994/08/02 07:45:44 davidg Exp $
38 * $Id: union_subr.c,v 1.4 1994/10/06 21:06:48 davidg Exp $
39 */
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/time.h>
44#include <sys/kernel.h>
45#include <sys/vnode.h>
46#include <sys/namei.h>

--- 172 unchanged lines hidden (view full) ---

219 struct vnode *undvp;
220 struct vnode *dvp; /* may be null */
221 struct componentname *cnp; /* may be null */
222 struct vnode *uppervp; /* may be null */
223 struct vnode *lowervp; /* may be null */
224{
225 int error;
226 struct union_node *un = 0;
39 */
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/time.h>
44#include <sys/kernel.h>
45#include <sys/vnode.h>
46#include <sys/namei.h>

--- 172 unchanged lines hidden (view full) ---

219 struct vnode *undvp;
220 struct vnode *dvp; /* may be null */
221 struct componentname *cnp; /* may be null */
222 struct vnode *uppervp; /* may be null */
223 struct vnode *lowervp; /* may be null */
224{
225 int error;
226 struct union_node *un = 0;
227 struct union_node **pp;
228 struct vnode *xlowervp = NULLVP;
229 int hash = 0;
230 int try;
231
232 if (uppervp == NULLVP && lowervp == NULLVP)
233 panic("union: unidentifiable allocation");
234
235 if (uppervp && lowervp && (uppervp->v_type != lowervp->v_type)) {

--- 353 unchanged lines hidden (view full) ---

589 else
590 cn.cn_cred = um->um_cred;
591 cn.cn_nameptr = cn.cn_pnbuf;
592 cn.cn_namelen = cnp->cn_namelen;
593 cn.cn_hash = cnp->cn_hash;
594 cn.cn_consume = cnp->cn_consume;
595
596 VREF(dvp);
227 struct vnode *xlowervp = NULLVP;
228 int hash = 0;
229 int try;
230
231 if (uppervp == NULLVP && lowervp == NULLVP)
232 panic("union: unidentifiable allocation");
233
234 if (uppervp && lowervp && (uppervp->v_type != lowervp->v_type)) {

--- 353 unchanged lines hidden (view full) ---

588 else
589 cn.cn_cred = um->um_cred;
590 cn.cn_nameptr = cn.cn_pnbuf;
591 cn.cn_namelen = cnp->cn_namelen;
592 cn.cn_hash = cnp->cn_hash;
593 cn.cn_consume = cnp->cn_consume;
594
595 VREF(dvp);
597 if (error = relookup(dvp, vpp, &cn))
596 error = relookup(dvp, vpp, &cn);
597 if (error)
598 return (error);
599 vrele(dvp);
600
601 if (*vpp) {
602 VOP_ABORTOP(dvp, &cn);
603 VOP_UNLOCK(dvp);
604 vrele(*vpp);
605 *vpp = NULLVP;

--- 27 unchanged lines hidden (view full) ---

633{
634 struct vnode *vp;
635 struct ucred *cred = p->p_ucred;
636 struct vattr vat;
637 struct vattr *vap = &vat;
638 int fmode = FFLAGS(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL);
639 int error;
640 int cmode = UN_FILEMODE & ~p->p_fd->fd_cmask;
598 return (error);
599 vrele(dvp);
600
601 if (*vpp) {
602 VOP_ABORTOP(dvp, &cn);
603 VOP_UNLOCK(dvp);
604 vrele(*vpp);
605 *vpp = NULLVP;

--- 27 unchanged lines hidden (view full) ---

633{
634 struct vnode *vp;
635 struct ucred *cred = p->p_ucred;
636 struct vattr vat;
637 struct vattr *vap = &vat;
638 int fmode = FFLAGS(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL);
639 int error;
640 int cmode = UN_FILEMODE & ~p->p_fd->fd_cmask;
641 char *cp;
642 struct componentname cn;
643
644 *vpp = NULLVP;
645
646 /*
647 * Build a new componentname structure (for the same
648 * reasons outlines in union_mkshadow).
649 * The difference here is that the file is owned by

--- 9 unchanged lines hidden (view full) ---

659 cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);
660 cn.cn_proc = p;
661 cn.cn_cred = p->p_ucred;
662 cn.cn_nameptr = cn.cn_pnbuf;
663 cn.cn_hash = un->un_hash;
664 cn.cn_consume = 0;
665
666 VREF(un->un_dirvp);
641 struct componentname cn;
642
643 *vpp = NULLVP;
644
645 /*
646 * Build a new componentname structure (for the same
647 * reasons outlines in union_mkshadow).
648 * The difference here is that the file is owned by

--- 9 unchanged lines hidden (view full) ---

658 cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);
659 cn.cn_proc = p;
660 cn.cn_cred = p->p_ucred;
661 cn.cn_nameptr = cn.cn_pnbuf;
662 cn.cn_hash = un->un_hash;
663 cn.cn_consume = 0;
664
665 VREF(un->un_dirvp);
667 if (error = relookup(un->un_dirvp, &vp, &cn))
666 error = relookup(un->un_dirvp, &vp, &cn);
667 if (error)
668 return (error);
669 vrele(un->un_dirvp);
670
671 if (vp) {
672 VOP_ABORTOP(un->un_dirvp, &cn);
673 if (un->un_dirvp == vp)
674 vrele(un->un_dirvp);
675 else

--- 11 unchanged lines hidden (view full) ---

687 * bottom files. Access when not unioned will simply
688 * require access to the top-level file.
689 * TODO: confirm choice of access permissions.
690 */
691 VATTR_NULL(vap);
692 vap->va_type = VREG;
693 vap->va_mode = cmode;
694 LEASE_CHECK(un->un_dirvp, p, cred, LEASE_WRITE);
668 return (error);
669 vrele(un->un_dirvp);
670
671 if (vp) {
672 VOP_ABORTOP(un->un_dirvp, &cn);
673 if (un->un_dirvp == vp)
674 vrele(un->un_dirvp);
675 else

--- 11 unchanged lines hidden (view full) ---

687 * bottom files. Access when not unioned will simply
688 * require access to the top-level file.
689 * TODO: confirm choice of access permissions.
690 */
691 VATTR_NULL(vap);
692 vap->va_type = VREG;
693 vap->va_mode = cmode;
694 LEASE_CHECK(un->un_dirvp, p, cred, LEASE_WRITE);
695 if (error = VOP_CREATE(un->un_dirvp, &vp, &cn, vap))
695 error = VOP_CREATE(un->un_dirvp, &vp, &cn, vap);
696 if (error)
696 return (error);
697
697 return (error);
698
698 if (error = VOP_OPEN(vp, fmode, cred, p)) {
699 error = VOP_OPEN(vp, fmode, cred, p);
700 if (error) {
699 vput(vp);
700 return (error);
701 }
702
703 vp->v_writecount++;
704 *vpp = vp;
705 return (0);
706}

--- 38 unchanged lines hidden ---
701 vput(vp);
702 return (error);
703 }
704
705 vp->v_writecount++;
706 *vpp = vp;
707 return (0);
708}

--- 38 unchanged lines hidden ---