Print this page
11083 support NFS server in zone
Portions contributed by: Dan Kruchinin <dan.kruchinin@nexenta.com>
Portions contributed by: Stepan Zastupov <stepan.zastupov@gmail.com>
Portions contributed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Portions contributed by: Mike Zeller <mike@mikezeller.net>
Portions contributed by: Dan McDonald <danmcd@joyent.com>
Portions contributed by: Gordon Ross <gordon.w.ross@gmail.com>
Portions contributed by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Jason King <jbk@joyent.com>
Reviewed by: C Fraire <cfraire@me.com>
Change-Id: I22f289d357503f9b48a0bc2482cc4328a6d43d16
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/nfs/nfs_acl.h
+++ new/usr/src/uts/common/nfs/nfs_acl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2006 Sun Microsystems, Inc.
23 23 * All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26 /*
27 27 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
28 28 */
29 29
30 30 #ifndef _NFS_NFS_ACL_H
31 31 #define _NFS_NFS_ACL_H
32 32
33 33 #ifdef __cplusplus
34 34 extern "C" {
35 35 #endif
36 36
37 37 #define NFS_ACL_MAX_ENTRIES 1024
38 38
39 39 typedef ushort_t o_mode;
40 40
41 41 struct aclent {
42 42 int type;
43 43 uid32_t id;
44 44 o_mode perm;
45 45 };
46 46 typedef struct aclent aclent;
47 47
48 48 #define NA_USER_OBJ 0x1
49 49 #define NA_USER 0x2
50 50 #define NA_GROUP_OBJ 0x4
51 51 #define NA_GROUP 0x8
52 52 #define NA_CLASS_OBJ 0x10
53 53 #define NA_OTHER_OBJ 0x20
54 54 #define NA_ACL_DEFAULT 0x1000
55 55
56 56 #define NA_READ 0x4
57 57 #define NA_WRITE 0x2
58 58 #define NA_EXEC 0x1
59 59
60 60 struct secattr {
61 61 uint32 mask;
62 62 int aclcnt;
63 63 struct {
64 64 uint_t aclent_len;
65 65 aclent *aclent_val;
66 66 } aclent;
67 67 int dfaclcnt;
68 68 struct {
69 69 uint_t dfaclent_len;
70 70 aclent *dfaclent_val;
71 71 } dfaclent;
72 72 };
73 73 typedef struct secattr secattr;
74 74
75 75 #define NA_ACL 0x1
76 76 #define NA_ACLCNT 0x2
77 77 #define NA_DFACL 0x4
78 78 #define NA_DFACLCNT 0x8
79 79
80 80 struct GETACL2args {
81 81 fhandle_t fh;
82 82 uint32 mask;
83 83 };
84 84 typedef struct GETACL2args GETACL2args;
85 85
86 86 struct GETACL2resok {
87 87 struct nfsfattr attr;
88 88 vsecattr_t acl;
89 89 };
90 90 typedef struct GETACL2resok GETACL2resok;
91 91
92 92 struct GETACL2res {
93 93 enum nfsstat status;
94 94 union {
95 95 GETACL2resok ok;
96 96 } res_u;
97 97 };
98 98 typedef struct GETACL2res GETACL2res;
99 99
100 100 struct SETACL2args {
101 101 fhandle_t fh;
102 102 vsecattr_t acl;
103 103 };
104 104 typedef struct SETACL2args SETACL2args;
105 105
106 106 struct SETACL2resok {
107 107 struct nfsfattr attr;
108 108 };
109 109 typedef struct SETACL2resok SETACL2resok;
110 110
111 111 struct SETACL2res {
112 112 enum nfsstat status;
113 113 union {
114 114 SETACL2resok ok;
115 115 } res_u;
116 116 };
117 117 typedef struct SETACL2res SETACL2res;
118 118
119 119 struct GETATTR2args {
120 120 fhandle_t fh;
121 121 };
122 122 typedef struct GETATTR2args GETATTR2args;
123 123
124 124 struct GETATTR2resok {
125 125 struct nfsfattr attr;
126 126 };
127 127 typedef struct GETATTR2resok GETATTR2resok;
128 128
129 129 struct GETATTR2res {
130 130 enum nfsstat status;
131 131 union {
132 132 GETATTR2resok ok;
133 133 } res_u;
134 134 };
135 135 typedef struct GETATTR2res GETATTR2res;
136 136
137 137 struct ACCESS2args {
138 138 fhandle_t fh;
139 139 uint32 access;
140 140 };
141 141 typedef struct ACCESS2args ACCESS2args;
142 142
143 143 #define ACCESS2_READ 0x1
144 144 #define ACCESS2_LOOKUP 0x2
145 145 #define ACCESS2_MODIFY 0x4
146 146 #define ACCESS2_EXTEND 0x8
147 147 #define ACCESS2_DELETE 0x10
148 148 #define ACCESS2_EXECUTE 0x20
149 149
150 150 struct ACCESS2resok {
151 151 struct nfsfattr attr;
152 152 uint32 access;
153 153 };
154 154 typedef struct ACCESS2resok ACCESS2resok;
155 155
156 156 struct ACCESS2res {
157 157 enum nfsstat status;
158 158 union {
159 159 ACCESS2resok ok;
160 160 } res_u;
161 161 };
162 162 typedef struct ACCESS2res ACCESS2res;
163 163
164 164 struct GETXATTRDIR2args {
165 165 fhandle_t fh;
166 166 bool_t create;
167 167 };
168 168 typedef struct GETXATTRDIR2args GETXATTRDIR2args;
169 169
170 170 struct GETXATTRDIR2resok {
171 171 fhandle_t fh;
172 172 struct nfsfattr attr;
173 173 };
174 174 typedef struct GETXATTRDIR2resok GETXATTRDIR2resok;
175 175
176 176 struct GETXATTRDIR2res {
177 177 enum nfsstat status;
178 178 union {
179 179 GETXATTRDIR2resok ok;
180 180 } res_u;
181 181 };
182 182 typedef struct GETXATTRDIR2res GETXATTRDIR2res;
183 183
184 184 struct GETACL3args {
185 185 nfs_fh3 fh;
186 186 uint32 mask;
187 187 };
188 188 typedef struct GETACL3args GETACL3args;
189 189
190 190 struct GETACL3resok {
191 191 post_op_attr attr;
192 192 vsecattr_t acl;
193 193 };
194 194 typedef struct GETACL3resok GETACL3resok;
195 195
196 196 struct GETACL3resfail {
197 197 post_op_attr attr;
198 198 };
199 199 typedef struct GETACL3resfail GETACL3resfail;
200 200
201 201 struct GETACL3res {
202 202 nfsstat3 status;
203 203 union {
204 204 GETACL3resok ok;
205 205 GETACL3resfail fail;
206 206 } res_u;
207 207 };
208 208 typedef struct GETACL3res GETACL3res;
209 209
210 210 struct SETACL3args {
211 211 nfs_fh3 fh;
212 212 vsecattr_t acl;
213 213 };
214 214 typedef struct SETACL3args SETACL3args;
215 215
216 216 struct SETACL3resok {
217 217 post_op_attr attr;
218 218 };
219 219 typedef struct SETACL3resok SETACL3resok;
220 220
221 221 struct SETACL3resfail {
222 222 post_op_attr attr;
223 223 };
224 224 typedef struct SETACL3resfail SETACL3resfail;
225 225
226 226 struct SETACL3res {
227 227 nfsstat3 status;
228 228 union {
229 229 SETACL3resok ok;
230 230 SETACL3resfail fail;
231 231 } res_u;
232 232 };
233 233 typedef struct SETACL3res SETACL3res;
234 234
235 235 struct GETXATTRDIR3args {
236 236 nfs_fh3 fh;
237 237 bool_t create;
238 238 };
239 239 typedef struct GETXATTRDIR3args GETXATTRDIR3args;
240 240
241 241 struct GETXATTRDIR3resok {
242 242 nfs_fh3 fh;
243 243 post_op_attr attr;
244 244 };
245 245 typedef struct GETXATTRDIR3resok GETXATTRDIR3resok;
246 246
247 247 struct GETXATTRDIR3res {
248 248 nfsstat3 status;
249 249 union {
250 250 GETXATTRDIR3resok ok;
251 251 } res_u;
252 252 };
253 253 typedef struct GETXATTRDIR3res GETXATTRDIR3res;
254 254
255 255 #define NFS_ACL_PROGRAM ((rpcprog_t)(100227))
256 256 #define NFS_ACL_VERSMIN ((rpcvers_t)(2))
257 257 #define NFS_ACL_VERSMAX ((rpcvers_t)(3))
258 258
259 259 #define NFS_ACL_V2 ((rpcvers_t)(2))
260 260 #define ACLPROC2_NULL ((rpcproc_t)(0))
261 261 #define ACLPROC2_GETACL ((rpcproc_t)(1))
262 262 #define ACLPROC2_SETACL ((rpcproc_t)(2))
263 263 #define ACLPROC2_GETATTR ((rpcproc_t)(3))
264 264 #define ACLPROC2_ACCESS ((rpcproc_t)(4))
265 265 #define ACLPROC2_GETXATTRDIR ((rpcproc_t)(5))
266 266
267 267 #define NFS_ACL_V3 ((rpcvers_t)(3))
268 268 #define ACLPROC3_NULL ((rpcproc_t)(0))
269 269 #define ACLPROC3_GETACL ((rpcproc_t)(1))
270 270 #define ACLPROC3_SETACL ((rpcproc_t)(2))
271 271 #define ACLPROC3_GETXATTRDIR ((rpcproc_t)(3))
272 272
273 273 #ifdef _KERNEL
274 274 /* the xdr functions */
275 275 extern bool_t xdr_uid(XDR *, uid32_t *);
276 276 extern bool_t xdr_o_mode(XDR *, o_mode *);
277 277 extern bool_t xdr_aclent(XDR *, aclent_t *);
278 278 extern bool_t xdr_secattr(XDR *, vsecattr_t *);
279 279
280 280 extern bool_t xdr_GETACL2args(XDR *, GETACL2args *);
281 281 extern bool_t xdr_fastGETACL2args(XDR *, GETACL2args **);
282 282 extern bool_t xdr_GETACL2resok(XDR *, GETACL2resok *);
283 283 extern bool_t xdr_GETACL2res(XDR *, GETACL2res *);
284 284 extern bool_t xdr_SETACL2args(XDR *, SETACL2args *);
285 285 extern bool_t xdr_SETACL2resok(XDR *, SETACL2resok *);
286 286 #ifdef _LITTLE_ENDIAN
287 287 extern bool_t xdr_fastSETACL2resok(XDR *, SETACL2resok *);
288 288 #endif
289 289 extern bool_t xdr_SETACL2res(XDR *, SETACL2res *);
290 290 #ifdef _LITTLE_ENDIAN
291 291 extern bool_t xdr_fastSETACL2res(XDR *, SETACL2res *);
292 292 #endif
293 293 extern bool_t xdr_GETATTR2args(XDR *, GETATTR2args *);
294 294 extern bool_t xdr_fastGETATTR2args(XDR *, GETATTR2args **);
295 295 extern bool_t xdr_GETATTR2resok(XDR *, GETATTR2resok *);
296 296 #ifdef _LITTLE_ENDIAN
297 297 extern bool_t xdr_fastGETATTR2resok(XDR *, GETATTR2resok *);
298 298 #endif
299 299 extern bool_t xdr_GETATTR2res(XDR *, GETATTR2res *);
300 300 #ifdef _LITTLE_ENDIAN
301 301 extern bool_t xdr_fastGETATTR2res(XDR *, GETATTR2res *);
302 302 #endif
303 303 extern bool_t xdr_ACCESS2args(XDR *, ACCESS2args *);
304 304 extern bool_t xdr_fastACCESS2args(XDR *, ACCESS2args **);
305 305 extern bool_t xdr_ACCESS2resok(XDR *, ACCESS2resok *);
306 306 #ifdef _LITTLE_ENDIAN
307 307 extern bool_t xdr_fastACCESS2resok(XDR *, ACCESS2resok *);
308 308 #endif
309 309 extern bool_t xdr_ACCESS2res(XDR *, ACCESS2res *);
310 310 #ifdef _LITTLE_ENDIAN
311 311 extern bool_t xdr_fastACCESS2res(XDR *, ACCESS2res *);
312 312 #endif
313 313 extern bool_t xdr_GETXATTRDIR2args(XDR *, GETXATTRDIR2args *);
314 314 extern bool_t xdr_GETXATTRDIR2res(XDR *, GETXATTRDIR2res *);
315 315
316 316 extern bool_t xdr_GETACL3args(XDR *, GETACL3args *);
317 317 extern bool_t xdr_GETACL3resok(XDR *, GETACL3resok *);
318 318 extern bool_t xdr_GETACL3resfail(XDR *, GETACL3resfail *);
319 319 extern bool_t xdr_GETACL3res(XDR *, GETACL3res *);
320 320 extern bool_t xdr_SETACL3args(XDR *, SETACL3args *);
321 321 extern bool_t xdr_SETACL3resok(XDR *, SETACL3resok *);
322 322 extern bool_t xdr_SETACL3resfail(XDR *, SETACL3resfail *);
323 323 extern bool_t xdr_SETACL3res(XDR *, SETACL3res *);
324 324 extern bool_t xdr_GETXATTRDIR3args(XDR *, GETXATTRDIR3args *);
325 325 extern bool_t xdr_GETXATTRDIR3res(XDR *, GETXATTRDIR3res *);
326 326
327 327 #endif
328 328
329 329 #ifdef _KERNEL
330 330 /* the service procedures */
331 331 extern void acl2_getacl(GETACL2args *, GETACL2res *,
332 332 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
333 333 extern void *acl2_getacl_getfh(GETACL2args *);
334 334 extern void acl2_getacl_free(GETACL2res *);
335 335 extern void acl2_setacl(SETACL2args *, SETACL2res *,
336 336 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
337 337 extern void *acl2_setacl_getfh(SETACL2args *);
338 338 extern void acl2_getattr(GETATTR2args *, GETATTR2res *,
339 339 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
340 340 extern void *acl2_getattr_getfh(GETATTR2args *);
341 341 extern void acl2_access(ACCESS2args *, ACCESS2res *,
342 342 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
343 343 extern void *acl2_access_getfh(ACCESS2args *);
344 344 extern void acl2_getxattrdir(GETXATTRDIR2args *, GETXATTRDIR2res *,
345 345 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
346 346 extern void *acl2_getxattrdir_getfh(GETXATTRDIR2args *);
347 347
348 348 extern void acl3_getacl(GETACL3args *, GETACL3res *,
349 349 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
350 350 extern void *acl3_getacl_getfh(GETACL3args *);
351 351 extern void acl3_getacl_free(GETACL3res *);
352 352 extern void acl3_setacl(SETACL3args *, SETACL3res *,
353 353 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
354 354 extern void *acl3_setacl_getfh(SETACL3args *);
355 355 extern void acl3_getxattrdir(GETXATTRDIR3args *, GETXATTRDIR3res *,
356 356 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
357 357 extern void *acl3_getxattrdir_getfh(GETXATTRDIR3args *);
358 358
359 359 #endif
360 360
361 361 #ifdef _KERNEL
362 362 /* the client side procedures */
363 363 extern int acl_getacl2(vnode_t *, vsecattr_t *, int, cred_t *);
364 364 extern int acl_setacl2(vnode_t *, vsecattr_t *, int, cred_t *);
365 365 extern int acl_getattr2_otw(vnode_t *, vattr_t *, cred_t *);
366 366 extern int acl_access2(vnode_t *, int, int, cred_t *);
367 367 extern int acl_getxattrdir2(vnode_t *, vnode_t **, bool_t, cred_t *, int);
368 368 extern int acl_getacl3(vnode_t *, vsecattr_t *, int, cred_t *);
369 369 extern int acl_setacl3(vnode_t *, vsecattr_t *, int, cred_t *);
370 370 extern int acl_getxattrdir3(vnode_t *, vnode_t **, bool_t, cred_t *, int);
371 371 extern int acl2call(mntinfo_t *, rpcproc_t, xdrproc_t, caddr_t, xdrproc_t,
|
↓ open down ↓ |
371 lines elided |
↑ open up ↑ |
372 372 caddr_t, cred_t *, int *, enum nfsstat *, int,
373 373 failinfo_t *);
374 374 extern int acl3call(mntinfo_t *, rpcproc_t, xdrproc_t, caddr_t, xdrproc_t,
375 375 caddr_t, cred_t *, int *, nfsstat3 *, int,
376 376 failinfo_t *);
377 377 extern void nfs_acl_free(vsecattr_t *);
378 378 #endif
379 379
380 380 #ifdef _KERNEL
381 381 /* server and client data structures */
382 -extern kstat_named_t *aclproccnt_v2_ptr;
383 -extern kstat_named_t *aclproccnt_v3_ptr;
384 382
385 383 extern char *aclnames_v2[];
386 384 extern uchar_t acl_call_type_v2[];
387 385 extern uchar_t acl_ss_call_type_v2[];
388 386 extern uchar_t acl_timer_type_v2[];
389 387
390 388 extern char *aclnames_v3[];
391 389 extern uchar_t acl_call_type_v3[];
392 390 extern uchar_t acl_ss_call_type_v3[];
393 391 extern uchar_t acl_timer_type_v3[];
394 392 #endif
395 393
396 394 #ifdef __cplusplus
397 395 }
398 396 #endif
399 397
400 398 #endif /* _NFS_NFS_ACL_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX