5027 zfs large block support (add copyright)
[unleashed.git] / usr / src / uts / common / sys / kidmap.h
blob00db50eb63b66b21a2fb0ee2c80fa04de6262421
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * Windows to Solaris Identity Mapping kernel API
29 * This header defines an API to map Windows SIDs to
30 * Solaris UID and GIDs and versa visa.
33 #ifndef _SYS_KIDMAP_H
34 #define _SYS_KIDMAP_H
36 #pragma ident "%Z%%M% %I% %E% SMI"
38 #include <sys/idmap.h>
39 #include <sys/door.h>
40 #include <sys/zone.h>
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 /* Opaque get handle */
47 typedef struct idmap_get_handle idmap_get_handle_t;
49 /* Return status */
50 typedef int32_t idmap_stat;
53 * In all the routines a Windows SID is handled as a
54 * string SID prefix plus a RID. For example
56 * S-1-5-5-12-34-568 will be passed as SID prefix
57 * S-1-5-5-12-34 and RID 568
59 * Certain routines returns pointers to a SID prefix string.
60 * These strings are stored internally and should not be modified
61 * or freed.
66 * The following routines are simple get ID mapping routines.
70 idmap_stat
71 kidmap_getuidbysid(zone_t *zone, const char *sid_prefix, uint32_t rid,
72 uid_t *uid);
74 idmap_stat
75 kidmap_getgidbysid(zone_t *zone, const char *sid_prefix, uint32_t rid,
76 gid_t *gid);
78 idmap_stat
79 kidmap_getpidbysid(zone_t *zone, const char *sid_prefix, uint32_t rid,
80 uid_t *pid, int *is_user);
82 idmap_stat
83 kidmap_getsidbyuid(zone_t *zone, uid_t uid, const char **sid_prefix,
84 uint32_t *rid);
86 idmap_stat
87 kidmap_getsidbygid(zone_t *zone, gid_t gid, const char **sid_prefix,
88 uint32_t *rid);
93 * The following routines provide a batch interface for mapping IDs.
97 * Create a batch "get mapping" handle for batch mappings.
99 idmap_get_handle_t *
100 kidmap_get_create(zone_t *zone);
103 * These routines queue the request to the "get mapping" handle
106 idmap_stat
107 kidmap_batch_getuidbysid(idmap_get_handle_t *get_handle,
108 const char *sid_prefix, uint32_t rid,
109 uid_t *uid, idmap_stat *stat);
111 idmap_stat
112 kidmap_batch_getgidbysid(idmap_get_handle_t *get_handle,
113 const char *sid_prefix, uint32_t rid,
114 gid_t *gid, idmap_stat *stat);
116 idmap_stat
117 kidmap_batch_getpidbysid(idmap_get_handle_t *get_handle,
118 const char *sid_prefix, uint32_t rid,
119 uid_t *pid, int *is_user, idmap_stat *stat);
121 idmap_stat
122 kidmap_batch_getsidbyuid(idmap_get_handle_t *get_handle, uid_t uid,
123 const char **sid_prefix, uint32_t *rid, idmap_stat *stat);
125 idmap_stat
126 kidmap_batch_getsidbygid(idmap_get_handle_t *get_handle, gid_t gid,
127 const char **sid_prefix, uint32_t *rid, idmap_stat *stat);
130 * Process the queued "get mapping" requests. The results (i.e.
131 * status and identity) will be available in the data areas
132 * provided by individual requests.
134 idmap_stat
135 kidmap_get_mappings(idmap_get_handle_t *get_handle);
138 * Destroy the "get mapping" handle
140 void
141 kidmap_get_destroy(idmap_get_handle_t *get_handle);
144 * Functions that do the hard part of door registration/unregistration
145 * for the idmap_reg()/idmap_unreg() syscalls
147 int idmap_reg_dh(zone_t *zone, door_handle_t dh);
148 int idmap_unreg_dh(zone_t *zone, door_handle_t dh);
151 * Function needed by allocids() to ensure only the daemon that owns
152 * the door gets ephemeral IDS
154 door_handle_t idmap_get_door(zone_t *zone);
157 * Function used by system call allocids() to purge the
158 * ID mapping cache
160 void idmap_purge_cache(zone_t *zone);
163 #ifdef __cplusplus
165 #endif
167 #endif /* _SYS_KIDMAP_H */