summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_xattr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-02-26 17:30:33 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2020-03-02 20:55:53 -0800
commita25446224353a773c7f4ba9ee5ae137515204efe (patch)
treee90927b44c008168d2ee7caa4e66c033b25a46b5 /fs/xfs/xfs_xattr.c
parentead189adb8abebc1555bf2776954131ba00c7619 (diff)
xfs: pass an initialized xfs_da_args structure to xfs_attr_set
Instead of converting from one style of arguments to another in xfs_attr_set, pass the structure from higher up in the call chain. 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.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 1670bfbc9ad2..bd770094b95a 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -12,6 +12,8 @@
#include "xfs_inode.h"
#include "xfs_attr.h"
#include "xfs_acl.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
#include <linux/posix_acl_xattr.h>
#include <linux/xattr.h>
@@ -66,20 +68,25 @@ xfs_xattr_set(const struct xattr_handler *handler, struct dentry *unused,
struct inode *inode, const char *name, const void *value,
size_t size, int flags)
{
- int xflags = handler->flags;
- struct xfs_inode *ip = XFS_I(inode);
+ struct xfs_da_args args = {
+ .dp = XFS_I(inode),
+ .flags = handler->flags,
+ .name = name,
+ .namelen = strlen(name),
+ .value = (void *)value,
+ .valuelen = size,
+ };
int error;
/* Convert Linux syscall to XFS internal ATTR flags */
if (flags & XATTR_CREATE)
- xflags |= ATTR_CREATE;
+ args.flags |= ATTR_CREATE;
if (flags & XATTR_REPLACE)
- xflags |= ATTR_REPLACE;
+ args.flags |= ATTR_REPLACE;
- error = xfs_attr_set(ip, (unsigned char *)name, strlen(name),
- (void *)value, size, xflags);
+ error = xfs_attr_set(&args);
if (!error)
- xfs_forget_acl(inode, name, xflags);
+ xfs_forget_acl(inode, name, args.flags);
return error;
}