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
34extern "C" {
35#endif
36
37typedef 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
46extern int acltrivial(const char *);
47extern void adjust_ace_pair(ace_t *pair, mode_t mode);
48extern void adjust_ace_pair_common(void *, size_t, size_t, mode_t);
49extern int ace_trivial(ace_t *acep, int aclcnt);
50extern int ace_trivial_common(void *, int,
51    uint64_t (*walk)(void *, uint64_t, int aclcnt, uint16_t *, uint16_t *,
52    uint32_t *mask));
53#if !defined(_KERNEL)
54extern acl_t *acl_alloc(acl_type_t);
55extern void acl_free(acl_t *aclp);
56extern int acl_translate(acl_t *aclp, int target_flavor, boolean_t isdir,
57    uid_t owner, gid_t group);
58#endif	/* !_KERNEL */
59void ksort(caddr_t v, int n, int s, int (*f)());
60int cmp2acls(void *a, void *b);
61int acl_trivial_create(mode_t mode, boolean_t isdir, ace_t **acl, int *count);
62void acl_trivial_access_masks(mode_t mode, boolean_t isdir,
63    trivial_acl_t *masks);
64
65#ifdef	__cplusplus
66}
67#endif
68
69#endif /* _ACL_COMMON_H */
70