aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_acl.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-02-26 14:04:15 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-02-26 14:06:24 -0500
commita7790532f5b7358c33a6b1834dc2b318de209f31 (patch)
tree0ceb9e24b3f54cb5c8453fb5a218e2a94a0f1cce /fs/xfs/linux-2.6/xfs_acl.c
parent2764fb4244cc1bc08df3667924ca4a972e90ac70 (diff)
parent60b341b778cc2929df16c0a504c91621b3c6a4ad (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
The SmartMedia FTL code depends on new kfifo bits from 2.6.33
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_acl.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_acl.c60
1 files changed, 22 insertions, 38 deletions
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c
index 69e598b6986f..883ca5ab8af5 100644
--- a/fs/xfs/linux-2.6/xfs_acl.c
+++ b/fs/xfs/linux-2.6/xfs_acl.c
@@ -251,8 +251,9 @@ xfs_set_mode(struct inode *inode, mode_t mode)
251 if (mode != inode->i_mode) { 251 if (mode != inode->i_mode) {
252 struct iattr iattr; 252 struct iattr iattr;
253 253
254 iattr.ia_valid = ATTR_MODE; 254 iattr.ia_valid = ATTR_MODE | ATTR_CTIME;
255 iattr.ia_mode = mode; 255 iattr.ia_mode = mode;
256 iattr.ia_ctime = current_fs_time(inode->i_sb);
256 257
257 error = -xfs_setattr(XFS_I(inode), &iattr, XFS_ATTR_NOACL); 258 error = -xfs_setattr(XFS_I(inode), &iattr, XFS_ATTR_NOACL);
258 } 259 }
@@ -354,37 +355,14 @@ xfs_acl_chmod(struct inode *inode)
354 return error; 355 return error;
355} 356}
356 357
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 358static int
367xfs_decode_acl(const char *name) 359xfs_xattr_acl_get(struct dentry *dentry, const char *name,
368{ 360 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{ 361{
380 struct posix_acl *acl; 362 struct posix_acl *acl;
381 int type, error; 363 int error;
382
383 type = xfs_decode_acl(name);
384 if (type < 0)
385 return type;
386 364
387 acl = xfs_get_acl(inode, type); 365 acl = xfs_get_acl(dentry->d_inode, type);
388 if (IS_ERR(acl)) 366 if (IS_ERR(acl))
389 return PTR_ERR(acl); 367 return PTR_ERR(acl);
390 if (acl == NULL) 368 if (acl == NULL)
@@ -397,15 +375,13 @@ xfs_xattr_system_get(struct inode *inode, const char *name,
397} 375}
398 376
399static int 377static int
400xfs_xattr_system_set(struct inode *inode, const char *name, 378xfs_xattr_acl_set(struct dentry *dentry, const char *name,
401 const void *value, size_t size, int flags) 379 const void *value, size_t size, int flags, int type)
402{ 380{
381 struct inode *inode = dentry->d_inode;
403 struct posix_acl *acl = NULL; 382 struct posix_acl *acl = NULL;
404 int error = 0, type; 383 int error = 0;
405 384
406 type = xfs_decode_acl(name);
407 if (type < 0)
408 return type;
409 if (flags & XATTR_CREATE) 385 if (flags & XATTR_CREATE)
410 return -EINVAL; 386 return -EINVAL;
411 if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode)) 387 if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
@@ -462,8 +438,16 @@ xfs_xattr_system_set(struct inode *inode, const char *name,
462 return error; 438 return error;
463} 439}
464 440
465struct xattr_handler xfs_xattr_system_handler = { 441struct xattr_handler xfs_xattr_acl_access_handler = {
466 .prefix = XATTR_SYSTEM_PREFIX, 442 .prefix = POSIX_ACL_XATTR_ACCESS,
467 .get = xfs_xattr_system_get, 443 .flags = ACL_TYPE_ACCESS,
468 .set = xfs_xattr_system_set, 444 .get = xfs_xattr_acl_get,
445 .set = xfs_xattr_acl_set,
446};
447
448struct xattr_handler xfs_xattr_acl_default_handler = {
449 .prefix = POSIX_ACL_XATTR_DEFAULT,
450 .flags = ACL_TYPE_DEFAULT,
451 .get = xfs_xattr_acl_get,
452 .set = xfs_xattr_acl_set,
469}; 453};