diff options
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r-- | fs/compat_ioctl.c | 406 |
1 files changed, 18 insertions, 388 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 4063a9396977..27ca1aa30562 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -40,15 +40,11 @@ | |||
40 | #include <linux/if_pppox.h> | 40 | #include <linux/if_pppox.h> |
41 | #include <linux/mtio.h> | 41 | #include <linux/mtio.h> |
42 | #include <linux/cdrom.h> | 42 | #include <linux/cdrom.h> |
43 | #include <linux/loop.h> | ||
44 | #include <linux/auto_fs.h> | 43 | #include <linux/auto_fs.h> |
45 | #include <linux/auto_fs4.h> | 44 | #include <linux/auto_fs4.h> |
46 | #include <linux/tty.h> | 45 | #include <linux/tty.h> |
47 | #include <linux/vt_kern.h> | 46 | #include <linux/vt_kern.h> |
48 | #include <linux/fb.h> | 47 | #include <linux/fb.h> |
49 | #include <linux/ext2_fs.h> | ||
50 | #include <linux/ext3_jbd.h> | ||
51 | #include <linux/ext3_fs.h> | ||
52 | #include <linux/videodev.h> | 48 | #include <linux/videodev.h> |
53 | #include <linux/netdevice.h> | 49 | #include <linux/netdevice.h> |
54 | #include <linux/raw.h> | 50 | #include <linux/raw.h> |
@@ -60,12 +56,10 @@ | |||
60 | #include <linux/pci.h> | 56 | #include <linux/pci.h> |
61 | #include <linux/module.h> | 57 | #include <linux/module.h> |
62 | #include <linux/serial.h> | 58 | #include <linux/serial.h> |
63 | #include <linux/reiserfs_fs.h> | ||
64 | #include <linux/if_tun.h> | 59 | #include <linux/if_tun.h> |
65 | #include <linux/ctype.h> | 60 | #include <linux/ctype.h> |
66 | #include <linux/ioctl32.h> | 61 | #include <linux/ioctl32.h> |
67 | #include <linux/syscalls.h> | 62 | #include <linux/syscalls.h> |
68 | #include <linux/ncp_fs.h> | ||
69 | #include <linux/i2c.h> | 63 | #include <linux/i2c.h> |
70 | #include <linux/i2c-dev.h> | 64 | #include <linux/i2c-dev.h> |
71 | #include <linux/wireless.h> | 65 | #include <linux/wireless.h> |
@@ -113,7 +107,6 @@ | |||
113 | #include <linux/nbd.h> | 107 | #include <linux/nbd.h> |
114 | #include <linux/random.h> | 108 | #include <linux/random.h> |
115 | #include <linux/filter.h> | 109 | #include <linux/filter.h> |
116 | #include <linux/msdos_fs.h> | ||
117 | #include <linux/pktcdvd.h> | 110 | #include <linux/pktcdvd.h> |
118 | 111 | ||
119 | #include <linux/hiddev.h> | 112 | #include <linux/hiddev.h> |
@@ -124,21 +117,6 @@ | |||
124 | #include <linux/dvb/video.h> | 117 | #include <linux/dvb/video.h> |
125 | #include <linux/lp.h> | 118 | #include <linux/lp.h> |
126 | 119 | ||
127 | /* Aiee. Someone does not find a difference between int and long */ | ||
128 | #define EXT2_IOC32_GETFLAGS _IOR('f', 1, int) | ||
129 | #define EXT2_IOC32_SETFLAGS _IOW('f', 2, int) | ||
130 | #define EXT3_IOC32_GETVERSION _IOR('f', 3, int) | ||
131 | #define EXT3_IOC32_SETVERSION _IOW('f', 4, int) | ||
132 | #define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int) | ||
133 | #define EXT3_IOC32_SETRSVSZ _IOW('f', 6, int) | ||
134 | #define EXT3_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) | ||
135 | #ifdef CONFIG_JBD_DEBUG | ||
136 | #define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int) | ||
137 | #endif | ||
138 | |||
139 | #define EXT2_IOC32_GETVERSION _IOR('v', 1, int) | ||
140 | #define EXT2_IOC32_SETVERSION _IOW('v', 2, int) | ||
141 | |||
142 | static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd, | 120 | static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd, |
143 | unsigned long arg, struct file *f) | 121 | unsigned long arg, struct file *f) |
144 | { | 122 | { |
@@ -176,34 +154,6 @@ static int rw_long(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
176 | return err; | 154 | return err; |
177 | } | 155 | } |
178 | 156 | ||
179 | static int do_ext2_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
180 | { | ||
181 | /* These are just misnamed, they actually get/put from/to user an int */ | ||
182 | switch (cmd) { | ||
183 | case EXT2_IOC32_GETFLAGS: cmd = EXT2_IOC_GETFLAGS; break; | ||
184 | case EXT2_IOC32_SETFLAGS: cmd = EXT2_IOC_SETFLAGS; break; | ||
185 | case EXT2_IOC32_GETVERSION: cmd = EXT2_IOC_GETVERSION; break; | ||
186 | case EXT2_IOC32_SETVERSION: cmd = EXT2_IOC_SETVERSION; break; | ||
187 | } | ||
188 | return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg)); | ||
189 | } | ||
190 | |||
191 | static int do_ext3_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
192 | { | ||
193 | /* These are just misnamed, they actually get/put from/to user an int */ | ||
194 | switch (cmd) { | ||
195 | case EXT3_IOC32_GETVERSION: cmd = EXT3_IOC_GETVERSION; break; | ||
196 | case EXT3_IOC32_SETVERSION: cmd = EXT3_IOC_SETVERSION; break; | ||
197 | case EXT3_IOC32_GETRSVSZ: cmd = EXT3_IOC_GETRSVSZ; break; | ||
198 | case EXT3_IOC32_SETRSVSZ: cmd = EXT3_IOC_SETRSVSZ; break; | ||
199 | case EXT3_IOC32_GROUP_EXTEND: cmd = EXT3_IOC_GROUP_EXTEND; break; | ||
200 | #ifdef CONFIG_JBD_DEBUG | ||
201 | case EXT3_IOC32_WAIT_FOR_READONLY: cmd = EXT3_IOC_WAIT_FOR_READONLY; break; | ||
202 | #endif | ||
203 | } | ||
204 | return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg)); | ||
205 | } | ||
206 | |||
207 | struct compat_video_event { | 157 | struct compat_video_event { |
208 | int32_t type; | 158 | int32_t type; |
209 | compat_time_t timestamp; | 159 | compat_time_t timestamp; |
@@ -694,6 +644,7 @@ out: | |||
694 | } | 644 | } |
695 | #endif | 645 | #endif |
696 | 646 | ||
647 | #ifdef CONFIG_BLOCK | ||
697 | struct hd_geometry32 { | 648 | struct hd_geometry32 { |
698 | unsigned char heads; | 649 | unsigned char heads; |
699 | unsigned char sectors; | 650 | unsigned char sectors; |
@@ -918,6 +869,7 @@ static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
918 | } | 869 | } |
919 | return err; | 870 | return err; |
920 | } | 871 | } |
872 | #endif /* CONFIG_BLOCK */ | ||
921 | 873 | ||
922 | struct sock_fprog32 { | 874 | struct sock_fprog32 { |
923 | unsigned short len; | 875 | unsigned short len; |
@@ -1041,6 +993,7 @@ static int ppp_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
1041 | } | 993 | } |
1042 | 994 | ||
1043 | 995 | ||
996 | #ifdef CONFIG_BLOCK | ||
1044 | struct mtget32 { | 997 | struct mtget32 { |
1045 | compat_long_t mt_type; | 998 | compat_long_t mt_type; |
1046 | compat_long_t mt_resid; | 999 | compat_long_t mt_resid; |
@@ -1213,73 +1166,7 @@ static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar | |||
1213 | 1166 | ||
1214 | return err; | 1167 | return err; |
1215 | } | 1168 | } |
1216 | 1169 | #endif /* CONFIG_BLOCK */ | |
1217 | struct loop_info32 { | ||
1218 | compat_int_t lo_number; /* ioctl r/o */ | ||
1219 | compat_dev_t lo_device; /* ioctl r/o */ | ||
1220 | compat_ulong_t lo_inode; /* ioctl r/o */ | ||
1221 | compat_dev_t lo_rdevice; /* ioctl r/o */ | ||
1222 | compat_int_t lo_offset; | ||
1223 | compat_int_t lo_encrypt_type; | ||
1224 | compat_int_t lo_encrypt_key_size; /* ioctl w/o */ | ||
1225 | compat_int_t lo_flags; /* ioctl r/o */ | ||
1226 | char lo_name[LO_NAME_SIZE]; | ||
1227 | unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ | ||
1228 | compat_ulong_t lo_init[2]; | ||
1229 | char reserved[4]; | ||
1230 | }; | ||
1231 | |||
1232 | static int loop_status(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
1233 | { | ||
1234 | mm_segment_t old_fs = get_fs(); | ||
1235 | struct loop_info l; | ||
1236 | struct loop_info32 __user *ul; | ||
1237 | int err = -EINVAL; | ||
1238 | |||
1239 | ul = compat_ptr(arg); | ||
1240 | switch(cmd) { | ||
1241 | case LOOP_SET_STATUS: | ||
1242 | err = get_user(l.lo_number, &ul->lo_number); | ||
1243 | err |= __get_user(l.lo_device, &ul->lo_device); | ||
1244 | err |= __get_user(l.lo_inode, &ul->lo_inode); | ||
1245 | err |= __get_user(l.lo_rdevice, &ul->lo_rdevice); | ||
1246 | err |= __copy_from_user(&l.lo_offset, &ul->lo_offset, | ||
1247 | 8 + (unsigned long)l.lo_init - (unsigned long)&l.lo_offset); | ||
1248 | if (err) { | ||
1249 | err = -EFAULT; | ||
1250 | } else { | ||
1251 | set_fs (KERNEL_DS); | ||
1252 | err = sys_ioctl (fd, cmd, (unsigned long)&l); | ||
1253 | set_fs (old_fs); | ||
1254 | } | ||
1255 | break; | ||
1256 | case LOOP_GET_STATUS: | ||
1257 | set_fs (KERNEL_DS); | ||
1258 | err = sys_ioctl (fd, cmd, (unsigned long)&l); | ||
1259 | set_fs (old_fs); | ||
1260 | if (!err) { | ||
1261 | err = put_user(l.lo_number, &ul->lo_number); | ||
1262 | err |= __put_user(l.lo_device, &ul->lo_device); | ||
1263 | err |= __put_user(l.lo_inode, &ul->lo_inode); | ||
1264 | err |= __put_user(l.lo_rdevice, &ul->lo_rdevice); | ||
1265 | err |= __copy_to_user(&ul->lo_offset, &l.lo_offset, | ||
1266 | (unsigned long)l.lo_init - (unsigned long)&l.lo_offset); | ||
1267 | if (err) | ||
1268 | err = -EFAULT; | ||
1269 | } | ||
1270 | break; | ||
1271 | default: { | ||
1272 | static int count; | ||
1273 | if (++count <= 20) | ||
1274 | printk("%s: Unknown loop ioctl cmd, fd(%d) " | ||
1275 | "cmd(%08x) arg(%08lx)\n", | ||
1276 | __FUNCTION__, fd, cmd, arg); | ||
1277 | } | ||
1278 | } | ||
1279 | return err; | ||
1280 | } | ||
1281 | |||
1282 | extern int tty_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg); | ||
1283 | 1170 | ||
1284 | #ifdef CONFIG_VT | 1171 | #ifdef CONFIG_VT |
1285 | 1172 | ||
@@ -1607,6 +1494,7 @@ ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
1607 | return -EINVAL; | 1494 | return -EINVAL; |
1608 | } | 1495 | } |
1609 | 1496 | ||
1497 | #ifdef CONFIG_BLOCK | ||
1610 | static int broken_blkgetsize(unsigned int fd, unsigned int cmd, unsigned long arg) | 1498 | static int broken_blkgetsize(unsigned int fd, unsigned int cmd, unsigned long arg) |
1611 | { | 1499 | { |
1612 | /* The mkswap binary hard codes it to Intel value :-((( */ | 1500 | /* The mkswap binary hard codes it to Intel value :-((( */ |
@@ -1641,12 +1529,14 @@ static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar | |||
1641 | 1529 | ||
1642 | return sys_ioctl(fd, cmd, (unsigned long)a); | 1530 | return sys_ioctl(fd, cmd, (unsigned long)a); |
1643 | } | 1531 | } |
1532 | #endif | ||
1644 | 1533 | ||
1645 | static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) | 1534 | static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) |
1646 | { | 1535 | { |
1647 | return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); | 1536 | return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); |
1648 | } | 1537 | } |
1649 | 1538 | ||
1539 | #ifdef CONFIG_BLOCK | ||
1650 | /* Fix sizeof(sizeof()) breakage */ | 1540 | /* Fix sizeof(sizeof()) breakage */ |
1651 | #define BLKBSZGET_32 _IOR(0x12,112,int) | 1541 | #define BLKBSZGET_32 _IOR(0x12,112,int) |
1652 | #define BLKBSZSET_32 _IOW(0x12,113,int) | 1542 | #define BLKBSZSET_32 _IOW(0x12,113,int) |
@@ -1667,6 +1557,7 @@ static int do_blkgetsize64(unsigned int fd, unsigned int cmd, | |||
1667 | { | 1557 | { |
1668 | return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg)); | 1558 | return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg)); |
1669 | } | 1559 | } |
1560 | #endif | ||
1670 | 1561 | ||
1671 | /* Bluetooth ioctls */ | 1562 | /* Bluetooth ioctls */ |
1672 | #define HCIUARTSETPROTO _IOW('U', 200, int) | 1563 | #define HCIUARTSETPROTO _IOW('U', 200, int) |
@@ -1687,6 +1578,7 @@ static int do_blkgetsize64(unsigned int fd, unsigned int cmd, | |||
1687 | #define HIDPGETCONNLIST _IOR('H', 210, int) | 1578 | #define HIDPGETCONNLIST _IOR('H', 210, int) |
1688 | #define HIDPGETCONNINFO _IOR('H', 211, int) | 1579 | #define HIDPGETCONNINFO _IOR('H', 211, int) |
1689 | 1580 | ||
1581 | #ifdef CONFIG_BLOCK | ||
1690 | struct floppy_struct32 { | 1582 | struct floppy_struct32 { |
1691 | compat_uint_t size; | 1583 | compat_uint_t size; |
1692 | compat_uint_t sect; | 1584 | compat_uint_t sect; |
@@ -2011,6 +1903,7 @@ out: | |||
2011 | kfree(karg); | 1903 | kfree(karg); |
2012 | return err; | 1904 | return err; |
2013 | } | 1905 | } |
1906 | #endif | ||
2014 | 1907 | ||
2015 | struct mtd_oob_buf32 { | 1908 | struct mtd_oob_buf32 { |
2016 | u_int32_t start; | 1909 | u_int32_t start; |
@@ -2052,61 +1945,7 @@ static int mtd_rw_oob(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
2052 | return err; | 1945 | return err; |
2053 | } | 1946 | } |
2054 | 1947 | ||
2055 | #define VFAT_IOCTL_READDIR_BOTH32 _IOR('r', 1, struct compat_dirent[2]) | 1948 | #ifdef CONFIG_BLOCK |
2056 | #define VFAT_IOCTL_READDIR_SHORT32 _IOR('r', 2, struct compat_dirent[2]) | ||
2057 | |||
2058 | static long | ||
2059 | put_dirent32 (struct dirent *d, struct compat_dirent __user *d32) | ||
2060 | { | ||
2061 | if (!access_ok(VERIFY_WRITE, d32, sizeof(struct compat_dirent))) | ||
2062 | return -EFAULT; | ||
2063 | |||
2064 | __put_user(d->d_ino, &d32->d_ino); | ||
2065 | __put_user(d->d_off, &d32->d_off); | ||
2066 | __put_user(d->d_reclen, &d32->d_reclen); | ||
2067 | if (__copy_to_user(d32->d_name, d->d_name, d->d_reclen)) | ||
2068 | return -EFAULT; | ||
2069 | |||
2070 | return 0; | ||
2071 | } | ||
2072 | |||
2073 | static int vfat_ioctl32(unsigned fd, unsigned cmd, unsigned long arg) | ||
2074 | { | ||
2075 | struct compat_dirent __user *p = compat_ptr(arg); | ||
2076 | int ret; | ||
2077 | mm_segment_t oldfs = get_fs(); | ||
2078 | struct dirent d[2]; | ||
2079 | |||
2080 | switch(cmd) | ||
2081 | { | ||
2082 | case VFAT_IOCTL_READDIR_BOTH32: | ||
2083 | cmd = VFAT_IOCTL_READDIR_BOTH; | ||
2084 | break; | ||
2085 | case VFAT_IOCTL_READDIR_SHORT32: | ||
2086 | cmd = VFAT_IOCTL_READDIR_SHORT; | ||
2087 | break; | ||
2088 | } | ||
2089 | |||
2090 | set_fs(KERNEL_DS); | ||
2091 | ret = sys_ioctl(fd,cmd,(unsigned long)&d); | ||
2092 | set_fs(oldfs); | ||
2093 | if (ret >= 0) { | ||
2094 | ret |= put_dirent32(&d[0], p); | ||
2095 | ret |= put_dirent32(&d[1], p + 1); | ||
2096 | } | ||
2097 | return ret; | ||
2098 | } | ||
2099 | |||
2100 | #define REISERFS_IOC_UNPACK32 _IOW(0xCD,1,int) | ||
2101 | |||
2102 | static int reiserfs_ioctl32(unsigned fd, unsigned cmd, unsigned long ptr) | ||
2103 | { | ||
2104 | if (cmd == REISERFS_IOC_UNPACK32) | ||
2105 | cmd = REISERFS_IOC_UNPACK; | ||
2106 | |||
2107 | return sys_ioctl(fd,cmd,ptr); | ||
2108 | } | ||
2109 | |||
2110 | struct raw32_config_request | 1949 | struct raw32_config_request |
2111 | { | 1950 | { |
2112 | compat_int_t raw_minor; | 1951 | compat_int_t raw_minor; |
@@ -2171,6 +2010,7 @@ static int raw_ioctl(unsigned fd, unsigned cmd, unsigned long arg) | |||
2171 | } | 2010 | } |
2172 | return ret; | 2011 | return ret; |
2173 | } | 2012 | } |
2013 | #endif /* CONFIG_BLOCK */ | ||
2174 | 2014 | ||
2175 | struct serial_struct32 { | 2015 | struct serial_struct32 { |
2176 | compat_int_t type; | 2016 | compat_int_t type; |
@@ -2507,193 +2347,6 @@ static int rtc_ioctl(unsigned fd, unsigned cmd, unsigned long arg) | |||
2507 | } | 2347 | } |
2508 | } | 2348 | } |
2509 | 2349 | ||
2510 | #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE) | ||
2511 | struct ncp_ioctl_request_32 { | ||
2512 | u32 function; | ||
2513 | u32 size; | ||
2514 | compat_caddr_t data; | ||
2515 | }; | ||
2516 | |||
2517 | struct ncp_fs_info_v2_32 { | ||
2518 | s32 version; | ||
2519 | u32 mounted_uid; | ||
2520 | u32 connection; | ||
2521 | u32 buffer_size; | ||
2522 | |||
2523 | u32 volume_number; | ||
2524 | u32 directory_id; | ||
2525 | |||
2526 | u32 dummy1; | ||
2527 | u32 dummy2; | ||
2528 | u32 dummy3; | ||
2529 | }; | ||
2530 | |||
2531 | struct ncp_objectname_ioctl_32 | ||
2532 | { | ||
2533 | s32 auth_type; | ||
2534 | u32 object_name_len; | ||
2535 | compat_caddr_t object_name; /* an userspace data, in most cases user name */ | ||
2536 | }; | ||
2537 | |||
2538 | struct ncp_privatedata_ioctl_32 | ||
2539 | { | ||
2540 | u32 len; | ||
2541 | compat_caddr_t data; /* ~1000 for NDS */ | ||
2542 | }; | ||
2543 | |||
2544 | #define NCP_IOC_NCPREQUEST_32 _IOR('n', 1, struct ncp_ioctl_request_32) | ||
2545 | #define NCP_IOC_GETMOUNTUID2_32 _IOW('n', 2, u32) | ||
2546 | #define NCP_IOC_GET_FS_INFO_V2_32 _IOWR('n', 4, struct ncp_fs_info_v2_32) | ||
2547 | #define NCP_IOC_GETOBJECTNAME_32 _IOWR('n', 9, struct ncp_objectname_ioctl_32) | ||
2548 | #define NCP_IOC_SETOBJECTNAME_32 _IOR('n', 9, struct ncp_objectname_ioctl_32) | ||
2549 | #define NCP_IOC_GETPRIVATEDATA_32 _IOWR('n', 10, struct ncp_privatedata_ioctl_32) | ||
2550 | #define NCP_IOC_SETPRIVATEDATA_32 _IOR('n', 10, struct ncp_privatedata_ioctl_32) | ||
2551 | |||
2552 | static int do_ncp_ncprequest(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
2553 | { | ||
2554 | struct ncp_ioctl_request_32 n32; | ||
2555 | struct ncp_ioctl_request __user *p = compat_alloc_user_space(sizeof(*p)); | ||
2556 | |||
2557 | if (copy_from_user(&n32, compat_ptr(arg), sizeof(n32)) || | ||
2558 | put_user(n32.function, &p->function) || | ||
2559 | put_user(n32.size, &p->size) || | ||
2560 | put_user(compat_ptr(n32.data), &p->data)) | ||
2561 | return -EFAULT; | ||
2562 | |||
2563 | return sys_ioctl(fd, NCP_IOC_NCPREQUEST, (unsigned long)p); | ||
2564 | } | ||
2565 | |||
2566 | static int do_ncp_getmountuid2(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
2567 | { | ||
2568 | mm_segment_t old_fs = get_fs(); | ||
2569 | __kernel_uid_t kuid; | ||
2570 | int err; | ||
2571 | |||
2572 | cmd = NCP_IOC_GETMOUNTUID2; | ||
2573 | |||
2574 | set_fs(KERNEL_DS); | ||
2575 | err = sys_ioctl(fd, cmd, (unsigned long)&kuid); | ||
2576 | set_fs(old_fs); | ||
2577 | |||
2578 | if (!err) | ||
2579 | err = put_user(kuid, | ||
2580 | (unsigned int __user *) compat_ptr(arg)); | ||
2581 | |||
2582 | return err; | ||
2583 | } | ||
2584 | |||
2585 | static int do_ncp_getfsinfo2(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
2586 | { | ||
2587 | mm_segment_t old_fs = get_fs(); | ||
2588 | struct ncp_fs_info_v2_32 n32; | ||
2589 | struct ncp_fs_info_v2 n; | ||
2590 | int err; | ||
2591 | |||
2592 | if (copy_from_user(&n32, compat_ptr(arg), sizeof(n32))) | ||
2593 | return -EFAULT; | ||
2594 | if (n32.version != NCP_GET_FS_INFO_VERSION_V2) | ||
2595 | return -EINVAL; | ||
2596 | n.version = NCP_GET_FS_INFO_VERSION_V2; | ||
2597 | |||
2598 | set_fs(KERNEL_DS); | ||
2599 | err = sys_ioctl(fd, NCP_IOC_GET_FS_INFO_V2, (unsigned long)&n); | ||
2600 | set_fs(old_fs); | ||
2601 | |||
2602 | if (!err) { | ||
2603 | n32.version = n.version; | ||
2604 | n32.mounted_uid = n.mounted_uid; | ||
2605 | n32.connection = n.connection; | ||
2606 | n32.buffer_size = n.buffer_size; | ||
2607 | n32.volume_number = n.volume_number; | ||
2608 | n32.directory_id = n.directory_id; | ||
2609 | n32.dummy1 = n.dummy1; | ||
2610 | n32.dummy2 = n.dummy2; | ||
2611 | n32.dummy3 = n.dummy3; | ||
2612 | err = copy_to_user(compat_ptr(arg), &n32, sizeof(n32)) ? -EFAULT : 0; | ||
2613 | } | ||
2614 | return err; | ||
2615 | } | ||
2616 | |||
2617 | static int do_ncp_getobjectname(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
2618 | { | ||
2619 | struct ncp_objectname_ioctl_32 n32, __user *p32 = compat_ptr(arg); | ||
2620 | struct ncp_objectname_ioctl __user *p = compat_alloc_user_space(sizeof(*p)); | ||
2621 | s32 auth_type; | ||
2622 | u32 name_len; | ||
2623 | int err; | ||
2624 | |||
2625 | if (copy_from_user(&n32, p32, sizeof(n32)) || | ||
2626 | put_user(n32.object_name_len, &p->object_name_len) || | ||
2627 | put_user(compat_ptr(n32.object_name), &p->object_name)) | ||
2628 | return -EFAULT; | ||
2629 | |||
2630 | err = sys_ioctl(fd, NCP_IOC_GETOBJECTNAME, (unsigned long)p); | ||
2631 | if (err) | ||
2632 | return err; | ||
2633 | |||
2634 | if (get_user(auth_type, &p->auth_type) || | ||
2635 | put_user(auth_type, &p32->auth_type) || | ||
2636 | get_user(name_len, &p->object_name_len) || | ||
2637 | put_user(name_len, &p32->object_name_len)) | ||
2638 | return -EFAULT; | ||
2639 | |||
2640 | return 0; | ||
2641 | } | ||
2642 | |||
2643 | static int do_ncp_setobjectname(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
2644 | { | ||
2645 | struct ncp_objectname_ioctl_32 n32, __user *p32 = compat_ptr(arg); | ||
2646 | struct ncp_objectname_ioctl __user *p = compat_alloc_user_space(sizeof(*p)); | ||
2647 | |||
2648 | if (copy_from_user(&n32, p32, sizeof(n32)) || | ||
2649 | put_user(n32.auth_type, &p->auth_type) || | ||
2650 | put_user(n32.object_name_len, &p->object_name_len) || | ||
2651 | put_user(compat_ptr(n32.object_name), &p->object_name)) | ||
2652 | return -EFAULT; | ||
2653 | |||
2654 | return sys_ioctl(fd, NCP_IOC_SETOBJECTNAME, (unsigned long)p); | ||
2655 | } | ||
2656 | |||
2657 | static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
2658 | { | ||
2659 | struct ncp_privatedata_ioctl_32 n32, __user *p32 = compat_ptr(arg); | ||
2660 | struct ncp_privatedata_ioctl __user *p = | ||
2661 | compat_alloc_user_space(sizeof(*p)); | ||
2662 | u32 len; | ||
2663 | int err; | ||
2664 | |||
2665 | if (copy_from_user(&n32, p32, sizeof(n32)) || | ||
2666 | put_user(n32.len, &p->len) || | ||
2667 | put_user(compat_ptr(n32.data), &p->data)) | ||
2668 | return -EFAULT; | ||
2669 | |||
2670 | err = sys_ioctl(fd, NCP_IOC_GETPRIVATEDATA, (unsigned long)p); | ||
2671 | if (err) | ||
2672 | return err; | ||
2673 | |||
2674 | if (get_user(len, &p->len) || | ||
2675 | put_user(len, &p32->len)) | ||
2676 | return -EFAULT; | ||
2677 | |||
2678 | return 0; | ||
2679 | } | ||
2680 | |||
2681 | static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
2682 | { | ||
2683 | struct ncp_privatedata_ioctl_32 n32; | ||
2684 | struct ncp_privatedata_ioctl_32 __user *p32 = compat_ptr(arg); | ||
2685 | struct ncp_privatedata_ioctl __user *p = | ||
2686 | compat_alloc_user_space(sizeof(*p)); | ||
2687 | |||
2688 | if (copy_from_user(&n32, p32, sizeof(n32)) || | ||
2689 | put_user(n32.len, &p->len) || | ||
2690 | put_user(compat_ptr(n32.data), &p->data)) | ||
2691 | return -EFAULT; | ||
2692 | |||
2693 | return sys_ioctl(fd, NCP_IOC_SETPRIVATEDATA, (unsigned long)p); | ||
2694 | } | ||
2695 | #endif | ||
2696 | |||
2697 | static int | 2350 | static int |
2698 | lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | 2351 | lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
2699 | { | 2352 | { |
@@ -2777,6 +2430,7 @@ HANDLE_IOCTL(SIOCBRDELIF, dev_ifsioc) | |||
2777 | HANDLE_IOCTL(SIOCRTMSG, ret_einval) | 2430 | HANDLE_IOCTL(SIOCRTMSG, ret_einval) |
2778 | HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) | 2431 | HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) |
2779 | #endif | 2432 | #endif |
2433 | #ifdef CONFIG_BLOCK | ||
2780 | HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) | 2434 | HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) |
2781 | HANDLE_IOCTL(BLKRAGET, w_long) | 2435 | HANDLE_IOCTL(BLKRAGET, w_long) |
2782 | HANDLE_IOCTL(BLKGETSIZE, w_long) | 2436 | HANDLE_IOCTL(BLKGETSIZE, w_long) |
@@ -2802,16 +2456,17 @@ HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans) | |||
2802 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) | 2456 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) |
2803 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) | 2457 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) |
2804 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) | 2458 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) |
2459 | #endif | ||
2805 | HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) | 2460 | HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) |
2806 | HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) | 2461 | HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) |
2807 | HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) | 2462 | HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) |
2808 | HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans) | 2463 | HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans) |
2464 | #ifdef CONFIG_BLOCK | ||
2809 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) | 2465 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) |
2810 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) | 2466 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) |
2811 | HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) | 2467 | HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) |
2812 | HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) | 2468 | HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) |
2813 | HANDLE_IOCTL(LOOP_SET_STATUS, loop_status) | 2469 | #endif |
2814 | HANDLE_IOCTL(LOOP_GET_STATUS, loop_status) | ||
2815 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) | 2470 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) |
2816 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) | 2471 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) |
2817 | #ifdef CONFIG_VT | 2472 | #ifdef CONFIG_VT |
@@ -2821,19 +2476,6 @@ HANDLE_IOCTL(PIO_UNIMAP, do_unimap_ioctl) | |||
2821 | HANDLE_IOCTL(GIO_UNIMAP, do_unimap_ioctl) | 2476 | HANDLE_IOCTL(GIO_UNIMAP, do_unimap_ioctl) |
2822 | HANDLE_IOCTL(KDFONTOP, do_kdfontop_ioctl) | 2477 | HANDLE_IOCTL(KDFONTOP, do_kdfontop_ioctl) |
2823 | #endif | 2478 | #endif |
2824 | HANDLE_IOCTL(EXT2_IOC32_GETFLAGS, do_ext2_ioctl) | ||
2825 | HANDLE_IOCTL(EXT2_IOC32_SETFLAGS, do_ext2_ioctl) | ||
2826 | HANDLE_IOCTL(EXT2_IOC32_GETVERSION, do_ext2_ioctl) | ||
2827 | HANDLE_IOCTL(EXT2_IOC32_SETVERSION, do_ext2_ioctl) | ||
2828 | HANDLE_IOCTL(EXT3_IOC32_GETVERSION, do_ext3_ioctl) | ||
2829 | HANDLE_IOCTL(EXT3_IOC32_SETVERSION, do_ext3_ioctl) | ||
2830 | HANDLE_IOCTL(EXT3_IOC32_GETRSVSZ, do_ext3_ioctl) | ||
2831 | HANDLE_IOCTL(EXT3_IOC32_SETRSVSZ, do_ext3_ioctl) | ||
2832 | HANDLE_IOCTL(EXT3_IOC32_GROUP_EXTEND, do_ext3_ioctl) | ||
2833 | COMPATIBLE_IOCTL(EXT3_IOC_GROUP_ADD) | ||
2834 | #ifdef CONFIG_JBD_DEBUG | ||
2835 | HANDLE_IOCTL(EXT3_IOC32_WAIT_FOR_READONLY, do_ext3_ioctl) | ||
2836 | #endif | ||
2837 | /* One SMB ioctl needs translations. */ | 2479 | /* One SMB ioctl needs translations. */ |
2838 | #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t) | 2480 | #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t) |
2839 | HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid) | 2481 | HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid) |
@@ -2863,16 +2505,14 @@ HANDLE_IOCTL(SONET_SETFRAMING, do_atm_ioctl) | |||
2863 | HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl) | 2505 | HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl) |
2864 | HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) | 2506 | HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) |
2865 | /* block stuff */ | 2507 | /* block stuff */ |
2508 | #ifdef CONFIG_BLOCK | ||
2866 | HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget) | 2509 | HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget) |
2867 | HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset) | 2510 | HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset) |
2868 | HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64) | 2511 | HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64) |
2869 | /* vfat */ | ||
2870 | HANDLE_IOCTL(VFAT_IOCTL_READDIR_BOTH32, vfat_ioctl32) | ||
2871 | HANDLE_IOCTL(VFAT_IOCTL_READDIR_SHORT32, vfat_ioctl32) | ||
2872 | HANDLE_IOCTL(REISERFS_IOC_UNPACK32, reiserfs_ioctl32) | ||
2873 | /* Raw devices */ | 2512 | /* Raw devices */ |
2874 | HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) | 2513 | HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) |
2875 | HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) | 2514 | HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) |
2515 | #endif | ||
2876 | /* Serial */ | 2516 | /* Serial */ |
2877 | HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl) | 2517 | HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl) |
2878 | HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl) | 2518 | HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl) |
@@ -2920,16 +2560,6 @@ HANDLE_IOCTL(RTC_IRQP_SET32, rtc_ioctl) | |||
2920 | HANDLE_IOCTL(RTC_EPOCH_READ32, rtc_ioctl) | 2560 | HANDLE_IOCTL(RTC_EPOCH_READ32, rtc_ioctl) |
2921 | HANDLE_IOCTL(RTC_EPOCH_SET32, rtc_ioctl) | 2561 | HANDLE_IOCTL(RTC_EPOCH_SET32, rtc_ioctl) |
2922 | 2562 | ||
2923 | #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE) | ||
2924 | HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest) | ||
2925 | HANDLE_IOCTL(NCP_IOC_GETMOUNTUID2_32, do_ncp_getmountuid2) | ||
2926 | HANDLE_IOCTL(NCP_IOC_GET_FS_INFO_V2_32, do_ncp_getfsinfo2) | ||
2927 | HANDLE_IOCTL(NCP_IOC_GETOBJECTNAME_32, do_ncp_getobjectname) | ||
2928 | HANDLE_IOCTL(NCP_IOC_SETOBJECTNAME_32, do_ncp_setobjectname) | ||
2929 | HANDLE_IOCTL(NCP_IOC_GETPRIVATEDATA_32, do_ncp_getprivatedata) | ||
2930 | HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata) | ||
2931 | #endif | ||
2932 | |||
2933 | /* dvb */ | 2563 | /* dvb */ |
2934 | HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event) | 2564 | HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event) |
2935 | HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture) | 2565 | HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture) |