aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_xattr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-02-26 17:30:42 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2020-03-02 20:55:55 -0800
commitd5f0f49a9bdd4206e941282dfd323c436331659b (patch)
tree8fbd423d8b336a8c2bdc417a6d67b496432a5ff9 /fs/xfs/xfs_xattr.c
parentxfs: clean up the ATTR_REPLACE checks (diff)
downloadlinux-dev-d5f0f49a9bdd4206e941282dfd323c436331659b.tar.xz
linux-dev-d5f0f49a9bdd4206e941282dfd323c436331659b.zip
xfs: clean up the attr flag confusion
The ATTR_* flags have a long IRIX history, where they a userspace interface, the on-disk format and an internal interface. We've split out the on-disk interface to the XFS_ATTR_* values, but despite (or because?) of that the flag have still been a mess. Switch the internal interface to pass the on-disk XFS_ATTR_* flags for the namespace and the Linux XATTR_* flags for the actual flags instead. The ATTR_* values that are actually used are move to xfs_fs.h with a new XFS_IOC_* prefix to not conflict with the userspace version that has the same name and must have the same value. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_xattr.c')
-rw-r--r--fs/xfs/xfs_xattr.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 6e149fedd75a..361c72549ec9 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -16,7 +16,6 @@
#include "xfs_da_btree.h"
#include <linux/posix_acl_xattr.h>
-#include <linux/xattr.h>
static int
@@ -25,7 +24,7 @@ xfs_xattr_get(const struct xattr_handler *handler, struct dentry *unused,
{
struct xfs_da_args args = {
.dp = XFS_I(inode),
- .flags = handler->flags,
+ .attr_filter = handler->flags,
.name = name,
.namelen = strlen(name),
.value = value,
@@ -46,7 +45,8 @@ xfs_xattr_set(const struct xattr_handler *handler, struct dentry *unused,
{
struct xfs_da_args args = {
.dp = XFS_I(inode),
- .flags = handler->flags,
+ .attr_filter = handler->flags,
+ .attr_flags = flags,
.name = name,
.namelen = strlen(name),
.value = (void *)value,
@@ -54,14 +54,8 @@ xfs_xattr_set(const struct xattr_handler *handler, struct dentry *unused,
};
int error;
- /* Convert Linux syscall to XFS internal ATTR flags */
- if (flags & XATTR_CREATE)
- args.flags |= ATTR_CREATE;
- if (flags & XATTR_REPLACE)
- args.flags |= ATTR_REPLACE;
-
error = xfs_attr_set(&args);
- if (!error && (handler->flags & ATTR_ROOT))
+ if (!error && (handler->flags & XFS_ATTR_ROOT))
xfs_forget_acl(inode, name);
return error;
}
@@ -75,14 +69,14 @@ static const struct xattr_handler xfs_xattr_user_handler = {
static const struct xattr_handler xfs_xattr_trusted_handler = {
.prefix = XATTR_TRUSTED_PREFIX,
- .flags = ATTR_ROOT,
+ .flags = XFS_ATTR_ROOT,
.get = xfs_xattr_get,
.set = xfs_xattr_set,
};
static const struct xattr_handler xfs_xattr_security_handler = {
.prefix = XATTR_SECURITY_PREFIX,
- .flags = ATTR_SECURE,
+ .flags = XFS_ATTR_SECURE,
.get = xfs_xattr_get,
.set = xfs_xattr_set,
};