xref: /titanic_51/usr/src/common/acl/acl_common.h (revision 45e662eb8429b38c18931ebeed30f2e5287ae51b)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
24  */
25 
26 #ifndef	_ACL_COMMON_H
27 #define	_ACL_COMMON_H
28 
29 #include <sys/types.h>
30 #include <sys/acl.h>
31 #include <sys/stat.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 typedef struct trivial_acl {
38 	uint32_t	allow0;		/* allow mask for bits only in owner */
39 	uint32_t	deny1;		/* deny mask for bits not in owner */
40 	uint32_t	deny2;		/* deny mask for bits not in group */
41 	uint32_t	owner;		/* allow mask matching mode */
42 	uint32_t	group;		/* allow mask matching mode */
43 	uint32_t	everyone;	/* allow mask matching mode */
44 } trivial_acl_t;
45 
46 extern int acltrivial(const char *);
47 extern void adjust_ace_pair(ace_t *pair, mode_t mode);
48 extern void adjust_ace_pair_common(void *, size_t, size_t, mode_t);
49 extern int ace_trivial(ace_t *acep, int aclcnt);
50 extern int ace_trivial_common(void *, int,
51     uint64_t (*walk)(void *, uint64_t, int aclcnt, uint16_t *, uint16_t *,
52     uint32_t *mask));
53 extern acl_t *acl_alloc(acl_type_t);
54 extern void acl_free(acl_t *aclp);
55 extern int acl_translate(acl_t *aclp, int target_flavor, boolean_t isdir,
56     uid_t owner, gid_t group);
57 void ksort(caddr_t v, int n, int s, int (*f)());
58 int cmp2acls(void *a, void *b);
59 int acl_trivial_create(mode_t mode, boolean_t isdir, ace_t **acl, int *count);
60 void acl_trivial_access_masks(mode_t mode, boolean_t isdir,
61     trivial_acl_t *masks);
62 
63 #ifdef	__cplusplus
64 }
65 #endif
66 
67 #endif /* _ACL_COMMON_H */
68