diff options
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r-- | fs/compat_ioctl.c | 671 |
1 files changed, 0 insertions, 671 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 37310b0e8107..b9e3357bcc2e 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/if.h> | 21 | #include <linux/if.h> |
22 | #include <linux/if_bridge.h> | 22 | #include <linux/if_bridge.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/hdreg.h> | ||
25 | #include <linux/raid/md.h> | 24 | #include <linux/raid/md.h> |
26 | #include <linux/kd.h> | 25 | #include <linux/kd.h> |
27 | #include <linux/dirent.h> | 26 | #include <linux/dirent.h> |
@@ -33,12 +32,10 @@ | |||
33 | #include <linux/vt.h> | 32 | #include <linux/vt.h> |
34 | #include <linux/fs.h> | 33 | #include <linux/fs.h> |
35 | #include <linux/file.h> | 34 | #include <linux/file.h> |
36 | #include <linux/fd.h> | ||
37 | #include <linux/ppp_defs.h> | 35 | #include <linux/ppp_defs.h> |
38 | #include <linux/if_ppp.h> | 36 | #include <linux/if_ppp.h> |
39 | #include <linux/if_pppox.h> | 37 | #include <linux/if_pppox.h> |
40 | #include <linux/mtio.h> | 38 | #include <linux/mtio.h> |
41 | #include <linux/cdrom.h> | ||
42 | #include <linux/auto_fs.h> | 39 | #include <linux/auto_fs.h> |
43 | #include <linux/auto_fs4.h> | 40 | #include <linux/auto_fs4.h> |
44 | #include <linux/tty.h> | 41 | #include <linux/tty.h> |
@@ -48,7 +45,6 @@ | |||
48 | #include <linux/netdevice.h> | 45 | #include <linux/netdevice.h> |
49 | #include <linux/raw.h> | 46 | #include <linux/raw.h> |
50 | #include <linux/smb_fs.h> | 47 | #include <linux/smb_fs.h> |
51 | #include <linux/blkpg.h> | ||
52 | #include <linux/blkdev.h> | 48 | #include <linux/blkdev.h> |
53 | #include <linux/elevator.h> | 49 | #include <linux/elevator.h> |
54 | #include <linux/rtc.h> | 50 | #include <linux/rtc.h> |
@@ -62,7 +58,6 @@ | |||
62 | #include <linux/i2c-dev.h> | 58 | #include <linux/i2c-dev.h> |
63 | #include <linux/wireless.h> | 59 | #include <linux/wireless.h> |
64 | #include <linux/atalk.h> | 60 | #include <linux/atalk.h> |
65 | #include <linux/blktrace_api.h> | ||
66 | #include <linux/loop.h> | 61 | #include <linux/loop.h> |
67 | 62 | ||
68 | #include <net/bluetooth/bluetooth.h> | 63 | #include <net/bluetooth/bluetooth.h> |
@@ -668,53 +663,6 @@ out: | |||
668 | #endif | 663 | #endif |
669 | 664 | ||
670 | #ifdef CONFIG_BLOCK | 665 | #ifdef CONFIG_BLOCK |
671 | struct hd_geometry32 { | ||
672 | unsigned char heads; | ||
673 | unsigned char sectors; | ||
674 | unsigned short cylinders; | ||
675 | u32 start; | ||
676 | }; | ||
677 | |||
678 | static int hdio_getgeo(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
679 | { | ||
680 | mm_segment_t old_fs = get_fs(); | ||
681 | struct hd_geometry geo; | ||
682 | struct hd_geometry32 __user *ugeo; | ||
683 | int err; | ||
684 | |||
685 | set_fs (KERNEL_DS); | ||
686 | err = sys_ioctl(fd, HDIO_GETGEO, (unsigned long)&geo); | ||
687 | set_fs (old_fs); | ||
688 | ugeo = compat_ptr(arg); | ||
689 | if (!err) { | ||
690 | err = copy_to_user (ugeo, &geo, 4); | ||
691 | err |= __put_user (geo.start, &ugeo->start); | ||
692 | if (err) | ||
693 | err = -EFAULT; | ||
694 | } | ||
695 | return err; | ||
696 | } | ||
697 | |||
698 | static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
699 | { | ||
700 | mm_segment_t old_fs = get_fs(); | ||
701 | unsigned long kval; | ||
702 | unsigned int __user *uvp; | ||
703 | int error; | ||
704 | |||
705 | set_fs(KERNEL_DS); | ||
706 | error = sys_ioctl(fd, cmd, (long)&kval); | ||
707 | set_fs(old_fs); | ||
708 | |||
709 | if(error == 0) { | ||
710 | uvp = compat_ptr(arg); | ||
711 | if(put_user(kval, uvp)) | ||
712 | error = -EFAULT; | ||
713 | } | ||
714 | return error; | ||
715 | } | ||
716 | |||
717 | |||
718 | typedef struct sg_io_hdr32 { | 666 | typedef struct sg_io_hdr32 { |
719 | compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ | 667 | compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ |
720 | compat_int_t dxfer_direction; /* [i] data transfer direction */ | 668 | compat_int_t dxfer_direction; /* [i] data transfer direction */ |
@@ -1089,108 +1037,6 @@ static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
1089 | return err ? -EFAULT: 0; | 1037 | return err ? -EFAULT: 0; |
1090 | } | 1038 | } |
1091 | 1039 | ||
1092 | struct cdrom_read_audio32 { | ||
1093 | union cdrom_addr addr; | ||
1094 | u8 addr_format; | ||
1095 | compat_int_t nframes; | ||
1096 | compat_caddr_t buf; | ||
1097 | }; | ||
1098 | |||
1099 | struct cdrom_generic_command32 { | ||
1100 | unsigned char cmd[CDROM_PACKET_SIZE]; | ||
1101 | compat_caddr_t buffer; | ||
1102 | compat_uint_t buflen; | ||
1103 | compat_int_t stat; | ||
1104 | compat_caddr_t sense; | ||
1105 | unsigned char data_direction; | ||
1106 | compat_int_t quiet; | ||
1107 | compat_int_t timeout; | ||
1108 | compat_caddr_t reserved[1]; | ||
1109 | }; | ||
1110 | |||
1111 | static int cdrom_do_read_audio(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1112 | { | ||
1113 | struct cdrom_read_audio __user *cdread_audio; | ||
1114 | struct cdrom_read_audio32 __user *cdread_audio32; | ||
1115 | __u32 data; | ||
1116 | void __user *datap; | ||
1117 | |||
1118 | cdread_audio = compat_alloc_user_space(sizeof(*cdread_audio)); | ||
1119 | cdread_audio32 = compat_ptr(arg); | ||
1120 | |||
1121 | if (copy_in_user(&cdread_audio->addr, | ||
1122 | &cdread_audio32->addr, | ||
1123 | (sizeof(*cdread_audio32) - | ||
1124 | sizeof(compat_caddr_t)))) | ||
1125 | return -EFAULT; | ||
1126 | |||
1127 | if (get_user(data, &cdread_audio32->buf)) | ||
1128 | return -EFAULT; | ||
1129 | datap = compat_ptr(data); | ||
1130 | if (put_user(datap, &cdread_audio->buf)) | ||
1131 | return -EFAULT; | ||
1132 | |||
1133 | return sys_ioctl(fd, cmd, (unsigned long) cdread_audio); | ||
1134 | } | ||
1135 | |||
1136 | static int cdrom_do_generic_command(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1137 | { | ||
1138 | struct cdrom_generic_command __user *cgc; | ||
1139 | struct cdrom_generic_command32 __user *cgc32; | ||
1140 | u32 data; | ||
1141 | unsigned char dir; | ||
1142 | int itmp; | ||
1143 | |||
1144 | cgc = compat_alloc_user_space(sizeof(*cgc)); | ||
1145 | cgc32 = compat_ptr(arg); | ||
1146 | |||
1147 | if (copy_in_user(&cgc->cmd, &cgc32->cmd, sizeof(cgc->cmd)) || | ||
1148 | get_user(data, &cgc32->buffer) || | ||
1149 | put_user(compat_ptr(data), &cgc->buffer) || | ||
1150 | copy_in_user(&cgc->buflen, &cgc32->buflen, | ||
1151 | (sizeof(unsigned int) + sizeof(int))) || | ||
1152 | get_user(data, &cgc32->sense) || | ||
1153 | put_user(compat_ptr(data), &cgc->sense) || | ||
1154 | get_user(dir, &cgc32->data_direction) || | ||
1155 | put_user(dir, &cgc->data_direction) || | ||
1156 | get_user(itmp, &cgc32->quiet) || | ||
1157 | put_user(itmp, &cgc->quiet) || | ||
1158 | get_user(itmp, &cgc32->timeout) || | ||
1159 | put_user(itmp, &cgc->timeout) || | ||
1160 | get_user(data, &cgc32->reserved[0]) || | ||
1161 | put_user(compat_ptr(data), &cgc->reserved[0])) | ||
1162 | return -EFAULT; | ||
1163 | |||
1164 | return sys_ioctl(fd, cmd, (unsigned long) cgc); | ||
1165 | } | ||
1166 | |||
1167 | static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1168 | { | ||
1169 | int err; | ||
1170 | |||
1171 | switch(cmd) { | ||
1172 | case CDROMREADAUDIO: | ||
1173 | err = cdrom_do_read_audio(fd, cmd, arg); | ||
1174 | break; | ||
1175 | |||
1176 | case CDROM_SEND_PACKET: | ||
1177 | err = cdrom_do_generic_command(fd, cmd, arg); | ||
1178 | break; | ||
1179 | |||
1180 | default: | ||
1181 | do { | ||
1182 | static int count; | ||
1183 | if (++count <= 20) | ||
1184 | printk("cdrom_ioctl: Unknown cmd fd(%d) " | ||
1185 | "cmd(%08x) arg(%08x)\n", | ||
1186 | (int)fd, (unsigned int)cmd, (unsigned int)arg); | ||
1187 | } while(0); | ||
1188 | err = -EINVAL; | ||
1189 | break; | ||
1190 | }; | ||
1191 | |||
1192 | return err; | ||
1193 | } | ||
1194 | #endif /* CONFIG_BLOCK */ | 1040 | #endif /* CONFIG_BLOCK */ |
1195 | 1041 | ||
1196 | #ifdef CONFIG_VT | 1042 | #ifdef CONFIG_VT |
@@ -1536,71 +1382,11 @@ ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
1536 | return -EINVAL; | 1382 | return -EINVAL; |
1537 | } | 1383 | } |
1538 | 1384 | ||
1539 | #ifdef CONFIG_BLOCK | ||
1540 | static int broken_blkgetsize(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1541 | { | ||
1542 | /* The mkswap binary hard codes it to Intel value :-((( */ | ||
1543 | return w_long(fd, BLKGETSIZE, arg); | ||
1544 | } | ||
1545 | |||
1546 | struct blkpg_ioctl_arg32 { | ||
1547 | compat_int_t op; | ||
1548 | compat_int_t flags; | ||
1549 | compat_int_t datalen; | ||
1550 | compat_caddr_t data; | ||
1551 | }; | ||
1552 | |||
1553 | static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1554 | { | ||
1555 | struct blkpg_ioctl_arg32 __user *ua32 = compat_ptr(arg); | ||
1556 | struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a)); | ||
1557 | compat_caddr_t udata; | ||
1558 | compat_int_t n; | ||
1559 | int err; | ||
1560 | |||
1561 | err = get_user(n, &ua32->op); | ||
1562 | err |= put_user(n, &a->op); | ||
1563 | err |= get_user(n, &ua32->flags); | ||
1564 | err |= put_user(n, &a->flags); | ||
1565 | err |= get_user(n, &ua32->datalen); | ||
1566 | err |= put_user(n, &a->datalen); | ||
1567 | err |= get_user(udata, &ua32->data); | ||
1568 | err |= put_user(compat_ptr(udata), &a->data); | ||
1569 | if (err) | ||
1570 | return err; | ||
1571 | |||
1572 | return sys_ioctl(fd, cmd, (unsigned long)a); | ||
1573 | } | ||
1574 | #endif | ||
1575 | |||
1576 | static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) | 1385 | static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) |
1577 | { | 1386 | { |
1578 | return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); | 1387 | return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); |
1579 | } | 1388 | } |
1580 | 1389 | ||
1581 | #ifdef CONFIG_BLOCK | ||
1582 | /* Fix sizeof(sizeof()) breakage */ | ||
1583 | #define BLKBSZGET_32 _IOR(0x12,112,int) | ||
1584 | #define BLKBSZSET_32 _IOW(0x12,113,int) | ||
1585 | #define BLKGETSIZE64_32 _IOR(0x12,114,int) | ||
1586 | |||
1587 | static int do_blkbszget(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1588 | { | ||
1589 | return sys_ioctl(fd, BLKBSZGET, (unsigned long)compat_ptr(arg)); | ||
1590 | } | ||
1591 | |||
1592 | static int do_blkbszset(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1593 | { | ||
1594 | return sys_ioctl(fd, BLKBSZSET, (unsigned long)compat_ptr(arg)); | ||
1595 | } | ||
1596 | |||
1597 | static int do_blkgetsize64(unsigned int fd, unsigned int cmd, | ||
1598 | unsigned long arg) | ||
1599 | { | ||
1600 | return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg)); | ||
1601 | } | ||
1602 | #endif | ||
1603 | |||
1604 | /* Bluetooth ioctls */ | 1390 | /* Bluetooth ioctls */ |
1605 | #define HCIUARTSETPROTO _IOW('U', 200, int) | 1391 | #define HCIUARTSETPROTO _IOW('U', 200, int) |
1606 | #define HCIUARTGETPROTO _IOR('U', 201, int) | 1392 | #define HCIUARTGETPROTO _IOR('U', 201, int) |
@@ -1620,333 +1406,6 @@ static int do_blkgetsize64(unsigned int fd, unsigned int cmd, | |||
1620 | #define HIDPGETCONNLIST _IOR('H', 210, int) | 1406 | #define HIDPGETCONNLIST _IOR('H', 210, int) |
1621 | #define HIDPGETCONNINFO _IOR('H', 211, int) | 1407 | #define HIDPGETCONNINFO _IOR('H', 211, int) |
1622 | 1408 | ||
1623 | #ifdef CONFIG_BLOCK | ||
1624 | struct floppy_struct32 { | ||
1625 | compat_uint_t size; | ||
1626 | compat_uint_t sect; | ||
1627 | compat_uint_t head; | ||
1628 | compat_uint_t track; | ||
1629 | compat_uint_t stretch; | ||
1630 | unsigned char gap; | ||
1631 | unsigned char rate; | ||
1632 | unsigned char spec1; | ||
1633 | unsigned char fmt_gap; | ||
1634 | const compat_caddr_t name; | ||
1635 | }; | ||
1636 | |||
1637 | struct floppy_drive_params32 { | ||
1638 | char cmos; | ||
1639 | compat_ulong_t max_dtr; | ||
1640 | compat_ulong_t hlt; | ||
1641 | compat_ulong_t hut; | ||
1642 | compat_ulong_t srt; | ||
1643 | compat_ulong_t spinup; | ||
1644 | compat_ulong_t spindown; | ||
1645 | unsigned char spindown_offset; | ||
1646 | unsigned char select_delay; | ||
1647 | unsigned char rps; | ||
1648 | unsigned char tracks; | ||
1649 | compat_ulong_t timeout; | ||
1650 | unsigned char interleave_sect; | ||
1651 | struct floppy_max_errors max_errors; | ||
1652 | char flags; | ||
1653 | char read_track; | ||
1654 | short autodetect[8]; | ||
1655 | compat_int_t checkfreq; | ||
1656 | compat_int_t native_format; | ||
1657 | }; | ||
1658 | |||
1659 | struct floppy_drive_struct32 { | ||
1660 | signed char flags; | ||
1661 | compat_ulong_t spinup_date; | ||
1662 | compat_ulong_t select_date; | ||
1663 | compat_ulong_t first_read_date; | ||
1664 | short probed_format; | ||
1665 | short track; | ||
1666 | short maxblock; | ||
1667 | short maxtrack; | ||
1668 | compat_int_t generation; | ||
1669 | compat_int_t keep_data; | ||
1670 | compat_int_t fd_ref; | ||
1671 | compat_int_t fd_device; | ||
1672 | compat_int_t last_checked; | ||
1673 | compat_caddr_t dmabuf; | ||
1674 | compat_int_t bufblocks; | ||
1675 | }; | ||
1676 | |||
1677 | struct floppy_fdc_state32 { | ||
1678 | compat_int_t spec1; | ||
1679 | compat_int_t spec2; | ||
1680 | compat_int_t dtr; | ||
1681 | unsigned char version; | ||
1682 | unsigned char dor; | ||
1683 | compat_ulong_t address; | ||
1684 | unsigned int rawcmd:2; | ||
1685 | unsigned int reset:1; | ||
1686 | unsigned int need_configure:1; | ||
1687 | unsigned int perp_mode:2; | ||
1688 | unsigned int has_fifo:1; | ||
1689 | unsigned int driver_version; | ||
1690 | unsigned char track[4]; | ||
1691 | }; | ||
1692 | |||
1693 | struct floppy_write_errors32 { | ||
1694 | unsigned int write_errors; | ||
1695 | compat_ulong_t first_error_sector; | ||
1696 | compat_int_t first_error_generation; | ||
1697 | compat_ulong_t last_error_sector; | ||
1698 | compat_int_t last_error_generation; | ||
1699 | compat_uint_t badness; | ||
1700 | }; | ||
1701 | |||
1702 | #define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32) | ||
1703 | #define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32) | ||
1704 | #define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32) | ||
1705 | #define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32) | ||
1706 | #define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32) | ||
1707 | #define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32) | ||
1708 | #define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32) | ||
1709 | #define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32) | ||
1710 | #define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32) | ||
1711 | |||
1712 | static struct { | ||
1713 | unsigned int cmd32; | ||
1714 | unsigned int cmd; | ||
1715 | } fd_ioctl_trans_table[] = { | ||
1716 | { FDSETPRM32, FDSETPRM }, | ||
1717 | { FDDEFPRM32, FDDEFPRM }, | ||
1718 | { FDGETPRM32, FDGETPRM }, | ||
1719 | { FDSETDRVPRM32, FDSETDRVPRM }, | ||
1720 | { FDGETDRVPRM32, FDGETDRVPRM }, | ||
1721 | { FDGETDRVSTAT32, FDGETDRVSTAT }, | ||
1722 | { FDPOLLDRVSTAT32, FDPOLLDRVSTAT }, | ||
1723 | { FDGETFDCSTAT32, FDGETFDCSTAT }, | ||
1724 | { FDWERRORGET32, FDWERRORGET } | ||
1725 | }; | ||
1726 | |||
1727 | #define NR_FD_IOCTL_TRANS ARRAY_SIZE(fd_ioctl_trans_table) | ||
1728 | |||
1729 | static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1730 | { | ||
1731 | mm_segment_t old_fs = get_fs(); | ||
1732 | void *karg = NULL; | ||
1733 | unsigned int kcmd = 0; | ||
1734 | int i, err; | ||
1735 | |||
1736 | for (i = 0; i < NR_FD_IOCTL_TRANS; i++) | ||
1737 | if (cmd == fd_ioctl_trans_table[i].cmd32) { | ||
1738 | kcmd = fd_ioctl_trans_table[i].cmd; | ||
1739 | break; | ||
1740 | } | ||
1741 | if (!kcmd) | ||
1742 | return -EINVAL; | ||
1743 | |||
1744 | switch (cmd) { | ||
1745 | case FDSETPRM32: | ||
1746 | case FDDEFPRM32: | ||
1747 | case FDGETPRM32: | ||
1748 | { | ||
1749 | compat_uptr_t name; | ||
1750 | struct floppy_struct32 __user *uf; | ||
1751 | struct floppy_struct *f; | ||
1752 | |||
1753 | uf = compat_ptr(arg); | ||
1754 | f = karg = kmalloc(sizeof(struct floppy_struct), GFP_KERNEL); | ||
1755 | if (!karg) | ||
1756 | return -ENOMEM; | ||
1757 | if (cmd == FDGETPRM32) | ||
1758 | break; | ||
1759 | err = __get_user(f->size, &uf->size); | ||
1760 | err |= __get_user(f->sect, &uf->sect); | ||
1761 | err |= __get_user(f->head, &uf->head); | ||
1762 | err |= __get_user(f->track, &uf->track); | ||
1763 | err |= __get_user(f->stretch, &uf->stretch); | ||
1764 | err |= __get_user(f->gap, &uf->gap); | ||
1765 | err |= __get_user(f->rate, &uf->rate); | ||
1766 | err |= __get_user(f->spec1, &uf->spec1); | ||
1767 | err |= __get_user(f->fmt_gap, &uf->fmt_gap); | ||
1768 | err |= __get_user(name, &uf->name); | ||
1769 | f->name = compat_ptr(name); | ||
1770 | if (err) { | ||
1771 | err = -EFAULT; | ||
1772 | goto out; | ||
1773 | } | ||
1774 | break; | ||
1775 | } | ||
1776 | case FDSETDRVPRM32: | ||
1777 | case FDGETDRVPRM32: | ||
1778 | { | ||
1779 | struct floppy_drive_params32 __user *uf; | ||
1780 | struct floppy_drive_params *f; | ||
1781 | |||
1782 | uf = compat_ptr(arg); | ||
1783 | f = karg = kmalloc(sizeof(struct floppy_drive_params), GFP_KERNEL); | ||
1784 | if (!karg) | ||
1785 | return -ENOMEM; | ||
1786 | if (cmd == FDGETDRVPRM32) | ||
1787 | break; | ||
1788 | err = __get_user(f->cmos, &uf->cmos); | ||
1789 | err |= __get_user(f->max_dtr, &uf->max_dtr); | ||
1790 | err |= __get_user(f->hlt, &uf->hlt); | ||
1791 | err |= __get_user(f->hut, &uf->hut); | ||
1792 | err |= __get_user(f->srt, &uf->srt); | ||
1793 | err |= __get_user(f->spinup, &uf->spinup); | ||
1794 | err |= __get_user(f->spindown, &uf->spindown); | ||
1795 | err |= __get_user(f->spindown_offset, &uf->spindown_offset); | ||
1796 | err |= __get_user(f->select_delay, &uf->select_delay); | ||
1797 | err |= __get_user(f->rps, &uf->rps); | ||
1798 | err |= __get_user(f->tracks, &uf->tracks); | ||
1799 | err |= __get_user(f->timeout, &uf->timeout); | ||
1800 | err |= __get_user(f->interleave_sect, &uf->interleave_sect); | ||
1801 | err |= __copy_from_user(&f->max_errors, &uf->max_errors, sizeof(f->max_errors)); | ||
1802 | err |= __get_user(f->flags, &uf->flags); | ||
1803 | err |= __get_user(f->read_track, &uf->read_track); | ||
1804 | err |= __copy_from_user(f->autodetect, uf->autodetect, sizeof(f->autodetect)); | ||
1805 | err |= __get_user(f->checkfreq, &uf->checkfreq); | ||
1806 | err |= __get_user(f->native_format, &uf->native_format); | ||
1807 | if (err) { | ||
1808 | err = -EFAULT; | ||
1809 | goto out; | ||
1810 | } | ||
1811 | break; | ||
1812 | } | ||
1813 | case FDGETDRVSTAT32: | ||
1814 | case FDPOLLDRVSTAT32: | ||
1815 | karg = kmalloc(sizeof(struct floppy_drive_struct), GFP_KERNEL); | ||
1816 | if (!karg) | ||
1817 | return -ENOMEM; | ||
1818 | break; | ||
1819 | case FDGETFDCSTAT32: | ||
1820 | karg = kmalloc(sizeof(struct floppy_fdc_state), GFP_KERNEL); | ||
1821 | if (!karg) | ||
1822 | return -ENOMEM; | ||
1823 | break; | ||
1824 | case FDWERRORGET32: | ||
1825 | karg = kmalloc(sizeof(struct floppy_write_errors), GFP_KERNEL); | ||
1826 | if (!karg) | ||
1827 | return -ENOMEM; | ||
1828 | break; | ||
1829 | default: | ||
1830 | return -EINVAL; | ||
1831 | } | ||
1832 | set_fs (KERNEL_DS); | ||
1833 | err = sys_ioctl (fd, kcmd, (unsigned long)karg); | ||
1834 | set_fs (old_fs); | ||
1835 | if (err) | ||
1836 | goto out; | ||
1837 | switch (cmd) { | ||
1838 | case FDGETPRM32: | ||
1839 | { | ||
1840 | struct floppy_struct *f = karg; | ||
1841 | struct floppy_struct32 __user *uf = compat_ptr(arg); | ||
1842 | |||
1843 | err = __put_user(f->size, &uf->size); | ||
1844 | err |= __put_user(f->sect, &uf->sect); | ||
1845 | err |= __put_user(f->head, &uf->head); | ||
1846 | err |= __put_user(f->track, &uf->track); | ||
1847 | err |= __put_user(f->stretch, &uf->stretch); | ||
1848 | err |= __put_user(f->gap, &uf->gap); | ||
1849 | err |= __put_user(f->rate, &uf->rate); | ||
1850 | err |= __put_user(f->spec1, &uf->spec1); | ||
1851 | err |= __put_user(f->fmt_gap, &uf->fmt_gap); | ||
1852 | err |= __put_user((u64)f->name, (compat_caddr_t __user *)&uf->name); | ||
1853 | break; | ||
1854 | } | ||
1855 | case FDGETDRVPRM32: | ||
1856 | { | ||
1857 | struct floppy_drive_params32 __user *uf; | ||
1858 | struct floppy_drive_params *f = karg; | ||
1859 | |||
1860 | uf = compat_ptr(arg); | ||
1861 | err = __put_user(f->cmos, &uf->cmos); | ||
1862 | err |= __put_user(f->max_dtr, &uf->max_dtr); | ||
1863 | err |= __put_user(f->hlt, &uf->hlt); | ||
1864 | err |= __put_user(f->hut, &uf->hut); | ||
1865 | err |= __put_user(f->srt, &uf->srt); | ||
1866 | err |= __put_user(f->spinup, &uf->spinup); | ||
1867 | err |= __put_user(f->spindown, &uf->spindown); | ||
1868 | err |= __put_user(f->spindown_offset, &uf->spindown_offset); | ||
1869 | err |= __put_user(f->select_delay, &uf->select_delay); | ||
1870 | err |= __put_user(f->rps, &uf->rps); | ||
1871 | err |= __put_user(f->tracks, &uf->tracks); | ||
1872 | err |= __put_user(f->timeout, &uf->timeout); | ||
1873 | err |= __put_user(f->interleave_sect, &uf->interleave_sect); | ||
1874 | err |= __copy_to_user(&uf->max_errors, &f->max_errors, sizeof(f->max_errors)); | ||
1875 | err |= __put_user(f->flags, &uf->flags); | ||
1876 | err |= __put_user(f->read_track, &uf->read_track); | ||
1877 | err |= __copy_to_user(uf->autodetect, f->autodetect, sizeof(f->autodetect)); | ||
1878 | err |= __put_user(f->checkfreq, &uf->checkfreq); | ||
1879 | err |= __put_user(f->native_format, &uf->native_format); | ||
1880 | break; | ||
1881 | } | ||
1882 | case FDGETDRVSTAT32: | ||
1883 | case FDPOLLDRVSTAT32: | ||
1884 | { | ||
1885 | struct floppy_drive_struct32 __user *uf; | ||
1886 | struct floppy_drive_struct *f = karg; | ||
1887 | |||
1888 | uf = compat_ptr(arg); | ||
1889 | err = __put_user(f->flags, &uf->flags); | ||
1890 | err |= __put_user(f->spinup_date, &uf->spinup_date); | ||
1891 | err |= __put_user(f->select_date, &uf->select_date); | ||
1892 | err |= __put_user(f->first_read_date, &uf->first_read_date); | ||
1893 | err |= __put_user(f->probed_format, &uf->probed_format); | ||
1894 | err |= __put_user(f->track, &uf->track); | ||
1895 | err |= __put_user(f->maxblock, &uf->maxblock); | ||
1896 | err |= __put_user(f->maxtrack, &uf->maxtrack); | ||
1897 | err |= __put_user(f->generation, &uf->generation); | ||
1898 | err |= __put_user(f->keep_data, &uf->keep_data); | ||
1899 | err |= __put_user(f->fd_ref, &uf->fd_ref); | ||
1900 | err |= __put_user(f->fd_device, &uf->fd_device); | ||
1901 | err |= __put_user(f->last_checked, &uf->last_checked); | ||
1902 | err |= __put_user((u64)f->dmabuf, &uf->dmabuf); | ||
1903 | err |= __put_user((u64)f->bufblocks, &uf->bufblocks); | ||
1904 | break; | ||
1905 | } | ||
1906 | case FDGETFDCSTAT32: | ||
1907 | { | ||
1908 | struct floppy_fdc_state32 __user *uf; | ||
1909 | struct floppy_fdc_state *f = karg; | ||
1910 | |||
1911 | uf = compat_ptr(arg); | ||
1912 | err = __put_user(f->spec1, &uf->spec1); | ||
1913 | err |= __put_user(f->spec2, &uf->spec2); | ||
1914 | err |= __put_user(f->dtr, &uf->dtr); | ||
1915 | err |= __put_user(f->version, &uf->version); | ||
1916 | err |= __put_user(f->dor, &uf->dor); | ||
1917 | err |= __put_user(f->address, &uf->address); | ||
1918 | err |= __copy_to_user((char __user *)&uf->address + sizeof(uf->address), | ||
1919 | (char *)&f->address + sizeof(f->address), sizeof(int)); | ||
1920 | err |= __put_user(f->driver_version, &uf->driver_version); | ||
1921 | err |= __copy_to_user(uf->track, f->track, sizeof(f->track)); | ||
1922 | break; | ||
1923 | } | ||
1924 | case FDWERRORGET32: | ||
1925 | { | ||
1926 | struct floppy_write_errors32 __user *uf; | ||
1927 | struct floppy_write_errors *f = karg; | ||
1928 | |||
1929 | uf = compat_ptr(arg); | ||
1930 | err = __put_user(f->write_errors, &uf->write_errors); | ||
1931 | err |= __put_user(f->first_error_sector, &uf->first_error_sector); | ||
1932 | err |= __put_user(f->first_error_generation, &uf->first_error_generation); | ||
1933 | err |= __put_user(f->last_error_sector, &uf->last_error_sector); | ||
1934 | err |= __put_user(f->last_error_generation, &uf->last_error_generation); | ||
1935 | err |= __put_user(f->badness, &uf->badness); | ||
1936 | break; | ||
1937 | } | ||
1938 | default: | ||
1939 | break; | ||
1940 | } | ||
1941 | if (err) | ||
1942 | err = -EFAULT; | ||
1943 | |||
1944 | out: | ||
1945 | kfree(karg); | ||
1946 | return err; | ||
1947 | } | ||
1948 | #endif | ||
1949 | |||
1950 | struct mtd_oob_buf32 { | 1409 | struct mtd_oob_buf32 { |
1951 | u_int32_t start; | 1410 | u_int32_t start; |
1952 | u_int32_t length; | 1411 | u_int32_t length; |
@@ -2506,60 +1965,6 @@ COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */ | |||
2506 | /* 0x00 */ | 1965 | /* 0x00 */ |
2507 | COMPATIBLE_IOCTL(FIBMAP) | 1966 | COMPATIBLE_IOCTL(FIBMAP) |
2508 | COMPATIBLE_IOCTL(FIGETBSZ) | 1967 | COMPATIBLE_IOCTL(FIGETBSZ) |
2509 | /* 0x03 -- HD/IDE ioctl's used by hdparm and friends. | ||
2510 | * Some need translations, these do not. | ||
2511 | */ | ||
2512 | COMPATIBLE_IOCTL(HDIO_GET_IDENTITY) | ||
2513 | COMPATIBLE_IOCTL(HDIO_DRIVE_TASK) | ||
2514 | COMPATIBLE_IOCTL(HDIO_DRIVE_CMD) | ||
2515 | ULONG_IOCTL(HDIO_SET_MULTCOUNT) | ||
2516 | ULONG_IOCTL(HDIO_SET_UNMASKINTR) | ||
2517 | ULONG_IOCTL(HDIO_SET_KEEPSETTINGS) | ||
2518 | ULONG_IOCTL(HDIO_SET_32BIT) | ||
2519 | ULONG_IOCTL(HDIO_SET_NOWERR) | ||
2520 | ULONG_IOCTL(HDIO_SET_DMA) | ||
2521 | ULONG_IOCTL(HDIO_SET_PIO_MODE) | ||
2522 | ULONG_IOCTL(HDIO_SET_NICE) | ||
2523 | ULONG_IOCTL(HDIO_SET_WCACHE) | ||
2524 | ULONG_IOCTL(HDIO_SET_ACOUSTIC) | ||
2525 | ULONG_IOCTL(HDIO_SET_BUSSTATE) | ||
2526 | ULONG_IOCTL(HDIO_SET_ADDRESS) | ||
2527 | COMPATIBLE_IOCTL(HDIO_SCAN_HWIF) | ||
2528 | /* 0x330 is reserved -- it used to be HDIO_GETGEO_BIG */ | ||
2529 | COMPATIBLE_IOCTL(0x330) | ||
2530 | /* 0x02 -- Floppy ioctls */ | ||
2531 | COMPATIBLE_IOCTL(FDMSGON) | ||
2532 | COMPATIBLE_IOCTL(FDMSGOFF) | ||
2533 | COMPATIBLE_IOCTL(FDSETEMSGTRESH) | ||
2534 | COMPATIBLE_IOCTL(FDFLUSH) | ||
2535 | COMPATIBLE_IOCTL(FDWERRORCLR) | ||
2536 | COMPATIBLE_IOCTL(FDSETMAXERRS) | ||
2537 | COMPATIBLE_IOCTL(FDGETMAXERRS) | ||
2538 | COMPATIBLE_IOCTL(FDGETDRVTYP) | ||
2539 | COMPATIBLE_IOCTL(FDEJECT) | ||
2540 | COMPATIBLE_IOCTL(FDCLRPRM) | ||
2541 | COMPATIBLE_IOCTL(FDFMTBEG) | ||
2542 | COMPATIBLE_IOCTL(FDFMTEND) | ||
2543 | COMPATIBLE_IOCTL(FDRESET) | ||
2544 | COMPATIBLE_IOCTL(FDTWADDLE) | ||
2545 | COMPATIBLE_IOCTL(FDFMTTRK) | ||
2546 | COMPATIBLE_IOCTL(FDRAWCMD) | ||
2547 | /* 0x12 */ | ||
2548 | #ifdef CONFIG_BLOCK | ||
2549 | COMPATIBLE_IOCTL(BLKRASET) | ||
2550 | COMPATIBLE_IOCTL(BLKROSET) | ||
2551 | COMPATIBLE_IOCTL(BLKROGET) | ||
2552 | COMPATIBLE_IOCTL(BLKRRPART) | ||
2553 | COMPATIBLE_IOCTL(BLKFLSBUF) | ||
2554 | COMPATIBLE_IOCTL(BLKSECTSET) | ||
2555 | COMPATIBLE_IOCTL(BLKSSZGET) | ||
2556 | COMPATIBLE_IOCTL(BLKTRACESTART) | ||
2557 | COMPATIBLE_IOCTL(BLKTRACESTOP) | ||
2558 | COMPATIBLE_IOCTL(BLKTRACESETUP) | ||
2559 | COMPATIBLE_IOCTL(BLKTRACETEARDOWN) | ||
2560 | ULONG_IOCTL(BLKRASET) | ||
2561 | ULONG_IOCTL(BLKFRASET) | ||
2562 | #endif | ||
2563 | /* RAID */ | 1968 | /* RAID */ |
2564 | COMPATIBLE_IOCTL(RAID_VERSION) | 1969 | COMPATIBLE_IOCTL(RAID_VERSION) |
2565 | COMPATIBLE_IOCTL(GET_ARRAY_INFO) | 1970 | COMPATIBLE_IOCTL(GET_ARRAY_INFO) |
@@ -2807,50 +2212,6 @@ COMPATIBLE_IOCTL(PPGETMODE) | |||
2807 | COMPATIBLE_IOCTL(PPGETPHASE) | 2212 | COMPATIBLE_IOCTL(PPGETPHASE) |
2808 | COMPATIBLE_IOCTL(PPGETFLAGS) | 2213 | COMPATIBLE_IOCTL(PPGETFLAGS) |
2809 | COMPATIBLE_IOCTL(PPSETFLAGS) | 2214 | COMPATIBLE_IOCTL(PPSETFLAGS) |
2810 | /* CDROM stuff */ | ||
2811 | COMPATIBLE_IOCTL(CDROMPAUSE) | ||
2812 | COMPATIBLE_IOCTL(CDROMRESUME) | ||
2813 | COMPATIBLE_IOCTL(CDROMPLAYMSF) | ||
2814 | COMPATIBLE_IOCTL(CDROMPLAYTRKIND) | ||
2815 | COMPATIBLE_IOCTL(CDROMREADTOCHDR) | ||
2816 | COMPATIBLE_IOCTL(CDROMREADTOCENTRY) | ||
2817 | COMPATIBLE_IOCTL(CDROMSTOP) | ||
2818 | COMPATIBLE_IOCTL(CDROMSTART) | ||
2819 | COMPATIBLE_IOCTL(CDROMEJECT) | ||
2820 | COMPATIBLE_IOCTL(CDROMVOLCTRL) | ||
2821 | COMPATIBLE_IOCTL(CDROMSUBCHNL) | ||
2822 | ULONG_IOCTL(CDROMEJECT_SW) | ||
2823 | COMPATIBLE_IOCTL(CDROMMULTISESSION) | ||
2824 | COMPATIBLE_IOCTL(CDROM_GET_MCN) | ||
2825 | COMPATIBLE_IOCTL(CDROMRESET) | ||
2826 | COMPATIBLE_IOCTL(CDROMVOLREAD) | ||
2827 | COMPATIBLE_IOCTL(CDROMSEEK) | ||
2828 | COMPATIBLE_IOCTL(CDROMPLAYBLK) | ||
2829 | COMPATIBLE_IOCTL(CDROMCLOSETRAY) | ||
2830 | ULONG_IOCTL(CDROM_SET_OPTIONS) | ||
2831 | ULONG_IOCTL(CDROM_CLEAR_OPTIONS) | ||
2832 | ULONG_IOCTL(CDROM_SELECT_SPEED) | ||
2833 | ULONG_IOCTL(CDROM_SELECT_DISC) | ||
2834 | ULONG_IOCTL(CDROM_MEDIA_CHANGED) | ||
2835 | ULONG_IOCTL(CDROM_DRIVE_STATUS) | ||
2836 | COMPATIBLE_IOCTL(CDROM_DISC_STATUS) | ||
2837 | COMPATIBLE_IOCTL(CDROM_CHANGER_NSLOTS) | ||
2838 | ULONG_IOCTL(CDROM_LOCKDOOR) | ||
2839 | ULONG_IOCTL(CDROM_DEBUG) | ||
2840 | COMPATIBLE_IOCTL(CDROM_GET_CAPABILITY) | ||
2841 | /* Ignore cdrom.h about these next 5 ioctls, they absolutely do | ||
2842 | * not take a struct cdrom_read, instead they take a struct cdrom_msf | ||
2843 | * which is compatible. | ||
2844 | */ | ||
2845 | COMPATIBLE_IOCTL(CDROMREADMODE2) | ||
2846 | COMPATIBLE_IOCTL(CDROMREADMODE1) | ||
2847 | COMPATIBLE_IOCTL(CDROMREADRAW) | ||
2848 | COMPATIBLE_IOCTL(CDROMREADCOOKED) | ||
2849 | COMPATIBLE_IOCTL(CDROMREADALL) | ||
2850 | /* DVD ioctls */ | ||
2851 | COMPATIBLE_IOCTL(DVD_READ_STRUCT) | ||
2852 | COMPATIBLE_IOCTL(DVD_WRITE_STRUCT) | ||
2853 | COMPATIBLE_IOCTL(DVD_AUTH) | ||
2854 | /* pktcdvd */ | 2215 | /* pktcdvd */ |
2855 | COMPATIBLE_IOCTL(PACKET_CTRL_CMD) | 2216 | COMPATIBLE_IOCTL(PACKET_CTRL_CMD) |
2856 | /* Big A */ | 2217 | /* Big A */ |
@@ -3336,33 +2697,6 @@ HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) | |||
3336 | HANDLE_IOCTL(SIOCGSTAMPNS, do_siocgstampns) | 2697 | HANDLE_IOCTL(SIOCGSTAMPNS, do_siocgstampns) |
3337 | #endif | 2698 | #endif |
3338 | #ifdef CONFIG_BLOCK | 2699 | #ifdef CONFIG_BLOCK |
3339 | HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) | ||
3340 | HANDLE_IOCTL(BLKRAGET, w_long) | ||
3341 | HANDLE_IOCTL(BLKGETSIZE, w_long) | ||
3342 | HANDLE_IOCTL(0x1260, broken_blkgetsize) | ||
3343 | HANDLE_IOCTL(BLKFRAGET, w_long) | ||
3344 | HANDLE_IOCTL(BLKSECTGET, w_long) | ||
3345 | HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans) | ||
3346 | HANDLE_IOCTL(HDIO_GET_UNMASKINTR, hdio_ioctl_trans) | ||
3347 | HANDLE_IOCTL(HDIO_GET_MULTCOUNT, hdio_ioctl_trans) | ||
3348 | HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans) | ||
3349 | HANDLE_IOCTL(HDIO_GET_32BIT, hdio_ioctl_trans) | ||
3350 | HANDLE_IOCTL(HDIO_GET_NOWERR, hdio_ioctl_trans) | ||
3351 | HANDLE_IOCTL(HDIO_GET_DMA, hdio_ioctl_trans) | ||
3352 | HANDLE_IOCTL(HDIO_GET_NICE, hdio_ioctl_trans) | ||
3353 | HANDLE_IOCTL(HDIO_GET_WCACHE, hdio_ioctl_trans) | ||
3354 | HANDLE_IOCTL(HDIO_GET_ACOUSTIC, hdio_ioctl_trans) | ||
3355 | HANDLE_IOCTL(HDIO_GET_ADDRESS, hdio_ioctl_trans) | ||
3356 | HANDLE_IOCTL(HDIO_GET_BUSSTATE, hdio_ioctl_trans) | ||
3357 | HANDLE_IOCTL(FDSETPRM32, fd_ioctl_trans) | ||
3358 | HANDLE_IOCTL(FDDEFPRM32, fd_ioctl_trans) | ||
3359 | HANDLE_IOCTL(FDGETPRM32, fd_ioctl_trans) | ||
3360 | HANDLE_IOCTL(FDSETDRVPRM32, fd_ioctl_trans) | ||
3361 | HANDLE_IOCTL(FDGETDRVPRM32, fd_ioctl_trans) | ||
3362 | HANDLE_IOCTL(FDGETDRVSTAT32, fd_ioctl_trans) | ||
3363 | HANDLE_IOCTL(FDPOLLDRVSTAT32, fd_ioctl_trans) | ||
3364 | HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans) | ||
3365 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) | ||
3366 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) | 2700 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) |
3367 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) | 2701 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) |
3368 | #endif | 2702 | #endif |
@@ -3373,8 +2707,6 @@ HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans) | |||
3373 | #ifdef CONFIG_BLOCK | 2707 | #ifdef CONFIG_BLOCK |
3374 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) | 2708 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) |
3375 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) | 2709 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) |
3376 | HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) | ||
3377 | HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) | ||
3378 | #endif | 2710 | #endif |
3379 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) | 2711 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) |
3380 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) | 2712 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) |
@@ -3415,9 +2747,6 @@ HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl) | |||
3415 | HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) | 2747 | HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) |
3416 | /* block stuff */ | 2748 | /* block stuff */ |
3417 | #ifdef CONFIG_BLOCK | 2749 | #ifdef CONFIG_BLOCK |
3418 | HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget) | ||
3419 | HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset) | ||
3420 | HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64) | ||
3421 | /* Raw devices */ | 2750 | /* Raw devices */ |
3422 | HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) | 2751 | HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) |
3423 | HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) | 2752 | HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) |