xref: /original-bsd/sys/miscfs/umapfs/umap.h (revision 7a38d872)
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.2 (Berkeley) 01/05/94
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 	u_long 		(*mapdata)[2];	/* pointer to array of user mappings */
26 	u_long 		(*gmapdata)[2];	/* 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 	u_long		info_mapdata[MAPFILEENTRIES][2]; /* mapping data for
35 	    user mapping in ficus */
36 	u_long		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 extern u_long umap_reverse_findid __P((u_long id, u_long map[][2], int nentries));
53 extern void umap_mapids __P((struct mount *v_mount, struct ucred *credp));
54 
55 #define	MOUNTTOUMAPMOUNT(mp) ((struct umap_mount *)((mp)->mnt_data))
56 #define	VTOUMAP(vp) ((struct umap_node *)(vp)->v_data)
57 #define UMAPTOV(xp) ((xp)->umap_vnode)
58 #ifdef UMAPFS_DIAGNOSTIC
59 extern struct vnode *umap_checkvp __P((struct vnode *vp, char *fil, int lno));
60 #define	UMAPVPTOLOWERVP(vp) umap_checkvp((vp), __FILE__, __LINE__)
61 #else
62 #define	UMAPVPTOLOWERVP(vp) (VTOUMAP(vp)->umap_lowervp)
63 #endif
64 
65 extern int (**umap_vnodeop_p)();
66 extern struct vfsops umap_vfsops;
67 #endif /* KERNEL */
68