aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/acl.c')
-rw-r--r--fs/btrfs/acl.c73
1 files changed, 44 insertions, 29 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 889ba89d3f9f..b4f85ebe1bd6 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -22,53 +22,68 @@
22#include <linux/posix_acl_xattr.h> 22#include <linux/posix_acl_xattr.h>
23#include "ctree.h" 23#include "ctree.h"
24#include "xattr.h" 24#include "xattr.h"
25static int btrfs_xattr_set_acl(struct inode *inode, int type,
26 const void *value, size_t size)
27{
28 int ret = 0;
29 struct posix_acl *acl;
25 30
26/* 31 if (!is_owner_or_cap(inode))
27 * FIXME: At this point this is all place holder stuff, we just return 32 return -EPERM;
28 * -EOPNOTSUPP so cp won't complain when it tries to copy over a file with an 33 if (value) {
29 * acl on it. 34 acl = posix_acl_from_xattr(value, size);
30 */ 35 if (acl == NULL) {
36 value = NULL;
37 size = 0;
38 } else if (IS_ERR(acl)) {
39 ret = PTR_ERR(acl);
40 } else {
41 ret = posix_acl_valid(acl);
42 posix_acl_release(acl);
43 }
44 if (ret)
45 return ret;
46 }
47 return btrfs_xattr_set(inode, type, "", value, size, 0);
48}
31 49
50static int btrfs_xattr_get_acl(struct inode *inode, int type,
51 void *value, size_t size)
52{
53 return btrfs_xattr_get(inode, type, "", value, size);
54}
32static int btrfs_xattr_acl_access_get(struct inode *inode, const char *name, 55static int btrfs_xattr_acl_access_get(struct inode *inode, const char *name,
33 void *value, size_t size) 56 void *value, size_t size)
34{ 57{
35 /* 58 if (*name != '\0')
36 return btrfs_xattr_get(inode, BTRFS_XATTR_INDEX_POSIX_ACL_ACCESS, name, 59 return -EINVAL;
37 value, size); 60 return btrfs_xattr_get_acl(inode, BTRFS_XATTR_INDEX_POSIX_ACL_ACCESS,
38 */ 61 value, size);
39 return -EOPNOTSUPP;
40} 62}
41
42static int btrfs_xattr_acl_access_set(struct inode *inode, const char *name, 63static int btrfs_xattr_acl_access_set(struct inode *inode, const char *name,
43 const void *value, size_t size, int flags) 64 const void *value, size_t size, int flags)
44{ 65{
45 /* 66 if (*name != '\0')
46 return btrfs_xattr_set(inode, BTRFS_XATTR_INDEX_POSIX_ACL_ACCESS, name, 67 return -EINVAL;
47 value, size, flags); 68 return btrfs_xattr_set_acl(inode, BTRFS_XATTR_INDEX_POSIX_ACL_ACCESS,
48 */ 69 value, size);
49 return -EOPNOTSUPP;
50} 70}
51
52static int btrfs_xattr_acl_default_get(struct inode *inode, const char *name, 71static int btrfs_xattr_acl_default_get(struct inode *inode, const char *name,
53 void *value, size_t size) 72 void *value, size_t size)
54{ 73{
55 /* 74 if (*name != '\0')
56 return btrfs_xattr_get(inode, BTRFS_XATTR_INDEX_POSIX_ACL_DEFAULT, 75 return -EINVAL;
57 name, value, size); 76 return btrfs_xattr_get_acl(inode, BTRFS_XATTR_INDEX_POSIX_ACL_DEFAULT,
58 */ 77 value, size);
59 return -EOPNOTSUPP;
60} 78}
61
62static int btrfs_xattr_acl_default_set(struct inode *inode, const char *name, 79static int btrfs_xattr_acl_default_set(struct inode *inode, const char *name,
63 const void *value, size_t size, int flags) 80 const void *value, size_t size, int flags)
64{ 81{
65 /* 82 if (*name != '\0')
66 return btrfs_xattr_set(inode, BTRFS_XATTR_INDEX_POSIX_ACL_DEFAULT, 83 return -EINVAL;
67 name, value, size, flags); 84 return btrfs_xattr_set_acl(inode, BTRFS_XATTR_INDEX_POSIX_ACL_DEFAULT,
68 */ 85 value, size);
69 return -EOPNOTSUPP;
70} 86}
71
72struct xattr_handler btrfs_xattr_acl_default_handler = { 87struct xattr_handler btrfs_xattr_acl_default_handler = {
73 .prefix = POSIX_ACL_XATTR_DEFAULT, 88 .prefix = POSIX_ACL_XATTR_DEFAULT,
74 .list = btrfs_xattr_generic_list, 89 .list = btrfs_xattr_generic_list,