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