zfs_acl.h revision 23d5bb1f2275e3b549733444de8e92fb47d0631b
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FS_ZFS_ACL_H
#define _SYS_FS_ZFS_ACL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef _KERNEL
#include <sys/isa_defs.h>
#endif
#include <sys/zfs_fuid.h>
#ifdef __cplusplus
extern "C" {
#endif
struct znode_phys;
#define ACE_SLOT_CNT 6
#define ZFS_ACL_VERSION_INITIAL 0ULL
#define ZFS_ACL_VERSION_FUID 1ULL
#define ZFS_ACL_VERSION ZFS_ACL_VERSION_FUID
/*
* ZFS ACLs are store in various forms.
* Files created with ACL version ZFS_ACL_VERSION_INITIAL
* will all be created with fixed length ACEs of type
* zfs_oldace_t.
*
* Files with ACL version ZFS_ACL_VERSION_FUID will be created
* with various sized ACEs. The abstraction entries will utilize
* and some specialized CIFS ACEs will use zfs_object_ace_t.
*/
/*
* All ACEs have a common hdr. For
* owner@, group@, and everyone@ this is all
* thats needed.
*/
typedef struct zfs_ace_hdr {
typedef zfs_ace_hdr_t zfs_ace_abstract_t;
/*
* Standard ACE
*/
typedef struct zfs_ace {
} zfs_ace_t;
/*
* The following type only applies to ACE_ACCESS_ALLOWED|DENIED_OBJECT_ACE_TYPE
*/
typedef struct zfs_object_ace {
typedef struct zfs_oldace {
} zfs_oldace_t;
typedef struct zfs_acl_phys_v0 {
typedef struct zfs_acl_phys {
typedef struct acl_ops {
void (*ace_mask_set) (void *acep,
void (*ace_flags_set) (void *acep,
void (*ace_type_set)(void *acep,
void (*ace_who_set)(void *acep,
int (*ace_mask_off)(void); /* off of access mask in ace */
/* ptr to data if any */
} acl_ops_t;
/*
* A zfs_acl_t structure is composed of a list of zfs_acl_node_t's.
* Each node will have one or more ACEs associated with it. You will
* only have multiple nodes during a chmod operation. Normally only
* one node is required.
*/
typedef struct zfs_acl_node {
void *z_acldata; /* pointer into actual ACE(s) */
void *z_allocdata; /* pointer to kmem allocated memory */
int z_ace_count; /* number of ACEs in this acl node */
int z_ace_idx; /* ace iterator positioned on */
typedef struct zfs_acl {
int z_acl_count; /* Number of ACEs */
void *z_next_ace; /* pointer to next ACE */
int z_hints; /* ACL hints (ZFS_INHERIT_ACE ...) */
} zfs_acl_t;
#define ACL_DATA_ALLOCED 0x1
/*
* Property values for acl_mode and acl_inherit.
*
* acl_mode can take discard, noallow, groupmask and passthrough.
* whereas acl_inherit has secure instead of groupmask.
*/
#define ZFS_ACL_DISCARD 0
#define ZFS_ACL_NOALLOW 1
#define ZFS_ACL_GROUPMASK 2
#define ZFS_ACL_PASSTHROUGH 3
#define ZFS_ACL_SECURE 4
struct znode;
struct zfsvfs;
struct zfs_fuid_info;
#ifdef _KERNEL
void zfs_acl_rele(void *);
void zfs_oldace_byteswap(ace_t *, int);
void zfs_acl_free(zfs_acl_t *);
struct zfs_fuid_info **, dmu_tx_t *);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FS_ZFS_ACL_H */