]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* $NetBSD: umap.h,v 1.4 1995/03/29 22:09:57 briggs Exp $ */ | |
23 | ||
24 | /* | |
25 | * Copyright (c) 1992, 1993 | |
26 | * The Regents of the University of California. All rights reserved. | |
27 | * | |
28 | * This code is derived from software donated to Berkeley by | |
29 | * the UCLA Ficus project. | |
30 | * | |
31 | * Redistribution and use in source and binary forms, with or without | |
32 | * modification, are permitted provided that the following conditions | |
33 | * are met: | |
34 | * 1. Redistributions of source code must retain the above copyright | |
35 | * notice, this list of conditions and the following disclaimer. | |
36 | * 2. Redistributions in binary form must reproduce the above copyright | |
37 | * notice, this list of conditions and the following disclaimer in the | |
38 | * documentation and/or other materials provided with the distribution. | |
39 | * 3. All advertising materials mentioning features or use of this software | |
40 | * must display the following acknowledgement: | |
41 | * This product includes software developed by the University of | |
42 | * California, Berkeley and its contributors. | |
43 | * 4. Neither the name of the University nor the names of its contributors | |
44 | * may be used to endorse or promote products derived from this software | |
45 | * without specific prior written permission. | |
46 | * | |
47 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
48 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
49 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
50 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
51 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
52 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
53 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
55 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
56 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
57 | * SUCH DAMAGE. | |
58 | * | |
59 | * from: @(#)null_vnops.c 1.5 (Berkeley) 7/10/92 | |
60 | * @(#)umap.h 8.3 (Berkeley) 1/21/94 | |
61 | */ | |
62 | ||
63 | #define MAPFILEENTRIES 64 | |
64 | #define GMAPFILEENTRIES 16 | |
65 | #define NOBODY 32767 | |
66 | #define NULLGROUP 65534 | |
67 | ||
68 | struct umap_args { | |
69 | char *target; /* Target of loopback */ | |
70 | int nentries; /* # of entries in user map array */ | |
71 | int gnentries; /* # of entries in group map array */ | |
72 | uid_t (*mapdata)[2]; /* pointer to array of user mappings */ | |
73 | gid_t (*gmapdata)[2]; /* pointer to array of group mappings */ | |
74 | }; | |
75 | ||
76 | struct umap_mount { | |
77 | struct mount *umapm_vfs; | |
78 | struct vnode *umapm_rootvp; /* Reference to root umap_node */ | |
79 | int info_nentries; /* number of uid mappings */ | |
80 | int info_gnentries; /* number of gid mappings */ | |
81 | uid_t info_mapdata[MAPFILEENTRIES][2]; /* mapping data for | |
82 | user mapping in ficus */ | |
83 | gid_t info_gmapdata[GMAPFILEENTRIES][2]; /*mapping data for | |
84 | group mapping in ficus */ | |
85 | }; | |
86 | ||
87 | #ifdef KERNEL | |
88 | /* | |
89 | * A cache of vnode references | |
90 | */ | |
91 | struct umap_node { | |
92 | LIST_ENTRY(umap_node) umap_hash; /* Hash list */ | |
93 | struct vnode *umap_lowervp; /* Aliased vnode - VREFed once */ | |
94 | struct vnode *umap_vnode; /* Back pointer to vnode/umap_node */ | |
95 | }; | |
96 | ||
97 | extern int umap_node_create __P((struct mount *mp, struct vnode *target, struct vnode **vpp)); | |
98 | extern u_long umap_reverse_findid __P((u_long id, u_long map[][2], int nentries)); | |
99 | extern void umap_mapids __P((struct mount *v_mount, struct ucred *credp)); | |
100 | ||
101 | #define MOUNTTOUMAPMOUNT(mp) ((struct umap_mount *)((mp)->mnt_data)) | |
102 | #define VTOUMAP(vp) ((struct umap_node *)(vp)->v_data) | |
103 | #define UMAPTOV(xp) ((xp)->umap_vnode) | |
104 | #ifdef UMAPFS_DIAGNOSTIC | |
105 | extern struct vnode *umap_checkvp __P((struct vnode *vp, char *fil, int lno)); | |
106 | #define UMAPVPTOLOWERVP(vp) umap_checkvp((vp), __FILE__, __LINE__) | |
107 | #else | |
108 | #define UMAPVPTOLOWERVP(vp) (VTOUMAP(vp)->umap_lowervp) | |
109 | #endif | |
110 | ||
111 | extern int (**umap_vnodeop_p)(void *); | |
112 | extern struct vfsops umap_vfsops; | |
113 | #endif /* KERNEL */ |