zfs_acl.h revision 0b2a8171b47dd85552e914b19eea8ce3c3c731ff
/*
* 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
*/
/*
*/
#ifndef _SYS_FS_ZFS_ACL_H
#define _SYS_FS_ZFS_ACL_H
#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 {
/*
* Size of ACL count is always 2 bytes.
* Necessary to for dealing with both V0 ACL and V1 ACL layout
*/
#define ZFS_ACL_COUNT_SIZE (sizeof (uint16_t))
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_idx; /* ace iterator positioned on */
typedef struct zfs_acl {
void *z_next_ace; /* pointer to next ACE */
} zfs_acl_t;
typedef struct acl_locator_cb {
#define ACL_DATA_ALLOCED 0x1
struct zfs_fuid_info;
typedef struct zfs_acl_ids {
/*
* 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_RESTRICTED 4
#define ZFS_ACL_PASSTHROUGH_X 5
struct znode;
struct zfsvfs;
#ifdef _KERNEL
void zfs_acl_ids_free(zfs_acl_ids_t *);
void zfs_acl_rele(void *);
void zfs_oldace_byteswap(ace_t *, int);
void zfs_acl_free(zfs_acl_t *);
struct zfs_fuid_info **, zfs_acl_t **);
int zfs_znode_acl_version(struct znode *);
int zfs_acl_size(struct znode *, int *);
zfs_acl_t *zfs_acl_alloc(int);
int zfs_acl_chown_setattr(struct znode *);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FS_ZFS_ACL_H */