diff options
author | sandeen@sandeen.net <sandeen@sandeen.net> | 2008-11-25 22:20:11 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-12-02 01:15:36 -0500 |
commit | 2ee4fa5cb716eba104a4ef8efe159e1007a2aef6 (patch) | |
tree | 943c9966c8daa913dff42216bcdc1cc4c1c835da /fs/xfs/linux-2.6 | |
parent | 471d59103167c84f17b9bcfee22ed10b44ff206e (diff) |
[XFS] Make the bulkstat_one compat ioctl handling more sane
Currently the compat formatter was handled by passing
in "private_data" for the xfs_bulkstat_one formatter,
which was really just another formatter... IMHO this
got confusing.
Instead, just make a new xfs_bulkstat_one_compat
formatter for xfs_bulkstat, and call it via a wrapper.
Also, don't translate the ioctl nrs into their native
counterparts, that just clouds the issue; we're in a
compat handler anyway, just switch on the 32-bit cmds.
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/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl32.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index d1ac5d5c009b..a97022f2d9b0 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -223,14 +223,30 @@ xfs_bulkstat_one_fmt_compat( | |||
223 | return sizeof(*p32); | 223 | return sizeof(*p32); |
224 | } | 224 | } |
225 | 225 | ||
226 | STATIC int | ||
227 | xfs_bulkstat_one_compat( | ||
228 | xfs_mount_t *mp, /* mount point for filesystem */ | ||
229 | xfs_ino_t ino, /* inode number to get data for */ | ||
230 | void __user *buffer, /* buffer to place output in */ | ||
231 | int ubsize, /* size of buffer */ | ||
232 | void *private_data, /* my private data */ | ||
233 | xfs_daddr_t bno, /* starting bno of inode cluster */ | ||
234 | int *ubused, /* bytes used by me */ | ||
235 | void *dibuff, /* on-disk inode buffer */ | ||
236 | int *stat) /* BULKSTAT_RV_... */ | ||
237 | { | ||
238 | return xfs_bulkstat_one_int(mp, ino, buffer, ubsize, | ||
239 | xfs_bulkstat_one_fmt_compat, bno, | ||
240 | ubused, dibuff, stat); | ||
241 | } | ||
242 | |||
226 | /* copied from xfs_ioctl.c */ | 243 | /* copied from xfs_ioctl.c */ |
227 | STATIC int | 244 | STATIC int |
228 | xfs_ioc_bulkstat_compat( | 245 | xfs_compat_ioc_bulkstat( |
229 | xfs_mount_t *mp, | 246 | xfs_mount_t *mp, |
230 | unsigned int cmd, | 247 | unsigned int cmd, |
231 | void __user *arg) | 248 | compat_xfs_fsop_bulkreq_t __user *p32) |
232 | { | 249 | { |
233 | compat_xfs_fsop_bulkreq_t __user *p32 = (void __user *)arg; | ||
234 | u32 addr; | 250 | u32 addr; |
235 | xfs_fsop_bulkreq_t bulkreq; | 251 | xfs_fsop_bulkreq_t bulkreq; |
236 | int count; /* # of records returned */ | 252 | int count; /* # of records returned */ |
@@ -267,14 +283,12 @@ xfs_ioc_bulkstat_compat( | |||
267 | if (bulkreq.ubuffer == NULL) | 283 | if (bulkreq.ubuffer == NULL) |
268 | return -XFS_ERROR(EINVAL); | 284 | return -XFS_ERROR(EINVAL); |
269 | 285 | ||
270 | if (cmd == XFS_IOC_FSINUMBERS) | 286 | if (cmd == XFS_IOC_FSINUMBERS_32) |
271 | error = xfs_inumbers(mp, &inlast, &count, | 287 | error = xfs_inumbers(mp, &inlast, &count, |
272 | bulkreq.ubuffer, xfs_inumbers_fmt_compat); | 288 | bulkreq.ubuffer, xfs_inumbers_fmt_compat); |
273 | else { | 289 | else { |
274 | /* declare a var to get a warning in case the type changes */ | ||
275 | bulkstat_one_fmt_pf formatter = xfs_bulkstat_one_fmt_compat; | ||
276 | error = xfs_bulkstat(mp, &inlast, &count, | 290 | error = xfs_bulkstat(mp, &inlast, &count, |
277 | xfs_bulkstat_one, formatter, | 291 | xfs_bulkstat_one_compat, NULL, |
278 | sizeof(compat_xfs_bstat_t), bulkreq.ubuffer, | 292 | sizeof(compat_xfs_bstat_t), bulkreq.ubuffer, |
279 | BULKSTAT_FG_QUICK, &done); | 293 | BULKSTAT_FG_QUICK, &done); |
280 | } | 294 | } |
@@ -422,9 +436,7 @@ xfs_compat_ioctl( | |||
422 | case XFS_IOC_FSBULKSTAT_32: | 436 | case XFS_IOC_FSBULKSTAT_32: |
423 | case XFS_IOC_FSBULKSTAT_SINGLE_32: | 437 | case XFS_IOC_FSBULKSTAT_SINGLE_32: |
424 | case XFS_IOC_FSINUMBERS_32: | 438 | case XFS_IOC_FSINUMBERS_32: |
425 | cmd = _NATIVE_IOC(cmd, struct xfs_fsop_bulkreq); | 439 | return xfs_compat_ioc_bulkstat(mp, cmd, arg); |
426 | return xfs_ioc_bulkstat_compat(XFS_I(inode)->i_mount, | ||
427 | cmd, (void __user*)arg); | ||
428 | case XFS_IOC_FD_TO_HANDLE_32: | 440 | case XFS_IOC_FD_TO_HANDLE_32: |
429 | case XFS_IOC_PATH_TO_HANDLE_32: | 441 | case XFS_IOC_PATH_TO_HANDLE_32: |
430 | case XFS_IOC_PATH_TO_FSHANDLE_32: { | 442 | case XFS_IOC_PATH_TO_FSHANDLE_32: { |