xref: /original-bsd/sys/miscfs/umapfs/umap.h (revision deff14a8)
1 /*
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software donated to Berkeley by
6  * the UCLA Ficus project.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)umap.h	8.4 (Berkeley) 08/20/94
11  *
12  * @(#)null_vnops.c       1.5 (Berkeley) 7/10/92
13  */
14 
15 #define MAPFILEENTRIES 64
16 #define GMAPFILEENTRIES 16
17 #define NOBODY 32767
18 #define NULLGROUP 65534
19 
20 struct umap_args {
21 	char		*target;	/* Target of loopback  */
22 	int 		nentries;       /* # of entries in user map array */
23 	int 		gnentries;	/* # of entries in group map array */
24 	u_long 		(*mapdata)[2];	/* pointer to array of user mappings */
25 	u_long 		(*gmapdata)[2];	/* pointer to array of group mappings */
26 };
27 
28 struct umap_mount {
29 	struct mount	*umapm_vfs;
30 	struct vnode	*umapm_rootvp;	/* Reference to root umap_node */
31 	int             info_nentries;  /* number of uid mappings */
32 	int		info_gnentries;	/* number of gid mappings */
33 	u_long		info_mapdata[MAPFILEENTRIES][2]; /* mapping data for
34 	    user mapping in ficus */
35 	u_long		info_gmapdata[GMAPFILEENTRIES][2]; /*mapping data for
36 	    group mapping in ficus */
37 };
38 
39 #ifdef KERNEL
40 /*
41  * A cache of vnode references
42  */
43 struct umap_node {
44 	LIST_ENTRY(umap_node) umap_hash;	/* Hash list */
45 	struct vnode	*umap_lowervp;	/* Aliased vnode - VREFed once */
46 	struct vnode	*umap_vnode;	/* Back pointer to vnode/umap_node */
47 };
48 
49 extern int umap_node_create __P((struct mount *mp, struct vnode *target, struct vnode **vpp));
50 extern u_long umap_reverse_findid __P((u_long id, u_long map[][2], int nentries));
51 extern void umap_mapids __P((struct mount *v_mount, struct ucred *credp));
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