aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorsandeen@sandeen.net <sandeen@sandeen.net>2008-11-25 22:20:17 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-12-02 01:18:21 -0500
commite5d412f17846b0aea9e5250926f994ab2e4e1006 (patch)
tree5d68f5076b24994edeac89b5f8e3822586d13795 /fs/xfs
parent710d62aaaf17c841b8bdbc7a775f8910a7160248 (diff)
[XFS] Reorder xfs_ioctl32.c for some tidiness
Put things in IMHO a more readable order, now that it's all done; add some comments. 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')
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.c78
1 files changed, 36 insertions, 42 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
index 9234360910f2..b34b3d8892a2 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -16,11 +16,7 @@
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18#include <linux/compat.h> 18#include <linux/compat.h>
19#include <linux/init.h>
20#include <linux/ioctl.h> 19#include <linux/ioctl.h>
21#include <linux/syscalls.h>
22#include <linux/types.h>
23#include <linux/fs.h>
24#include <asm/uaccess.h> 20#include <asm/uaccess.h>
25#include "xfs.h" 21#include "xfs.h"
26#include "xfs_fs.h" 22#include "xfs_fs.h"
@@ -131,7 +127,7 @@ xfs_inumbers_fmt_compat(
131 127
132#else 128#else
133#define xfs_inumbers_fmt_compat xfs_inumbers_fmt 129#define xfs_inumbers_fmt_compat xfs_inumbers_fmt
134#endif 130#endif /* BROKEN_X86_ALIGNMENT */
135 131
136STATIC int 132STATIC int
137xfs_ioctl32_bstime_copyin( 133xfs_ioctl32_bstime_copyin(
@@ -617,6 +613,7 @@ xfs_compat_ioctl(
617 613
618 xfs_itrace_entry(XFS_I(inode)); 614 xfs_itrace_entry(XFS_I(inode));
619 switch (cmd) { 615 switch (cmd) {
616 /* No size or alignment issues on any arch */
620 case XFS_IOC_DIOINFO: 617 case XFS_IOC_DIOINFO:
621 case XFS_IOC_FSGEOMETRY: 618 case XFS_IOC_FSGEOMETRY:
622 case XFS_IOC_FSGETXATTR: 619 case XFS_IOC_FSGETXATTR:
@@ -629,35 +626,28 @@ xfs_compat_ioctl(
629 case XFS_IOC_FSCOUNTS: 626 case XFS_IOC_FSCOUNTS:
630 case XFS_IOC_SET_RESBLKS: 627 case XFS_IOC_SET_RESBLKS:
631 case XFS_IOC_GET_RESBLKS: 628 case XFS_IOC_GET_RESBLKS:
632 case XFS_IOC_FSGROWFSDATA:
633 case XFS_IOC_FSGROWFSLOG: 629 case XFS_IOC_FSGROWFSLOG:
634 case XFS_IOC_FSGROWFSRT:
635 case XFS_IOC_FREEZE: 630 case XFS_IOC_FREEZE:
636 case XFS_IOC_THAW: 631 case XFS_IOC_THAW:
637 case XFS_IOC_GOINGDOWN: 632 case XFS_IOC_GOINGDOWN:
638 case XFS_IOC_ERROR_INJECTION: 633 case XFS_IOC_ERROR_INJECTION:
639 case XFS_IOC_ERROR_CLEARALL: 634 case XFS_IOC_ERROR_CLEARALL:
640 break; 635 return xfs_ioctl(ip, filp, ioflags, cmd, arg);
641 636#ifndef BROKEN_X86_ALIGNMENT
642 case XFS_IOC_GETXFLAGS_32: 637 /* These are handled fine if no alignment issues */
643 case XFS_IOC_SETXFLAGS_32: 638 case XFS_IOC_ALLOCSP:
644 case XFS_IOC_GETVERSION_32: 639 case XFS_IOC_FREESP:
645 cmd = _NATIVE_IOC(cmd, long); 640 case XFS_IOC_RESVSP:
646 break; 641 case XFS_IOC_UNRESVSP:
647 case XFS_IOC_SWAPEXT: { 642 case XFS_IOC_ALLOCSP64:
648 struct xfs_swapext sxp; 643 case XFS_IOC_FREESP64:
649 struct compat_xfs_swapext __user *sxu = arg; 644 case XFS_IOC_RESVSP64:
650 645 case XFS_IOC_UNRESVSP64:
651 /* Bulk copy in up to the sx_stat field, then grab bstat */ 646 case XFS_IOC_FSGEOMETRY_V1:
652 if (copy_from_user(&sxp, sxu, 647 case XFS_IOC_FSGROWFSDATA:
653 offsetof(xfs_swapext_t, sx_stat)) || 648 case XFS_IOC_FSGROWFSRT:
654 xfs_ioctl32_bstat_copyin(&sxp.sx_stat, &sxu->sx_stat)) 649 return xfs_ioctl(ip, filp, ioflags, cmd, arg);
655 return -XFS_ERROR(EFAULT); 650#else
656 error = xfs_swapext(&sxp);
657 return -error;
658 }
659#ifdef BROKEN_X86_ALIGNMENT
660 /* xfs_flock_t has wrong u32 vs u64 alignment */
661 case XFS_IOC_ALLOCSP_32: 651 case XFS_IOC_ALLOCSP_32:
662 case XFS_IOC_FREESP_32: 652 case XFS_IOC_FREESP_32:
663 case XFS_IOC_ALLOCSP64_32: 653 case XFS_IOC_ALLOCSP64_32:
@@ -691,18 +681,25 @@ xfs_compat_ioctl(
691 error = xfs_growfs_rt(mp, &in); 681 error = xfs_growfs_rt(mp, &in);
692 return -error; 682 return -error;
693 } 683 }
694#else /* These are handled fine if no alignment issues */
695 case XFS_IOC_ALLOCSP:
696 case XFS_IOC_FREESP:
697 case XFS_IOC_RESVSP:
698 case XFS_IOC_UNRESVSP:
699 case XFS_IOC_ALLOCSP64:
700 case XFS_IOC_FREESP64:
701 case XFS_IOC_RESVSP64:
702 case XFS_IOC_UNRESVSP64:
703 case XFS_IOC_FSGEOMETRY_V1:
704 break;
705#endif 684#endif
685 /* long changes size, but xfs only copiese out 32 bits */
686 case XFS_IOC_GETXFLAGS_32:
687 case XFS_IOC_SETXFLAGS_32:
688 case XFS_IOC_GETVERSION_32:
689 cmd = _NATIVE_IOC(cmd, long);
690 return xfs_ioctl(ip, filp, ioflags, cmd, arg);
691 case XFS_IOC_SWAPEXT: {
692 struct xfs_swapext sxp;
693 struct compat_xfs_swapext __user *sxu = arg;
694
695 /* Bulk copy in up to the sx_stat field, then copy bstat */
696 if (copy_from_user(&sxp, sxu,
697 offsetof(struct xfs_swapext, sx_stat)) ||
698 xfs_ioctl32_bstat_copyin(&sxp.sx_stat, &sxu->sx_stat))
699 return -XFS_ERROR(EFAULT);
700 error = xfs_swapext(&sxp);
701 return -error;
702 }
706 case XFS_IOC_FSBULKSTAT_32: 703 case XFS_IOC_FSBULKSTAT_32:
707 case XFS_IOC_FSBULKSTAT_SINGLE_32: 704 case XFS_IOC_FSBULKSTAT_SINGLE_32:
708 case XFS_IOC_FSINUMBERS_32: 705 case XFS_IOC_FSINUMBERS_32:
@@ -740,9 +737,6 @@ xfs_compat_ioctl(
740 default: 737 default:
741 return -XFS_ERROR(ENOIOCTLCMD); 738 return -XFS_ERROR(ENOIOCTLCMD);
742 } 739 }
743
744 error = xfs_ioctl(ip, filp, ioflags, cmd, arg);
745 return error;
746} 740}
747 741
748long 742long