Commit 6cc4f4ff authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: merge xfs_attrmulti_attr_remove into xfs_attrmulti_attr_set

Merge the ioctl handlers just like the low-level xfs_attr_set function.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarChandan Rajendra <chandanrlinux@gmail.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 0eb81a5f
...@@ -389,18 +389,20 @@ xfs_attrmulti_attr_set( ...@@ -389,18 +389,20 @@ xfs_attrmulti_attr_set(
uint32_t len, uint32_t len,
uint32_t flags) uint32_t flags)
{ {
unsigned char *kbuf; unsigned char *kbuf = NULL;
int error; int error;
size_t namelen; size_t namelen;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM; return -EPERM;
if (len > XFS_XATTR_SIZE_MAX)
return -EINVAL;
kbuf = memdup_user(ubuf, len); if (ubuf) {
if (IS_ERR(kbuf)) if (len > XFS_XATTR_SIZE_MAX)
return PTR_ERR(kbuf); return -EINVAL;
kbuf = memdup_user(ubuf, len);
if (IS_ERR(kbuf))
return PTR_ERR(kbuf);
}
namelen = strlen(name); namelen = strlen(name);
error = xfs_attr_set(XFS_I(inode), name, namelen, kbuf, len, flags); error = xfs_attr_set(XFS_I(inode), name, namelen, kbuf, len, flags);
...@@ -410,22 +412,6 @@ xfs_attrmulti_attr_set( ...@@ -410,22 +412,6 @@ xfs_attrmulti_attr_set(
return error; return error;
} }
int
xfs_attrmulti_attr_remove(
struct inode *inode,
unsigned char *name,
uint32_t flags)
{
int error;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
error = xfs_attr_set(XFS_I(inode), name, strlen(name), NULL, 0, flags);
if (!error)
xfs_forget_acl(inode, name, flags);
return error;
}
STATIC int STATIC int
xfs_attrmulti_by_handle( xfs_attrmulti_by_handle(
struct file *parfilp, struct file *parfilp,
...@@ -504,8 +490,8 @@ xfs_attrmulti_by_handle( ...@@ -504,8 +490,8 @@ xfs_attrmulti_by_handle(
ops[i].am_error = mnt_want_write_file(parfilp); ops[i].am_error = mnt_want_write_file(parfilp);
if (ops[i].am_error) if (ops[i].am_error)
break; break;
ops[i].am_error = xfs_attrmulti_attr_remove( ops[i].am_error = xfs_attrmulti_attr_set(
d_inode(dentry), attr_name, d_inode(dentry), attr_name, NULL, 0,
ops[i].am_flags); ops[i].am_flags);
mnt_drop_write_file(parfilp); mnt_drop_write_file(parfilp);
break; break;
......
...@@ -46,12 +46,6 @@ xfs_attrmulti_attr_set( ...@@ -46,12 +46,6 @@ xfs_attrmulti_attr_set(
uint32_t len, uint32_t len,
uint32_t flags); uint32_t flags);
extern int
xfs_attrmulti_attr_remove(
struct inode *inode,
unsigned char *name,
uint32_t flags);
extern struct dentry * extern struct dentry *
xfs_handle_to_dentry( xfs_handle_to_dentry(
struct file *parfilp, struct file *parfilp,
......
...@@ -488,8 +488,8 @@ xfs_compat_attrmulti_by_handle( ...@@ -488,8 +488,8 @@ xfs_compat_attrmulti_by_handle(
ops[i].am_error = mnt_want_write_file(parfilp); ops[i].am_error = mnt_want_write_file(parfilp);
if (ops[i].am_error) if (ops[i].am_error)
break; break;
ops[i].am_error = xfs_attrmulti_attr_remove( ops[i].am_error = xfs_attrmulti_attr_set(
d_inode(dentry), attr_name, d_inode(dentry), attr_name, NULL, 0,
ops[i].am_flags); ops[i].am_flags);
mnt_drop_write_file(parfilp); mnt_drop_write_file(parfilp);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment