aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/acl.c')
-rw-r--r--fs/ext4/acl.c188
1 files changed, 94 insertions, 94 deletions
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index 1e5038d9a01b..d143489aeb4c 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/fs/ext3/acl.c 2 * linux/fs/ext4/acl.c
3 * 3 *
4 * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> 4 * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de>
5 */ 5 */
@@ -9,8 +9,8 @@
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/capability.h> 10#include <linux/capability.h>
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/ext3_jbd.h> 12#include <linux/ext4_jbd.h>
13#include <linux/ext3_fs.h> 13#include <linux/ext4_fs.h>
14#include "xattr.h" 14#include "xattr.h"
15#include "acl.h" 15#include "acl.h"
16 16
@@ -18,7 +18,7 @@
18 * Convert from filesystem to in-memory representation. 18 * Convert from filesystem to in-memory representation.
19 */ 19 */
20static struct posix_acl * 20static struct posix_acl *
21ext3_acl_from_disk(const void *value, size_t size) 21ext4_acl_from_disk(const void *value, size_t size)
22{ 22{
23 const char *end = (char *)value + size; 23 const char *end = (char *)value + size;
24 int n, count; 24 int n, count;
@@ -26,13 +26,13 @@ ext3_acl_from_disk(const void *value, size_t size)
26 26
27 if (!value) 27 if (!value)
28 return NULL; 28 return NULL;
29 if (size < sizeof(ext3_acl_header)) 29 if (size < sizeof(ext4_acl_header))
30 return ERR_PTR(-EINVAL); 30 return ERR_PTR(-EINVAL);
31 if (((ext3_acl_header *)value)->a_version != 31 if (((ext4_acl_header *)value)->a_version !=
32 cpu_to_le32(EXT3_ACL_VERSION)) 32 cpu_to_le32(EXT4_ACL_VERSION))
33 return ERR_PTR(-EINVAL); 33 return ERR_PTR(-EINVAL);
34 value = (char *)value + sizeof(ext3_acl_header); 34 value = (char *)value + sizeof(ext4_acl_header);
35 count = ext3_acl_count(size); 35 count = ext4_acl_count(size);
36 if (count < 0) 36 if (count < 0)
37 return ERR_PTR(-EINVAL); 37 return ERR_PTR(-EINVAL);
38 if (count == 0) 38 if (count == 0)
@@ -41,9 +41,9 @@ ext3_acl_from_disk(const void *value, size_t size)
41 if (!acl) 41 if (!acl)
42 return ERR_PTR(-ENOMEM); 42 return ERR_PTR(-ENOMEM);
43 for (n=0; n < count; n++) { 43 for (n=0; n < count; n++) {
44 ext3_acl_entry *entry = 44 ext4_acl_entry *entry =
45 (ext3_acl_entry *)value; 45 (ext4_acl_entry *)value;
46 if ((char *)value + sizeof(ext3_acl_entry_short) > end) 46 if ((char *)value + sizeof(ext4_acl_entry_short) > end)
47 goto fail; 47 goto fail;
48 acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag); 48 acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag);
49 acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm); 49 acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm);
@@ -53,13 +53,13 @@ ext3_acl_from_disk(const void *value, size_t size)
53 case ACL_MASK: 53 case ACL_MASK:
54 case ACL_OTHER: 54 case ACL_OTHER:
55 value = (char *)value + 55 value = (char *)value +
56 sizeof(ext3_acl_entry_short); 56 sizeof(ext4_acl_entry_short);
57 acl->a_entries[n].e_id = ACL_UNDEFINED_ID; 57 acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
58 break; 58 break;
59 59
60 case ACL_USER: 60 case ACL_USER:
61 case ACL_GROUP: 61 case ACL_GROUP:
62 value = (char *)value + sizeof(ext3_acl_entry); 62 value = (char *)value + sizeof(ext4_acl_entry);
63 if ((char *)value > end) 63 if ((char *)value > end)
64 goto fail; 64 goto fail;
65 acl->a_entries[n].e_id = 65 acl->a_entries[n].e_id =
@@ -83,21 +83,21 @@ fail:
83 * Convert from in-memory to filesystem representation. 83 * Convert from in-memory to filesystem representation.
84 */ 84 */
85static void * 85static void *
86ext3_acl_to_disk(const struct posix_acl *acl, size_t *size) 86ext4_acl_to_disk(const struct posix_acl *acl, size_t *size)
87{ 87{
88 ext3_acl_header *ext_acl; 88 ext4_acl_header *ext_acl;
89 char *e; 89 char *e;
90 size_t n; 90 size_t n;
91 91
92 *size = ext3_acl_size(acl->a_count); 92 *size = ext4_acl_size(acl->a_count);
93 ext_acl = kmalloc(sizeof(ext3_acl_header) + acl->a_count * 93 ext_acl = kmalloc(sizeof(ext4_acl_header) + acl->a_count *
94 sizeof(ext3_acl_entry), GFP_KERNEL); 94 sizeof(ext4_acl_entry), GFP_KERNEL);
95 if (!ext_acl) 95 if (!ext_acl)
96 return ERR_PTR(-ENOMEM); 96 return ERR_PTR(-ENOMEM);
97 ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION); 97 ext_acl->a_version = cpu_to_le32(EXT4_ACL_VERSION);
98 e = (char *)ext_acl + sizeof(ext3_acl_header); 98 e = (char *)ext_acl + sizeof(ext4_acl_header);
99 for (n=0; n < acl->a_count; n++) { 99 for (n=0; n < acl->a_count; n++) {
100 ext3_acl_entry *entry = (ext3_acl_entry *)e; 100 ext4_acl_entry *entry = (ext4_acl_entry *)e;
101 entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag); 101 entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag);
102 entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm); 102 entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm);
103 switch(acl->a_entries[n].e_tag) { 103 switch(acl->a_entries[n].e_tag) {
@@ -105,14 +105,14 @@ ext3_acl_to_disk(const struct posix_acl *acl, size_t *size)
105 case ACL_GROUP: 105 case ACL_GROUP:
106 entry->e_id = 106 entry->e_id =
107 cpu_to_le32(acl->a_entries[n].e_id); 107 cpu_to_le32(acl->a_entries[n].e_id);
108 e += sizeof(ext3_acl_entry); 108 e += sizeof(ext4_acl_entry);
109 break; 109 break;
110 110
111 case ACL_USER_OBJ: 111 case ACL_USER_OBJ:
112 case ACL_GROUP_OBJ: 112 case ACL_GROUP_OBJ:
113 case ACL_MASK: 113 case ACL_MASK:
114 case ACL_OTHER: 114 case ACL_OTHER:
115 e += sizeof(ext3_acl_entry_short); 115 e += sizeof(ext4_acl_entry_short);
116 break; 116 break;
117 117
118 default: 118 default:
@@ -127,12 +127,12 @@ fail:
127} 127}
128 128
129static inline struct posix_acl * 129static inline struct posix_acl *
130ext3_iget_acl(struct inode *inode, struct posix_acl **i_acl) 130ext4_iget_acl(struct inode *inode, struct posix_acl **i_acl)
131{ 131{
132 struct posix_acl *acl = EXT3_ACL_NOT_CACHED; 132 struct posix_acl *acl = EXT4_ACL_NOT_CACHED;
133 133
134 spin_lock(&inode->i_lock); 134 spin_lock(&inode->i_lock);
135 if (*i_acl != EXT3_ACL_NOT_CACHED) 135 if (*i_acl != EXT4_ACL_NOT_CACHED)
136 acl = posix_acl_dup(*i_acl); 136 acl = posix_acl_dup(*i_acl);
137 spin_unlock(&inode->i_lock); 137 spin_unlock(&inode->i_lock);
138 138
@@ -140,11 +140,11 @@ ext3_iget_acl(struct inode *inode, struct posix_acl **i_acl)
140} 140}
141 141
142static inline void 142static inline void
143ext3_iset_acl(struct inode *inode, struct posix_acl **i_acl, 143ext4_iset_acl(struct inode *inode, struct posix_acl **i_acl,
144 struct posix_acl *acl) 144 struct posix_acl *acl)
145{ 145{
146 spin_lock(&inode->i_lock); 146 spin_lock(&inode->i_lock);
147 if (*i_acl != EXT3_ACL_NOT_CACHED) 147 if (*i_acl != EXT4_ACL_NOT_CACHED)
148 posix_acl_release(*i_acl); 148 posix_acl_release(*i_acl);
149 *i_acl = posix_acl_dup(acl); 149 *i_acl = posix_acl_dup(acl);
150 spin_unlock(&inode->i_lock); 150 spin_unlock(&inode->i_lock);
@@ -156,9 +156,9 @@ ext3_iset_acl(struct inode *inode, struct posix_acl **i_acl,
156 * inode->i_mutex: don't care 156 * inode->i_mutex: don't care
157 */ 157 */
158static struct posix_acl * 158static struct posix_acl *
159ext3_get_acl(struct inode *inode, int type) 159ext4_get_acl(struct inode *inode, int type)
160{ 160{
161 struct ext3_inode_info *ei = EXT3_I(inode); 161 struct ext4_inode_info *ei = EXT4_I(inode);
162 int name_index; 162 int name_index;
163 char *value = NULL; 163 char *value = NULL;
164 struct posix_acl *acl; 164 struct posix_acl *acl;
@@ -169,31 +169,31 @@ ext3_get_acl(struct inode *inode, int type)
169 169
170 switch(type) { 170 switch(type) {
171 case ACL_TYPE_ACCESS: 171 case ACL_TYPE_ACCESS:
172 acl = ext3_iget_acl(inode, &ei->i_acl); 172 acl = ext4_iget_acl(inode, &ei->i_acl);
173 if (acl != EXT3_ACL_NOT_CACHED) 173 if (acl != EXT4_ACL_NOT_CACHED)
174 return acl; 174 return acl;
175 name_index = EXT3_XATTR_INDEX_POSIX_ACL_ACCESS; 175 name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
176 break; 176 break;
177 177
178 case ACL_TYPE_DEFAULT: 178 case ACL_TYPE_DEFAULT:
179 acl = ext3_iget_acl(inode, &ei->i_default_acl); 179 acl = ext4_iget_acl(inode, &ei->i_default_acl);
180 if (acl != EXT3_ACL_NOT_CACHED) 180 if (acl != EXT4_ACL_NOT_CACHED)
181 return acl; 181 return acl;
182 name_index = EXT3_XATTR_INDEX_POSIX_ACL_DEFAULT; 182 name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
183 break; 183 break;
184 184
185 default: 185 default:
186 return ERR_PTR(-EINVAL); 186 return ERR_PTR(-EINVAL);
187 } 187 }
188 retval = ext3_xattr_get(inode, name_index, "", NULL, 0); 188 retval = ext4_xattr_get(inode, name_index, "", NULL, 0);
189 if (retval > 0) { 189 if (retval > 0) {
190 value = kmalloc(retval, GFP_KERNEL); 190 value = kmalloc(retval, GFP_KERNEL);
191 if (!value) 191 if (!value)
192 return ERR_PTR(-ENOMEM); 192 return ERR_PTR(-ENOMEM);
193 retval = ext3_xattr_get(inode, name_index, "", value, retval); 193 retval = ext4_xattr_get(inode, name_index, "", value, retval);
194 } 194 }
195 if (retval > 0) 195 if (retval > 0)
196 acl = ext3_acl_from_disk(value, retval); 196 acl = ext4_acl_from_disk(value, retval);
197 else if (retval == -ENODATA || retval == -ENOSYS) 197 else if (retval == -ENODATA || retval == -ENOSYS)
198 acl = NULL; 198 acl = NULL;
199 else 199 else
@@ -203,11 +203,11 @@ ext3_get_acl(struct inode *inode, int type)
203 if (!IS_ERR(acl)) { 203 if (!IS_ERR(acl)) {
204 switch(type) { 204 switch(type) {
205 case ACL_TYPE_ACCESS: 205 case ACL_TYPE_ACCESS:
206 ext3_iset_acl(inode, &ei->i_acl, acl); 206 ext4_iset_acl(inode, &ei->i_acl, acl);
207 break; 207 break;
208 208
209 case ACL_TYPE_DEFAULT: 209 case ACL_TYPE_DEFAULT:
210 ext3_iset_acl(inode, &ei->i_default_acl, acl); 210 ext4_iset_acl(inode, &ei->i_default_acl, acl);
211 break; 211 break;
212 } 212 }
213 } 213 }
@@ -217,13 +217,13 @@ ext3_get_acl(struct inode *inode, int type)
217/* 217/*
218 * Set the access or default ACL of an inode. 218 * Set the access or default ACL of an inode.
219 * 219 *
220 * inode->i_mutex: down unless called from ext3_new_inode 220 * inode->i_mutex: down unless called from ext4_new_inode
221 */ 221 */
222static int 222static int
223ext3_set_acl(handle_t *handle, struct inode *inode, int type, 223ext4_set_acl(handle_t *handle, struct inode *inode, int type,
224 struct posix_acl *acl) 224 struct posix_acl *acl)
225{ 225{
226 struct ext3_inode_info *ei = EXT3_I(inode); 226 struct ext4_inode_info *ei = EXT4_I(inode);
227 int name_index; 227 int name_index;
228 void *value = NULL; 228 void *value = NULL;
229 size_t size = 0; 229 size_t size = 0;
@@ -234,7 +234,7 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
234 234
235 switch(type) { 235 switch(type) {
236 case ACL_TYPE_ACCESS: 236 case ACL_TYPE_ACCESS:
237 name_index = EXT3_XATTR_INDEX_POSIX_ACL_ACCESS; 237 name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
238 if (acl) { 238 if (acl) {
239 mode_t mode = inode->i_mode; 239 mode_t mode = inode->i_mode;
240 error = posix_acl_equiv_mode(acl, &mode); 240 error = posix_acl_equiv_mode(acl, &mode);
@@ -242,7 +242,7 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
242 return error; 242 return error;
243 else { 243 else {
244 inode->i_mode = mode; 244 inode->i_mode = mode;
245 ext3_mark_inode_dirty(handle, inode); 245 ext4_mark_inode_dirty(handle, inode);
246 if (error == 0) 246 if (error == 0)
247 acl = NULL; 247 acl = NULL;
248 } 248 }
@@ -250,7 +250,7 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
250 break; 250 break;
251 251
252 case ACL_TYPE_DEFAULT: 252 case ACL_TYPE_DEFAULT:
253 name_index = EXT3_XATTR_INDEX_POSIX_ACL_DEFAULT; 253 name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
254 if (!S_ISDIR(inode->i_mode)) 254 if (!S_ISDIR(inode->i_mode))
255 return acl ? -EACCES : 0; 255 return acl ? -EACCES : 0;
256 break; 256 break;
@@ -259,23 +259,23 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
259 return -EINVAL; 259 return -EINVAL;
260 } 260 }
261 if (acl) { 261 if (acl) {
262 value = ext3_acl_to_disk(acl, &size); 262 value = ext4_acl_to_disk(acl, &size);
263 if (IS_ERR(value)) 263 if (IS_ERR(value))
264 return (int)PTR_ERR(value); 264 return (int)PTR_ERR(value);
265 } 265 }
266 266
267 error = ext3_xattr_set_handle(handle, inode, name_index, "", 267 error = ext4_xattr_set_handle(handle, inode, name_index, "",
268 value, size, 0); 268 value, size, 0);
269 269
270 kfree(value); 270 kfree(value);
271 if (!error) { 271 if (!error) {
272 switch(type) { 272 switch(type) {
273 case ACL_TYPE_ACCESS: 273 case ACL_TYPE_ACCESS:
274 ext3_iset_acl(inode, &ei->i_acl, acl); 274 ext4_iset_acl(inode, &ei->i_acl, acl);
275 break; 275 break;
276 276
277 case ACL_TYPE_DEFAULT: 277 case ACL_TYPE_DEFAULT:
278 ext3_iset_acl(inode, &ei->i_default_acl, acl); 278 ext4_iset_acl(inode, &ei->i_default_acl, acl);
279 break; 279 break;
280 } 280 }
281 } 281 }
@@ -283,9 +283,9 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
283} 283}
284 284
285static int 285static int
286ext3_check_acl(struct inode *inode, int mask) 286ext4_check_acl(struct inode *inode, int mask)
287{ 287{
288 struct posix_acl *acl = ext3_get_acl(inode, ACL_TYPE_ACCESS); 288 struct posix_acl *acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
289 289
290 if (IS_ERR(acl)) 290 if (IS_ERR(acl))
291 return PTR_ERR(acl); 291 return PTR_ERR(acl);
@@ -299,26 +299,26 @@ ext3_check_acl(struct inode *inode, int mask)
299} 299}
300 300
301int 301int
302ext3_permission(struct inode *inode, int mask, struct nameidata *nd) 302ext4_permission(struct inode *inode, int mask, struct nameidata *nd)
303{ 303{
304 return generic_permission(inode, mask, ext3_check_acl); 304 return generic_permission(inode, mask, ext4_check_acl);
305} 305}
306 306
307/* 307/*
308 * Initialize the ACLs of a new inode. Called from ext3_new_inode. 308 * Initialize the ACLs of a new inode. Called from ext4_new_inode.
309 * 309 *
310 * dir->i_mutex: down 310 * dir->i_mutex: down
311 * inode->i_mutex: up (access to inode is still exclusive) 311 * inode->i_mutex: up (access to inode is still exclusive)
312 */ 312 */
313int 313int
314ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir) 314ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
315{ 315{
316 struct posix_acl *acl = NULL; 316 struct posix_acl *acl = NULL;
317 int error = 0; 317 int error = 0;
318 318
319 if (!S_ISLNK(inode->i_mode)) { 319 if (!S_ISLNK(inode->i_mode)) {
320 if (test_opt(dir->i_sb, POSIX_ACL)) { 320 if (test_opt(dir->i_sb, POSIX_ACL)) {
321 acl = ext3_get_acl(dir, ACL_TYPE_DEFAULT); 321 acl = ext4_get_acl(dir, ACL_TYPE_DEFAULT);
322 if (IS_ERR(acl)) 322 if (IS_ERR(acl))
323 return PTR_ERR(acl); 323 return PTR_ERR(acl);
324 } 324 }
@@ -330,7 +330,7 @@ ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
330 mode_t mode; 330 mode_t mode;
331 331
332 if (S_ISDIR(inode->i_mode)) { 332 if (S_ISDIR(inode->i_mode)) {
333 error = ext3_set_acl(handle, inode, 333 error = ext4_set_acl(handle, inode,
334 ACL_TYPE_DEFAULT, acl); 334 ACL_TYPE_DEFAULT, acl);
335 if (error) 335 if (error)
336 goto cleanup; 336 goto cleanup;
@@ -346,7 +346,7 @@ ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
346 inode->i_mode = mode; 346 inode->i_mode = mode;
347 if (error > 0) { 347 if (error > 0) {
348 /* This is an extended ACL */ 348 /* This is an extended ACL */
349 error = ext3_set_acl(handle, inode, 349 error = ext4_set_acl(handle, inode,
350 ACL_TYPE_ACCESS, clone); 350 ACL_TYPE_ACCESS, clone);
351 } 351 }
352 } 352 }
@@ -372,7 +372,7 @@ cleanup:
372 * inode->i_mutex: down 372 * inode->i_mutex: down
373 */ 373 */
374int 374int
375ext3_acl_chmod(struct inode *inode) 375ext4_acl_chmod(struct inode *inode)
376{ 376{
377 struct posix_acl *acl, *clone; 377 struct posix_acl *acl, *clone;
378 int error; 378 int error;
@@ -381,7 +381,7 @@ ext3_acl_chmod(struct inode *inode)
381 return -EOPNOTSUPP; 381 return -EOPNOTSUPP;
382 if (!test_opt(inode->i_sb, POSIX_ACL)) 382 if (!test_opt(inode->i_sb, POSIX_ACL))
383 return 0; 383 return 0;
384 acl = ext3_get_acl(inode, ACL_TYPE_ACCESS); 384 acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
385 if (IS_ERR(acl) || !acl) 385 if (IS_ERR(acl) || !acl)
386 return PTR_ERR(acl); 386 return PTR_ERR(acl);
387 clone = posix_acl_clone(acl, GFP_KERNEL); 387 clone = posix_acl_clone(acl, GFP_KERNEL);
@@ -394,17 +394,17 @@ ext3_acl_chmod(struct inode *inode)
394 int retries = 0; 394 int retries = 0;
395 395
396 retry: 396 retry:
397 handle = ext3_journal_start(inode, 397 handle = ext4_journal_start(inode,
398 EXT3_DATA_TRANS_BLOCKS(inode->i_sb)); 398 EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
399 if (IS_ERR(handle)) { 399 if (IS_ERR(handle)) {
400 error = PTR_ERR(handle); 400 error = PTR_ERR(handle);
401 ext3_std_error(inode->i_sb, error); 401 ext4_std_error(inode->i_sb, error);
402 goto out; 402 goto out;
403 } 403 }
404 error = ext3_set_acl(handle, inode, ACL_TYPE_ACCESS, clone); 404 error = ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, clone);
405 ext3_journal_stop(handle); 405 ext4_journal_stop(handle);
406 if (error == -ENOSPC && 406 if (error == -ENOSPC &&
407 ext3_should_retry_alloc(inode->i_sb, &retries)) 407 ext4_should_retry_alloc(inode->i_sb, &retries))
408 goto retry; 408 goto retry;
409 } 409 }
410out: 410out:
@@ -416,7 +416,7 @@ out:
416 * Extended attribute handlers 416 * Extended attribute handlers
417 */ 417 */
418static size_t 418static size_t
419ext3_xattr_list_acl_access(struct inode *inode, char *list, size_t list_len, 419ext4_xattr_list_acl_access(struct inode *inode, char *list, size_t list_len,
420 const char *name, size_t name_len) 420 const char *name, size_t name_len)
421{ 421{
422 const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS); 422 const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS);
@@ -429,7 +429,7 @@ ext3_xattr_list_acl_access(struct inode *inode, char *list, size_t list_len,
429} 429}
430 430
431static size_t 431static size_t
432ext3_xattr_list_acl_default(struct inode *inode, char *list, size_t list_len, 432ext4_xattr_list_acl_default(struct inode *inode, char *list, size_t list_len,
433 const char *name, size_t name_len) 433 const char *name, size_t name_len)
434{ 434{
435 const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT); 435 const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT);
@@ -442,7 +442,7 @@ ext3_xattr_list_acl_default(struct inode *inode, char *list, size_t list_len,
442} 442}
443 443
444static int 444static int
445ext3_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size) 445ext4_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
446{ 446{
447 struct posix_acl *acl; 447 struct posix_acl *acl;
448 int error; 448 int error;
@@ -450,7 +450,7 @@ ext3_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
450 if (!test_opt(inode->i_sb, POSIX_ACL)) 450 if (!test_opt(inode->i_sb, POSIX_ACL))
451 return -EOPNOTSUPP; 451 return -EOPNOTSUPP;
452 452
453 acl = ext3_get_acl(inode, type); 453 acl = ext4_get_acl(inode, type);
454 if (IS_ERR(acl)) 454 if (IS_ERR(acl))
455 return PTR_ERR(acl); 455 return PTR_ERR(acl);
456 if (acl == NULL) 456 if (acl == NULL)
@@ -462,25 +462,25 @@ ext3_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
462} 462}
463 463
464static int 464static int
465ext3_xattr_get_acl_access(struct inode *inode, const char *name, 465ext4_xattr_get_acl_access(struct inode *inode, const char *name,
466 void *buffer, size_t size) 466 void *buffer, size_t size)
467{ 467{
468 if (strcmp(name, "") != 0) 468 if (strcmp(name, "") != 0)
469 return -EINVAL; 469 return -EINVAL;
470 return ext3_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size); 470 return ext4_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
471} 471}
472 472
473static int 473static int
474ext3_xattr_get_acl_default(struct inode *inode, const char *name, 474ext4_xattr_get_acl_default(struct inode *inode, const char *name,
475 void *buffer, size_t size) 475 void *buffer, size_t size)
476{ 476{
477 if (strcmp(name, "") != 0) 477 if (strcmp(name, "") != 0)
478 return -EINVAL; 478 return -EINVAL;
479 return ext3_xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size); 479 return ext4_xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size);
480} 480}
481 481
482static int 482static int
483ext3_xattr_set_acl(struct inode *inode, int type, const void *value, 483ext4_xattr_set_acl(struct inode *inode, int type, const void *value,
484 size_t size) 484 size_t size)
485{ 485{
486 handle_t *handle; 486 handle_t *handle;
@@ -505,12 +505,12 @@ ext3_xattr_set_acl(struct inode *inode, int type, const void *value,
505 acl = NULL; 505 acl = NULL;
506 506
507retry: 507retry:
508 handle = ext3_journal_start(inode, EXT3_DATA_TRANS_BLOCKS(inode->i_sb)); 508 handle = ext4_journal_start(inode, EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
509 if (IS_ERR(handle)) 509 if (IS_ERR(handle))
510 return PTR_ERR(handle); 510 return PTR_ERR(handle);
511 error = ext3_set_acl(handle, inode, type, acl); 511 error = ext4_set_acl(handle, inode, type, acl);
512 ext3_journal_stop(handle); 512 ext4_journal_stop(handle);
513 if (error == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) 513 if (error == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
514 goto retry; 514 goto retry;
515 515
516release_and_out: 516release_and_out:
@@ -519,33 +519,33 @@ release_and_out:
519} 519}
520 520
521static int 521static int
522ext3_xattr_set_acl_access(struct inode *inode, const char *name, 522ext4_xattr_set_acl_access(struct inode *inode, const char *name,
523 const void *value, size_t size, int flags) 523 const void *value, size_t size, int flags)
524{ 524{
525 if (strcmp(name, "") != 0) 525 if (strcmp(name, "") != 0)
526 return -EINVAL; 526 return -EINVAL;
527 return ext3_xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size); 527 return ext4_xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
528} 528}
529 529
530static int 530static int
531ext3_xattr_set_acl_default(struct inode *inode, const char *name, 531ext4_xattr_set_acl_default(struct inode *inode, const char *name,
532 const void *value, size_t size, int flags) 532 const void *value, size_t size, int flags)
533{ 533{
534 if (strcmp(name, "") != 0) 534 if (strcmp(name, "") != 0)
535 return -EINVAL; 535 return -EINVAL;
536 return ext3_xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size); 536 return ext4_xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
537} 537}
538 538
539struct xattr_handler ext3_xattr_acl_access_handler = { 539struct xattr_handler ext4_xattr_acl_access_handler = {
540 .prefix = POSIX_ACL_XATTR_ACCESS, 540 .prefix = POSIX_ACL_XATTR_ACCESS,
541 .list = ext3_xattr_list_acl_access, 541 .list = ext4_xattr_list_acl_access,
542 .get = ext3_xattr_get_acl_access, 542 .get = ext4_xattr_get_acl_access,
543 .set = ext3_xattr_set_acl_access, 543 .set = ext4_xattr_set_acl_access,
544}; 544};
545 545
546struct xattr_handler ext3_xattr_acl_default_handler = { 546struct xattr_handler ext4_xattr_acl_default_handler = {
547 .prefix = POSIX_ACL_XATTR_DEFAULT, 547 .prefix = POSIX_ACL_XATTR_DEFAULT,
548 .list = ext3_xattr_list_acl_default, 548 .list = ext4_xattr_list_acl_default,
549 .get = ext3_xattr_get_acl_default, 549 .get = ext4_xattr_get_acl_default,
550 .set = ext3_xattr_set_acl_default, 550 .set = ext4_xattr_set_acl_default,
551}; 551};