From: sandeen@sandeen.net
To: xfs@oss.sgi.com
Subject: [patch 05/12] Add compat handlers for data & rt growfs ioctls
Date: Tue, 25 Nov 2008 21:20:10 -0600 [thread overview]
Message-ID: <20081126032028.057811191@sandeen.net> (raw)
In-Reply-To: 20081126032005.639750968@sandeen.net
[-- Attachment #1: compat_ioctl_growfs --]
[-- Type: text/plain, Size: 3322 bytes --]
The args for XFS_IOC_FSGROWFSDATA and XFS_IOC_FSGROWFSRTA
have padding on the end on intel, so add arg copyin functions,
and then just call the growfs ioctl helpers.
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
--
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl32.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_ioctl32.c 2008-11-24 17:00:25.416001918 -0600
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl32.c 2008-11-24 17:09:28.311001451 -0600
@@ -45,6 +45,8 @@
#include "xfs_dfrag.h"
#include "xfs_vnodeops.h"
#include "xfs_fsops.h"
+#include "xfs_alloc.h"
+#include "xfs_rtalloc.h"
#include "xfs_ioctl.h"
#include "xfs_ioctl32.h"
@@ -86,6 +88,28 @@ xfs_compat_ioc_fsgeometry_v1(
}
STATIC int
+xfs_compat_growfs_data_copyin(
+ struct xfs_growfs_data *in,
+ compat_xfs_growfs_data_t __user *arg32)
+{
+ if (get_user(in->newblocks, &arg32->newblocks) ||
+ get_user(in->imaxpct, &arg32->imaxpct))
+ return -XFS_ERROR(EFAULT);
+ return 0;
+}
+
+STATIC int
+xfs_compat_growfs_rt_copyin(
+ struct xfs_growfs_rt *in,
+ compat_xfs_growfs_rt_t __user *arg32)
+{
+ if (get_user(in->newblocks, &arg32->newblocks) ||
+ get_user(in->extsize, &arg32->extsize))
+ return -XFS_ERROR(EFAULT);
+ return 0;
+}
+
+STATIC int
xfs_inumbers_fmt_compat(
void __user *ubuffer,
const xfs_inogrp_t *buffer,
@@ -368,6 +392,22 @@ xfs_compat_ioctl(
}
case XFS_IOC_FSGEOMETRY_V1_32:
return xfs_compat_ioc_fsgeometry_v1(mp, arg);
+ case XFS_IOC_FSGROWFSDATA_32: {
+ struct xfs_growfs_data in;
+
+ if (xfs_compat_growfs_data_copyin(&in, arg))
+ return -XFS_ERROR(EFAULT);
+ error = xfs_growfs_data(mp, &in);
+ return -error;
+ }
+ case XFS_IOC_FSGROWFSRT_32: {
+ struct xfs_growfs_rt in;
+
+ if (xfs_compat_growfs_rt_copyin(&in, arg))
+ return -XFS_ERROR(EFAULT);
+ error = xfs_growfs_rt(mp, &in);
+ return -error;
+ }
#else /* These are handled fine if no alignment issues */
case XFS_IOC_ALLOCSP:
case XFS_IOC_FREESP:
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl32.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_ioctl32.h 2008-11-24 17:00:25.432471112 -0600
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl32.h 2008-11-24 17:09:26.662001447 -0600
@@ -177,6 +177,20 @@ typedef struct compat_xfs_inogrp {
__u64 xi_allocmask; /* mask of allocated inodes */
} __attribute__((packed)) compat_xfs_inogrp_t;
+/* These growfs input structures have padding on the end, so must translate */
+typedef struct compat_xfs_growfs_data {
+ __u64 newblocks; /* new data subvol size, fsblocks */
+ __u32 imaxpct; /* new inode space percentage limit */
+} __attribute__((packed)) compat_xfs_growfs_data_t;
+
+typedef struct compat_xfs_growfs_rt {
+ __u64 newblocks; /* new realtime size, fsblocks */
+ __u32 extsize; /* new realtime extent size, fsblocks */
+} __attribute__((packed)) compat_xfs_growfs_rt_t;
+
+#define XFS_IOC_FSGROWFSDATA_32 _IOW('X', 110, struct compat_xfs_growfs_data)
+#define XFS_IOC_FSGROWFSRT_32 _IOW('X', 112, struct compat_xfs_growfs_rt)
+
#endif /* BROKEN_X86_ALIGNMENT */
#endif /* __XFS_IOCTL32_H__ */
--
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2008-11-26 3:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-26 3:20 [patch 00/12] [PATCH V2]: compat ioctl fixes/cleanups/additions sandeen
2008-11-26 3:20 ` [patch 01/12] Move copy_from_user calls out of ioctl helpers into ioctl switch sandeen
2008-11-26 3:20 ` [patch 02/12] Move compat ioctl structs & numbers into xfs_ioctl32.h sandeen
2008-11-26 3:20 ` [patch 03/12] Clean up some existing compat ioctl calls sandeen
2008-11-26 3:20 ` [patch 04/12] Add compat handlers for swapext ioctl sandeen
2008-11-26 3:20 ` sandeen [this message]
2008-11-26 3:20 ` [patch 06/12] Make the bulkstat_one compat ioctl handling more sane sandeen
2008-11-26 3:20 ` [patch 07/12] Fix xfs_bulkstat_one size checks & error handling sandeen
2008-11-26 3:20 ` [patch 08/12] Fix compat XFS_IOC_FSBULKSTAT_SINGLE ioctl sandeen
2008-11-26 3:20 ` [patch 09/12] Hook up compat XFS_IOC_ATTRLIST_BY_HANDLE ioctl handler sandeen
2008-11-26 3:20 ` [patch 10/12] Hook up compat XFS_IOC_ATTRMULTI_BY_HANDLE " sandeen
2008-11-26 3:20 ` [patch 11/12] Hook up compat XFS_IOC_FSSETDM_BY_HANDLE " sandeen
2008-11-26 3:20 ` [patch 12/12] Reorder xfs_ioctl32.c for some tidiness sandeen
2008-11-26 14:40 ` [patch 00/12] [PATCH V2]: compat ioctl fixes/cleanups/additions Eric Sandeen
2008-11-26 15:07 ` Eric Sandeen
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=20081126032028.057811191@sandeen.net \
--to=sandeen@sandeen.net \
--cc=xfs@oss.sgi.com \
/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