1 /* 2 * Copyright (c) 1994 The Regents of the University of California. 3 * Copyright (c) 1994 Jan-Simon Pendry. 4 * All rights reserved. 5 * 6 * This code is derived from software donated to Berkeley by 7 * Jan-Simon Pendry. 8 * 9 * %sccs.include.redist.c% 10 * 11 * @(#)union.h 1.3 (Berkeley) 02/01/94 12 */ 13 14 struct union_args { 15 char *target; /* Target of loopback */ 16 }; 17 18 struct union_mount { 19 struct vnode *um_uppervp; 20 struct vnode *um_lowervp; 21 struct ucred *um_cred; /* Credentials of user calling mount */ 22 }; 23 24 /* begin XXX */ 25 #define VT_UNION VT_LOFS 26 /*#define MOUNT_UNION 15*/ 27 /* end XXX */ 28 29 #ifdef KERNEL 30 31 /* 32 * DEFDIRMODE is the mode bits used to create a shadow directory. 33 */ 34 #define VRWXMODE (VREAD|VWRITE|VEXEC) 35 #define VRWMODE (VREAD|VWRITE) 36 #define UN_DIRMODE ((VRWXMODE)|(VRWXMODE>>3)|(VRWXMODE>>6)) 37 #define UN_FILEMODE ((VRWMODE)|(VRWMODE>>3)|(VRWMODE>>6)) 38 39 /* 40 * A cache of vnode references 41 */ 42 struct union_node { 43 struct union_node *un_next; /* Hash chain */ 44 struct vnode *un_uppervp; /* overlaying object */ 45 struct vnode *un_lowervp; /* underlying object */ 46 struct vnode *un_dirvp; /* Parent dir of uppervp */ 47 struct vnode *un_vnode; /* Back pointer */ 48 char *un_path; /* saved component name */ 49 int un_flags; 50 pid_t un_pid; 51 }; 52 53 #define UN_WANT 0x01 54 #define UN_LOCKED 0x02 55 56 extern int union_node_create __P((struct mount *mp, struct vnode *target, struct vnode **vpp)); 57 58 #define MOUNTTOUNIONMOUNT(mp) ((struct union_mount *)((mp)->mnt_data)) 59 #define VTOUNION(vp) ((struct union_node *)(vp)->v_data) 60 #define UNIONTOV(un) ((un)->un_vnode) 61 #define LOWERVP(vp) (VTOUNION(vp)->un_lowervp) 62 #define UPPERVP(vp) (VTOUNION(vp)->un_uppervp) 63 #define OTHERVP(vp) (UPPERVP(vp) ? UPPERVP(vp) : LOWERVP(vp)) 64 65 extern int (**union_vnodeop_p)(); 66 extern struct vfsops union_vfsops; 67 #endif /* KERNEL */ 68