Merge remote-tracking branch 'origin/master'
[unleashed/lotheac.git] / usr / src / uts / common / nfs / nfsid_map.h
blob197970d4d2ac73dca7562a160624097d37e3ffd8
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
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _NFSID_MAP_H
27 #define _NFSID_MAP_H
29 #ifndef _KERNEL
30 #include <stddef.h>
31 #endif
32 #include <sys/sysmacros.h>
33 #include <sys/types.h>
36 * NFSv4 id mapping daemon
38 * This daemon is used by the kernel to map strings in the form
39 * "user@dns_domain" from an integer form or vice-versa. The daemon
40 * uses the system configured name services for the mapping.
42 * The status results determines if a mapping was successful.
44 * The mapping is cached in the kernel, so that expensive upcalls are
45 * reduced to a minimum.
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
53 * mapid commands
55 #define NFSMAPID_STR_UID 1
56 #define NFSMAPID_UID_STR 2
57 #define NFSMAPID_STR_GID 3
58 #define NFSMAPID_GID_STR 4
59 #define NFSMAPID_SRV_NETINFO 5
62 * We are passing in arguments in a variable length struct
63 * similar to a dirent_t. We break apart a utf8string into
64 * its components and allocate a struct long enough to hold
65 * the string and a NUL terminator. The caller must ensure the
66 * terminator is set.
68 struct mapid_arg {
69 uint_t cmd;
70 union {
71 uid_t uid;
72 gid_t gid;
73 int len;
74 } u_arg;
75 char str[1];
77 typedef struct mapid_arg mapid_arg_t;
80 * The actual required size of the args, rounded up to a 64 bit boundary
82 #define MAPID_ARG_LEN(str_length) \
83 ((offsetof(mapid_arg_t, str[0]) + 1 + (str_length) + 7) & ~ 7)
86 * Return status codes
88 #define NFSMAPID_OK 0
91 * numeric string is mapped to its literal number
93 #define NFSMAPID_NUMSTR 1
96 * Value cannot be mapped, badly formed string
98 #define NFSMAPID_UNMAPPABLE 2
101 * Caller provided invalid arguments
103 #define NFSMAPID_INVALID 3
106 * Internal error in daemon e.g. out of memory, can't return result
108 #define NFSMAPID_INTERNAL 4
111 * Incorrect domain used
113 #define NFSMAPID_BADDOMAIN 5
116 * Out of range uid/gid
118 #define NFSMAPID_BADID 6
121 * User or group cannot be found in nameservice
123 #define NFSMAPID_NOTFOUND 7
126 * Similar to the arguments, the result is variable length.
127 * The returner must ensure the string terminator is set.
129 struct mapid_res {
130 uint_t status;
131 union {
132 uid_t uid;
133 gid_t gid;
134 int len;
135 } u_res;
136 char str[1];
138 typedef struct mapid_res mapid_res_t;
141 * The actual required size of the result, rounded up to a 64 bit boundary
143 #define MAPID_RES_LEN(str_length) \
144 ((offsetof(mapid_res_t, str[0]) + 1 + (str_length) + 7) & ~ 7)
147 * Support for referral name resolution by the NFS client
149 typedef struct refd_door_args {
150 int cmd; /* NFS4_FS_LOCATIONS/NFS4_SRV_NETINFO */
151 int xdr_len; /* Length of xdr Buffer */
152 char xdr_arg[1]; /* Buffer holding xdr encoded data */
153 } refd_door_args_t;
155 typedef struct refd_door_res {
156 int res_status;
157 int xdr_len;
158 char xdr_res[1];
159 } refd_door_res_t;
161 #ifdef _SYSCALL32
162 typedef struct refd_door_args32 {
163 int32_t cmd;
164 int32_t xdr_len;
165 char xdr_arg[1];
166 } refd_door_args32_t;
168 typedef struct refd_door_res32 {
169 int32_t res_status;
170 int32_t xdr_len;
171 char xdr_res[1];
172 } refd_door_res32_t;
173 #endif
175 #ifdef __cplusplus
177 #endif
179 #endif /* _NFSID_MAP_H */