Print this page
3742 zfs comments need cleaner, more consistent style
Submitted by: Will Andrews <willa@spectralogic.com>
Submitted by: Alan Somers <alans@spectralogic.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/fs/zfs/sys/zfs_acl.h
+++ new/usr/src/uts/common/fs/zfs/sys/zfs_acl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 */
24 24
25 25 #ifndef _SYS_FS_ZFS_ACL_H
26 26 #define _SYS_FS_ZFS_ACL_H
27 27
28 28 #ifdef _KERNEL
29 29 #include <sys/isa_defs.h>
30 30 #include <sys/types32.h>
31 31 #endif
32 32 #include <sys/acl.h>
33 33 #include <sys/dmu.h>
34 34 #include <sys/zfs_fuid.h>
35 35 #include <sys/sa.h>
36 36
37 37 #ifdef __cplusplus
38 38 extern "C" {
↓ open down ↓ |
38 lines elided |
↑ open up ↑ |
39 39 #endif
40 40
41 41 struct znode_phys;
42 42
43 43 #define ACE_SLOT_CNT 6
44 44 #define ZFS_ACL_VERSION_INITIAL 0ULL
45 45 #define ZFS_ACL_VERSION_FUID 1ULL
46 46 #define ZFS_ACL_VERSION ZFS_ACL_VERSION_FUID
47 47
48 48 /*
49 - * ZFS ACLs are store in various forms.
49 + * ZFS ACLs (Access Control Lists) are stored in various forms.
50 + *
50 51 * Files created with ACL version ZFS_ACL_VERSION_INITIAL
51 52 * will all be created with fixed length ACEs of type
52 53 * zfs_oldace_t.
53 54 *
54 55 * Files with ACL version ZFS_ACL_VERSION_FUID will be created
55 56 * with various sized ACEs. The abstraction entries will utilize
56 57 * zfs_ace_hdr_t, normal user/group entries will use zfs_ace_t
57 58 * and some specialized CIFS ACEs will use zfs_object_ace_t.
58 59 */
59 60
60 61 /*
61 62 * All ACEs have a common hdr. For
62 63 * owner@, group@, and everyone@ this is all
63 64 * thats needed.
64 65 */
65 66 typedef struct zfs_ace_hdr {
66 67 uint16_t z_type;
67 68 uint16_t z_flags;
68 69 uint32_t z_access_mask;
69 70 } zfs_ace_hdr_t;
70 71
71 72 typedef zfs_ace_hdr_t zfs_ace_abstract_t;
72 73
73 74 /*
74 75 * Standard ACE
75 76 */
76 77 typedef struct zfs_ace {
77 78 zfs_ace_hdr_t z_hdr;
78 79 uint64_t z_fuid;
79 80 } zfs_ace_t;
80 81
81 82 /*
82 83 * The following type only applies to ACE_ACCESS_ALLOWED|DENIED_OBJECT_ACE_TYPE
83 84 * and will only be set/retrieved in a CIFS context.
84 85 */
85 86
86 87 typedef struct zfs_object_ace {
87 88 zfs_ace_t z_ace;
88 89 uint8_t z_object_type[16]; /* object type */
89 90 uint8_t z_inherit_type[16]; /* inherited object type */
90 91 } zfs_object_ace_t;
91 92
92 93 typedef struct zfs_oldace {
93 94 uint32_t z_fuid; /* "who" */
94 95 uint32_t z_access_mask; /* access mask */
95 96 uint16_t z_flags; /* flags, i.e inheritance */
96 97 uint16_t z_type; /* type of entry allow/deny */
97 98 } zfs_oldace_t;
98 99
99 100 typedef struct zfs_acl_phys_v0 {
100 101 uint64_t z_acl_extern_obj; /* ext acl pieces */
101 102 uint32_t z_acl_count; /* Number of ACEs */
102 103 uint16_t z_acl_version; /* acl version */
103 104 uint16_t z_acl_pad; /* pad */
104 105 zfs_oldace_t z_ace_data[ACE_SLOT_CNT]; /* 6 standard ACEs */
105 106 } zfs_acl_phys_v0_t;
106 107
107 108 #define ZFS_ACE_SPACE (sizeof (zfs_oldace_t) * ACE_SLOT_CNT)
108 109
109 110 /*
110 111 * Size of ACL count is always 2 bytes.
111 112 * Necessary to for dealing with both V0 ACL and V1 ACL layout
112 113 */
113 114 #define ZFS_ACL_COUNT_SIZE (sizeof (uint16_t))
114 115
115 116 typedef struct zfs_acl_phys {
116 117 uint64_t z_acl_extern_obj; /* ext acl pieces */
117 118 uint32_t z_acl_size; /* Number of bytes in ACL */
118 119 uint16_t z_acl_version; /* acl version */
119 120 uint16_t z_acl_count; /* ace count */
120 121 uint8_t z_ace_data[ZFS_ACE_SPACE]; /* space for embedded ACEs */
121 122 } zfs_acl_phys_t;
122 123
123 124 typedef struct acl_ops {
124 125 uint32_t (*ace_mask_get) (void *acep); /* get access mask */
125 126 void (*ace_mask_set) (void *acep,
126 127 uint32_t mask); /* set access mask */
127 128 uint16_t (*ace_flags_get) (void *acep); /* get flags */
128 129 void (*ace_flags_set) (void *acep,
↓ open down ↓ |
69 lines elided |
↑ open up ↑ |
129 130 uint16_t flags); /* set flags */
130 131 uint16_t (*ace_type_get)(void *acep); /* get type */
131 132 void (*ace_type_set)(void *acep,
132 133 uint16_t type); /* set type */
133 134 uint64_t (*ace_who_get)(void *acep); /* get who/fuid */
134 135 void (*ace_who_set)(void *acep,
135 136 uint64_t who); /* set who/fuid */
136 137 size_t (*ace_size)(void *acep); /* how big is this ace */
137 138 size_t (*ace_abstract_size)(void); /* sizeof abstract entry */
138 139 int (*ace_mask_off)(void); /* off of access mask in ace */
140 + /* ptr to data if any */
139 141 int (*ace_data)(void *acep, void **datap);
140 - /* ptr to data if any */
141 142 } acl_ops_t;
142 143
143 144 /*
144 145 * A zfs_acl_t structure is composed of a list of zfs_acl_node_t's.
145 146 * Each node will have one or more ACEs associated with it. You will
146 147 * only have multiple nodes during a chmod operation. Normally only
147 148 * one node is required.
148 149 */
149 150 typedef struct zfs_acl_node {
150 151 list_node_t z_next; /* Next chunk of ACEs */
151 152 void *z_acldata; /* pointer into actual ACE(s) */
152 153 void *z_allocdata; /* pointer to kmem allocated memory */
153 154 size_t z_allocsize; /* Size of blob in bytes */
154 155 size_t z_size; /* length of ACL data */
155 156 uint64_t z_ace_count; /* number of ACEs in this acl node */
156 157 int z_ace_idx; /* ace iterator positioned on */
157 158 } zfs_acl_node_t;
158 159
159 160 typedef struct zfs_acl {
160 161 uint64_t z_acl_count; /* Number of ACEs */
161 162 size_t z_acl_bytes; /* Number of bytes in ACL */
162 163 uint_t z_version; /* version of ACL */
163 164 void *z_next_ace; /* pointer to next ACE */
164 165 uint64_t z_hints; /* ACL hints (ZFS_INHERIT_ACE ...) */
165 166 zfs_acl_node_t *z_curr_node; /* current node iterator is handling */
166 167 list_t z_acl; /* chunks of ACE data */
167 168 acl_ops_t z_ops; /* ACL operations */
168 169 } zfs_acl_t;
169 170
170 171 typedef struct acl_locator_cb {
171 172 zfs_acl_t *cb_aclp;
172 173 zfs_acl_node_t *cb_acl_node;
173 174 } zfs_acl_locator_cb_t;
174 175
175 176 #define ACL_DATA_ALLOCED 0x1
176 177 #define ZFS_ACL_SIZE(aclcnt) (sizeof (ace_t) * (aclcnt))
177 178
178 179 struct zfs_fuid_info;
179 180
180 181 typedef struct zfs_acl_ids {
181 182 uint64_t z_fuid; /* file owner fuid */
182 183 uint64_t z_fgid; /* file group owner fuid */
183 184 uint64_t z_mode; /* mode to set on create */
184 185 zfs_acl_t *z_aclp; /* ACL to create with file */
185 186 struct zfs_fuid_info *z_fuidp; /* for tracking fuids for log */
186 187 } zfs_acl_ids_t;
187 188
188 189 /*
189 190 * Property values for acl_mode and acl_inherit.
190 191 *
191 192 * acl_mode can take discard, noallow, groupmask and passthrough.
192 193 * whereas acl_inherit has secure instead of groupmask.
193 194 */
194 195
195 196 #define ZFS_ACL_DISCARD 0
196 197 #define ZFS_ACL_NOALLOW 1
197 198 #define ZFS_ACL_GROUPMASK 2
198 199 #define ZFS_ACL_PASSTHROUGH 3
199 200 #define ZFS_ACL_RESTRICTED 4
200 201 #define ZFS_ACL_PASSTHROUGH_X 5
201 202
202 203 struct znode;
203 204 struct zfsvfs;
204 205
205 206 #ifdef _KERNEL
206 207 int zfs_acl_ids_create(struct znode *, int, vattr_t *,
207 208 cred_t *, vsecattr_t *, zfs_acl_ids_t *);
208 209 void zfs_acl_ids_free(zfs_acl_ids_t *);
209 210 boolean_t zfs_acl_ids_overquota(struct zfsvfs *, zfs_acl_ids_t *);
210 211 int zfs_getacl(struct znode *, vsecattr_t *, boolean_t, cred_t *);
211 212 int zfs_setacl(struct znode *, vsecattr_t *, boolean_t, cred_t *);
212 213 void zfs_acl_rele(void *);
213 214 void zfs_oldace_byteswap(ace_t *, int);
214 215 void zfs_ace_byteswap(void *, size_t, boolean_t);
215 216 extern boolean_t zfs_has_access(struct znode *zp, cred_t *cr);
216 217 extern int zfs_zaccess(struct znode *, int, int, boolean_t, cred_t *);
217 218 int zfs_fastaccesschk_execute(struct znode *, cred_t *);
218 219 extern int zfs_zaccess_rwx(struct znode *, mode_t, int, cred_t *);
219 220 extern int zfs_zaccess_unix(struct znode *, mode_t, cred_t *);
220 221 extern int zfs_acl_access(struct znode *, int, cred_t *);
221 222 int zfs_acl_chmod_setattr(struct znode *, zfs_acl_t **, uint64_t);
222 223 int zfs_zaccess_delete(struct znode *, struct znode *, cred_t *);
223 224 int zfs_zaccess_rename(struct znode *, struct znode *,
224 225 struct znode *, struct znode *, cred_t *cr);
225 226 void zfs_acl_free(zfs_acl_t *);
226 227 int zfs_vsec_2_aclp(struct zfsvfs *, vtype_t, vsecattr_t *, cred_t *,
227 228 struct zfs_fuid_info **, zfs_acl_t **);
228 229 int zfs_aclset_common(struct znode *, zfs_acl_t *, cred_t *, dmu_tx_t *);
229 230 uint64_t zfs_external_acl(struct znode *);
230 231 int zfs_znode_acl_version(struct znode *);
231 232 int zfs_acl_size(struct znode *, int *);
232 233 zfs_acl_t *zfs_acl_alloc(int);
233 234 zfs_acl_node_t *zfs_acl_node_alloc(size_t);
234 235 void zfs_acl_xform(struct znode *, zfs_acl_t *, cred_t *);
235 236 void zfs_acl_data_locator(void **, uint32_t *, uint32_t, boolean_t, void *);
236 237 uint64_t zfs_mode_compute(uint64_t, zfs_acl_t *,
237 238 uint64_t *, uint64_t, uint64_t);
238 239 int zfs_acl_chown_setattr(struct znode *);
239 240
240 241 #endif
241 242
242 243 #ifdef __cplusplus
243 244 }
244 245 #endif
245 246 #endif /* _SYS_FS_ZFS_ACL_H */
↓ open down ↓ |
95 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX