aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorsandeen@sandeen.net <sandeen@sandeen.net>2008-11-25 22:20:10 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-12-02 01:15:09 -0500
commit471d59103167c84f17b9bcfee22ed10b44ff206e (patch)
treecca786d598f2d4c12f50ea6d8fbc6bdb057eeec1 /fs
parente94fc4a43e5c39f689e83caf6d2f0939081f5e6b (diff)
[XFS] Add compat handlers for data & rt growfs ioctls
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> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.c40
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.h14
2 files changed, 54 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
index 132f3dd2c7e8..d1ac5d5c009b 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -44,6 +44,8 @@
44#include "xfs_dfrag.h" 44#include "xfs_dfrag.h"
45#include "xfs_vnodeops.h" 45#include "xfs_vnodeops.h"
46#include "xfs_fsops.h" 46#include "xfs_fsops.h"
47#include "xfs_alloc.h"
48#include "xfs_rtalloc.h"
47#include "xfs_ioctl.h" 49#include "xfs_ioctl.h"
48#include "xfs_ioctl32.h" 50#include "xfs_ioctl32.h"
49 51
@@ -85,6 +87,28 @@ xfs_compat_ioc_fsgeometry_v1(
85} 87}
86 88
87STATIC int 89STATIC int
90xfs_compat_growfs_data_copyin(
91 struct xfs_growfs_data *in,
92 compat_xfs_growfs_data_t __user *arg32)
93{
94 if (get_user(in->newblocks, &arg32->newblocks) ||
95 get_user(in->imaxpct, &arg32->imaxpct))
96 return -XFS_ERROR(EFAULT);
97 return 0;
98}
99
100STATIC int
101xfs_compat_growfs_rt_copyin(
102 struct xfs_growfs_rt *in,
103 compat_xfs_growfs_rt_t __user *arg32)
104{
105 if (get_user(in->newblocks, &arg32->newblocks) ||
106 get_user(in->extsize, &arg32->extsize))
107 return -XFS_ERROR(EFAULT);
108 return 0;
109}
110
111STATIC int
88xfs_inumbers_fmt_compat( 112xfs_inumbers_fmt_compat(
89 void __user *ubuffer, 113 void __user *ubuffer,
90 const xfs_inogrp_t *buffer, 114 const xfs_inogrp_t *buffer,
@@ -367,6 +391,22 @@ xfs_compat_ioctl(
367 } 391 }
368 case XFS_IOC_FSGEOMETRY_V1_32: 392 case XFS_IOC_FSGEOMETRY_V1_32:
369 return xfs_compat_ioc_fsgeometry_v1(mp, arg); 393 return xfs_compat_ioc_fsgeometry_v1(mp, arg);
394 case XFS_IOC_FSGROWFSDATA_32: {
395 struct xfs_growfs_data in;
396
397 if (xfs_compat_growfs_data_copyin(&in, arg))
398 return -XFS_ERROR(EFAULT);
399 error = xfs_growfs_data(mp, &in);
400 return -error;
401 }
402 case XFS_IOC_FSGROWFSRT_32: {
403 struct xfs_growfs_rt in;
404
405 if (xfs_compat_growfs_rt_copyin(&in, arg))
406 return -XFS_ERROR(EFAULT);
407 error = xfs_growfs_rt(mp, &in);
408 return -error;
409 }
370#else /* These are handled fine if no alignment issues */ 410#else /* These are handled fine if no alignment issues */
371 case XFS_IOC_ALLOCSP: 411 case XFS_IOC_ALLOCSP:
372 case XFS_IOC_FREESP: 412 case XFS_IOC_FREESP:
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.h b/fs/xfs/linux-2.6/xfs_ioctl32.h
index bf08ab12a6f8..8b2a12a8e96f 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.h
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.h
@@ -177,6 +177,20 @@ typedef struct compat_xfs_inogrp {
177 __u64 xi_allocmask; /* mask of allocated inodes */ 177 __u64 xi_allocmask; /* mask of allocated inodes */
178} __attribute__((packed)) compat_xfs_inogrp_t; 178} __attribute__((packed)) compat_xfs_inogrp_t;
179 179
180/* These growfs input structures have padding on the end, so must translate */
181typedef struct compat_xfs_growfs_data {
182 __u64 newblocks; /* new data subvol size, fsblocks */
183 __u32 imaxpct; /* new inode space percentage limit */
184} __attribute__((packed)) compat_xfs_growfs_data_t;
185
186typedef struct compat_xfs_growfs_rt {
187 __u64 newblocks; /* new realtime size, fsblocks */
188 __u32 extsize; /* new realtime extent size, fsblocks */
189} __attribute__((packed)) compat_xfs_growfs_rt_t;
190
191#define XFS_IOC_FSGROWFSDATA_32 _IOW('X', 110, struct compat_xfs_growfs_data)
192#define XFS_IOC_FSGROWFSRT_32 _IOW('X', 112, struct compat_xfs_growfs_rt)
193
180#endif /* BROKEN_X86_ALIGNMENT */ 194#endif /* BROKEN_X86_ALIGNMENT */
181 195
182#endif /* __XFS_IOCTL32_H__ */ 196#endif /* __XFS_IOCTL32_H__ */