xref: /illumos-gate/usr/src/common/acl/acl_common.h (revision a3c49ce1)
1fa9e4066Sahrens /*
2fa9e4066Sahrens  * CDDL HEADER START
3fa9e4066Sahrens  *
4fa9e4066Sahrens  * The contents of this file are subject to the terms of the
5da6c28aaSamw  * Common Development and Distribution License (the "License").
6da6c28aaSamw  * You may not use this file except in compliance with the License.
7fa9e4066Sahrens  *
8fa9e4066Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e4066Sahrens  * or http://www.opensolaris.org/os/licensing.
10fa9e4066Sahrens  * See the License for the specific language governing permissions
11fa9e4066Sahrens  * and limitations under the License.
12fa9e4066Sahrens  *
13fa9e4066Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14fa9e4066Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e4066Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16fa9e4066Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e4066Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e4066Sahrens  *
19fa9e4066Sahrens  * CDDL HEADER END
20fa9e4066Sahrens  */
21fa9e4066Sahrens /*
2227dd1e87SMark Shellenbaum  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23*a3c49ce1SAlbert Lee  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
24fa9e4066Sahrens  */
26da6c28aaSamw #ifndef	_ACL_COMMON_H
27da6c28aaSamw #define	_ACL_COMMON_H
29fa9e4066Sahrens #include <sys/types.h>
30fa9e4066Sahrens #include <sys/acl.h>
31fa9e4066Sahrens #include <sys/stat.h>
33da6c28aaSamw #ifdef	__cplusplus
34fa9e4066Sahrens extern "C" {
35fa9e4066Sahrens #endif
37*a3c49ce1SAlbert Lee typedef struct trivial_acl {
38*a3c49ce1SAlbert Lee 	uint32_t	allow0;		/* allow mask for bits only in owner */
39*a3c49ce1SAlbert Lee 	uint32_t	deny1;		/* deny mask for bits not in owner */
40*a3c49ce1SAlbert Lee 	uint32_t	deny2;		/* deny mask for bits not in group */
41*a3c49ce1SAlbert Lee 	uint32_t	owner;		/* allow mask matching mode */
42*a3c49ce1SAlbert Lee 	uint32_t	group;		/* allow mask matching mode */
43*a3c49ce1SAlbert Lee 	uint32_t	everyone;	/* allow mask matching mode */
44*a3c49ce1SAlbert Lee } trivial_acl_t;
46fa9e4066Sahrens extern int acltrivial(const char *);
47fa9e4066Sahrens extern void adjust_ace_pair(ace_t *pair, mode_t mode);
48da6c28aaSamw extern void adjust_ace_pair_common(void *, size_t, size_t, mode_t);
49fa9e4066Sahrens extern int ace_trivial(ace_t *acep, int aclcnt);
50da6c28aaSamw extern int ace_trivial_common(void *, int,
51da6c28aaSamw     uint64_t (*walk)(void *, uint64_t, int aclcnt, uint16_t *, uint16_t *,
52da6c28aaSamw     uint32_t *mask));
53da6c28aaSamw extern acl_t *acl_alloc(acl_type_t);
54da6c28aaSamw extern void acl_free(acl_t *aclp);
55*a3c49ce1SAlbert Lee extern int acl_translate(acl_t *aclp, int target_flavor, boolean_t isdir,
56*a3c49ce1SAlbert Lee     uid_t owner, gid_t group);
57fa9e4066Sahrens void ksort(caddr_t v, int n, int s, int (*f)());
58fa9e4066Sahrens int cmp2acls(void *a, void *b);
59*a3c49ce1SAlbert Lee int acl_trivial_create(mode_t mode, boolean_t isdir, ace_t **acl, int *count);
60*a3c49ce1SAlbert Lee void acl_trivial_access_masks(mode_t mode, boolean_t isdir,
61*a3c49ce1SAlbert Lee     trivial_acl_t *masks);
63da6c28aaSamw #ifdef	__cplusplus
64fa9e4066Sahrens }
65fa9e4066Sahrens #endif
67da6c28aaSamw #endif /* _ACL_COMMON_H */