From: Christoph Hellwig <hch@lst.de>
To: Carlos Maiolino <cem@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 06/16] xfs: split out the handlers for XFS_IOC_.*HANDLE
Date: Wed, 29 Jul 2026 15:03:05 +0200 [thread overview]
Message-ID: <20260729130320.2282183-7-hch@lst.de> (raw)
In-Reply-To: <20260729130320.2282183-1-hch@lst.de>
Split out helpers for XFS_IOC_.*HANDLE to keep the stack variables out of
xfs_file_ioctl and to clean up the main ioctl handler flow.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_ioctl.c | 65 ++++++++++++++++++++++++++++++----------------
1 file changed, 42 insertions(+), 23 deletions(-)
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 2924d8d0f03f..6a7c570ea535 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1226,6 +1226,42 @@ xfs_ioc_dioinfo(
return 0;
}
+static int
+xfs_ioc_find_handle(
+ unsigned int cmd,
+ void __user *arg)
+{
+ struct xfs_fsop_handlereq hreq;
+
+ if (copy_from_user(&hreq, arg, sizeof(hreq)))
+ return -EFAULT;
+ return xfs_find_handle(cmd, &hreq);
+}
+
+static int
+xfs_ioc_open_by_handle(
+ struct file *file,
+ void __user *arg)
+{
+ struct xfs_fsop_handlereq hreq;
+
+ if (copy_from_user(&hreq, arg, sizeof(hreq)))
+ return -EFAULT;
+ return xfs_open_by_handle(file, &hreq);
+}
+
+static int
+xfs_ioc_readlink_by_handle(
+ struct file *file,
+ void __user *arg)
+{
+ struct xfs_fsop_handlereq hreq;
+
+ if (copy_from_user(&hreq, arg, sizeof(hreq)))
+ return -EFAULT;
+ return xfs_readlink_by_handle(file, &hreq);
+}
+
/*
* These long-unused ioctls were removed from the official ioctl API in 5.17,
* but retain these definitions so that we can log warnings about them.
@@ -1314,31 +1350,14 @@ xfs_file_ioctl(
case XFS_IOC_FD_TO_HANDLE:
case XFS_IOC_PATH_TO_HANDLE:
- case XFS_IOC_PATH_TO_FSHANDLE: {
- xfs_fsop_handlereq_t hreq;
-
- if (copy_from_user(&hreq, arg, sizeof(hreq)))
- return -EFAULT;
- return xfs_find_handle(cmd, &hreq);
- }
- case XFS_IOC_OPEN_BY_HANDLE: {
- xfs_fsop_handlereq_t hreq;
-
- if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t)))
- return -EFAULT;
- return xfs_open_by_handle(filp, &hreq);
- }
-
- case XFS_IOC_READLINK_BY_HANDLE: {
- xfs_fsop_handlereq_t hreq;
-
- if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t)))
- return -EFAULT;
- return xfs_readlink_by_handle(filp, &hreq);
- }
+ case XFS_IOC_PATH_TO_FSHANDLE:
+ return xfs_ioc_find_handle(cmd, arg);
+ case XFS_IOC_OPEN_BY_HANDLE:
+ return xfs_ioc_open_by_handle(filp, arg);
+ case XFS_IOC_READLINK_BY_HANDLE:
+ return xfs_ioc_readlink_by_handle(filp, arg);
case XFS_IOC_ATTRLIST_BY_HANDLE:
return xfs_attrlist_by_handle(filp, arg);
-
case XFS_IOC_ATTRMULTI_BY_HANDLE:
return xfs_attrmulti_by_handle(filp, arg);
--
2.53.0
next prev parent reply other threads:[~2026-07-29 13:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 13:02 xfs ioctl handler cleanups Christoph Hellwig
2026-07-29 13:03 ` [PATCH 01/16] xfs: remove an outdated comment above xfs_file_ioctl Christoph Hellwig
2026-07-29 13:03 ` [PATCH 02/16] xfs: rename xfs_ioc_swapext to xfs_swapext Christoph Hellwig
2026-07-29 13:03 ` [PATCH 03/16] xfs: rename xfs_ioctl_fs_counts to xfs_ioc_fs_counts Christoph Hellwig
2026-07-29 13:03 ` [PATCH 04/16] xfs: rename xfs_ioctl_getset_resblocks to xfs_ioc_getset_resblocks Christoph Hellwig
2026-07-29 13:03 ` [PATCH 05/16] xfs: split out the handler for XFS_IOC_DIOINFO Christoph Hellwig
2026-07-29 13:03 ` Christoph Hellwig [this message]
2026-07-29 13:03 ` [PATCH 07/16] xfs: split out the handler for XFS_IOC_SWAPEXT Christoph Hellwig
2026-07-29 13:03 ` [PATCH 08/16] xfs: split out the handlers for XFS_IOC_FSGROWFS* Christoph Hellwig
2026-07-29 13:03 ` [PATCH 09/16] xfs: split out the handler for XFS_IOC_GOINGDOWN Christoph Hellwig
2026-07-29 13:03 ` [PATCH 10/16] xfs: split out the handler for XFS_IOC_ERROR_INJECTION Christoph Hellwig
2026-07-29 13:03 ` [PATCH 11/16] xfs: split out the handler for XFS_IOC_FREE_EOFBLOCKS Christoph Hellwig
2026-07-29 13:03 ` [PATCH 12/16] xfs: split out the handlers for XFS_IOC_FSGROWFS_*_32 Christoph Hellwig
2026-07-29 13:03 ` [PATCH 13/16] xfs: cleanup XFS_IOC_GETVERSION_32 handling Christoph Hellwig
2026-07-29 13:03 ` [PATCH 14/16] xfs: split out the handlers for XFS_IOC_SWAPEXT_32 Christoph Hellwig
2026-07-29 13:03 ` [PATCH 15/16] xfs: split out the handlers for XFS_IOC_*_BY_HANDLE_32 Christoph Hellwig
2026-07-29 13:03 ` [PATCH 16/16] xfs: remove an extra cast in xfs_file_compat_ioctl Christoph Hellwig
2026-07-29 15:29 ` xfs ioctl handler cleanups Darrick J. Wong
-- strict thread matches above, loose matches on Subject: below --
2026-07-29 11:39 Christoph Hellwig
2026-07-29 11:39 ` [PATCH 06/16] xfs: split out the handlers for XFS_IOC_.*HANDLE 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=20260729130320.2282183-7-hch@lst.de \
--to=hch@lst.de \
--cc=cem@kernel.org \
--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