From: Christoph Hellwig <hch@lst.de>
To: linux-xfs@vger.kernel.org
Cc: Allison Collins <allison.henderson@oracle.com>,
Chandan Rajendra <chandanrlinux@gmail.com>,
"Darrick J . Wong" <darrick.wong@oracle.com>
Subject: [PATCH 04/31] xfs: merge xfs_attrmulti_attr_remove into xfs_attrmulti_attr_set
Date: Mon, 17 Feb 2020 13:59:30 +0100 [thread overview]
Message-ID: <20200217125957.263434-5-hch@lst.de> (raw)
In-Reply-To: <20200217125957.263434-1-hch@lst.de>
Merge the ioctl handlers just like the low-level xfs_attr_set function.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/xfs_ioctl.c | 34 ++++++++++------------------------
fs/xfs/xfs_ioctl.h | 6 ------
fs/xfs/xfs_ioctl32.c | 4 ++--
3 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 79c418888e9a..b806003caacd 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -389,18 +389,20 @@ xfs_attrmulti_attr_set(
uint32_t len,
uint32_t flags)
{
- unsigned char *kbuf;
+ unsigned char *kbuf = NULL;
int error;
size_t namelen;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
- if (len > XFS_XATTR_SIZE_MAX)
- return -EINVAL;
- kbuf = memdup_user(ubuf, len);
- if (IS_ERR(kbuf))
- return PTR_ERR(kbuf);
+ if (ubuf) {
+ if (len > XFS_XATTR_SIZE_MAX)
+ return -EINVAL;
+ kbuf = memdup_user(ubuf, len);
+ if (IS_ERR(kbuf))
+ return PTR_ERR(kbuf);
+ }
namelen = strlen(name);
error = xfs_attr_set(XFS_I(inode), name, namelen, kbuf, len, flags);
@@ -410,22 +412,6 @@ xfs_attrmulti_attr_set(
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
xfs_attrmulti_by_handle(
struct file *parfilp,
@@ -504,8 +490,8 @@ xfs_attrmulti_by_handle(
ops[i].am_error = mnt_want_write_file(parfilp);
if (ops[i].am_error)
break;
- ops[i].am_error = xfs_attrmulti_attr_remove(
- d_inode(dentry), attr_name,
+ ops[i].am_error = xfs_attrmulti_attr_set(
+ d_inode(dentry), attr_name, NULL, 0,
ops[i].am_flags);
mnt_drop_write_file(parfilp);
break;
diff --git a/fs/xfs/xfs_ioctl.h b/fs/xfs/xfs_ioctl.h
index 420bd95dc326..819504df00ae 100644
--- a/fs/xfs/xfs_ioctl.h
+++ b/fs/xfs/xfs_ioctl.h
@@ -46,12 +46,6 @@ xfs_attrmulti_attr_set(
uint32_t len,
uint32_t flags);
-extern int
-xfs_attrmulti_attr_remove(
- struct inode *inode,
- unsigned char *name,
- uint32_t flags);
-
extern struct dentry *
xfs_handle_to_dentry(
struct file *parfilp,
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index 9705172e5410..e085f304e539 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -488,8 +488,8 @@ xfs_compat_attrmulti_by_handle(
ops[i].am_error = mnt_want_write_file(parfilp);
if (ops[i].am_error)
break;
- ops[i].am_error = xfs_attrmulti_attr_remove(
- d_inode(dentry), attr_name,
+ ops[i].am_error = xfs_attrmulti_attr_set(
+ d_inode(dentry), attr_name, NULL, 0,
ops[i].am_flags);
mnt_drop_write_file(parfilp);
break;
--
2.24.1
next prev parent reply other threads:[~2020-02-17 13:00 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-17 12:59 clean up the attr interface v4 Christoph Hellwig
2020-02-17 12:59 ` [PATCH 01/31] xfs: reject invalid flags combinations in XFS_IOC_ATTRLIST_BY_HANDLE Christoph Hellwig
2020-02-17 21:48 ` Dave Chinner
2020-02-19 0:49 ` Darrick J. Wong
2020-02-17 12:59 ` [PATCH 02/31] xfs: remove the ATTR_INCOMPLETE flag Christoph Hellwig
2020-02-17 21:51 ` Dave Chinner
2020-02-18 15:19 ` Christoph Hellwig
2020-02-17 12:59 ` [PATCH 03/31] xfs: merge xfs_attr_remove into xfs_attr_set Christoph Hellwig
2020-02-17 22:02 ` Dave Chinner
2020-02-17 12:59 ` Christoph Hellwig [this message]
2020-02-17 22:04 ` [PATCH 04/31] xfs: merge xfs_attrmulti_attr_remove into xfs_attrmulti_attr_set Dave Chinner
2020-02-17 12:59 ` [PATCH 05/31] xfs: use strndup_user in XFS_IOC_ATTRMULTI_BY_HANDLE Christoph Hellwig
2020-02-17 22:15 ` Dave Chinner
2020-02-18 15:24 ` Christoph Hellwig
2020-02-19 0:38 ` Darrick J. Wong
2020-02-19 4:03 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 06/31] xfs: factor out a helper for a single XFS_IOC_ATTRMULTI_BY_HANDLE op Christoph Hellwig
2020-02-17 22:28 ` Dave Chinner
2020-02-18 15:28 ` Christoph Hellwig
2020-02-17 12:59 ` [PATCH 07/31] xfs: remove the name == NULL check from xfs_attr_args_init Christoph Hellwig
2020-02-17 22:29 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 08/31] xfs: remove the MAXNAMELEN " Christoph Hellwig
2020-02-17 22:29 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 09/31] xfs: move struct xfs_da_args to xfs_types.h Christoph Hellwig
2020-02-17 12:59 ` [PATCH 10/31] xfs: turn xfs_da_args.value into a void pointer Christoph Hellwig
2020-02-17 12:59 ` [PATCH 11/31] xfs: pass an initialized xfs_da_args structure to xfs_attr_set Christoph Hellwig
2020-02-17 12:59 ` [PATCH 12/31] xfs: pass an initialized xfs_da_args to xfs_attr_get Christoph Hellwig
2020-02-17 12:59 ` [PATCH 13/31] xfs: remove the xfs_inode argument to xfs_attr_get_ilocked Christoph Hellwig
2020-02-17 23:06 ` Dave Chinner
2020-02-18 15:30 ` Christoph Hellwig
2020-02-17 12:59 ` [PATCH 14/31] xfs: remove ATTR_KERNOVAL Christoph Hellwig
2020-02-17 23:06 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 15/31] xfs: remove ATTR_ALLOC and XFS_DA_OP_ALLOCVAL Christoph Hellwig
2020-02-17 23:09 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 16/31] xfs: replace ATTR_KERNOTIME with XFS_DA_OP_NOTIME Christoph Hellwig
2020-02-17 23:21 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 17/31] xfs: factor out a xfs_attr_match helper Christoph Hellwig
2020-02-17 23:23 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 18/31] xfs: cleanup struct xfs_attr_list_context Christoph Hellwig
2020-02-17 23:25 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 19/31] xfs: remove the unused ATTR_ENTRY macro Christoph Hellwig
2020-02-17 23:25 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 20/31] xfs: open code ATTR_ENTSIZE Christoph Hellwig
2020-02-17 23:32 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 21/31] xfs: move the legacy xfs_attr_list to xfs_ioctl.c Christoph Hellwig
2020-02-17 23:41 ` Dave Chinner
2020-02-18 15:38 ` Christoph Hellwig
2020-02-17 12:59 ` [PATCH 22/31] xfs: rename xfs_attr_list_int to xfs_attr_list Christoph Hellwig
2020-02-17 23:42 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 23/31] xfs: properly type the buffer field in struct xfs_fsop_attrlist_handlereq Christoph Hellwig
2020-02-17 23:53 ` Dave Chinner
2020-02-18 15:39 ` Christoph Hellwig
2020-02-19 0:58 ` Darrick J. Wong
2020-02-19 4:10 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 24/31] xfs: lift common checks into xfs_ioc_attr_list Christoph Hellwig
2020-02-17 23:47 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 25/31] xfs: lift buffer allocation " Christoph Hellwig
2020-02-17 23:55 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 26/31] xfs: lift cursor copy in/out " Christoph Hellwig
2020-02-18 0:03 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 27/31] xfs: improve xfs_forget_acl Christoph Hellwig
2020-02-18 1:58 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 28/31] xfs: clean up the ATTR_REPLACE checks Christoph Hellwig
2020-02-18 2:06 ` Dave Chinner
2020-02-18 15:41 ` Christoph Hellwig
2020-02-17 12:59 ` [PATCH 29/31] xfs: clean up the attr flag confusion Christoph Hellwig
2020-02-17 12:59 ` [PATCH 30/31] xfs: remove XFS_DA_OP_INCOMPLETE Christoph Hellwig
2020-02-18 2:23 ` Dave Chinner
2020-02-18 15:48 ` Christoph Hellwig
2020-02-19 0:47 ` Darrick J. Wong
2020-02-19 6:53 ` Dave Chinner
2020-02-17 12:59 ` [PATCH 31/31] xfs: embedded the attrlist cursor into struct xfs_attr_list_context Christoph Hellwig
2020-02-18 2:24 ` Dave Chinner
2020-02-19 0:48 ` clean up the attr interface v4 Darrick J. Wong
-- strict thread matches above, loose matches on Subject: below --
2020-02-21 14:11 clean up the attr interface v5 Christoph Hellwig
2020-02-21 14:11 ` [PATCH 04/31] xfs: merge xfs_attrmulti_attr_remove into xfs_attrmulti_attr_set Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200217125957.263434-5-hch@lst.de \
--to=hch@lst.de \
--cc=allison.henderson@oracle.com \
--cc=chandanrlinux@gmail.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).