diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_xattr.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_xattr.c | 67 |
1 files changed, 4 insertions, 63 deletions
diff --git a/fs/xfs/linux-2.6/xfs_xattr.c b/fs/xfs/linux-2.6/xfs_xattr.c index 964621fde6ed..497c7fb75cc1 100644 --- a/fs/xfs/linux-2.6/xfs_xattr.c +++ b/fs/xfs/linux-2.6/xfs_xattr.c | |||
@@ -29,67 +29,6 @@ | |||
29 | #include <linux/xattr.h> | 29 | #include <linux/xattr.h> |
30 | 30 | ||
31 | 31 | ||
32 | /* | ||
33 | * ACL handling. Should eventually be moved into xfs_acl.c | ||
34 | */ | ||
35 | |||
36 | static int | ||
37 | xfs_decode_acl(const char *name) | ||
38 | { | ||
39 | if (strcmp(name, "posix_acl_access") == 0) | ||
40 | return _ACL_TYPE_ACCESS; | ||
41 | else if (strcmp(name, "posix_acl_default") == 0) | ||
42 | return _ACL_TYPE_DEFAULT; | ||
43 | return -EINVAL; | ||
44 | } | ||
45 | |||
46 | /* | ||
47 | * Get system extended attributes which at the moment only | ||
48 | * includes Posix ACLs. | ||
49 | */ | ||
50 | static int | ||
51 | xfs_xattr_system_get(struct inode *inode, const char *name, | ||
52 | void *buffer, size_t size) | ||
53 | { | ||
54 | int acl; | ||
55 | |||
56 | acl = xfs_decode_acl(name); | ||
57 | if (acl < 0) | ||
58 | return acl; | ||
59 | |||
60 | return xfs_acl_vget(inode, buffer, size, acl); | ||
61 | } | ||
62 | |||
63 | static int | ||
64 | xfs_xattr_system_set(struct inode *inode, const char *name, | ||
65 | const void *value, size_t size, int flags) | ||
66 | { | ||
67 | int acl; | ||
68 | |||
69 | acl = xfs_decode_acl(name); | ||
70 | if (acl < 0) | ||
71 | return acl; | ||
72 | if (flags & XATTR_CREATE) | ||
73 | return -EINVAL; | ||
74 | |||
75 | if (!value) | ||
76 | return xfs_acl_vremove(inode, acl); | ||
77 | |||
78 | return xfs_acl_vset(inode, (void *)value, size, acl); | ||
79 | } | ||
80 | |||
81 | static struct xattr_handler xfs_xattr_system_handler = { | ||
82 | .prefix = XATTR_SYSTEM_PREFIX, | ||
83 | .get = xfs_xattr_system_get, | ||
84 | .set = xfs_xattr_system_set, | ||
85 | }; | ||
86 | |||
87 | |||
88 | /* | ||
89 | * Real xattr handling. The only difference between the namespaces is | ||
90 | * a flag passed to the low-level attr code. | ||
91 | */ | ||
92 | |||
93 | static int | 32 | static int |
94 | __xfs_xattr_get(struct inode *inode, const char *name, | 33 | __xfs_xattr_get(struct inode *inode, const char *name, |
95 | void *value, size_t size, int xflags) | 34 | void *value, size_t size, int xflags) |
@@ -199,7 +138,9 @@ struct xattr_handler *xfs_xattr_handlers[] = { | |||
199 | &xfs_xattr_user_handler, | 138 | &xfs_xattr_user_handler, |
200 | &xfs_xattr_trusted_handler, | 139 | &xfs_xattr_trusted_handler, |
201 | &xfs_xattr_security_handler, | 140 | &xfs_xattr_security_handler, |
141 | #ifdef CONFIG_XFS_POSIX_ACL | ||
202 | &xfs_xattr_system_handler, | 142 | &xfs_xattr_system_handler, |
143 | #endif | ||
203 | NULL | 144 | NULL |
204 | }; | 145 | }; |
205 | 146 | ||
@@ -310,7 +251,7 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size) | |||
310 | /* | 251 | /* |
311 | * Then add the two synthetic ACL attributes. | 252 | * Then add the two synthetic ACL attributes. |
312 | */ | 253 | */ |
313 | if (xfs_acl_vhasacl_access(inode)) { | 254 | if (posix_acl_access_exists(inode)) { |
314 | error = list_one_attr(POSIX_ACL_XATTR_ACCESS, | 255 | error = list_one_attr(POSIX_ACL_XATTR_ACCESS, |
315 | strlen(POSIX_ACL_XATTR_ACCESS) + 1, | 256 | strlen(POSIX_ACL_XATTR_ACCESS) + 1, |
316 | data, size, &context.count); | 257 | data, size, &context.count); |
@@ -318,7 +259,7 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size) | |||
318 | return error; | 259 | return error; |
319 | } | 260 | } |
320 | 261 | ||
321 | if (xfs_acl_vhasacl_default(inode)) { | 262 | if (posix_acl_default_exists(inode)) { |
322 | error = list_one_attr(POSIX_ACL_XATTR_DEFAULT, | 263 | error = list_one_attr(POSIX_ACL_XATTR_DEFAULT, |
323 | strlen(POSIX_ACL_XATTR_DEFAULT) + 1, | 264 | strlen(POSIX_ACL_XATTR_DEFAULT) + 1, |
324 | data, size, &context.count); | 265 | data, size, &context.count); |