xref: /csrg-svn/sys/miscfs/umapfs/umap.h (revision 54946)
1*54946Sheideman /*
2*54946Sheideman  * Copyright (c) 1992 The Regents of the University of California
3*54946Sheideman  * Copyright (c) 1990, 1992 Jan-Simon Pendry
4*54946Sheideman  * All rights reserved.
5*54946Sheideman  *
6*54946Sheideman  * This code is derived from software donated to Berkeley by
7*54946Sheideman  * Jan-Simon Pendry.
8*54946Sheideman  *
9*54946Sheideman  * Redistribution and use in source and binary forms, with or without
10*54946Sheideman  * modification, are permitted provided that the following conditions
11*54946Sheideman  * are met:
12*54946Sheideman  * 1. Redistributions of source code must retain the above copyright
13*54946Sheideman  *    notice, this list of conditions and the following disclaimer.
14*54946Sheideman  * 2. Redistributions in binary form must reproduce the above copyright
15*54946Sheideman  *    notice, this list of conditions and the following disclaimer in the
16*54946Sheideman  *    documentation and/or other materials provided with the distribution.
17*54946Sheideman  * 3. All advertising materials mentioning features or use of this software
18*54946Sheideman  *    must display the following acknowledgement:
19*54946Sheideman  *	This product includes software developed by the University of
20*54946Sheideman  *	California, Berkeley and its contributors.
21*54946Sheideman  * 4. Neither the name of the University nor the names of its contributors
22*54946Sheideman  *    may be used to endorse or promote products derived from this software
23*54946Sheideman  *    without specific prior written permission.
24*54946Sheideman  *
25*54946Sheideman  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26*54946Sheideman  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27*54946Sheideman  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28*54946Sheideman  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29*54946Sheideman  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30*54946Sheideman  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31*54946Sheideman  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32*54946Sheideman  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33*54946Sheideman  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34*54946Sheideman  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35*54946Sheideman  * SUCH DAMAGE.
36*54946Sheideman  *
37*54946Sheideman  *	@(#)lofs.h	1.1 (Berkeley) 6/3/92
38*54946Sheideman  *
39*54946Sheideman  * $Id: lofs.h,v 1.8 1992/05/30 10:05:43 jsp Exp jsp $
40*54946Sheideman  */
41*54946Sheideman 
42*54946Sheideman #define MAPFILEENTRIES 64
43*54946Sheideman #define GMAPFILEENTRIES 16
44*54946Sheideman #define NOBODY 32767
45*54946Sheideman #define UMAPGROUP 65534
46*54946Sheideman 
47*54946Sheideman struct umap_args {
48*54946Sheideman 	char		*target;	/* Target of loopback  */
49*54946Sheideman 	int 		nentries;       /* # of entries in user map array */
50*54946Sheideman 	int 		gnentries;	/* # of entries in group map array */
51*54946Sheideman 	int 		*mapdata;       /* pointer to array of user mappings */
52*54946Sheideman 	int 		*gmapdata;	/* pointer to array of group mappings */
53*54946Sheideman };
54*54946Sheideman 
55*54946Sheideman struct umap_mount {
56*54946Sheideman 	struct mount	*umapm_vfs;
57*54946Sheideman 	struct vnode	*umapm_rootvp;	/* Reference to root umap_node */
58*54946Sheideman 	int             info_nentries;  /* number of uid mappings */
59*54946Sheideman 	int		info_gnentries; /* number of gid mappings */
60*54946Sheideman 	int             info_mapdata[MAPFILEENTRIES][2]; /* mapping data for
61*54946Sheideman 	    user mapping in ficus */
62*54946Sheideman 	int		info_gmapdata[GMAPFILEENTRIES] [2]; /*mapping data for
63*54946Sheideman 	    group mapping in ficus */
64*54946Sheideman };
65*54946Sheideman 
66*54946Sheideman #ifdef KERNEL
67*54946Sheideman /*
68*54946Sheideman  * A cache of vnode references
69*54946Sheideman  */
70*54946Sheideman struct umap_node {
71*54946Sheideman 	struct umap_node	*umap_forw;	/* Hash chain */
72*54946Sheideman 	struct umap_node	*umap_back;
73*54946Sheideman 	struct vnode	*umap_lowervp;	/* Aliased vnode - VREFed once */
74*54946Sheideman 	struct vnode	*umap_vnode;	/* Back pointer to vnode/umap_node */
75*54946Sheideman };
76*54946Sheideman 
77*54946Sheideman extern int umap_node_create __P((struct mount *mp, struct vnode *target, struct vnode **vpp));
78*54946Sheideman 
79*54946Sheideman #define	MOUNTTOUMAPMOUNT(mp) ((struct umap_mount *)((mp)->mnt_data))
80*54946Sheideman #define	VTOUMAP(vp) ((struct umap_node *)(vp)->v_data)
81*54946Sheideman #ifdef UMAPFS_DIAGNOSTIC
82*54946Sheideman extern struct vnode *umap_checkvp __P((struct vnode *vp, char *fil, int lno));
83*54946Sheideman #define	UMAPVPTOLOWERVP(vp) umap_checkvp((vp), __FILE__, __LINE__)
84*54946Sheideman #else
85*54946Sheideman #define	UMAPVPTOLOWERVP(vp) (VTOUMAP(vp)->umap_lowervp)
86*54946Sheideman #endif
87*54946Sheideman 
88*54946Sheideman extern int (**umap_vnodeop_p)();
89*54946Sheideman extern struct vfsops umap_vfsops;
90*54946Sheideman #endif /* KERNEL */
91*54946Sheideman 
92