summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_ioctl32.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-07-02 09:39:43 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2019-07-02 09:40:06 -0700
commit677717fbd4b020404bf7cbaf4fd00c51f52abdaa (patch)
treedb48cf49d9d22b630b24dd1542dab09c58ee4e0e /fs/xfs/xfs_ioctl32.c
parent04b8fba2e1bf1d767af6579d5f9a25c480257d40 (diff)
xfs: refactor INUMBERS to use iwalk functions
Now that we have generic functions to walk inode records, refactor the INUMBERS implementation to use it. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_ioctl32.c')
-rw-r--r--fs/xfs/xfs_ioctl32.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index 6280c2de7b09..ff5c726c26be 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -81,22 +81,17 @@ xfs_compat_growfs_rt_copyin(
STATIC int
xfs_inumbers_fmt_compat(
- void __user *ubuffer,
- const struct xfs_inogrp *buffer,
- long count,
- long *written)
+ struct xfs_ibulk *breq,
+ const struct xfs_inogrp *igrp)
{
- compat_xfs_inogrp_t __user *p32 = ubuffer;
- long i;
+ struct compat_xfs_inogrp __user *p32 = breq->ubuffer;
- for (i = 0; i < count; i++) {
- if (put_user(buffer[i].xi_startino, &p32[i].xi_startino) ||
- put_user(buffer[i].xi_alloccount, &p32[i].xi_alloccount) ||
- put_user(buffer[i].xi_allocmask, &p32[i].xi_allocmask))
- return -EFAULT;
- }
- *written = count * sizeof(*p32);
- return 0;
+ if (put_user(igrp->xi_startino, &p32->xi_startino) ||
+ put_user(igrp->xi_alloccount, &p32->xi_alloccount) ||
+ put_user(igrp->xi_allocmask, &p32->xi_allocmask))
+ return -EFAULT;
+
+ return xfs_ibulk_advance(breq, sizeof(struct compat_xfs_inogrp));
}
#else
@@ -222,7 +217,7 @@ xfs_compat_ioc_bulkstat(
* to userpace memory via bulkreq.ubuffer. Normally the compat
* functions and structure size are the correct ones to use ...
*/
- inumbers_fmt_pf inumbers_func = xfs_inumbers_fmt_compat;
+ inumbers_fmt_pf inumbers_func = xfs_inumbers_fmt_compat;
bulkstat_one_fmt_pf bs_one_func = xfs_bulkstat_one_fmt_compat;
#ifdef CONFIG_X86_X32
@@ -284,13 +279,9 @@ xfs_compat_ioc_bulkstat(
* in filesystem".
*/
if (cmd == XFS_IOC_FSINUMBERS_32) {
- int count = breq.icount;
-
- breq.startino = lastino;
- error = xfs_inumbers(mp, &breq.startino, &count,
- bulkreq.ubuffer, inumbers_func);
- breq.ocount = count;
- lastino = breq.startino;
+ breq.startino = lastino ? lastino + 1 : 0;
+ error = xfs_inumbers(&breq, inumbers_func);
+ lastino = breq.startino - 1;
} else if (cmd == XFS_IOC_FSBULKSTAT_SINGLE_32) {
breq.startino = lastino;
breq.icount = 1;