8 #include <linux/sched.h>
9 #include <linux/slab.h>
10 #include <linux/capability.h>
21 ext4_acl_from_disk(
const void *
value,
size_t size)
23 const char *
end = (
char *)value + size;
35 count = ext4_acl_count(size);
43 for (n = 0; n <
count; n++) {
56 value = (
char *)value +
62 if ((
char *)value >
end)
70 if ((
char *)value >
end)
86 posix_acl_release(acl);
94 ext4_acl_to_disk(
const struct posix_acl *acl,
size_t *size)
100 *size = ext4_acl_size(acl->
a_count);
107 for (n = 0; n < acl->
a_count; n++) {
112 switch (acl_e->
e_tag) {
135 return (
char *)ext_acl;
158 acl = get_cached_acl(inode, type);
180 acl = ext4_acl_from_disk(value, retval);
184 acl = ERR_PTR(retval);
188 set_cached_acl(inode, type, acl);
218 inode->
i_ctime = ext4_current_time(inode);
236 value = ext4_acl_to_disk(acl, &size);
238 return (
int)PTR_ERR(value);
246 set_cached_acl(inode, type, acl);
274 error = ext4_set_acl(handle, inode,
289 posix_acl_release(acl);
321 if (IS_ERR(acl) || !acl)
327 handle = ext4_journal_start(inode,
329 if (IS_ERR(handle)) {
330 error = PTR_ERR(handle);
331 ext4_std_error(inode->
i_sb, error);
340 posix_acl_release(acl);
355 if (list && size <= list_len)
361 ext4_xattr_list_acl_default(
struct dentry *dentry,
char *list,
size_t list_len,
362 const char *name,
size_t name_len,
int type)
368 if (list && size <= list_len)
374 ext4_xattr_get_acl(
struct dentry *dentry,
const char *name,
void *
buffer,
375 size_t size,
int type)
380 if (
strcmp(name,
"") != 0)
391 posix_acl_release(acl);
397 ext4_xattr_set_acl(
struct dentry *dentry,
const char *name,
const void *value,
398 size_t size,
int flags,
int type)
400 struct inode *inode = dentry->
d_inode;
405 if (
strcmp(name,
"") != 0)
419 goto release_and_out;
427 return PTR_ERR(handle);
428 error = ext4_set_acl(handle, inode, type, acl);
434 posix_acl_release(acl);
441 .list = ext4_xattr_list_acl_access,
442 .get = ext4_xattr_get_acl,
443 .set = ext4_xattr_set_acl,
449 .list = ext4_xattr_list_acl_default,
450 .get = ext4_xattr_get_acl,
451 .set = ext4_xattr_set_acl,