1 #include <linux/capability.h>
5 #include <linux/errno.h>
7 #include <linux/xattr.h>
8 #include <linux/slab.h>
12 #include <asm/uaccess.h>
26 size_t jcreate_blocks;
47 jcreate_blocks = reiserfs_xattr_jcreate_nblocks(inode) +
48 reiserfs_xattr_nblocks(inode, size) * 2;
53 error = reiserfs_set_acl(&
th, inode, type, acl);
61 posix_acl_release(acl);
66 posix_acl_get(
struct dentry *dentry,
const char *name,
void *
buffer,
67 size_t size,
int type)
81 posix_acl_release(acl);
89 static struct posix_acl *posix_acl_from_disk(
const void *value,
size_t size)
91 const char *
end = (
char *)value + size;
103 count = reiserfs_acl_count(size);
111 for (n = 0; n <
count; n++) {
122 value = (
char *)value +
128 if ((
char *)value >
end)
136 if ((
char *)value >
end)
152 posix_acl_release(acl);
159 static void *posix_acl_to_disk(
const struct posix_acl *acl,
size_t * size)
165 *size = reiserfs_acl_size(acl->
a_count);
174 for (n = 0; n < acl->
a_count; n++) {
202 return (
char *)ext_acl;
222 acl = get_cached_acl(inode, type);
237 size = reiserfs_xattr_get(inode, name,
NULL, 0);
240 set_cached_acl(inode, type,
NULL);
243 return ERR_PTR(size);
250 retval = reiserfs_xattr_get(inode, name, value, size);
255 }
else if (retval < 0) {
256 acl = ERR_PTR(retval);
258 acl = posix_acl_from_disk(value, retval);
261 set_cached_acl(inode, type, acl);
308 value = posix_acl_to_disk(acl, &size);
310 return (
int)PTR_ERR(value);
313 error = reiserfs_xattr_set_handle(th, inode, name, value, size, 0);
325 mark_inode_dirty(inode);
332 set_cached_acl(inode, type, acl);
341 struct inode *dir,
struct dentry *dentry,
387 posix_acl_release(acl);
418 if (acl && !IS_ERR(acl)) {
419 int size = reiserfs_acl_size(acl->
a_count);
425 nblocks = reiserfs_xattr_jcreate_nblocks(inode);
431 nblocks += reiserfs_xattr_nblocks(inode, size) * 4;
432 posix_acl_release(acl);
465 size = reiserfs_xattr_nblocks(inode, reiserfs_acl_size(acl->
a_count));
476 posix_acl_release(acl);
480 static size_t posix_acl_access_list(
struct dentry *dentry,
char *
list,
481 size_t list_size,
const char *name,
487 if (list && size <= list_size)
495 .get = posix_acl_get,
496 .set = posix_acl_set,
497 .list = posix_acl_access_list,
500 static size_t posix_acl_default_list(
struct dentry *dentry,
char *list,
501 size_t list_size,
const char *name,
502 size_t name_len,
int type)
507 if (list && size <= list_size)
515 .get = posix_acl_get,
516 .set = posix_acl_set,
517 .list = posix_acl_default_list,