7 #include <linux/capability.h>
9 #include <linux/sched.h>
10 #include <linux/slab.h>
20 ext2_acl_from_disk(
const void *
value,
size_t size)
22 const char *
end = (
char *)value + size;
34 count = ext2_acl_count(size);
42 for (n=0; n <
count; n++) {
54 value = (
char *)value +
60 if ((
char *)value >
end)
68 if ((
char *)value >
end)
84 posix_acl_release(acl);
92 ext2_acl_to_disk(
const struct posix_acl *acl,
size_t *size)
98 *size = ext2_acl_size(acl->
a_count);
105 for (n=0; n < acl->
a_count; n++) {
110 switch(acl_e->
e_tag) {
133 return (
char *)ext_acl;
154 acl = get_cached_acl(inode, type);
176 acl = ext2_acl_from_disk(value, retval);
180 acl = ERR_PTR(retval);
184 set_cached_acl(inode, type, acl);
214 mark_inode_dirty(inode);
231 value = ext2_acl_to_disk(acl, &size);
233 return (
int)PTR_ERR(value);
240 set_cached_acl(inode, type, acl);
280 posix_acl_release(acl);
309 if (IS_ERR(acl) || !acl)
315 posix_acl_release(acl);
323 ext2_xattr_list_acl_access(
struct dentry *
dentry,
char *
list,
size_t list_size,
330 if (list && size <= list_size)
336 ext2_xattr_list_acl_default(
struct dentry *dentry,
char *list,
size_t list_size,
337 const char *name,
size_t name_len,
int type)
343 if (list && size <= list_size)
349 ext2_xattr_get_acl(
struct dentry *dentry,
const char *name,
void *
buffer,
350 size_t size,
int type)
355 if (
strcmp(name,
"") != 0)
366 posix_acl_release(acl);
372 ext2_xattr_set_acl(
struct dentry *dentry,
const char *name,
const void *value,
373 size_t size,
int flags,
int type)
378 if (
strcmp(name,
"") != 0)
392 goto release_and_out;
400 posix_acl_release(acl);
407 .list = ext2_xattr_list_acl_access,
408 .get = ext2_xattr_get_acl,
409 .set = ext2_xattr_set_acl,
415 .list = ext2_xattr_list_acl_default,
416 .get = ext2_xattr_get_acl,
417 .set = ext2_xattr_set_acl,