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]
23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
27 * Copyright 2006 Sun Microsystems, Inc.
28 * All rights reserved.
29 * Use is subject to license terms.
32 #ifndef _NFS_NFS_ACL_H
33 #define _NFS_NFS_ACL_H
39 #define NFS_ACL_MAX_ENTRIES 1024
41 typedef ushort_t o_mode
;
48 typedef struct aclent aclent
;
50 #define NA_USER_OBJ 0x1
52 #define NA_GROUP_OBJ 0x4
54 #define NA_CLASS_OBJ 0x10
55 #define NA_OTHER_OBJ 0x20
56 #define NA_ACL_DEFAULT 0x1000
75 typedef struct secattr secattr
;
80 #define NA_DFACLCNT 0x8
86 typedef struct GETACL2args GETACL2args
;
92 typedef struct GETACL2resok GETACL2resok
;
100 typedef struct GETACL2res GETACL2res
;
106 typedef struct SETACL2args SETACL2args
;
108 struct SETACL2resok
{
109 struct nfsfattr attr
;
111 typedef struct SETACL2resok SETACL2resok
;
119 typedef struct SETACL2res SETACL2res
;
121 struct GETATTR2args
{
124 typedef struct GETATTR2args GETATTR2args
;
126 struct GETATTR2resok
{
127 struct nfsfattr attr
;
129 typedef struct GETATTR2resok GETATTR2resok
;
137 typedef struct GETATTR2res GETATTR2res
;
143 typedef struct ACCESS2args ACCESS2args
;
145 #define ACCESS2_READ 0x1
146 #define ACCESS2_LOOKUP 0x2
147 #define ACCESS2_MODIFY 0x4
148 #define ACCESS2_EXTEND 0x8
149 #define ACCESS2_DELETE 0x10
150 #define ACCESS2_EXECUTE 0x20
152 struct ACCESS2resok
{
153 struct nfsfattr attr
;
156 typedef struct ACCESS2resok ACCESS2resok
;
164 typedef struct ACCESS2res ACCESS2res
;
166 struct GETXATTRDIR2args
{
170 typedef struct GETXATTRDIR2args GETXATTRDIR2args
;
172 struct GETXATTRDIR2resok
{
174 struct nfsfattr attr
;
176 typedef struct GETXATTRDIR2resok GETXATTRDIR2resok
;
178 struct GETXATTRDIR2res
{
181 GETXATTRDIR2resok ok
;
184 typedef struct GETXATTRDIR2res GETXATTRDIR2res
;
190 typedef struct GETACL3args GETACL3args
;
192 struct GETACL3resok
{
196 typedef struct GETACL3resok GETACL3resok
;
198 struct GETACL3resfail
{
201 typedef struct GETACL3resfail GETACL3resfail
;
210 typedef struct GETACL3res GETACL3res
;
216 typedef struct SETACL3args SETACL3args
;
218 struct SETACL3resok
{
221 typedef struct SETACL3resok SETACL3resok
;
223 struct SETACL3resfail
{
226 typedef struct SETACL3resfail SETACL3resfail
;
235 typedef struct SETACL3res SETACL3res
;
237 struct GETXATTRDIR3args
{
241 typedef struct GETXATTRDIR3args GETXATTRDIR3args
;
243 struct GETXATTRDIR3resok
{
247 typedef struct GETXATTRDIR3resok GETXATTRDIR3resok
;
249 struct GETXATTRDIR3res
{
252 GETXATTRDIR3resok ok
;
255 typedef struct GETXATTRDIR3res GETXATTRDIR3res
;
257 #define NFS_ACL_PROGRAM ((rpcprog_t)(100227))
258 #define NFS_ACL_VERSMIN ((rpcvers_t)(2))
259 #define NFS_ACL_VERSMAX ((rpcvers_t)(3))
261 #define NFS_ACL_V2 ((rpcvers_t)(2))
262 #define ACLPROC2_NULL ((rpcproc_t)(0))
263 #define ACLPROC2_GETACL ((rpcproc_t)(1))
264 #define ACLPROC2_SETACL ((rpcproc_t)(2))
265 #define ACLPROC2_GETATTR ((rpcproc_t)(3))
266 #define ACLPROC2_ACCESS ((rpcproc_t)(4))
267 #define ACLPROC2_GETXATTRDIR ((rpcproc_t)(5))
269 #define NFS_ACL_V3 ((rpcvers_t)(3))
270 #define ACLPROC3_NULL ((rpcproc_t)(0))
271 #define ACLPROC3_GETACL ((rpcproc_t)(1))
272 #define ACLPROC3_SETACL ((rpcproc_t)(2))
273 #define ACLPROC3_GETXATTRDIR ((rpcproc_t)(3))
276 /* the xdr functions */
277 extern bool_t
xdr_uid(XDR
*, uid32_t
*);
278 extern bool_t
xdr_o_mode(XDR
*, o_mode
*);
279 extern bool_t
xdr_aclent(XDR
*, aclent_t
*);
280 extern bool_t
xdr_secattr(XDR
*, vsecattr_t
*);
282 extern bool_t
xdr_GETACL2args(XDR
*, GETACL2args
*);
283 extern bool_t
xdr_fastGETACL2args(XDR
*, GETACL2args
**);
284 extern bool_t
xdr_GETACL2resok(XDR
*, GETACL2resok
*);
285 extern bool_t
xdr_GETACL2res(XDR
*, GETACL2res
*);
286 extern bool_t
xdr_SETACL2args(XDR
*, SETACL2args
*);
287 extern bool_t
xdr_SETACL2resok(XDR
*, SETACL2resok
*);
288 #ifdef _LITTLE_ENDIAN
289 extern bool_t
xdr_fastSETACL2resok(XDR
*, SETACL2resok
*);
291 extern bool_t
xdr_SETACL2res(XDR
*, SETACL2res
*);
292 #ifdef _LITTLE_ENDIAN
293 extern bool_t
xdr_fastSETACL2res(XDR
*, SETACL2res
*);
295 extern bool_t
xdr_GETATTR2args(XDR
*, GETATTR2args
*);
296 extern bool_t
xdr_fastGETATTR2args(XDR
*, GETATTR2args
**);
297 extern bool_t
xdr_GETATTR2resok(XDR
*, GETATTR2resok
*);
298 #ifdef _LITTLE_ENDIAN
299 extern bool_t
xdr_fastGETATTR2resok(XDR
*, GETATTR2resok
*);
301 extern bool_t
xdr_GETATTR2res(XDR
*, GETATTR2res
*);
302 #ifdef _LITTLE_ENDIAN
303 extern bool_t
xdr_fastGETATTR2res(XDR
*, GETATTR2res
*);
305 extern bool_t
xdr_ACCESS2args(XDR
*, ACCESS2args
*);
306 extern bool_t
xdr_fastACCESS2args(XDR
*, ACCESS2args
**);
307 extern bool_t
xdr_ACCESS2resok(XDR
*, ACCESS2resok
*);
308 #ifdef _LITTLE_ENDIAN
309 extern bool_t
xdr_fastACCESS2resok(XDR
*, ACCESS2resok
*);
311 extern bool_t
xdr_ACCESS2res(XDR
*, ACCESS2res
*);
312 #ifdef _LITTLE_ENDIAN
313 extern bool_t
xdr_fastACCESS2res(XDR
*, ACCESS2res
*);
315 extern bool_t
xdr_GETXATTRDIR2args(XDR
*, GETXATTRDIR2args
*);
316 extern bool_t
xdr_GETXATTRDIR2res(XDR
*, GETXATTRDIR2res
*);
318 extern bool_t
xdr_GETACL3args(XDR
*, GETACL3args
*);
319 extern bool_t
xdr_GETACL3resok(XDR
*, GETACL3resok
*);
320 extern bool_t
xdr_GETACL3resfail(XDR
*, GETACL3resfail
*);
321 extern bool_t
xdr_GETACL3res(XDR
*, GETACL3res
*);
322 extern bool_t
xdr_SETACL3args(XDR
*, SETACL3args
*);
323 extern bool_t
xdr_SETACL3resok(XDR
*, SETACL3resok
*);
324 extern bool_t
xdr_SETACL3resfail(XDR
*, SETACL3resfail
*);
325 extern bool_t
xdr_SETACL3res(XDR
*, SETACL3res
*);
326 extern bool_t
xdr_GETXATTRDIR3args(XDR
*, GETXATTRDIR3args
*);
327 extern bool_t
xdr_GETXATTRDIR3res(XDR
*, GETXATTRDIR3res
*);
332 /* the service procedures */
333 extern void acl2_getacl(GETACL2args
*, GETACL2res
*,
334 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
335 extern void *acl2_getacl_getfh(GETACL2args
*);
336 extern void acl2_getacl_free(GETACL2res
*);
337 extern void acl2_setacl(SETACL2args
*, SETACL2res
*,
338 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
339 extern void *acl2_setacl_getfh(SETACL2args
*);
340 extern void acl2_getattr(GETATTR2args
*, GETATTR2res
*,
341 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
342 extern void *acl2_getattr_getfh(GETATTR2args
*);
343 extern void acl2_access(ACCESS2args
*, ACCESS2res
*,
344 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
345 extern void *acl2_access_getfh(ACCESS2args
*);
346 extern void acl2_getxattrdir(GETXATTRDIR2args
*, GETXATTRDIR2res
*,
347 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
348 extern void *acl2_getxattrdir_getfh(GETXATTRDIR2args
*);
350 extern void acl3_getacl(GETACL3args
*, GETACL3res
*,
351 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
352 extern void *acl3_getacl_getfh(GETACL3args
*);
353 extern void acl3_getacl_free(GETACL3res
*);
354 extern void acl3_setacl(SETACL3args
*, SETACL3res
*,
355 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
356 extern void *acl3_setacl_getfh(SETACL3args
*);
357 extern void acl3_getxattrdir(GETXATTRDIR3args
*, GETXATTRDIR3res
*,
358 struct exportinfo
*, struct svc_req
*, cred_t
*, bool_t
);
359 extern void *acl3_getxattrdir_getfh(GETXATTRDIR3args
*);
364 /* the client side procedures */
365 extern int acl_getacl2(vnode_t
*, vsecattr_t
*, int, cred_t
*);
366 extern int acl_setacl2(vnode_t
*, vsecattr_t
*, int, cred_t
*);
367 extern int acl_getattr2_otw(vnode_t
*, vattr_t
*, cred_t
*);
368 extern int acl_access2(vnode_t
*, int, int, cred_t
*);
369 extern int acl_getxattrdir2(vnode_t
*, vnode_t
**, bool_t
, cred_t
*, int);
370 extern int acl_getacl3(vnode_t
*, vsecattr_t
*, int, cred_t
*);
371 extern int acl_setacl3(vnode_t
*, vsecattr_t
*, int, cred_t
*);
372 extern int acl_getxattrdir3(vnode_t
*, vnode_t
**, bool_t
, cred_t
*, int);
373 extern int acl2call(mntinfo_t
*, rpcproc_t
, xdrproc_t
, caddr_t
, xdrproc_t
,
374 caddr_t
, cred_t
*, int *, enum nfsstat
*, int,
376 extern int acl3call(mntinfo_t
*, rpcproc_t
, xdrproc_t
, caddr_t
, xdrproc_t
,
377 caddr_t
, cred_t
*, int *, nfsstat3
*, int,
379 extern void nfs_acl_free(vsecattr_t
*);
383 /* server and client data structures */
384 extern kstat_named_t
*aclproccnt_v2_ptr
;
385 extern kstat_t
**aclprocio_v2_ptr
;
386 extern kstat_named_t
*aclproccnt_v3_ptr
;
387 extern kstat_t
**aclprocio_v3_ptr
;
389 extern char *aclnames_v2
[];
390 extern uchar_t acl_call_type_v2
[];
391 extern uchar_t acl_ss_call_type_v2
[];
392 extern uchar_t acl_timer_type_v2
[];
394 extern char *aclnames_v3
[];
395 extern uchar_t acl_call_type_v3
[];
396 extern uchar_t acl_ss_call_type_v3
[];
397 extern uchar_t acl_timer_type_v3
[];
404 #endif /* _NFS_NFS_ACL_H */