checkpoint
[unix-history] / usr / src / sys / miscfs / union / union.h
CommitLineData
cad9958b
JSP
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 *
3b293975 11 * @(#)union.h 1.6 (Berkeley) %G%
cad9958b
JSP
12 */
13
14struct union_args {
15 char *target; /* Target of loopback */
16};
17
18struct union_mount {
19 struct vnode *um_uppervp;
20 struct vnode *um_lowervp;
21 struct ucred *um_cred; /* Credentials of user calling mount */
3b293975 22 int um_cmode; /* cmask from mount process */
cad9958b
JSP
23};
24
cad9958b
JSP
25#ifdef KERNEL
26
27/*
28 * DEFDIRMODE is the mode bits used to create a shadow directory.
29 */
30#define VRWXMODE (VREAD|VWRITE|VEXEC)
31#define VRWMODE (VREAD|VWRITE)
32#define UN_DIRMODE ((VRWXMODE)|(VRWXMODE>>3)|(VRWXMODE>>6))
33#define UN_FILEMODE ((VRWMODE)|(VRWMODE>>3)|(VRWMODE>>6))
34
35/*
36 * A cache of vnode references
37 */
38struct union_node {
39 struct union_node *un_next; /* Hash chain */
79f80c71 40 struct vnode *un_vnode; /* Back pointer */
cad9958b
JSP
41 struct vnode *un_uppervp; /* overlaying object */
42 struct vnode *un_lowervp; /* underlying object */
43 struct vnode *un_dirvp; /* Parent dir of uppervp */
cad9958b 44 char *un_path; /* saved component name */
3b293975 45 int un_open; /* # of opens on lowervp */
cad9958b
JSP
46 int un_flags;
47 pid_t un_pid;
48};
49
50#define UN_WANT 0x01
51#define UN_LOCKED 0x02
52
81be6ee0
JSP
53extern int union_allocvp __P((struct vnode **, struct mount *,
54 struct vnode *, struct vnode *,
55 struct componentname *, struct vnode *,
56 struct vnode *));
57extern int union_copyfile __P((struct proc *, struct ucred *,
58 struct vnode *, struct vnode *));
3b293975
JSP
59extern int union_mkshadow __P((struct union_mount *, struct vnode *,
60 struct componentname *, struct vnode **));
81be6ee0 61extern int union_vn_create __P((struct vnode **, struct union_node *,
3b293975 62 struct proc *));
cad9958b
JSP
63
64#define MOUNTTOUNIONMOUNT(mp) ((struct union_mount *)((mp)->mnt_data))
65#define VTOUNION(vp) ((struct union_node *)(vp)->v_data)
66#define UNIONTOV(un) ((un)->un_vnode)
67#define LOWERVP(vp) (VTOUNION(vp)->un_lowervp)
01dac67e 68#define UPPERVP(vp) (VTOUNION(vp)->un_uppervp)
cad9958b
JSP
69#define OTHERVP(vp) (UPPERVP(vp) ? UPPERVP(vp) : LOWERVP(vp))
70
71extern int (**union_vnodeop_p)();
72extern struct vfsops union_vfsops;
73#endif /* KERNEL */