xref: /original-bsd/sys/miscfs/umapfs/umap.h (revision 3705696b)
1 /*
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  * All rights reserved.
5  *
6  * This code is derived from software donated to Berkeley by
7  * the UCLA Ficus project.
8  *
9  * %sccs.include.redist.c%
10  *
11  *	@(#)umap.h	8.1 (Berkeley) 06/10/93
12  *
13  * @(#)null_vnops.c       1.5 (Berkeley) 7/10/92
14  */
15 
16 #define MAPFILEENTRIES 64
17 #define GMAPFILEENTRIES 16
18 #define NOBODY 32767
19 #define NULLGROUP 65534
20 
21 struct umap_args {
22 	char		*target;	/* Target of loopback  */
23 	int 		nentries;       /* # of entries in user map array */
24 	int 		gnentries;	/* # of entries in group map array */
25 	int 		*mapdata;       /* pointer to array of user mappings */
26 	int 		*gmapdata;	/* pointer to array of group mappings */
27 };
28 
29 struct umap_mount {
30 	struct mount	*umapm_vfs;
31 	struct vnode	*umapm_rootvp;	/* Reference to root umap_node */
32 	int             info_nentries;  /* number of uid mappings */
33 	int		info_gnentries; /* number of gid mappings */
34 	int             info_mapdata[MAPFILEENTRIES][2]; /* mapping data for
35 	    user mapping in ficus */
36 	int		info_gmapdata[GMAPFILEENTRIES] [2]; /*mapping data for
37 	    group mapping in ficus */
38 };
39 
40 #ifdef KERNEL
41 /*
42  * A cache of vnode references
43  */
44 struct umap_node {
45 	struct umap_node	*umap_forw;	/* Hash chain */
46 	struct umap_node	*umap_back;
47 	struct vnode	*umap_lowervp;	/* Aliased vnode - VREFed once */
48 	struct vnode	*umap_vnode;	/* Back pointer to vnode/umap_node */
49 };
50 
51 extern int umap_node_create __P((struct mount *mp, struct vnode *target, struct vnode **vpp));
52 
53 #define	MOUNTTOUMAPMOUNT(mp) ((struct umap_mount *)((mp)->mnt_data))
54 #define	VTOUMAP(vp) ((struct umap_node *)(vp)->v_data)
55 #define UMAPTOV(xp) ((xp)->umap_vnode)
56 #ifdef UMAPFS_DIAGNOSTIC
57 extern struct vnode *umap_checkvp __P((struct vnode *vp, char *fil, int lno));
58 #define	UMAPVPTOLOWERVP(vp) umap_checkvp((vp), __FILE__, __LINE__)
59 #else
60 #define	UMAPVPTOLOWERVP(vp) (VTOUMAP(vp)->umap_lowervp)
61 #endif
62 
63 extern int (**umap_vnodeop_p)();
64 extern struct vfsops umap_vfsops;
65 #endif /* KERNEL */
66