fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License (the "License").
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * or http://www.opensolaris.org/os/licensing.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
27dd1e87cd3d939264769dd4af7e6a529cde001fMark Shellenbaum * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
a3c49ce110f325a563c245bedc4d533adddb7211Albert Lee * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifndef _ACL_COMMON_H
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define _ACL_COMMON_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/types.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/acl.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/stat.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern "C" {
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
a3c49ce110f325a563c245bedc4d533adddb7211Albert Leetypedef struct trivial_acl {
a3c49ce110f325a563c245bedc4d533adddb7211Albert Lee uint32_t allow0; /* allow mask for bits only in owner */
a3c49ce110f325a563c245bedc4d533adddb7211Albert Lee uint32_t deny1; /* deny mask for bits not in owner */
a3c49ce110f325a563c245bedc4d533adddb7211Albert Lee uint32_t deny2; /* deny mask for bits not in group */
a3c49ce110f325a563c245bedc4d533adddb7211Albert Lee uint32_t owner; /* allow mask matching mode */
a3c49ce110f325a563c245bedc4d533adddb7211Albert Lee uint32_t group; /* allow mask matching mode */
a3c49ce110f325a563c245bedc4d533adddb7211Albert Lee uint32_t everyone; /* allow mask matching mode */
a3c49ce110f325a563c245bedc4d533adddb7211Albert Lee} trivial_acl_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int acltrivial(const char *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern void adjust_ace_pair(ace_t *pair, mode_t mode);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwextern void adjust_ace_pair_common(void *, size_t, size_t, mode_t);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ace_trivial(ace_t *acep, int aclcnt);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwextern int ace_trivial_common(void *, int,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint64_t (*walk)(void *, uint64_t, int aclcnt, uint16_t *, uint16_t *,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint32_t *mask));
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwextern acl_t *acl_alloc(acl_type_t);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwextern void acl_free(acl_t *aclp);
a3c49ce110f325a563c245bedc4d533adddb7211Albert Leeextern int acl_translate(acl_t *aclp, int target_flavor, boolean_t isdir,
a3c49ce110f325a563c245bedc4d533adddb7211Albert Lee uid_t owner, gid_t group);
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid ksort(caddr_t v, int n, int s, int (*f)());
fa9e4066f08beec538e775443c5be79dd423fcabahrensint cmp2acls(void *a, void *b);
a3c49ce110f325a563c245bedc4d533adddb7211Albert Leeint acl_trivial_create(mode_t mode, boolean_t isdir, ace_t **acl, int *count);
a3c49ce110f325a563c245bedc4d533adddb7211Albert Leevoid acl_trivial_access_masks(mode_t mode, boolean_t isdir,
a3c49ce110f325a563c245bedc4d533adddb7211Albert Lee trivial_acl_t *masks);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif /* _ACL_COMMON_H */