summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_xattr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-02-27 04:30:34 +0300
committerDarrick J. Wong <darrick.wong@oracle.com>2020-03-03 07:55:53 +0300
commite5171d7e989479fe6298f8aedbd94e0aec23f5fc (patch)
treefb3abcdab59516c8af05261763b4e2ae8bcccea2 /fs/xfs/xfs_xattr.c
parenta25446224353a773c7f4ba9ee5ae137515204efe (diff)
downloadlinux-e5171d7e989479fe6298f8aedbd94e0aec23f5fc.tar.xz
xfs: pass an initialized xfs_da_args to xfs_attr_get
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.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index bd770094b95a..5411f3b3f7a8 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -23,22 +23,24 @@ static int
xfs_xattr_get(const struct xattr_handler *handler, struct dentry *unused,
struct inode *inode, const char *name, void *value, size_t size)
{
- int xflags = handler->flags;
- struct xfs_inode *ip = XFS_I(inode);
- int error, asize = size;
- size_t namelen = strlen(name);
+ struct xfs_da_args args = {
+ .dp = XFS_I(inode),
+ .flags = handler->flags,
+ .name = name,
+ .namelen = strlen(name),
+ .value = value,
+ .valuelen = size,
+ };
+ int error;
/* Convert Linux syscall to XFS internal ATTR flags */
- if (!size) {
- xflags |= ATTR_KERNOVAL;
- value = NULL;
- }
+ if (!size)
+ args.flags |= ATTR_KERNOVAL;
- error = xfs_attr_get(ip, name, namelen, (unsigned char **)&value,
- &asize, xflags);
+ error = xfs_attr_get(&args);
if (error)
return error;
- return asize;
+ return args.valuelen;
}
void