diff options
author | Christoph Hellwig <hch@lst.de> | 2020-02-27 02:30:33 +0100 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2020-03-03 05:55:53 +0100 |
commit | a25446224353a773c7f4ba9ee5ae137515204efe (patch) | |
tree | e90927b44c008168d2ee7caa4e66c033b25a46b5 /fs/xfs/xfs_ioctl.c | |
parent | xfs: turn xfs_da_args.value into a void pointer (diff) | |
download | linux-a25446224353a773c7f4ba9ee5ae137515204efe.tar.xz linux-a25446224353a773c7f4ba9ee5ae137515204efe.zip |
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_ioctl.c')
-rw-r--r-- | fs/xfs/xfs_ioctl.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index d42be87ca143..d4aa60a6f761 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -35,6 +35,8 @@ #include "xfs_health.h" #include "xfs_reflink.h" #include "xfs_ioctl.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" #include <linux/mount.h> #include <linux/namei.h> @@ -389,9 +391,13 @@ xfs_attrmulti_attr_set( uint32_t len, uint32_t flags) { - unsigned char *kbuf = NULL; + struct xfs_da_args args = { + .dp = XFS_I(inode), + .flags = flags, + .name = name, + .namelen = strlen(name), + }; int error; - size_t namelen; if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) return -EPERM; @@ -399,16 +405,16 @@ xfs_attrmulti_attr_set( if (ubuf) { if (len > XFS_XATTR_SIZE_MAX) return -EINVAL; - kbuf = memdup_user(ubuf, len); - if (IS_ERR(kbuf)) - return PTR_ERR(kbuf); + args.value = memdup_user(ubuf, len); + if (IS_ERR(args.value)) + return PTR_ERR(args.value); + args.valuelen = len; } - namelen = strlen(name); - error = xfs_attr_set(XFS_I(inode), name, namelen, kbuf, len, flags); + error = xfs_attr_set(&args); if (!error) xfs_forget_acl(inode, name, flags); - kfree(kbuf); + kfree(args.value); return error; } |