aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_acl.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_acl.c57
1 files changed, 20 insertions, 37 deletions
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c
index 69e598b6986f..2512125dfa7c 100644
--- a/fs/xfs/linux-2.6/xfs_acl.c
+++ b/fs/xfs/linux-2.6/xfs_acl.c
@@ -354,37 +354,14 @@ xfs_acl_chmod(struct inode *inode)
354 return error; 354 return error;
355} 355}
356 356
357/*
358 * System xattr handlers.
359 *
360 * Currently Posix ACLs are the only system namespace extended attribute
361 * handlers supported by XFS, so we just implement the handlers here.
362 * If we ever support other system extended attributes this will need
363 * some refactoring.
364 */
365
366static int 357static int
367xfs_decode_acl(const char *name) 358xfs_xattr_acl_get(struct dentry *dentry, const char *name,
368{ 359 void *value, size_t size, int type)
369 if (strcmp(name, "posix_acl_access") == 0)
370 return ACL_TYPE_ACCESS;
371 else if (strcmp(name, "posix_acl_default") == 0)
372 return ACL_TYPE_DEFAULT;
373 return -EINVAL;
374}
375
376static int
377xfs_xattr_system_get(struct inode *inode, const char *name,
378 void *value, size_t size)
379{ 360{
380 struct posix_acl *acl; 361 struct posix_acl *acl;
381 int type, error; 362 int error;
382
383 type = xfs_decode_acl(name);
384 if (type < 0)
385 return type;
386 363
387 acl = xfs_get_acl(inode, type); 364 acl = xfs_get_acl(dentry->d_inode, type);
388 if (IS_ERR(acl)) 365 if (IS_ERR(acl))
389 return PTR_ERR(acl); 366 return PTR_ERR(acl);
390 if (acl == NULL) 367 if (acl == NULL)
@@ -397,15 +374,13 @@ xfs_xattr_system_get(struct inode *inode, const char *name,
397} 374}
398 375
399static int 376static int
400xfs_xattr_system_set(struct inode *inode, const char *name, 377xfs_xattr_acl_set(struct dentry *dentry, const char *name,
401 const void *value, size_t size, int flags) 378 const void *value, size_t size, int flags, int type)
402{ 379{
380 struct inode *inode = dentry->d_inode;
403 struct posix_acl *acl = NULL; 381 struct posix_acl *acl = NULL;
404 int error = 0, type; 382 int error = 0;
405 383
406 type = xfs_decode_acl(name);
407 if (type < 0)
408 return type;
409 if (flags & XATTR_CREATE) 384 if (flags & XATTR_CREATE)
410 return -EINVAL; 385 return -EINVAL;
411 if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode)) 386 if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
@@ -462,8 +437,16 @@ xfs_xattr_system_set(struct inode *inode, const char *name,
462 return error; 437 return error;
463} 438}
464 439
465struct xattr_handler xfs_xattr_system_handler = { 440struct xattr_handler xfs_xattr_acl_access_handler = {
466 .prefix = XATTR_SYSTEM_PREFIX, 441 .prefix = POSIX_ACL_XATTR_ACCESS,
467 .get = xfs_xattr_system_get, 442 .flags = ACL_TYPE_ACCESS,
468 .set = xfs_xattr_system_set, 443 .get = xfs_xattr_acl_get,
444 .set = xfs_xattr_acl_set,
445};
446
447struct xattr_handler xfs_xattr_acl_default_handler = {
448 .prefix = POSIX_ACL_XATTR_DEFAULT,
449 .flags = ACL_TYPE_DEFAULT,
450 .get = xfs_xattr_acl_get,
451 .set = xfs_xattr_acl_set,
469}; 452};