diff options
author | Arnd Bergmann <arnd@arndb.de> | 2009-11-13 20:28:05 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2009-12-10 16:55:37 -0500 |
commit | 637e8a60a7aaf4ef7d46cfdf83bcfac9cf6f0fbd (patch) | |
tree | 5d50aaa8bcdf0b5f9af5c24ff6adcdb9d482cd9c /fs/compat_ioctl.c | |
parent | 3695669cd4f5fb6d569fd4243312c1b4a05bd5ce (diff) |
usbdevfs: move compat_ioctl handling to devio.c
Half the compat_ioctl handling is in devio.c, the other
half is in fs/compat_ioctl.c. This moves everything into
one place for consistency.
As a positive side-effect, push down the BKL into the
ioctl methods.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oliver@neukum.org>
Cc: Alon Bar-Lev <alon.barlev@gmail.com>
Cc: David Vrabel <david.vrabel@csr.com>
Cc: linux-usb@vger.kernel.org
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r-- | fs/compat_ioctl.c | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 598763fd207f..278020d2449c 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -742,94 +742,6 @@ static int serial_struct_ioctl(unsigned fd, unsigned cmd, | |||
742 | return err; | 742 | return err; |
743 | } | 743 | } |
744 | 744 | ||
745 | struct usbdevfs_ctrltransfer32 { | ||
746 | u8 bRequestType; | ||
747 | u8 bRequest; | ||
748 | u16 wValue; | ||
749 | u16 wIndex; | ||
750 | u16 wLength; | ||
751 | u32 timeout; /* in milliseconds */ | ||
752 | compat_caddr_t data; | ||
753 | }; | ||
754 | |||
755 | #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32) | ||
756 | |||
757 | static int do_usbdevfs_control(unsigned int fd, unsigned int cmd, | ||
758 | struct usbdevfs_ctrltransfer32 __user *p32) | ||
759 | { | ||
760 | struct usbdevfs_ctrltransfer __user *p; | ||
761 | __u32 udata; | ||
762 | p = compat_alloc_user_space(sizeof(*p)); | ||
763 | if (copy_in_user(p, p32, (sizeof(*p32) - sizeof(compat_caddr_t))) || | ||
764 | get_user(udata, &p32->data) || | ||
765 | put_user(compat_ptr(udata), &p->data)) | ||
766 | return -EFAULT; | ||
767 | return sys_ioctl(fd, USBDEVFS_CONTROL, (unsigned long)p); | ||
768 | } | ||
769 | |||
770 | |||
771 | struct usbdevfs_bulktransfer32 { | ||
772 | compat_uint_t ep; | ||
773 | compat_uint_t len; | ||
774 | compat_uint_t timeout; /* in milliseconds */ | ||
775 | compat_caddr_t data; | ||
776 | }; | ||
777 | |||
778 | #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32) | ||
779 | |||
780 | static int do_usbdevfs_bulk(unsigned int fd, unsigned int cmd, | ||
781 | struct usbdevfs_bulktransfer32 __user *p32) | ||
782 | { | ||
783 | struct usbdevfs_bulktransfer __user *p; | ||
784 | compat_uint_t n; | ||
785 | compat_caddr_t addr; | ||
786 | |||
787 | p = compat_alloc_user_space(sizeof(*p)); | ||
788 | |||
789 | if (get_user(n, &p32->ep) || put_user(n, &p->ep) || | ||
790 | get_user(n, &p32->len) || put_user(n, &p->len) || | ||
791 | get_user(n, &p32->timeout) || put_user(n, &p->timeout) || | ||
792 | get_user(addr, &p32->data) || put_user(compat_ptr(addr), &p->data)) | ||
793 | return -EFAULT; | ||
794 | |||
795 | return sys_ioctl(fd, USBDEVFS_BULK, (unsigned long)p); | ||
796 | } | ||
797 | |||
798 | |||
799 | /* | ||
800 | * USBDEVFS_SUBMITURB, USBDEVFS_REAPURB and USBDEVFS_REAPURBNDELAY | ||
801 | * are handled in usbdevfs core. -Christopher Li | ||
802 | */ | ||
803 | |||
804 | struct usbdevfs_disconnectsignal32 { | ||
805 | compat_int_t signr; | ||
806 | compat_caddr_t context; | ||
807 | }; | ||
808 | |||
809 | #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32) | ||
810 | |||
811 | static int do_usbdevfs_discsignal(unsigned int fd, unsigned int cmd, | ||
812 | struct usbdevfs_disconnectsignal32 __user *udis) | ||
813 | { | ||
814 | struct usbdevfs_disconnectsignal kdis; | ||
815 | mm_segment_t old_fs; | ||
816 | u32 uctx; | ||
817 | int err; | ||
818 | |||
819 | if (get_user(kdis.signr, &udis->signr) || | ||
820 | __get_user(uctx, &udis->context)) | ||
821 | return -EFAULT; | ||
822 | |||
823 | kdis.context = compat_ptr(uctx); | ||
824 | |||
825 | old_fs = get_fs(); | ||
826 | set_fs(KERNEL_DS); | ||
827 | err = sys_ioctl(fd, USBDEVFS_DISCSIGNAL, (unsigned long) &kdis); | ||
828 | set_fs(old_fs); | ||
829 | |||
830 | return err; | ||
831 | } | ||
832 | |||
833 | /* | 745 | /* |
834 | * I2C layer ioctls | 746 | * I2C layer ioctls |
835 | */ | 747 | */ |
@@ -1471,21 +1383,6 @@ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) | |||
1471 | COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) | 1383 | COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) |
1472 | COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) | 1384 | COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) |
1473 | COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) | 1385 | COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) |
1474 | /* USB */ | ||
1475 | COMPATIBLE_IOCTL(USBDEVFS_RESETEP) | ||
1476 | COMPATIBLE_IOCTL(USBDEVFS_SETINTERFACE) | ||
1477 | COMPATIBLE_IOCTL(USBDEVFS_SETCONFIGURATION) | ||
1478 | COMPATIBLE_IOCTL(USBDEVFS_GETDRIVER) | ||
1479 | COMPATIBLE_IOCTL(USBDEVFS_DISCARDURB) | ||
1480 | COMPATIBLE_IOCTL(USBDEVFS_CLAIMINTERFACE) | ||
1481 | COMPATIBLE_IOCTL(USBDEVFS_RELEASEINTERFACE) | ||
1482 | COMPATIBLE_IOCTL(USBDEVFS_CONNECTINFO) | ||
1483 | COMPATIBLE_IOCTL(USBDEVFS_HUB_PORTINFO) | ||
1484 | COMPATIBLE_IOCTL(USBDEVFS_RESET) | ||
1485 | COMPATIBLE_IOCTL(USBDEVFS_SUBMITURB32) | ||
1486 | COMPATIBLE_IOCTL(USBDEVFS_REAPURB32) | ||
1487 | COMPATIBLE_IOCTL(USBDEVFS_REAPURBNDELAY32) | ||
1488 | COMPATIBLE_IOCTL(USBDEVFS_CLEAR_HALT) | ||
1489 | /* NBD */ | 1386 | /* NBD */ |
1490 | COMPATIBLE_IOCTL(NBD_DO_IT) | 1387 | COMPATIBLE_IOCTL(NBD_DO_IT) |
1491 | COMPATIBLE_IOCTL(NBD_CLEAR_SOCK) | 1388 | COMPATIBLE_IOCTL(NBD_CLEAR_SOCK) |
@@ -1604,8 +1501,6 @@ COMPATIBLE_IOCTL(TIOCSLTC) | |||
1604 | COMPATIBLE_IOCTL(TIOCSTART) | 1501 | COMPATIBLE_IOCTL(TIOCSTART) |
1605 | COMPATIBLE_IOCTL(TIOCSTOP) | 1502 | COMPATIBLE_IOCTL(TIOCSTOP) |
1606 | #endif | 1503 | #endif |
1607 | /* Usbdevfs */ | ||
1608 | COMPATIBLE_IOCTL(USBDEVFS_IOCTL32) | ||
1609 | 1504 | ||
1610 | /* fat 'r' ioctls. These are handled by fat with ->compat_ioctl, | 1505 | /* fat 'r' ioctls. These are handled by fat with ->compat_ioctl, |
1611 | but we don't want warnings on other file systems. So declare | 1506 | but we don't want warnings on other file systems. So declare |
@@ -1677,13 +1572,6 @@ static long do_ioctl_trans(int fd, unsigned int cmd, | |||
1677 | case TIOCGSERIAL: | 1572 | case TIOCGSERIAL: |
1678 | case TIOCSSERIAL: | 1573 | case TIOCSSERIAL: |
1679 | return serial_struct_ioctl(fd, cmd, argp); | 1574 | return serial_struct_ioctl(fd, cmd, argp); |
1680 | /* Usbdevfs */ | ||
1681 | case USBDEVFS_CONTROL32: | ||
1682 | return do_usbdevfs_control(fd, cmd, argp); | ||
1683 | case USBDEVFS_BULK32: | ||
1684 | return do_usbdevfs_bulk(fd, cmd, argp); | ||
1685 | case USBDEVFS_DISCSIGNAL32: | ||
1686 | return do_usbdevfs_discsignal(fd, cmd, argp); | ||
1687 | /* i2c */ | 1575 | /* i2c */ |
1688 | case I2C_FUNCS: | 1576 | case I2C_FUNCS: |
1689 | return w_long(fd, cmd, argp); | 1577 | return w_long(fd, cmd, argp); |