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]
22 * Copyright 2006 Sun Microsystems, Inc.
23 * All rights reserved.
24 * Use is subject to license terms.
27 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
30 #ifndef _NFS_NFS_ACL_H
31 #define _NFS_NFS_ACL_H
37 #define NFS_ACL_MAX_ENTRIES 1024
39 typedef ushort_t o_mode
;
46 typedef struct aclent aclent
;
48 #define NA_USER_OBJ 0x1
50 #define NA_GROUP_OBJ 0x4
52 #define NA_CLASS_OBJ 0x10
53 #define NA_OTHER_OBJ 0x20
54 #define NA_ACL_DEFAULT 0x1000
73 typedef struct secattr secattr
;
78 #define NA_DFACLCNT 0x8
84 typedef struct GETACL2args GETACL2args
;
90 typedef struct GETACL2resok GETACL2resok
;
98 typedef struct GETACL2res GETACL2res
;
104 typedef struct SETACL2args SETACL2args
;
106 struct SETACL2resok
{
107 struct nfsfattr attr
;
109 typedef struct SETACL2resok SETACL2resok
;
117 typedef struct SETACL2res SETACL2res
;
119 struct GETATTR2args
{
122 typedef struct GETATTR2args GETATTR2args
;
124 struct GETATTR2resok
{
125 struct nfsfattr attr
;
127 typedef struct GETATTR2resok GETATTR2resok
;
135 typedef struct GETATTR2res GETATTR2res
;
141 typedef struct ACCESS2args ACCESS2args
;
143 #define ACCESS2_READ 0x1
144 #define ACCESS2_LOOKUP 0x2
145 #define ACCESS2_MODIFY 0x4
146 #define ACCESS2_EXTEND 0x8
147 #define ACCESS2_DELETE 0x10
148 #define ACCESS2_EXECUTE 0x20
150 struct ACCESS2resok
{
151 struct nfsfattr attr
;
154 typedef struct ACCESS2resok ACCESS2resok
;
162 typedef struct ACCESS2res ACCESS2res
;
164 struct GETXATTRDIR2args
{
168 typedef struct GETXATTRDIR2args GETXATTRDIR2args
;
170 struct GETXATTRDIR2resok
{
172 struct nfsfattr attr
;
174 typedef struct GETXATTRDIR2resok GETXATTRDIR2resok
;
176 struct GETXATTRDIR2res
{
179 GETXATTRDIR2resok ok
;
182 typedef struct GETXATTRDIR2res GETXATTRDIR2res
;
188 typedef struct GETACL3args GETACL3args
;
190 struct GETACL3resok
{
194 typedef struct GETACL3resok GETACL3resok
;
196 struct GETACL3resfail
{
199 typedef struct GETACL3resfail GETACL3resfail
;
208 typedef struct GETACL3res GETACL3res
;
214 typedef struct SETACL3args SETACL3args
;
216 struct SETACL3resok
{
219 typedef struct SETACL3resok SETACL3resok
;
221 struct SETACL3resfail
{
224 typedef struct SETACL3resfail SETACL3resfail
;
233 typedef struct SETACL3res SETACL3res
;
235 struct GETXATTRDIR3args
{
239 typedef struct GETXATTRDIR3args GETXATTRDIR3args
;
241 struct GETXATTRDIR3resok
{
245 typedef struct GETXATTRDIR3resok GETXATTRDIR3resok
;
247 struct GETXATTRDIR3res
{
250 GETXATTRDIR3resok ok
;
253 typedef struct GETXATTRDIR3res GETXATTRDIR3res
;
255 #define NFS_ACL_PROGRAM ((rpcprog_t)(100227))
256 #define NFS_ACL_VERSMIN ((rpcvers_t)(2))
257 #define NFS_ACL_VERSMAX ((rpcvers_t)(3))
259 #define NFS_ACL_V2 ((rpcvers_t)(2))
260 #define ACLPROC2_NULL ((rpcproc_t)(0))
261 #define ACLPROC2_GETACL ((rpcproc_t)(1))
262 #define ACLPROC2_SETACL ((rpcproc_t)(2))
263 #define ACLPROC2_GETATTR ((rpcproc_t)(3))
264 #define ACLPROC2_ACCESS ((rpcproc_t)(4))
265 #define ACLPROC2_GETXATTRDIR ((rpcproc_t)(5))
267 #define NFS_ACL_V3 ((rpcvers_t)(3))
268 #define ACLPROC3_NULL ((rpcproc_t)(0))
269 #define ACLPROC3_GETACL ((rpcproc_t)(1))
270 #define ACLPROC3_SETACL ((rpcproc_t)(2))
271 #define ACLPROC3_GETXATTRDIR ((rpcproc_t)(3))
274 /* the xdr functions */
275 extern bool_t
xdr_uid(XDR
*, uid32_t
*);
276 extern bool_t
xdr_o_mode(XDR
*, o_mode
*);
277 extern bool_t
xdr_aclent(XDR
*, aclent_t
*);
278 extern bool_t
xdr_secattr(XDR
*, vsecattr_t
*);
280 extern bool_t
xdr_GETACL2args(XDR
*, GETACL2args
*);
281 extern bool_t
xdr_fastGETACL2args(XDR
*, GETACL2args
**);
282 extern bool_t
xdr_GETACL2resok(XDR
*, GETACL2resok
*);
283 extern bool_t
xdr_GETACL2res(XDR
*, GETACL2res
*);
284 extern bool_t
xdr_SETACL2args(XDR
*, SETACL2args
*);
285 extern bool_t
xdr_SETACL2resok(XDR
*, SETACL2resok
*);
286 #ifdef _LITTLE_ENDIAN
287 extern bool_t
xdr_fastSETACL2resok(XDR
*, SETACL2resok
*);
289 extern bool_t
xdr_SETACL2res(XDR
*, SETACL2res
*);
290 #ifdef _LITTLE_ENDIAN
291 extern bool_t
xdr_fastSETACL2res(XDR
*, SETACL2res
*);
293 extern bool_t
xdr_GETATTR2args(XDR
*, GETATTR2args
*);
294 extern bool_t
xdr_fastGETATTR2args(XDR
*, GETATTR2args
**);
295 extern bool_t
xdr_GETATTR2resok(XDR
*, GETATTR2resok
*);
296 #ifdef _LITTLE_ENDIAN
297 extern bool_t
xdr_fastGETATTR2resok(XDR
*, GETATTR2resok
*);
299 extern bool_t
xdr_GETATTR2res(XDR
*, GETATTR2res
*);
300 #ifdef _LITTLE_ENDIAN
301 extern bool_t
xdr_fastGETATTR2res(XDR
*, GETATTR2res
*);
303 extern bool_t
xdr_ACCESS2args(XDR
*, ACCESS2args
*);
304 extern bool_t
xdr_fastACCESS2args(XDR
*, ACCESS2args
**);
305 extern bool_t
xdr_ACCESS2resok(XDR
*, ACCESS2resok
*);
306 #ifdef _LITTLE_ENDIAN
307 extern bool_t
xdr_fastACCESS2resok(XDR
*, ACCESS2resok
*);
309 extern bool_t
xdr_ACCESS2res(XDR
*, ACCESS2res
*);
310 #ifdef _LITTLE_ENDIAN
311 extern bool_t
xdr_fastACCESS2res(XDR
*, ACCESS2res
*);
313 extern bool_t
xdr_GETXATTRDIR2args(XDR
*, GETXATTRDIR2args
*);
314 extern bool_t
xdr_GETXATTRDIR2res(XDR
*, GETXATTRDIR2res
*);
316 extern bool_t
xdr_GETACL3args(XDR
*, GETACL3args
*);
317 extern bool_t
xdr_GETACL3resok(XDR
*, GETACL3resok
*);
318 extern bool_t
xdr_GETACL3resfail(XDR
*, GETACL3resfail
*);
319 extern bool_t
xdr_GETACL3res(XDR
*, GETACL3res
*);
320 extern bool_t
xdr_SETACL3args(XDR
*, SETACL3args
*);
321 extern bool_t
xdr_SETACL3resok(XDR
*, SETACL3resok
*);
322 extern bool_t
xdr_SETACL3resfail(XDR
*, SETACL3resfail
*);
323 extern bool_t
xdr_SETACL3res(XDR
*, SETACL3res
*);
324 extern bool_t
xdr_GETXATTRDIR3args(XDR
*, GETXATTRDIR3args
*);
325 extern bool_t
xdr_GETXATTRDIR3res(XDR
*, GETXATTRDIR3res
*);
330 /* the service procedures */
331 extern void acl2_getacl(GETACL2args
*, GETACL2res
*,
332 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
333 extern void *acl2_getacl_getfh(GETACL2args
*);
334 extern void acl2_getacl_free(GETACL2res
*);
335 extern void acl2_setacl(SETACL2args
*, SETACL2res
*,
336 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
337 extern void *acl2_setacl_getfh(SETACL2args
*);
338 extern void acl2_getattr(GETATTR2args
*, GETATTR2res
*,
339 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
340 extern void *acl2_getattr_getfh(GETATTR2args
*);
341 extern void acl2_access(ACCESS2args
*, ACCESS2res
*,
342 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
343 extern void *acl2_access_getfh(ACCESS2args
*);
344 extern void acl2_getxattrdir(GETXATTRDIR2args
*, GETXATTRDIR2res
*,
345 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
346 extern void *acl2_getxattrdir_getfh(GETXATTRDIR2args
*);
348 extern void acl3_getacl(GETACL3args
*, GETACL3res
*,
349 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
350 extern void *acl3_getacl_getfh(GETACL3args
*);
351 extern void acl3_getacl_free(GETACL3res
*);
352 extern void acl3_setacl(SETACL3args
*, SETACL3res
*,
353 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
354 extern void *acl3_setacl_getfh(SETACL3args
*);
355 extern void acl3_getxattrdir(GETXATTRDIR3args
*, GETXATTRDIR3res
*,
356 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
357 extern void *acl3_getxattrdir_getfh(GETXATTRDIR3args
*);
362 /* the client side procedures */
363 extern int acl_getacl2(vnode_t
*, vsecattr_t
*, int, cred_t
*);
364 extern int acl_setacl2(vnode_t
*, vsecattr_t
*, int, cred_t
*);
365 extern int acl_getattr2_otw(vnode_t
*, vattr_t
*, cred_t
*);
366 extern int acl_access2(vnode_t
*, int, int, cred_t
*);
367 extern int acl_getxattrdir2(vnode_t
*, vnode_t
**, bool_t
, cred_t
*, int);
368 extern int acl_getacl3(vnode_t
*, vsecattr_t
*, int, cred_t
*);
369 extern int acl_setacl3(vnode_t
*, vsecattr_t
*, int, cred_t
*);
370 extern int acl_getxattrdir3(vnode_t
*, vnode_t
**, bool_t
, cred_t
*, int);
371 extern int acl2call(mntinfo_t
*, rpcproc_t
, xdrproc_t
, caddr_t
, xdrproc_t
,
372 caddr_t
, cred_t
*, int *, enum nfsstat
*, int,
374 extern int acl3call(mntinfo_t
*, rpcproc_t
, xdrproc_t
, caddr_t
, xdrproc_t
,
375 caddr_t
, cred_t
*, int *, nfsstat3
*, int,
377 extern void nfs_acl_free(vsecattr_t
*);
381 /* server and client data structures */
383 extern char *aclnames_v2
[];
384 extern uchar_t acl_call_type_v2
[];
385 extern uchar_t acl_ss_call_type_v2
[];
386 extern uchar_t acl_timer_type_v2
[];
388 extern char *aclnames_v3
[];
389 extern uchar_t acl_call_type_v3
[];
390 extern uchar_t acl_ss_call_type_v3
[];
391 extern uchar_t acl_timer_type_v3
[];
398 #endif /* _NFS_NFS_ACL_H */