From a25446224353a773c7f4ba9ee5ae137515204efe Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 26 Feb 2020 17:30:33 -0800 Subject: 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 Reviewed-by: Dave Chinner Reviewed-by: Chandan Rajendra Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- fs/xfs/xfs_xattr.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'fs/xfs/xfs_xattr.c') 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 #include @@ -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; } -- cgit v1.2.3