165933Spendry /* 265933Spendry * Copyright (c) 1994 The Regents of the University of California. 365933Spendry * Copyright (c) 1994 Jan-Simon Pendry. 465933Spendry * All rights reserved. 565933Spendry * 665933Spendry * This code is derived from software donated to Berkeley by 765933Spendry * Jan-Simon Pendry. 865933Spendry * 965933Spendry * %sccs.include.redist.c% 1065933Spendry * 11*65997Spendry * @(#)union.h 1.6 (Berkeley) 02/04/94 1265933Spendry */ 1365933Spendry 1465933Spendry struct union_args { 1565933Spendry char *target; /* Target of loopback */ 1665933Spendry }; 1765933Spendry 1865933Spendry struct union_mount { 1965933Spendry struct vnode *um_uppervp; 2065933Spendry struct vnode *um_lowervp; 2165933Spendry struct ucred *um_cred; /* Credentials of user calling mount */ 22*65997Spendry int um_cmode; /* cmask from mount process */ 2365933Spendry }; 2465933Spendry 2565933Spendry #ifdef KERNEL 2665933Spendry 2765933Spendry /* 2865933Spendry * DEFDIRMODE is the mode bits used to create a shadow directory. 2965933Spendry */ 3065933Spendry #define VRWXMODE (VREAD|VWRITE|VEXEC) 3165933Spendry #define VRWMODE (VREAD|VWRITE) 3265933Spendry #define UN_DIRMODE ((VRWXMODE)|(VRWXMODE>>3)|(VRWXMODE>>6)) 3365933Spendry #define UN_FILEMODE ((VRWMODE)|(VRWMODE>>3)|(VRWMODE>>6)) 3465933Spendry 3565933Spendry /* 3665933Spendry * A cache of vnode references 3765933Spendry */ 3865933Spendry struct union_node { 3965933Spendry struct union_node *un_next; /* Hash chain */ 4065991Spendry struct vnode *un_vnode; /* Back pointer */ 4165933Spendry struct vnode *un_uppervp; /* overlaying object */ 4265933Spendry struct vnode *un_lowervp; /* underlying object */ 4365933Spendry struct vnode *un_dirvp; /* Parent dir of uppervp */ 4465933Spendry char *un_path; /* saved component name */ 45*65997Spendry int un_open; /* # of opens on lowervp */ 4665933Spendry int un_flags; 4765933Spendry pid_t un_pid; 4865933Spendry }; 4965933Spendry 5065933Spendry #define UN_WANT 0x01 5165933Spendry #define UN_LOCKED 0x02 5265933Spendry 5365994Spendry extern int union_allocvp __P((struct vnode **, struct mount *, 5465994Spendry struct vnode *, struct vnode *, 5565994Spendry struct componentname *, struct vnode *, 5665994Spendry struct vnode *)); 5765994Spendry extern int union_copyfile __P((struct proc *, struct ucred *, 5865994Spendry struct vnode *, struct vnode *)); 59*65997Spendry extern int union_mkshadow __P((struct union_mount *, struct vnode *, 60*65997Spendry struct componentname *, struct vnode **)); 6165994Spendry extern int union_vn_create __P((struct vnode **, struct union_node *, 62*65997Spendry struct proc *)); 6365933Spendry 6465933Spendry #define MOUNTTOUNIONMOUNT(mp) ((struct union_mount *)((mp)->mnt_data)) 6565933Spendry #define VTOUNION(vp) ((struct union_node *)(vp)->v_data) 6665933Spendry #define UNIONTOV(un) ((un)->un_vnode) 6765933Spendry #define LOWERVP(vp) (VTOUNION(vp)->un_lowervp) 6865965Spendry #define UPPERVP(vp) (VTOUNION(vp)->un_uppervp) 6965933Spendry #define OTHERVP(vp) (UPPERVP(vp) ? UPPERVP(vp) : LOWERVP(vp)) 7065933Spendry 7165933Spendry extern int (**union_vnodeop_p)(); 7265933Spendry extern struct vfsops union_vfsops; 7365933Spendry #endif /* KERNEL */ 74