29 #include <sys/isa_defs.h>
30 #include <sys/types32.h>
31 #endif
32 #include <sys/acl.h>
33 #include <sys/dmu.h>
34 #include <sys/zfs_fuid.h>
35 #include <sys/sa.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 struct znode_phys;
42
43 #define ACE_SLOT_CNT 6
44 #define ZFS_ACL_VERSION_INITIAL 0ULL
45 #define ZFS_ACL_VERSION_FUID 1ULL
46 #define ZFS_ACL_VERSION ZFS_ACL_VERSION_FUID
47
48 /*
49 * ZFS ACLs are store in various forms.
50 * Files created with ACL version ZFS_ACL_VERSION_INITIAL
51 * will all be created with fixed length ACEs of type
52 * zfs_oldace_t.
53 *
54 * Files with ACL version ZFS_ACL_VERSION_FUID will be created
55 * with various sized ACEs. The abstraction entries will utilize
56 * zfs_ace_hdr_t, normal user/group entries will use zfs_ace_t
57 * and some specialized CIFS ACEs will use zfs_object_ace_t.
58 */
59
60 /*
61 * All ACEs have a common hdr. For
62 * owner@, group@, and everyone@ this is all
63 * thats needed.
64 */
65 typedef struct zfs_ace_hdr {
66 uint16_t z_type;
67 uint16_t z_flags;
68 uint32_t z_access_mask;
69 } zfs_ace_hdr_t;
119 uint16_t z_acl_count; /* ace count */
120 uint8_t z_ace_data[ZFS_ACE_SPACE]; /* space for embedded ACEs */
121 } zfs_acl_phys_t;
122
123 typedef struct acl_ops {
124 uint32_t (*ace_mask_get) (void *acep); /* get access mask */
125 void (*ace_mask_set) (void *acep,
126 uint32_t mask); /* set access mask */
127 uint16_t (*ace_flags_get) (void *acep); /* get flags */
128 void (*ace_flags_set) (void *acep,
129 uint16_t flags); /* set flags */
130 uint16_t (*ace_type_get)(void *acep); /* get type */
131 void (*ace_type_set)(void *acep,
132 uint16_t type); /* set type */
133 uint64_t (*ace_who_get)(void *acep); /* get who/fuid */
134 void (*ace_who_set)(void *acep,
135 uint64_t who); /* set who/fuid */
136 size_t (*ace_size)(void *acep); /* how big is this ace */
137 size_t (*ace_abstract_size)(void); /* sizeof abstract entry */
138 int (*ace_mask_off)(void); /* off of access mask in ace */
139 int (*ace_data)(void *acep, void **datap);
140 /* ptr to data if any */
141 } acl_ops_t;
142
143 /*
144 * A zfs_acl_t structure is composed of a list of zfs_acl_node_t's.
145 * Each node will have one or more ACEs associated with it. You will
146 * only have multiple nodes during a chmod operation. Normally only
147 * one node is required.
148 */
149 typedef struct zfs_acl_node {
150 list_node_t z_next; /* Next chunk of ACEs */
151 void *z_acldata; /* pointer into actual ACE(s) */
152 void *z_allocdata; /* pointer to kmem allocated memory */
153 size_t z_allocsize; /* Size of blob in bytes */
154 size_t z_size; /* length of ACL data */
155 uint64_t z_ace_count; /* number of ACEs in this acl node */
156 int z_ace_idx; /* ace iterator positioned on */
157 } zfs_acl_node_t;
158
159 typedef struct zfs_acl {
160 uint64_t z_acl_count; /* Number of ACEs */
|
29 #include <sys/isa_defs.h>
30 #include <sys/types32.h>
31 #endif
32 #include <sys/acl.h>
33 #include <sys/dmu.h>
34 #include <sys/zfs_fuid.h>
35 #include <sys/sa.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 struct znode_phys;
42
43 #define ACE_SLOT_CNT 6
44 #define ZFS_ACL_VERSION_INITIAL 0ULL
45 #define ZFS_ACL_VERSION_FUID 1ULL
46 #define ZFS_ACL_VERSION ZFS_ACL_VERSION_FUID
47
48 /*
49 * ZFS ACLs (Access Control Lists) are stored in various forms.
50 *
51 * Files created with ACL version ZFS_ACL_VERSION_INITIAL
52 * will all be created with fixed length ACEs of type
53 * zfs_oldace_t.
54 *
55 * Files with ACL version ZFS_ACL_VERSION_FUID will be created
56 * with various sized ACEs. The abstraction entries will utilize
57 * zfs_ace_hdr_t, normal user/group entries will use zfs_ace_t
58 * and some specialized CIFS ACEs will use zfs_object_ace_t.
59 */
60
61 /*
62 * All ACEs have a common hdr. For
63 * owner@, group@, and everyone@ this is all
64 * thats needed.
65 */
66 typedef struct zfs_ace_hdr {
67 uint16_t z_type;
68 uint16_t z_flags;
69 uint32_t z_access_mask;
70 } zfs_ace_hdr_t;
120 uint16_t z_acl_count; /* ace count */
121 uint8_t z_ace_data[ZFS_ACE_SPACE]; /* space for embedded ACEs */
122 } zfs_acl_phys_t;
123
124 typedef struct acl_ops {
125 uint32_t (*ace_mask_get) (void *acep); /* get access mask */
126 void (*ace_mask_set) (void *acep,
127 uint32_t mask); /* set access mask */
128 uint16_t (*ace_flags_get) (void *acep); /* get flags */
129 void (*ace_flags_set) (void *acep,
130 uint16_t flags); /* set flags */
131 uint16_t (*ace_type_get)(void *acep); /* get type */
132 void (*ace_type_set)(void *acep,
133 uint16_t type); /* set type */
134 uint64_t (*ace_who_get)(void *acep); /* get who/fuid */
135 void (*ace_who_set)(void *acep,
136 uint64_t who); /* set who/fuid */
137 size_t (*ace_size)(void *acep); /* how big is this ace */
138 size_t (*ace_abstract_size)(void); /* sizeof abstract entry */
139 int (*ace_mask_off)(void); /* off of access mask in ace */
140 /* ptr to data if any */
141 int (*ace_data)(void *acep, void **datap);
142 } acl_ops_t;
143
144 /*
145 * A zfs_acl_t structure is composed of a list of zfs_acl_node_t's.
146 * Each node will have one or more ACEs associated with it. You will
147 * only have multiple nodes during a chmod operation. Normally only
148 * one node is required.
149 */
150 typedef struct zfs_acl_node {
151 list_node_t z_next; /* Next chunk of ACEs */
152 void *z_acldata; /* pointer into actual ACE(s) */
153 void *z_allocdata; /* pointer to kmem allocated memory */
154 size_t z_allocsize; /* Size of blob in bytes */
155 size_t z_size; /* length of ACL data */
156 uint64_t z_ace_count; /* number of ACEs in this acl node */
157 int z_ace_idx; /* ace iterator positioned on */
158 } zfs_acl_node_t;
159
160 typedef struct zfs_acl {
161 uint64_t z_acl_count; /* Number of ACEs */
|