Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ioctl32.c: Conversion between 32bit and 64bit native ioctls. |
| 3 | * |
| 4 | * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) |
| 5 | * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) |
| 6 | * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs |
| 7 | * Copyright (C) 2003 Pavel Machek (pavel@suse.cz) |
| 8 | * |
| 9 | * These routines maintain argument size conversion between 32bit and 64bit |
| 10 | * ioctls. |
| 11 | */ |
| 12 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/types.h> |
| 14 | #include <linux/compat.h> |
| 15 | #include <linux/kernel.h> |
Randy Dunlap | 16f7e0f | 2006-01-11 12:17:46 -0800 | [diff] [blame] | 16 | #include <linux/capability.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <linux/compiler.h> |
| 18 | #include <linux/sched.h> |
| 19 | #include <linux/smp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include <linux/ioctl.h> |
| 21 | #include <linux/if.h> |
| 22 | #include <linux/if_bridge.h> |
| 23 | #include <linux/slab.h> |
| 24 | #include <linux/hdreg.h> |
| 25 | #include <linux/raid/md.h> |
| 26 | #include <linux/kd.h> |
| 27 | #include <linux/dirent.h> |
| 28 | #include <linux/route.h> |
| 29 | #include <linux/in6.h> |
| 30 | #include <linux/ipv6_route.h> |
| 31 | #include <linux/skbuff.h> |
| 32 | #include <linux/netlink.h> |
| 33 | #include <linux/vt.h> |
| 34 | #include <linux/fs.h> |
| 35 | #include <linux/file.h> |
| 36 | #include <linux/fd.h> |
| 37 | #include <linux/ppp_defs.h> |
| 38 | #include <linux/if_ppp.h> |
| 39 | #include <linux/if_pppox.h> |
| 40 | #include <linux/mtio.h> |
| 41 | #include <linux/cdrom.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | #include <linux/auto_fs.h> |
| 43 | #include <linux/auto_fs4.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <linux/tty.h> |
| 45 | #include <linux/vt_kern.h> |
| 46 | #include <linux/fb.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | #include <linux/videodev.h> |
| 48 | #include <linux/netdevice.h> |
| 49 | #include <linux/raw.h> |
| 50 | #include <linux/smb_fs.h> |
| 51 | #include <linux/blkpg.h> |
| 52 | #include <linux/blkdev.h> |
| 53 | #include <linux/elevator.h> |
| 54 | #include <linux/rtc.h> |
| 55 | #include <linux/pci.h> |
| 56 | #include <linux/module.h> |
| 57 | #include <linux/serial.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | #include <linux/if_tun.h> |
| 59 | #include <linux/ctype.h> |
| 60 | #include <linux/ioctl32.h> |
| 61 | #include <linux/syscalls.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | #include <linux/i2c.h> |
| 63 | #include <linux/i2c-dev.h> |
| 64 | #include <linux/wireless.h> |
| 65 | #include <linux/atalk.h> |
Jens Axboe | 2056a78 | 2006-03-23 20:00:26 +0100 | [diff] [blame] | 66 | #include <linux/blktrace_api.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
| 68 | #include <net/sock.h> /* siocdevprivate_ioctl */ |
| 69 | #include <net/bluetooth/bluetooth.h> |
| 70 | #include <net/bluetooth/hci.h> |
| 71 | #include <net/bluetooth/rfcomm.h> |
| 72 | |
| 73 | #include <linux/capi.h> |
Hansjoerg Lipp | 5024ad4 | 2006-06-26 00:25:35 -0700 | [diff] [blame] | 74 | #include <linux/gigaset_dev.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
| 76 | #include <scsi/scsi.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | #include <scsi/scsi_ioctl.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | #include <scsi/sg.h> |
| 79 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | #include <asm/uaccess.h> |
| 81 | #include <linux/ethtool.h> |
| 82 | #include <linux/mii.h> |
| 83 | #include <linux/if_bonding.h> |
| 84 | #include <linux/watchdog.h> |
| 85 | #include <linux/dm-ioctl.h> |
| 86 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | #include <linux/soundcard.h> |
| 88 | #include <linux/lp.h> |
| 89 | #include <linux/ppdev.h> |
| 90 | |
| 91 | #include <linux/atm.h> |
| 92 | #include <linux/atmarp.h> |
| 93 | #include <linux/atmclip.h> |
| 94 | #include <linux/atmdev.h> |
| 95 | #include <linux/atmioc.h> |
| 96 | #include <linux/atmlec.h> |
| 97 | #include <linux/atmmpc.h> |
| 98 | #include <linux/atmsvc.h> |
| 99 | #include <linux/atm_tcp.h> |
| 100 | #include <linux/sonet.h> |
| 101 | #include <linux/atm_suni.h> |
| 102 | #include <linux/mtd/mtd.h> |
| 103 | |
| 104 | #include <linux/usb.h> |
| 105 | #include <linux/usbdevice_fs.h> |
| 106 | #include <linux/nbd.h> |
| 107 | #include <linux/random.h> |
| 108 | #include <linux/filter.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | #include <linux/pktcdvd.h> |
| 110 | |
| 111 | #include <linux/hiddev.h> |
| 112 | |
David S. Miller | 6e87abd | 2005-11-16 00:52:57 -0800 | [diff] [blame] | 113 | #include <linux/dvb/audio.h> |
| 114 | #include <linux/dvb/dmx.h> |
| 115 | #include <linux/dvb/frontend.h> |
| 116 | #include <linux/dvb/video.h> |
Andi Kleen | c6b44d1 | 2006-01-12 01:05:26 -0800 | [diff] [blame] | 117 | #include <linux/lp.h> |
David S. Miller | 6e87abd | 2005-11-16 00:52:57 -0800 | [diff] [blame] | 118 | |
Christoph Hellwig | e6a6d2e | 2006-01-09 20:52:14 -0800 | [diff] [blame] | 119 | static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd, |
| 120 | unsigned long arg, struct file *f) |
| 121 | { |
| 122 | return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg)); |
| 123 | } |
| 124 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | static int w_long(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 126 | { |
| 127 | mm_segment_t old_fs = get_fs(); |
| 128 | int err; |
| 129 | unsigned long val; |
| 130 | |
| 131 | set_fs (KERNEL_DS); |
| 132 | err = sys_ioctl(fd, cmd, (unsigned long)&val); |
| 133 | set_fs (old_fs); |
| 134 | if (!err && put_user(val, (u32 __user *)compat_ptr(arg))) |
| 135 | return -EFAULT; |
| 136 | return err; |
| 137 | } |
| 138 | |
| 139 | static int rw_long(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 140 | { |
| 141 | mm_segment_t old_fs = get_fs(); |
| 142 | u32 __user *argptr = compat_ptr(arg); |
| 143 | int err; |
| 144 | unsigned long val; |
| 145 | |
| 146 | if(get_user(val, argptr)) |
| 147 | return -EFAULT; |
| 148 | set_fs (KERNEL_DS); |
| 149 | err = sys_ioctl(fd, cmd, (unsigned long)&val); |
| 150 | set_fs (old_fs); |
| 151 | if (!err && put_user(val, argptr)) |
| 152 | return -EFAULT; |
| 153 | return err; |
| 154 | } |
| 155 | |
David S. Miller | 6e87abd | 2005-11-16 00:52:57 -0800 | [diff] [blame] | 156 | struct compat_video_event { |
| 157 | int32_t type; |
| 158 | compat_time_t timestamp; |
| 159 | union { |
| 160 | video_size_t size; |
| 161 | unsigned int frame_rate; |
| 162 | } u; |
| 163 | }; |
| 164 | |
| 165 | static int do_video_get_event(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 166 | { |
| 167 | struct video_event kevent; |
| 168 | mm_segment_t old_fs = get_fs(); |
| 169 | int err; |
| 170 | |
| 171 | set_fs(KERNEL_DS); |
| 172 | err = sys_ioctl(fd, cmd, (unsigned long) &kevent); |
| 173 | set_fs(old_fs); |
| 174 | |
| 175 | if (!err) { |
| 176 | struct compat_video_event __user *up = compat_ptr(arg); |
| 177 | |
| 178 | err = put_user(kevent.type, &up->type); |
| 179 | err |= put_user(kevent.timestamp, &up->timestamp); |
| 180 | err |= put_user(kevent.u.size.w, &up->u.size.w); |
| 181 | err |= put_user(kevent.u.size.h, &up->u.size.h); |
| 182 | err |= put_user(kevent.u.size.aspect_ratio, |
| 183 | &up->u.size.aspect_ratio); |
| 184 | if (err) |
| 185 | err = -EFAULT; |
| 186 | } |
| 187 | |
| 188 | return err; |
| 189 | } |
| 190 | |
| 191 | struct compat_video_still_picture { |
| 192 | compat_uptr_t iFrame; |
| 193 | int32_t size; |
| 194 | }; |
| 195 | |
| 196 | static int do_video_stillpicture(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 197 | { |
| 198 | struct compat_video_still_picture __user *up; |
| 199 | struct video_still_picture __user *up_native; |
| 200 | compat_uptr_t fp; |
| 201 | int32_t size; |
| 202 | int err; |
| 203 | |
| 204 | up = (struct compat_video_still_picture __user *) arg; |
| 205 | err = get_user(fp, &up->iFrame); |
| 206 | err |= get_user(size, &up->size); |
| 207 | if (err) |
| 208 | return -EFAULT; |
| 209 | |
| 210 | up_native = |
| 211 | compat_alloc_user_space(sizeof(struct video_still_picture)); |
| 212 | |
Heiko Carstens | 7116e99 | 2006-12-06 20:36:36 -0800 | [diff] [blame] | 213 | err = put_user(compat_ptr(fp), &up_native->iFrame); |
| 214 | err |= put_user(size, &up_native->size); |
| 215 | if (err) |
| 216 | return -EFAULT; |
David S. Miller | 6e87abd | 2005-11-16 00:52:57 -0800 | [diff] [blame] | 217 | |
| 218 | err = sys_ioctl(fd, cmd, (unsigned long) up_native); |
| 219 | |
| 220 | return err; |
| 221 | } |
| 222 | |
| 223 | struct compat_video_spu_palette { |
| 224 | int length; |
| 225 | compat_uptr_t palette; |
| 226 | }; |
| 227 | |
| 228 | static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 229 | { |
| 230 | struct compat_video_spu_palette __user *up; |
| 231 | struct video_spu_palette __user *up_native; |
| 232 | compat_uptr_t palp; |
| 233 | int length, err; |
| 234 | |
| 235 | up = (struct compat_video_spu_palette __user *) arg; |
| 236 | err = get_user(palp, &up->palette); |
| 237 | err |= get_user(length, &up->length); |
| 238 | |
| 239 | up_native = compat_alloc_user_space(sizeof(struct video_spu_palette)); |
Heiko Carstens | 7116e99 | 2006-12-06 20:36:36 -0800 | [diff] [blame] | 240 | err = put_user(compat_ptr(palp), &up_native->palette); |
| 241 | err |= put_user(length, &up_native->length); |
| 242 | if (err) |
| 243 | return -EFAULT; |
David S. Miller | 6e87abd | 2005-11-16 00:52:57 -0800 | [diff] [blame] | 244 | |
| 245 | err = sys_ioctl(fd, cmd, (unsigned long) up_native); |
| 246 | |
| 247 | return err; |
| 248 | } |
| 249 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | #ifdef CONFIG_NET |
| 251 | static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 252 | { |
| 253 | struct compat_timeval __user *up = compat_ptr(arg); |
| 254 | struct timeval ktv; |
| 255 | mm_segment_t old_fs = get_fs(); |
| 256 | int err; |
| 257 | |
| 258 | set_fs(KERNEL_DS); |
| 259 | err = sys_ioctl(fd, cmd, (unsigned long)&ktv); |
| 260 | set_fs(old_fs); |
| 261 | if(!err) { |
| 262 | err = put_user(ktv.tv_sec, &up->tv_sec); |
| 263 | err |= __put_user(ktv.tv_usec, &up->tv_usec); |
| 264 | } |
| 265 | return err; |
| 266 | } |
| 267 | |
Eric Dumazet | ae40eb1 | 2007-03-18 17:33:16 -0700 | [diff] [blame] | 268 | static int do_siocgstampns(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 269 | { |
| 270 | struct compat_timespec __user *up = compat_ptr(arg); |
| 271 | struct timespec kts; |
| 272 | mm_segment_t old_fs = get_fs(); |
| 273 | int err; |
| 274 | |
| 275 | set_fs(KERNEL_DS); |
| 276 | err = sys_ioctl(fd, cmd, (unsigned long)&kts); |
| 277 | set_fs(old_fs); |
| 278 | if (!err) { |
| 279 | err = put_user(kts.tv_sec, &up->tv_sec); |
| 280 | err |= __put_user(kts.tv_nsec, &up->tv_nsec); |
| 281 | } |
| 282 | return err; |
| 283 | } |
| 284 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | struct ifmap32 { |
| 286 | compat_ulong_t mem_start; |
| 287 | compat_ulong_t mem_end; |
| 288 | unsigned short base_addr; |
| 289 | unsigned char irq; |
| 290 | unsigned char dma; |
| 291 | unsigned char port; |
| 292 | }; |
| 293 | |
| 294 | struct ifreq32 { |
| 295 | #define IFHWADDRLEN 6 |
| 296 | #define IFNAMSIZ 16 |
| 297 | union { |
| 298 | char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
| 299 | } ifr_ifrn; |
| 300 | union { |
| 301 | struct sockaddr ifru_addr; |
| 302 | struct sockaddr ifru_dstaddr; |
| 303 | struct sockaddr ifru_broadaddr; |
| 304 | struct sockaddr ifru_netmask; |
| 305 | struct sockaddr ifru_hwaddr; |
| 306 | short ifru_flags; |
| 307 | compat_int_t ifru_ivalue; |
| 308 | compat_int_t ifru_mtu; |
| 309 | struct ifmap32 ifru_map; |
| 310 | char ifru_slave[IFNAMSIZ]; /* Just fits the size */ |
| 311 | char ifru_newname[IFNAMSIZ]; |
| 312 | compat_caddr_t ifru_data; |
| 313 | /* XXXX? ifru_settings should be here */ |
| 314 | } ifr_ifru; |
| 315 | }; |
| 316 | |
| 317 | struct ifconf32 { |
| 318 | compat_int_t ifc_len; /* size of buffer */ |
| 319 | compat_caddr_t ifcbuf; |
| 320 | }; |
| 321 | |
| 322 | static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 323 | { |
| 324 | struct net_device *dev; |
| 325 | struct ifreq32 ifr32; |
| 326 | int err; |
| 327 | |
| 328 | if (copy_from_user(&ifr32, compat_ptr(arg), sizeof(ifr32))) |
| 329 | return -EFAULT; |
| 330 | |
| 331 | dev = dev_get_by_index(ifr32.ifr_ifindex); |
| 332 | if (!dev) |
| 333 | return -ENODEV; |
| 334 | |
| 335 | strlcpy(ifr32.ifr_name, dev->name, sizeof(ifr32.ifr_name)); |
| 336 | dev_put(dev); |
| 337 | |
| 338 | err = copy_to_user(compat_ptr(arg), &ifr32, sizeof(ifr32)); |
| 339 | return (err ? -EFAULT : 0); |
| 340 | } |
| 341 | |
| 342 | static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 343 | { |
| 344 | struct ifconf32 ifc32; |
| 345 | struct ifconf ifc; |
| 346 | struct ifconf __user *uifc; |
| 347 | struct ifreq32 __user *ifr32; |
| 348 | struct ifreq __user *ifr; |
| 349 | unsigned int i, j; |
| 350 | int err; |
| 351 | |
| 352 | if (copy_from_user(&ifc32, compat_ptr(arg), sizeof(struct ifconf32))) |
| 353 | return -EFAULT; |
| 354 | |
| 355 | if (ifc32.ifcbuf == 0) { |
| 356 | ifc32.ifc_len = 0; |
| 357 | ifc.ifc_len = 0; |
| 358 | ifc.ifc_req = NULL; |
| 359 | uifc = compat_alloc_user_space(sizeof(struct ifconf)); |
| 360 | } else { |
| 361 | size_t len =((ifc32.ifc_len / sizeof (struct ifreq32)) + 1) * |
| 362 | sizeof (struct ifreq); |
| 363 | uifc = compat_alloc_user_space(sizeof(struct ifconf) + len); |
| 364 | ifc.ifc_len = len; |
| 365 | ifr = ifc.ifc_req = (void __user *)(uifc + 1); |
| 366 | ifr32 = compat_ptr(ifc32.ifcbuf); |
| 367 | for (i = 0; i < ifc32.ifc_len; i += sizeof (struct ifreq32)) { |
| 368 | if (copy_in_user(ifr, ifr32, sizeof(struct ifreq32))) |
| 369 | return -EFAULT; |
| 370 | ifr++; |
| 371 | ifr32++; |
| 372 | } |
| 373 | } |
| 374 | if (copy_to_user(uifc, &ifc, sizeof(struct ifconf))) |
| 375 | return -EFAULT; |
| 376 | |
| 377 | err = sys_ioctl (fd, SIOCGIFCONF, (unsigned long)uifc); |
| 378 | if (err) |
| 379 | return err; |
| 380 | |
| 381 | if (copy_from_user(&ifc, uifc, sizeof(struct ifconf))) |
| 382 | return -EFAULT; |
| 383 | |
| 384 | ifr = ifc.ifc_req; |
| 385 | ifr32 = compat_ptr(ifc32.ifcbuf); |
Alexandra Kossovsky | 4909724 | 2005-11-20 13:41:59 -0800 | [diff] [blame] | 386 | for (i = 0, j = 0; |
Randy Dunlap | 1efa3c0 | 2006-03-08 16:46:08 -0800 | [diff] [blame] | 387 | i + sizeof (struct ifreq32) <= ifc32.ifc_len && j < ifc.ifc_len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) { |
| 389 | if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32))) |
| 390 | return -EFAULT; |
| 391 | ifr32++; |
| 392 | ifr++; |
| 393 | } |
| 394 | |
| 395 | if (ifc32.ifcbuf == 0) { |
| 396 | /* Translate from 64-bit structure multiple to |
| 397 | * a 32-bit one. |
| 398 | */ |
| 399 | i = ifc.ifc_len; |
| 400 | i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32)); |
| 401 | ifc32.ifc_len = i; |
| 402 | } else { |
Alexandra Kossovsky | 4909724 | 2005-11-20 13:41:59 -0800 | [diff] [blame] | 403 | ifc32.ifc_len = i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | } |
| 405 | if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32))) |
| 406 | return -EFAULT; |
| 407 | |
| 408 | return 0; |
| 409 | } |
| 410 | |
| 411 | static int ethtool_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 412 | { |
| 413 | struct ifreq __user *ifr; |
| 414 | struct ifreq32 __user *ifr32; |
| 415 | u32 data; |
| 416 | void __user *datap; |
| 417 | |
| 418 | ifr = compat_alloc_user_space(sizeof(*ifr)); |
| 419 | ifr32 = compat_ptr(arg); |
| 420 | |
| 421 | if (copy_in_user(&ifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ)) |
| 422 | return -EFAULT; |
| 423 | |
| 424 | if (get_user(data, &ifr32->ifr_ifru.ifru_data)) |
| 425 | return -EFAULT; |
| 426 | |
| 427 | datap = compat_ptr(data); |
| 428 | if (put_user(datap, &ifr->ifr_ifru.ifru_data)) |
| 429 | return -EFAULT; |
| 430 | |
| 431 | return sys_ioctl(fd, cmd, (unsigned long) ifr); |
| 432 | } |
| 433 | |
| 434 | static int bond_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 435 | { |
| 436 | struct ifreq kifr; |
| 437 | struct ifreq __user *uifr; |
| 438 | struct ifreq32 __user *ifr32 = compat_ptr(arg); |
| 439 | mm_segment_t old_fs; |
| 440 | int err; |
| 441 | u32 data; |
| 442 | void __user *datap; |
| 443 | |
| 444 | switch (cmd) { |
| 445 | case SIOCBONDENSLAVE: |
| 446 | case SIOCBONDRELEASE: |
| 447 | case SIOCBONDSETHWADDR: |
| 448 | case SIOCBONDCHANGEACTIVE: |
| 449 | if (copy_from_user(&kifr, ifr32, sizeof(struct ifreq32))) |
| 450 | return -EFAULT; |
| 451 | |
| 452 | old_fs = get_fs(); |
| 453 | set_fs (KERNEL_DS); |
| 454 | err = sys_ioctl (fd, cmd, (unsigned long)&kifr); |
| 455 | set_fs (old_fs); |
| 456 | |
| 457 | return err; |
| 458 | case SIOCBONDSLAVEINFOQUERY: |
| 459 | case SIOCBONDINFOQUERY: |
| 460 | uifr = compat_alloc_user_space(sizeof(*uifr)); |
| 461 | if (copy_in_user(&uifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ)) |
| 462 | return -EFAULT; |
| 463 | |
| 464 | if (get_user(data, &ifr32->ifr_ifru.ifru_data)) |
| 465 | return -EFAULT; |
| 466 | |
| 467 | datap = compat_ptr(data); |
| 468 | if (put_user(datap, &uifr->ifr_ifru.ifru_data)) |
| 469 | return -EFAULT; |
| 470 | |
| 471 | return sys_ioctl (fd, cmd, (unsigned long)uifr); |
| 472 | default: |
| 473 | return -EINVAL; |
| 474 | }; |
| 475 | } |
| 476 | |
| 477 | int siocdevprivate_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 478 | { |
| 479 | struct ifreq __user *u_ifreq64; |
| 480 | struct ifreq32 __user *u_ifreq32 = compat_ptr(arg); |
| 481 | char tmp_buf[IFNAMSIZ]; |
| 482 | void __user *data64; |
| 483 | u32 data32; |
| 484 | |
| 485 | if (copy_from_user(&tmp_buf[0], &(u_ifreq32->ifr_ifrn.ifrn_name[0]), |
| 486 | IFNAMSIZ)) |
| 487 | return -EFAULT; |
| 488 | if (__get_user(data32, &u_ifreq32->ifr_ifru.ifru_data)) |
| 489 | return -EFAULT; |
| 490 | data64 = compat_ptr(data32); |
| 491 | |
| 492 | u_ifreq64 = compat_alloc_user_space(sizeof(*u_ifreq64)); |
| 493 | |
| 494 | /* Don't check these user accesses, just let that get trapped |
| 495 | * in the ioctl handler instead. |
| 496 | */ |
| 497 | if (copy_to_user(&u_ifreq64->ifr_ifrn.ifrn_name[0], &tmp_buf[0], |
| 498 | IFNAMSIZ)) |
| 499 | return -EFAULT; |
| 500 | if (__put_user(data64, &u_ifreq64->ifr_ifru.ifru_data)) |
| 501 | return -EFAULT; |
| 502 | |
| 503 | return sys_ioctl(fd, cmd, (unsigned long) u_ifreq64); |
| 504 | } |
| 505 | |
| 506 | static int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 507 | { |
| 508 | struct ifreq ifr; |
| 509 | struct ifreq32 __user *uifr32; |
| 510 | struct ifmap32 __user *uifmap32; |
| 511 | mm_segment_t old_fs; |
| 512 | int err; |
| 513 | |
| 514 | uifr32 = compat_ptr(arg); |
| 515 | uifmap32 = &uifr32->ifr_ifru.ifru_map; |
| 516 | switch (cmd) { |
| 517 | case SIOCSIFMAP: |
| 518 | err = copy_from_user(&ifr, uifr32, sizeof(ifr.ifr_name)); |
| 519 | err |= __get_user(ifr.ifr_map.mem_start, &uifmap32->mem_start); |
| 520 | err |= __get_user(ifr.ifr_map.mem_end, &uifmap32->mem_end); |
| 521 | err |= __get_user(ifr.ifr_map.base_addr, &uifmap32->base_addr); |
| 522 | err |= __get_user(ifr.ifr_map.irq, &uifmap32->irq); |
| 523 | err |= __get_user(ifr.ifr_map.dma, &uifmap32->dma); |
| 524 | err |= __get_user(ifr.ifr_map.port, &uifmap32->port); |
| 525 | if (err) |
| 526 | return -EFAULT; |
| 527 | break; |
| 528 | default: |
| 529 | if (copy_from_user(&ifr, uifr32, sizeof(*uifr32))) |
| 530 | return -EFAULT; |
| 531 | break; |
| 532 | } |
| 533 | old_fs = get_fs(); |
| 534 | set_fs (KERNEL_DS); |
| 535 | err = sys_ioctl (fd, cmd, (unsigned long)&ifr); |
| 536 | set_fs (old_fs); |
| 537 | if (!err) { |
| 538 | switch (cmd) { |
| 539 | /* TUNSETIFF is defined as _IOW, it should be _IORW |
| 540 | * as the data is copied back to user space, but that |
| 541 | * cannot be fixed without breaking all existing apps. |
| 542 | */ |
| 543 | case TUNSETIFF: |
| 544 | case SIOCGIFFLAGS: |
| 545 | case SIOCGIFMETRIC: |
| 546 | case SIOCGIFMTU: |
| 547 | case SIOCGIFMEM: |
| 548 | case SIOCGIFHWADDR: |
| 549 | case SIOCGIFINDEX: |
| 550 | case SIOCGIFADDR: |
| 551 | case SIOCGIFBRDADDR: |
| 552 | case SIOCGIFDSTADDR: |
| 553 | case SIOCGIFNETMASK: |
| 554 | case SIOCGIFTXQLEN: |
| 555 | if (copy_to_user(uifr32, &ifr, sizeof(*uifr32))) |
| 556 | return -EFAULT; |
| 557 | break; |
| 558 | case SIOCGIFMAP: |
| 559 | err = copy_to_user(uifr32, &ifr, sizeof(ifr.ifr_name)); |
| 560 | err |= __put_user(ifr.ifr_map.mem_start, &uifmap32->mem_start); |
| 561 | err |= __put_user(ifr.ifr_map.mem_end, &uifmap32->mem_end); |
| 562 | err |= __put_user(ifr.ifr_map.base_addr, &uifmap32->base_addr); |
| 563 | err |= __put_user(ifr.ifr_map.irq, &uifmap32->irq); |
| 564 | err |= __put_user(ifr.ifr_map.dma, &uifmap32->dma); |
| 565 | err |= __put_user(ifr.ifr_map.port, &uifmap32->port); |
| 566 | if (err) |
| 567 | err = -EFAULT; |
| 568 | break; |
| 569 | } |
| 570 | } |
| 571 | return err; |
| 572 | } |
| 573 | |
| 574 | struct rtentry32 { |
| 575 | u32 rt_pad1; |
| 576 | struct sockaddr rt_dst; /* target address */ |
| 577 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ |
| 578 | struct sockaddr rt_genmask; /* target network mask (IP) */ |
| 579 | unsigned short rt_flags; |
| 580 | short rt_pad2; |
| 581 | u32 rt_pad3; |
| 582 | unsigned char rt_tos; |
| 583 | unsigned char rt_class; |
| 584 | short rt_pad4; |
| 585 | short rt_metric; /* +1 for binary compatibility! */ |
| 586 | /* char * */ u32 rt_dev; /* forcing the device at add */ |
| 587 | u32 rt_mtu; /* per route MTU/Window */ |
| 588 | u32 rt_window; /* Window clamping */ |
| 589 | unsigned short rt_irtt; /* Initial RTT */ |
| 590 | |
| 591 | }; |
| 592 | |
| 593 | struct in6_rtmsg32 { |
| 594 | struct in6_addr rtmsg_dst; |
| 595 | struct in6_addr rtmsg_src; |
| 596 | struct in6_addr rtmsg_gateway; |
| 597 | u32 rtmsg_type; |
| 598 | u16 rtmsg_dst_len; |
| 599 | u16 rtmsg_src_len; |
| 600 | u32 rtmsg_metric; |
| 601 | u32 rtmsg_info; |
| 602 | u32 rtmsg_flags; |
| 603 | s32 rtmsg_ifindex; |
| 604 | }; |
| 605 | |
| 606 | static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 607 | { |
| 608 | int ret; |
| 609 | void *r = NULL; |
| 610 | struct in6_rtmsg r6; |
| 611 | struct rtentry r4; |
| 612 | char devname[16]; |
| 613 | u32 rtdev; |
| 614 | mm_segment_t old_fs = get_fs(); |
| 615 | |
| 616 | struct socket *mysock = sockfd_lookup(fd, &ret); |
| 617 | |
| 618 | if (mysock && mysock->sk && mysock->sk->sk_family == AF_INET6) { /* ipv6 */ |
| 619 | struct in6_rtmsg32 __user *ur6 = compat_ptr(arg); |
| 620 | ret = copy_from_user (&r6.rtmsg_dst, &(ur6->rtmsg_dst), |
| 621 | 3 * sizeof(struct in6_addr)); |
| 622 | ret |= __get_user (r6.rtmsg_type, &(ur6->rtmsg_type)); |
| 623 | ret |= __get_user (r6.rtmsg_dst_len, &(ur6->rtmsg_dst_len)); |
| 624 | ret |= __get_user (r6.rtmsg_src_len, &(ur6->rtmsg_src_len)); |
| 625 | ret |= __get_user (r6.rtmsg_metric, &(ur6->rtmsg_metric)); |
| 626 | ret |= __get_user (r6.rtmsg_info, &(ur6->rtmsg_info)); |
| 627 | ret |= __get_user (r6.rtmsg_flags, &(ur6->rtmsg_flags)); |
| 628 | ret |= __get_user (r6.rtmsg_ifindex, &(ur6->rtmsg_ifindex)); |
| 629 | |
| 630 | r = (void *) &r6; |
| 631 | } else { /* ipv4 */ |
| 632 | struct rtentry32 __user *ur4 = compat_ptr(arg); |
| 633 | ret = copy_from_user (&r4.rt_dst, &(ur4->rt_dst), |
| 634 | 3 * sizeof(struct sockaddr)); |
| 635 | ret |= __get_user (r4.rt_flags, &(ur4->rt_flags)); |
| 636 | ret |= __get_user (r4.rt_metric, &(ur4->rt_metric)); |
| 637 | ret |= __get_user (r4.rt_mtu, &(ur4->rt_mtu)); |
| 638 | ret |= __get_user (r4.rt_window, &(ur4->rt_window)); |
| 639 | ret |= __get_user (r4.rt_irtt, &(ur4->rt_irtt)); |
| 640 | ret |= __get_user (rtdev, &(ur4->rt_dev)); |
| 641 | if (rtdev) { |
| 642 | ret |= copy_from_user (devname, compat_ptr(rtdev), 15); |
| 643 | r4.rt_dev = devname; devname[15] = 0; |
| 644 | } else |
| 645 | r4.rt_dev = NULL; |
| 646 | |
| 647 | r = (void *) &r4; |
| 648 | } |
| 649 | |
Kirill Korotaev | d99901d | 2005-09-09 13:59:48 +0400 | [diff] [blame] | 650 | if (ret) { |
| 651 | ret = -EFAULT; |
| 652 | goto out; |
| 653 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 654 | |
| 655 | set_fs (KERNEL_DS); |
| 656 | ret = sys_ioctl (fd, cmd, (unsigned long) r); |
| 657 | set_fs (old_fs); |
| 658 | |
Kirill Korotaev | d99901d | 2005-09-09 13:59:48 +0400 | [diff] [blame] | 659 | out: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 660 | if (mysock) |
| 661 | sockfd_put(mysock); |
| 662 | |
| 663 | return ret; |
| 664 | } |
| 665 | #endif |
| 666 | |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 667 | #ifdef CONFIG_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 668 | struct hd_geometry32 { |
| 669 | unsigned char heads; |
| 670 | unsigned char sectors; |
| 671 | unsigned short cylinders; |
| 672 | u32 start; |
| 673 | }; |
| 674 | |
| 675 | static int hdio_getgeo(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 676 | { |
| 677 | mm_segment_t old_fs = get_fs(); |
| 678 | struct hd_geometry geo; |
| 679 | struct hd_geometry32 __user *ugeo; |
| 680 | int err; |
| 681 | |
| 682 | set_fs (KERNEL_DS); |
| 683 | err = sys_ioctl(fd, HDIO_GETGEO, (unsigned long)&geo); |
| 684 | set_fs (old_fs); |
| 685 | ugeo = compat_ptr(arg); |
| 686 | if (!err) { |
| 687 | err = copy_to_user (ugeo, &geo, 4); |
| 688 | err |= __put_user (geo.start, &ugeo->start); |
| 689 | } |
| 690 | return err ? -EFAULT : 0; |
| 691 | } |
| 692 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 693 | static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 694 | { |
| 695 | mm_segment_t old_fs = get_fs(); |
| 696 | unsigned long kval; |
| 697 | unsigned int __user *uvp; |
| 698 | int error; |
| 699 | |
| 700 | set_fs(KERNEL_DS); |
| 701 | error = sys_ioctl(fd, cmd, (long)&kval); |
| 702 | set_fs(old_fs); |
| 703 | |
| 704 | if(error == 0) { |
| 705 | uvp = compat_ptr(arg); |
| 706 | if(put_user(kval, uvp)) |
| 707 | error = -EFAULT; |
| 708 | } |
| 709 | return error; |
| 710 | } |
| 711 | |
| 712 | |
| 713 | typedef struct sg_io_hdr32 { |
| 714 | compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ |
| 715 | compat_int_t dxfer_direction; /* [i] data transfer direction */ |
| 716 | unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */ |
| 717 | unsigned char mx_sb_len; /* [i] max length to write to sbp */ |
| 718 | unsigned short iovec_count; /* [i] 0 implies no scatter gather */ |
| 719 | compat_uint_t dxfer_len; /* [i] byte count of data transfer */ |
| 720 | compat_uint_t dxferp; /* [i], [*io] points to data transfer memory |
| 721 | or scatter gather list */ |
| 722 | compat_uptr_t cmdp; /* [i], [*i] points to command to perform */ |
| 723 | compat_uptr_t sbp; /* [i], [*o] points to sense_buffer memory */ |
| 724 | compat_uint_t timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ |
| 725 | compat_uint_t flags; /* [i] 0 -> default, see SG_FLAG... */ |
| 726 | compat_int_t pack_id; /* [i->o] unused internally (normally) */ |
| 727 | compat_uptr_t usr_ptr; /* [i->o] unused internally */ |
| 728 | unsigned char status; /* [o] scsi status */ |
| 729 | unsigned char masked_status; /* [o] shifted, masked scsi status */ |
| 730 | unsigned char msg_status; /* [o] messaging level data (optional) */ |
| 731 | unsigned char sb_len_wr; /* [o] byte count actually written to sbp */ |
| 732 | unsigned short host_status; /* [o] errors from host adapter */ |
| 733 | unsigned short driver_status; /* [o] errors from software driver */ |
| 734 | compat_int_t resid; /* [o] dxfer_len - actual_transferred */ |
| 735 | compat_uint_t duration; /* [o] time taken by cmd (unit: millisec) */ |
| 736 | compat_uint_t info; /* [o] auxiliary information */ |
| 737 | } sg_io_hdr32_t; /* 64 bytes long (on sparc32) */ |
| 738 | |
| 739 | typedef struct sg_iovec32 { |
| 740 | compat_uint_t iov_base; |
| 741 | compat_uint_t iov_len; |
| 742 | } sg_iovec32_t; |
| 743 | |
| 744 | static int sg_build_iovec(sg_io_hdr_t __user *sgio, void __user *dxferp, u16 iovec_count) |
| 745 | { |
| 746 | sg_iovec_t __user *iov = (sg_iovec_t __user *) (sgio + 1); |
| 747 | sg_iovec32_t __user *iov32 = dxferp; |
| 748 | int i; |
| 749 | |
| 750 | for (i = 0; i < iovec_count; i++) { |
| 751 | u32 base, len; |
| 752 | |
| 753 | if (get_user(base, &iov32[i].iov_base) || |
| 754 | get_user(len, &iov32[i].iov_len) || |
| 755 | put_user(compat_ptr(base), &iov[i].iov_base) || |
| 756 | put_user(len, &iov[i].iov_len)) |
| 757 | return -EFAULT; |
| 758 | } |
| 759 | |
| 760 | if (put_user(iov, &sgio->dxferp)) |
| 761 | return -EFAULT; |
| 762 | return 0; |
| 763 | } |
| 764 | |
| 765 | static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 766 | { |
| 767 | sg_io_hdr_t __user *sgio; |
| 768 | sg_io_hdr32_t __user *sgio32; |
| 769 | u16 iovec_count; |
| 770 | u32 data; |
| 771 | void __user *dxferp; |
| 772 | int err; |
| 773 | |
| 774 | sgio32 = compat_ptr(arg); |
| 775 | if (get_user(iovec_count, &sgio32->iovec_count)) |
| 776 | return -EFAULT; |
| 777 | |
| 778 | { |
| 779 | void __user *top = compat_alloc_user_space(0); |
| 780 | void __user *new = compat_alloc_user_space(sizeof(sg_io_hdr_t) + |
| 781 | (iovec_count * sizeof(sg_iovec_t))); |
| 782 | if (new > top) |
| 783 | return -EINVAL; |
| 784 | |
| 785 | sgio = new; |
| 786 | } |
| 787 | |
| 788 | /* Ok, now construct. */ |
| 789 | if (copy_in_user(&sgio->interface_id, &sgio32->interface_id, |
| 790 | (2 * sizeof(int)) + |
| 791 | (2 * sizeof(unsigned char)) + |
| 792 | (1 * sizeof(unsigned short)) + |
| 793 | (1 * sizeof(unsigned int)))) |
| 794 | return -EFAULT; |
| 795 | |
| 796 | if (get_user(data, &sgio32->dxferp)) |
| 797 | return -EFAULT; |
| 798 | dxferp = compat_ptr(data); |
| 799 | if (iovec_count) { |
| 800 | if (sg_build_iovec(sgio, dxferp, iovec_count)) |
| 801 | return -EFAULT; |
| 802 | } else { |
| 803 | if (put_user(dxferp, &sgio->dxferp)) |
| 804 | return -EFAULT; |
| 805 | } |
| 806 | |
| 807 | { |
| 808 | unsigned char __user *cmdp; |
| 809 | unsigned char __user *sbp; |
| 810 | |
| 811 | if (get_user(data, &sgio32->cmdp)) |
| 812 | return -EFAULT; |
| 813 | cmdp = compat_ptr(data); |
| 814 | |
| 815 | if (get_user(data, &sgio32->sbp)) |
| 816 | return -EFAULT; |
| 817 | sbp = compat_ptr(data); |
| 818 | |
| 819 | if (put_user(cmdp, &sgio->cmdp) || |
| 820 | put_user(sbp, &sgio->sbp)) |
| 821 | return -EFAULT; |
| 822 | } |
| 823 | |
| 824 | if (copy_in_user(&sgio->timeout, &sgio32->timeout, |
| 825 | 3 * sizeof(int))) |
| 826 | return -EFAULT; |
| 827 | |
| 828 | if (get_user(data, &sgio32->usr_ptr)) |
| 829 | return -EFAULT; |
| 830 | if (put_user(compat_ptr(data), &sgio->usr_ptr)) |
| 831 | return -EFAULT; |
| 832 | |
| 833 | if (copy_in_user(&sgio->status, &sgio32->status, |
| 834 | (4 * sizeof(unsigned char)) + |
| 835 | (2 * sizeof(unsigned (short))) + |
| 836 | (3 * sizeof(int)))) |
| 837 | return -EFAULT; |
| 838 | |
| 839 | err = sys_ioctl(fd, cmd, (unsigned long) sgio); |
| 840 | |
| 841 | if (err >= 0) { |
| 842 | void __user *datap; |
| 843 | |
| 844 | if (copy_in_user(&sgio32->pack_id, &sgio->pack_id, |
| 845 | sizeof(int)) || |
| 846 | get_user(datap, &sgio->usr_ptr) || |
| 847 | put_user((u32)(unsigned long)datap, |
| 848 | &sgio32->usr_ptr) || |
| 849 | copy_in_user(&sgio32->status, &sgio->status, |
| 850 | (4 * sizeof(unsigned char)) + |
| 851 | (2 * sizeof(unsigned short)) + |
| 852 | (3 * sizeof(int)))) |
| 853 | err = -EFAULT; |
| 854 | } |
| 855 | |
| 856 | return err; |
| 857 | } |
| 858 | |
Andi Kleen | 2966387 | 2006-01-11 22:44:03 +0100 | [diff] [blame] | 859 | struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */ |
| 860 | char req_state; |
| 861 | char orphan; |
| 862 | char sg_io_owned; |
| 863 | char problem; |
| 864 | int pack_id; |
| 865 | compat_uptr_t usr_ptr; |
| 866 | unsigned int duration; |
| 867 | int unused; |
| 868 | }; |
| 869 | |
| 870 | static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 871 | { |
| 872 | int err, i; |
Al Viro | 6b2b4e5 | 2006-02-01 06:33:33 -0500 | [diff] [blame] | 873 | sg_req_info_t __user *r; |
| 874 | struct compat_sg_req_info __user *o = (void __user *)arg; |
Andi Kleen | 2966387 | 2006-01-11 22:44:03 +0100 | [diff] [blame] | 875 | r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); |
| 876 | err = sys_ioctl(fd,cmd,(unsigned long)r); |
| 877 | if (err < 0) |
| 878 | return err; |
| 879 | for (i = 0; i < SG_MAX_QUEUE; i++) { |
| 880 | void __user *ptr; |
| 881 | int d; |
| 882 | |
| 883 | if (copy_in_user(o + i, r + i, offsetof(sg_req_info_t, usr_ptr)) || |
| 884 | get_user(ptr, &r[i].usr_ptr) || |
| 885 | get_user(d, &r[i].duration) || |
| 886 | put_user((u32)(unsigned long)(ptr), &o[i].usr_ptr) || |
| 887 | put_user(d, &o[i].duration)) |
| 888 | return -EFAULT; |
| 889 | } |
| 890 | return err; |
| 891 | } |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 892 | #endif /* CONFIG_BLOCK */ |
Andi Kleen | 2966387 | 2006-01-11 22:44:03 +0100 | [diff] [blame] | 893 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 894 | struct sock_fprog32 { |
| 895 | unsigned short len; |
| 896 | compat_caddr_t filter; |
| 897 | }; |
| 898 | |
| 899 | #define PPPIOCSPASS32 _IOW('t', 71, struct sock_fprog32) |
| 900 | #define PPPIOCSACTIVE32 _IOW('t', 70, struct sock_fprog32) |
| 901 | |
| 902 | static int ppp_sock_fprog_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 903 | { |
| 904 | struct sock_fprog32 __user *u_fprog32 = compat_ptr(arg); |
| 905 | struct sock_fprog __user *u_fprog64 = compat_alloc_user_space(sizeof(struct sock_fprog)); |
| 906 | void __user *fptr64; |
| 907 | u32 fptr32; |
| 908 | u16 flen; |
| 909 | |
| 910 | if (get_user(flen, &u_fprog32->len) || |
| 911 | get_user(fptr32, &u_fprog32->filter)) |
| 912 | return -EFAULT; |
| 913 | |
| 914 | fptr64 = compat_ptr(fptr32); |
| 915 | |
| 916 | if (put_user(flen, &u_fprog64->len) || |
| 917 | put_user(fptr64, &u_fprog64->filter)) |
| 918 | return -EFAULT; |
| 919 | |
| 920 | if (cmd == PPPIOCSPASS32) |
| 921 | cmd = PPPIOCSPASS; |
| 922 | else |
| 923 | cmd = PPPIOCSACTIVE; |
| 924 | |
| 925 | return sys_ioctl(fd, cmd, (unsigned long) u_fprog64); |
| 926 | } |
| 927 | |
| 928 | struct ppp_option_data32 { |
| 929 | compat_caddr_t ptr; |
| 930 | u32 length; |
| 931 | compat_int_t transmit; |
| 932 | }; |
| 933 | #define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32) |
| 934 | |
| 935 | struct ppp_idle32 { |
| 936 | compat_time_t xmit_idle; |
| 937 | compat_time_t recv_idle; |
| 938 | }; |
| 939 | #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32) |
| 940 | |
| 941 | static int ppp_gidle(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 942 | { |
| 943 | struct ppp_idle __user *idle; |
| 944 | struct ppp_idle32 __user *idle32; |
| 945 | __kernel_time_t xmit, recv; |
| 946 | int err; |
| 947 | |
| 948 | idle = compat_alloc_user_space(sizeof(*idle)); |
| 949 | idle32 = compat_ptr(arg); |
| 950 | |
| 951 | err = sys_ioctl(fd, PPPIOCGIDLE, (unsigned long) idle); |
| 952 | |
| 953 | if (!err) { |
| 954 | if (get_user(xmit, &idle->xmit_idle) || |
| 955 | get_user(recv, &idle->recv_idle) || |
| 956 | put_user(xmit, &idle32->xmit_idle) || |
| 957 | put_user(recv, &idle32->recv_idle)) |
| 958 | err = -EFAULT; |
| 959 | } |
| 960 | return err; |
| 961 | } |
| 962 | |
| 963 | static int ppp_scompress(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 964 | { |
| 965 | struct ppp_option_data __user *odata; |
| 966 | struct ppp_option_data32 __user *odata32; |
| 967 | __u32 data; |
| 968 | void __user *datap; |
| 969 | |
| 970 | odata = compat_alloc_user_space(sizeof(*odata)); |
| 971 | odata32 = compat_ptr(arg); |
| 972 | |
| 973 | if (get_user(data, &odata32->ptr)) |
| 974 | return -EFAULT; |
| 975 | |
| 976 | datap = compat_ptr(data); |
| 977 | if (put_user(datap, &odata->ptr)) |
| 978 | return -EFAULT; |
| 979 | |
| 980 | if (copy_in_user(&odata->length, &odata32->length, |
| 981 | sizeof(__u32) + sizeof(int))) |
| 982 | return -EFAULT; |
| 983 | |
| 984 | return sys_ioctl(fd, PPPIOCSCOMPRESS, (unsigned long) odata); |
| 985 | } |
| 986 | |
| 987 | static int ppp_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 988 | { |
| 989 | int err; |
| 990 | |
| 991 | switch (cmd) { |
| 992 | case PPPIOCGIDLE32: |
| 993 | err = ppp_gidle(fd, cmd, arg); |
| 994 | break; |
| 995 | |
| 996 | case PPPIOCSCOMPRESS32: |
| 997 | err = ppp_scompress(fd, cmd, arg); |
| 998 | break; |
| 999 | |
| 1000 | default: |
| 1001 | do { |
| 1002 | static int count; |
| 1003 | if (++count <= 20) |
| 1004 | printk("ppp_ioctl: Unknown cmd fd(%d) " |
| 1005 | "cmd(%08x) arg(%08x)\n", |
| 1006 | (int)fd, (unsigned int)cmd, (unsigned int)arg); |
| 1007 | } while(0); |
| 1008 | err = -EINVAL; |
| 1009 | break; |
| 1010 | }; |
| 1011 | |
| 1012 | return err; |
| 1013 | } |
| 1014 | |
| 1015 | |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 1016 | #ifdef CONFIG_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1017 | struct mtget32 { |
| 1018 | compat_long_t mt_type; |
| 1019 | compat_long_t mt_resid; |
| 1020 | compat_long_t mt_dsreg; |
| 1021 | compat_long_t mt_gstat; |
| 1022 | compat_long_t mt_erreg; |
| 1023 | compat_daddr_t mt_fileno; |
| 1024 | compat_daddr_t mt_blkno; |
| 1025 | }; |
| 1026 | #define MTIOCGET32 _IOR('m', 2, struct mtget32) |
| 1027 | |
| 1028 | struct mtpos32 { |
| 1029 | compat_long_t mt_blkno; |
| 1030 | }; |
| 1031 | #define MTIOCPOS32 _IOR('m', 3, struct mtpos32) |
| 1032 | |
| 1033 | static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1034 | { |
| 1035 | mm_segment_t old_fs = get_fs(); |
| 1036 | struct mtget get; |
| 1037 | struct mtget32 __user *umget32; |
| 1038 | struct mtpos pos; |
| 1039 | struct mtpos32 __user *upos32; |
| 1040 | unsigned long kcmd; |
| 1041 | void *karg; |
| 1042 | int err = 0; |
| 1043 | |
| 1044 | switch(cmd) { |
| 1045 | case MTIOCPOS32: |
| 1046 | kcmd = MTIOCPOS; |
| 1047 | karg = &pos; |
| 1048 | break; |
| 1049 | case MTIOCGET32: |
| 1050 | kcmd = MTIOCGET; |
| 1051 | karg = &get; |
| 1052 | break; |
| 1053 | default: |
| 1054 | do { |
| 1055 | static int count; |
| 1056 | if (++count <= 20) |
| 1057 | printk("mt_ioctl: Unknown cmd fd(%d) " |
| 1058 | "cmd(%08x) arg(%08x)\n", |
| 1059 | (int)fd, (unsigned int)cmd, (unsigned int)arg); |
| 1060 | } while(0); |
| 1061 | return -EINVAL; |
| 1062 | } |
| 1063 | set_fs (KERNEL_DS); |
| 1064 | err = sys_ioctl (fd, kcmd, (unsigned long)karg); |
| 1065 | set_fs (old_fs); |
| 1066 | if (err) |
| 1067 | return err; |
| 1068 | switch (cmd) { |
| 1069 | case MTIOCPOS32: |
| 1070 | upos32 = compat_ptr(arg); |
| 1071 | err = __put_user(pos.mt_blkno, &upos32->mt_blkno); |
| 1072 | break; |
| 1073 | case MTIOCGET32: |
| 1074 | umget32 = compat_ptr(arg); |
| 1075 | err = __put_user(get.mt_type, &umget32->mt_type); |
| 1076 | err |= __put_user(get.mt_resid, &umget32->mt_resid); |
| 1077 | err |= __put_user(get.mt_dsreg, &umget32->mt_dsreg); |
| 1078 | err |= __put_user(get.mt_gstat, &umget32->mt_gstat); |
| 1079 | err |= __put_user(get.mt_erreg, &umget32->mt_erreg); |
| 1080 | err |= __put_user(get.mt_fileno, &umget32->mt_fileno); |
| 1081 | err |= __put_user(get.mt_blkno, &umget32->mt_blkno); |
| 1082 | break; |
| 1083 | } |
| 1084 | return err ? -EFAULT: 0; |
| 1085 | } |
| 1086 | |
| 1087 | struct cdrom_read_audio32 { |
| 1088 | union cdrom_addr addr; |
| 1089 | u8 addr_format; |
| 1090 | compat_int_t nframes; |
| 1091 | compat_caddr_t buf; |
| 1092 | }; |
| 1093 | |
| 1094 | struct cdrom_generic_command32 { |
| 1095 | unsigned char cmd[CDROM_PACKET_SIZE]; |
| 1096 | compat_caddr_t buffer; |
| 1097 | compat_uint_t buflen; |
| 1098 | compat_int_t stat; |
| 1099 | compat_caddr_t sense; |
| 1100 | unsigned char data_direction; |
| 1101 | compat_int_t quiet; |
| 1102 | compat_int_t timeout; |
| 1103 | compat_caddr_t reserved[1]; |
| 1104 | }; |
| 1105 | |
| 1106 | static int cdrom_do_read_audio(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1107 | { |
| 1108 | struct cdrom_read_audio __user *cdread_audio; |
| 1109 | struct cdrom_read_audio32 __user *cdread_audio32; |
| 1110 | __u32 data; |
| 1111 | void __user *datap; |
| 1112 | |
| 1113 | cdread_audio = compat_alloc_user_space(sizeof(*cdread_audio)); |
| 1114 | cdread_audio32 = compat_ptr(arg); |
| 1115 | |
| 1116 | if (copy_in_user(&cdread_audio->addr, |
| 1117 | &cdread_audio32->addr, |
| 1118 | (sizeof(*cdread_audio32) - |
| 1119 | sizeof(compat_caddr_t)))) |
| 1120 | return -EFAULT; |
| 1121 | |
| 1122 | if (get_user(data, &cdread_audio32->buf)) |
| 1123 | return -EFAULT; |
| 1124 | datap = compat_ptr(data); |
| 1125 | if (put_user(datap, &cdread_audio->buf)) |
| 1126 | return -EFAULT; |
| 1127 | |
| 1128 | return sys_ioctl(fd, cmd, (unsigned long) cdread_audio); |
| 1129 | } |
| 1130 | |
| 1131 | static int cdrom_do_generic_command(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1132 | { |
| 1133 | struct cdrom_generic_command __user *cgc; |
| 1134 | struct cdrom_generic_command32 __user *cgc32; |
| 1135 | u32 data; |
| 1136 | unsigned char dir; |
| 1137 | int itmp; |
| 1138 | |
| 1139 | cgc = compat_alloc_user_space(sizeof(*cgc)); |
| 1140 | cgc32 = compat_ptr(arg); |
| 1141 | |
| 1142 | if (copy_in_user(&cgc->cmd, &cgc32->cmd, sizeof(cgc->cmd)) || |
| 1143 | get_user(data, &cgc32->buffer) || |
| 1144 | put_user(compat_ptr(data), &cgc->buffer) || |
| 1145 | copy_in_user(&cgc->buflen, &cgc32->buflen, |
| 1146 | (sizeof(unsigned int) + sizeof(int))) || |
| 1147 | get_user(data, &cgc32->sense) || |
| 1148 | put_user(compat_ptr(data), &cgc->sense) || |
| 1149 | get_user(dir, &cgc32->data_direction) || |
| 1150 | put_user(dir, &cgc->data_direction) || |
| 1151 | get_user(itmp, &cgc32->quiet) || |
| 1152 | put_user(itmp, &cgc->quiet) || |
| 1153 | get_user(itmp, &cgc32->timeout) || |
| 1154 | put_user(itmp, &cgc->timeout) || |
| 1155 | get_user(data, &cgc32->reserved[0]) || |
| 1156 | put_user(compat_ptr(data), &cgc->reserved[0])) |
| 1157 | return -EFAULT; |
| 1158 | |
| 1159 | return sys_ioctl(fd, cmd, (unsigned long) cgc); |
| 1160 | } |
| 1161 | |
| 1162 | static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1163 | { |
| 1164 | int err; |
| 1165 | |
| 1166 | switch(cmd) { |
| 1167 | case CDROMREADAUDIO: |
| 1168 | err = cdrom_do_read_audio(fd, cmd, arg); |
| 1169 | break; |
| 1170 | |
| 1171 | case CDROM_SEND_PACKET: |
| 1172 | err = cdrom_do_generic_command(fd, cmd, arg); |
| 1173 | break; |
| 1174 | |
| 1175 | default: |
| 1176 | do { |
| 1177 | static int count; |
| 1178 | if (++count <= 20) |
| 1179 | printk("cdrom_ioctl: Unknown cmd fd(%d) " |
| 1180 | "cmd(%08x) arg(%08x)\n", |
| 1181 | (int)fd, (unsigned int)cmd, (unsigned int)arg); |
| 1182 | } while(0); |
| 1183 | err = -EINVAL; |
| 1184 | break; |
| 1185 | }; |
| 1186 | |
| 1187 | return err; |
| 1188 | } |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 1189 | #endif /* CONFIG_BLOCK */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1190 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1191 | #ifdef CONFIG_VT |
| 1192 | |
| 1193 | static int vt_check(struct file *file) |
| 1194 | { |
| 1195 | struct tty_struct *tty; |
Josef "Jeff" Sipek | 0f7fc9e | 2006-12-08 02:36:35 -0800 | [diff] [blame] | 1196 | struct inode *inode = file->f_path.dentry->d_inode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1197 | |
| 1198 | if (file->f_op->ioctl != tty_ioctl) |
| 1199 | return -EINVAL; |
| 1200 | |
| 1201 | tty = (struct tty_struct *)file->private_data; |
| 1202 | if (tty_paranoia_check(tty, inode, "tty_ioctl")) |
| 1203 | return -EINVAL; |
| 1204 | |
| 1205 | if (tty->driver->ioctl != vt_ioctl) |
| 1206 | return -EINVAL; |
| 1207 | |
| 1208 | /* |
| 1209 | * To have permissions to do most of the vt ioctls, we either have |
| 1210 | * to be the owner of the tty, or super-user. |
| 1211 | */ |
| 1212 | if (current->signal->tty == tty || capable(CAP_SYS_ADMIN)) |
| 1213 | return 1; |
| 1214 | return 0; |
| 1215 | } |
| 1216 | |
| 1217 | struct consolefontdesc32 { |
| 1218 | unsigned short charcount; /* characters in font (256 or 512) */ |
| 1219 | unsigned short charheight; /* scan lines per character (1-32) */ |
| 1220 | compat_caddr_t chardata; /* font data in expanded form */ |
| 1221 | }; |
| 1222 | |
| 1223 | static int do_fontx_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file) |
| 1224 | { |
| 1225 | struct consolefontdesc32 __user *user_cfd = compat_ptr(arg); |
| 1226 | struct console_font_op op; |
| 1227 | compat_caddr_t data; |
| 1228 | int i, perm; |
| 1229 | |
| 1230 | perm = vt_check(file); |
| 1231 | if (perm < 0) return perm; |
| 1232 | |
| 1233 | switch (cmd) { |
| 1234 | case PIO_FONTX: |
| 1235 | if (!perm) |
| 1236 | return -EPERM; |
| 1237 | op.op = KD_FONT_OP_SET; |
| 1238 | op.flags = 0; |
| 1239 | op.width = 8; |
| 1240 | if (get_user(op.height, &user_cfd->charheight) || |
| 1241 | get_user(op.charcount, &user_cfd->charcount) || |
| 1242 | get_user(data, &user_cfd->chardata)) |
| 1243 | return -EFAULT; |
| 1244 | op.data = compat_ptr(data); |
| 1245 | return con_font_op(vc_cons[fg_console].d, &op); |
| 1246 | case GIO_FONTX: |
| 1247 | op.op = KD_FONT_OP_GET; |
| 1248 | op.flags = 0; |
| 1249 | op.width = 8; |
| 1250 | if (get_user(op.height, &user_cfd->charheight) || |
| 1251 | get_user(op.charcount, &user_cfd->charcount) || |
| 1252 | get_user(data, &user_cfd->chardata)) |
| 1253 | return -EFAULT; |
| 1254 | if (!data) |
| 1255 | return 0; |
| 1256 | op.data = compat_ptr(data); |
| 1257 | i = con_font_op(vc_cons[fg_console].d, &op); |
| 1258 | if (i) |
| 1259 | return i; |
| 1260 | if (put_user(op.height, &user_cfd->charheight) || |
| 1261 | put_user(op.charcount, &user_cfd->charcount) || |
| 1262 | put_user((compat_caddr_t)(unsigned long)op.data, |
| 1263 | &user_cfd->chardata)) |
| 1264 | return -EFAULT; |
| 1265 | return 0; |
| 1266 | } |
| 1267 | return -EINVAL; |
| 1268 | } |
| 1269 | |
| 1270 | struct console_font_op32 { |
| 1271 | compat_uint_t op; /* operation code KD_FONT_OP_* */ |
| 1272 | compat_uint_t flags; /* KD_FONT_FLAG_* */ |
| 1273 | compat_uint_t width, height; /* font size */ |
| 1274 | compat_uint_t charcount; |
| 1275 | compat_caddr_t data; /* font data with height fixed to 32 */ |
| 1276 | }; |
| 1277 | |
| 1278 | static int do_kdfontop_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file) |
| 1279 | { |
| 1280 | struct console_font_op op; |
| 1281 | struct console_font_op32 __user *fontop = compat_ptr(arg); |
| 1282 | int perm = vt_check(file), i; |
| 1283 | struct vc_data *vc; |
| 1284 | |
| 1285 | if (perm < 0) return perm; |
| 1286 | |
| 1287 | if (copy_from_user(&op, fontop, sizeof(struct console_font_op32))) |
| 1288 | return -EFAULT; |
| 1289 | if (!perm && op.op != KD_FONT_OP_GET) |
| 1290 | return -EPERM; |
| 1291 | op.data = compat_ptr(((struct console_font_op32 *)&op)->data); |
| 1292 | op.flags |= KD_FONT_FLAG_OLD; |
| 1293 | vc = ((struct tty_struct *)file->private_data)->driver_data; |
| 1294 | i = con_font_op(vc, &op); |
| 1295 | if (i) |
| 1296 | return i; |
| 1297 | ((struct console_font_op32 *)&op)->data = (unsigned long)op.data; |
| 1298 | if (copy_to_user(fontop, &op, sizeof(struct console_font_op32))) |
| 1299 | return -EFAULT; |
| 1300 | return 0; |
| 1301 | } |
| 1302 | |
| 1303 | struct unimapdesc32 { |
| 1304 | unsigned short entry_ct; |
| 1305 | compat_caddr_t entries; |
| 1306 | }; |
| 1307 | |
| 1308 | static int do_unimap_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file) |
| 1309 | { |
| 1310 | struct unimapdesc32 tmp; |
| 1311 | struct unimapdesc32 __user *user_ud = compat_ptr(arg); |
| 1312 | int perm = vt_check(file); |
| 1313 | |
| 1314 | if (perm < 0) return perm; |
| 1315 | if (copy_from_user(&tmp, user_ud, sizeof tmp)) |
| 1316 | return -EFAULT; |
| 1317 | switch (cmd) { |
| 1318 | case PIO_UNIMAP: |
| 1319 | if (!perm) return -EPERM; |
| 1320 | return con_set_unimap(vc_cons[fg_console].d, tmp.entry_ct, compat_ptr(tmp.entries)); |
| 1321 | case GIO_UNIMAP: |
| 1322 | return con_get_unimap(vc_cons[fg_console].d, tmp.entry_ct, &(user_ud->entry_ct), compat_ptr(tmp.entries)); |
| 1323 | } |
| 1324 | return 0; |
| 1325 | } |
| 1326 | |
| 1327 | #endif /* CONFIG_VT */ |
| 1328 | |
| 1329 | static int do_smb_getmountuid(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1330 | { |
| 1331 | mm_segment_t old_fs = get_fs(); |
| 1332 | __kernel_uid_t kuid; |
| 1333 | int err; |
| 1334 | |
| 1335 | cmd = SMB_IOC_GETMOUNTUID; |
| 1336 | |
| 1337 | set_fs(KERNEL_DS); |
| 1338 | err = sys_ioctl(fd, cmd, (unsigned long)&kuid); |
| 1339 | set_fs(old_fs); |
| 1340 | |
| 1341 | if (err >= 0) |
| 1342 | err = put_user(kuid, (compat_uid_t __user *)compat_ptr(arg)); |
| 1343 | |
| 1344 | return err; |
| 1345 | } |
| 1346 | |
| 1347 | struct atmif_sioc32 { |
| 1348 | compat_int_t number; |
| 1349 | compat_int_t length; |
| 1350 | compat_caddr_t arg; |
| 1351 | }; |
| 1352 | |
| 1353 | struct atm_iobuf32 { |
| 1354 | compat_int_t length; |
| 1355 | compat_caddr_t buffer; |
| 1356 | }; |
| 1357 | |
| 1358 | #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32) |
| 1359 | #define ATM_GETNAMES32 _IOW('a', ATMIOC_ITF+3, struct atm_iobuf32) |
| 1360 | #define ATM_GETTYPE32 _IOW('a', ATMIOC_ITF+4, struct atmif_sioc32) |
| 1361 | #define ATM_GETESI32 _IOW('a', ATMIOC_ITF+5, struct atmif_sioc32) |
| 1362 | #define ATM_GETADDR32 _IOW('a', ATMIOC_ITF+6, struct atmif_sioc32) |
| 1363 | #define ATM_RSTADDR32 _IOW('a', ATMIOC_ITF+7, struct atmif_sioc32) |
| 1364 | #define ATM_ADDADDR32 _IOW('a', ATMIOC_ITF+8, struct atmif_sioc32) |
| 1365 | #define ATM_DELADDR32 _IOW('a', ATMIOC_ITF+9, struct atmif_sioc32) |
| 1366 | #define ATM_GETCIRANGE32 _IOW('a', ATMIOC_ITF+10, struct atmif_sioc32) |
| 1367 | #define ATM_SETCIRANGE32 _IOW('a', ATMIOC_ITF+11, struct atmif_sioc32) |
| 1368 | #define ATM_SETESI32 _IOW('a', ATMIOC_ITF+12, struct atmif_sioc32) |
| 1369 | #define ATM_SETESIF32 _IOW('a', ATMIOC_ITF+13, struct atmif_sioc32) |
| 1370 | #define ATM_GETSTAT32 _IOW('a', ATMIOC_SARCOM+0, struct atmif_sioc32) |
| 1371 | #define ATM_GETSTATZ32 _IOW('a', ATMIOC_SARCOM+1, struct atmif_sioc32) |
| 1372 | #define ATM_GETLOOP32 _IOW('a', ATMIOC_SARCOM+2, struct atmif_sioc32) |
| 1373 | #define ATM_SETLOOP32 _IOW('a', ATMIOC_SARCOM+3, struct atmif_sioc32) |
| 1374 | #define ATM_QUERYLOOP32 _IOW('a', ATMIOC_SARCOM+4, struct atmif_sioc32) |
| 1375 | |
| 1376 | static struct { |
| 1377 | unsigned int cmd32; |
| 1378 | unsigned int cmd; |
| 1379 | } atm_ioctl_map[] = { |
| 1380 | { ATM_GETLINKRATE32, ATM_GETLINKRATE }, |
| 1381 | { ATM_GETNAMES32, ATM_GETNAMES }, |
| 1382 | { ATM_GETTYPE32, ATM_GETTYPE }, |
| 1383 | { ATM_GETESI32, ATM_GETESI }, |
| 1384 | { ATM_GETADDR32, ATM_GETADDR }, |
| 1385 | { ATM_RSTADDR32, ATM_RSTADDR }, |
| 1386 | { ATM_ADDADDR32, ATM_ADDADDR }, |
| 1387 | { ATM_DELADDR32, ATM_DELADDR }, |
| 1388 | { ATM_GETCIRANGE32, ATM_GETCIRANGE }, |
| 1389 | { ATM_SETCIRANGE32, ATM_SETCIRANGE }, |
| 1390 | { ATM_SETESI32, ATM_SETESI }, |
| 1391 | { ATM_SETESIF32, ATM_SETESIF }, |
| 1392 | { ATM_GETSTAT32, ATM_GETSTAT }, |
| 1393 | { ATM_GETSTATZ32, ATM_GETSTATZ }, |
| 1394 | { ATM_GETLOOP32, ATM_GETLOOP }, |
| 1395 | { ATM_SETLOOP32, ATM_SETLOOP }, |
| 1396 | { ATM_QUERYLOOP32, ATM_QUERYLOOP } |
| 1397 | }; |
| 1398 | |
Tobias Klauser | e8c96f8 | 2006-03-24 03:15:34 -0800 | [diff] [blame] | 1399 | #define NR_ATM_IOCTL ARRAY_SIZE(atm_ioctl_map) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1400 | |
| 1401 | static int do_atm_iobuf(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1402 | { |
| 1403 | struct atm_iobuf __user *iobuf; |
| 1404 | struct atm_iobuf32 __user *iobuf32; |
| 1405 | u32 data; |
| 1406 | void __user *datap; |
| 1407 | int len, err; |
| 1408 | |
| 1409 | iobuf = compat_alloc_user_space(sizeof(*iobuf)); |
| 1410 | iobuf32 = compat_ptr(arg); |
| 1411 | |
| 1412 | if (get_user(len, &iobuf32->length) || |
| 1413 | get_user(data, &iobuf32->buffer)) |
| 1414 | return -EFAULT; |
| 1415 | datap = compat_ptr(data); |
| 1416 | if (put_user(len, &iobuf->length) || |
| 1417 | put_user(datap, &iobuf->buffer)) |
| 1418 | return -EFAULT; |
| 1419 | |
| 1420 | err = sys_ioctl(fd, cmd, (unsigned long)iobuf); |
| 1421 | |
| 1422 | if (!err) { |
| 1423 | if (copy_in_user(&iobuf32->length, &iobuf->length, |
| 1424 | sizeof(int))) |
| 1425 | err = -EFAULT; |
| 1426 | } |
| 1427 | |
| 1428 | return err; |
| 1429 | } |
| 1430 | |
| 1431 | static int do_atmif_sioc(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1432 | { |
| 1433 | struct atmif_sioc __user *sioc; |
| 1434 | struct atmif_sioc32 __user *sioc32; |
| 1435 | u32 data; |
| 1436 | void __user *datap; |
| 1437 | int err; |
| 1438 | |
| 1439 | sioc = compat_alloc_user_space(sizeof(*sioc)); |
| 1440 | sioc32 = compat_ptr(arg); |
| 1441 | |
| 1442 | if (copy_in_user(&sioc->number, &sioc32->number, 2 * sizeof(int)) || |
| 1443 | get_user(data, &sioc32->arg)) |
| 1444 | return -EFAULT; |
| 1445 | datap = compat_ptr(data); |
| 1446 | if (put_user(datap, &sioc->arg)) |
| 1447 | return -EFAULT; |
| 1448 | |
| 1449 | err = sys_ioctl(fd, cmd, (unsigned long) sioc); |
| 1450 | |
| 1451 | if (!err) { |
| 1452 | if (copy_in_user(&sioc32->length, &sioc->length, |
| 1453 | sizeof(int))) |
| 1454 | err = -EFAULT; |
| 1455 | } |
| 1456 | return err; |
| 1457 | } |
| 1458 | |
| 1459 | static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg) |
| 1460 | { |
| 1461 | int i; |
| 1462 | unsigned int cmd = 0; |
| 1463 | |
| 1464 | switch (cmd32) { |
| 1465 | case SONET_GETSTAT: |
| 1466 | case SONET_GETSTATZ: |
| 1467 | case SONET_GETDIAG: |
| 1468 | case SONET_SETDIAG: |
| 1469 | case SONET_CLRDIAG: |
| 1470 | case SONET_SETFRAMING: |
| 1471 | case SONET_GETFRAMING: |
| 1472 | case SONET_GETFRSENSE: |
| 1473 | return do_atmif_sioc(fd, cmd32, arg); |
| 1474 | } |
| 1475 | |
| 1476 | for (i = 0; i < NR_ATM_IOCTL; i++) { |
| 1477 | if (cmd32 == atm_ioctl_map[i].cmd32) { |
| 1478 | cmd = atm_ioctl_map[i].cmd; |
| 1479 | break; |
| 1480 | } |
| 1481 | } |
| 1482 | if (i == NR_ATM_IOCTL) |
| 1483 | return -EINVAL; |
| 1484 | |
| 1485 | switch (cmd) { |
| 1486 | case ATM_GETNAMES: |
| 1487 | return do_atm_iobuf(fd, cmd, arg); |
| 1488 | |
| 1489 | case ATM_GETLINKRATE: |
| 1490 | case ATM_GETTYPE: |
| 1491 | case ATM_GETESI: |
| 1492 | case ATM_GETADDR: |
| 1493 | case ATM_RSTADDR: |
| 1494 | case ATM_ADDADDR: |
| 1495 | case ATM_DELADDR: |
| 1496 | case ATM_GETCIRANGE: |
| 1497 | case ATM_SETCIRANGE: |
| 1498 | case ATM_SETESI: |
| 1499 | case ATM_SETESIF: |
| 1500 | case ATM_GETSTAT: |
| 1501 | case ATM_GETSTATZ: |
| 1502 | case ATM_GETLOOP: |
| 1503 | case ATM_SETLOOP: |
| 1504 | case ATM_QUERYLOOP: |
| 1505 | return do_atmif_sioc(fd, cmd, arg); |
| 1506 | } |
| 1507 | |
| 1508 | return -EINVAL; |
| 1509 | } |
| 1510 | |
| 1511 | static __attribute_used__ int |
| 1512 | ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1513 | { |
| 1514 | return -EINVAL; |
| 1515 | } |
| 1516 | |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 1517 | #ifdef CONFIG_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1518 | static int broken_blkgetsize(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1519 | { |
| 1520 | /* The mkswap binary hard codes it to Intel value :-((( */ |
| 1521 | return w_long(fd, BLKGETSIZE, arg); |
| 1522 | } |
| 1523 | |
| 1524 | struct blkpg_ioctl_arg32 { |
| 1525 | compat_int_t op; |
| 1526 | compat_int_t flags; |
| 1527 | compat_int_t datalen; |
| 1528 | compat_caddr_t data; |
| 1529 | }; |
| 1530 | |
| 1531 | static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1532 | { |
| 1533 | struct blkpg_ioctl_arg32 __user *ua32 = compat_ptr(arg); |
| 1534 | struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a)); |
| 1535 | compat_caddr_t udata; |
| 1536 | compat_int_t n; |
| 1537 | int err; |
| 1538 | |
| 1539 | err = get_user(n, &ua32->op); |
| 1540 | err |= put_user(n, &a->op); |
| 1541 | err |= get_user(n, &ua32->flags); |
| 1542 | err |= put_user(n, &a->flags); |
| 1543 | err |= get_user(n, &ua32->datalen); |
| 1544 | err |= put_user(n, &a->datalen); |
| 1545 | err |= get_user(udata, &ua32->data); |
| 1546 | err |= put_user(compat_ptr(udata), &a->data); |
| 1547 | if (err) |
| 1548 | return err; |
| 1549 | |
| 1550 | return sys_ioctl(fd, cmd, (unsigned long)a); |
| 1551 | } |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 1552 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1553 | |
| 1554 | static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1555 | { |
| 1556 | return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); |
| 1557 | } |
| 1558 | |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 1559 | #ifdef CONFIG_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1560 | /* Fix sizeof(sizeof()) breakage */ |
| 1561 | #define BLKBSZGET_32 _IOR(0x12,112,int) |
| 1562 | #define BLKBSZSET_32 _IOW(0x12,113,int) |
| 1563 | #define BLKGETSIZE64_32 _IOR(0x12,114,int) |
| 1564 | |
| 1565 | static int do_blkbszget(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1566 | { |
| 1567 | return sys_ioctl(fd, BLKBSZGET, (unsigned long)compat_ptr(arg)); |
| 1568 | } |
| 1569 | |
| 1570 | static int do_blkbszset(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1571 | { |
| 1572 | return sys_ioctl(fd, BLKBSZSET, (unsigned long)compat_ptr(arg)); |
| 1573 | } |
| 1574 | |
| 1575 | static int do_blkgetsize64(unsigned int fd, unsigned int cmd, |
| 1576 | unsigned long arg) |
| 1577 | { |
| 1578 | return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg)); |
| 1579 | } |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 1580 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1581 | |
| 1582 | /* Bluetooth ioctls */ |
| 1583 | #define HCIUARTSETPROTO _IOW('U', 200, int) |
| 1584 | #define HCIUARTGETPROTO _IOR('U', 201, int) |
| 1585 | |
| 1586 | #define BNEPCONNADD _IOW('B', 200, int) |
| 1587 | #define BNEPCONNDEL _IOW('B', 201, int) |
| 1588 | #define BNEPGETCONNLIST _IOR('B', 210, int) |
| 1589 | #define BNEPGETCONNINFO _IOR('B', 211, int) |
| 1590 | |
| 1591 | #define CMTPCONNADD _IOW('C', 200, int) |
| 1592 | #define CMTPCONNDEL _IOW('C', 201, int) |
| 1593 | #define CMTPGETCONNLIST _IOR('C', 210, int) |
| 1594 | #define CMTPGETCONNINFO _IOR('C', 211, int) |
| 1595 | |
| 1596 | #define HIDPCONNADD _IOW('H', 200, int) |
| 1597 | #define HIDPCONNDEL _IOW('H', 201, int) |
| 1598 | #define HIDPGETCONNLIST _IOR('H', 210, int) |
| 1599 | #define HIDPGETCONNINFO _IOR('H', 211, int) |
| 1600 | |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 1601 | #ifdef CONFIG_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1602 | struct floppy_struct32 { |
| 1603 | compat_uint_t size; |
| 1604 | compat_uint_t sect; |
| 1605 | compat_uint_t head; |
| 1606 | compat_uint_t track; |
| 1607 | compat_uint_t stretch; |
| 1608 | unsigned char gap; |
| 1609 | unsigned char rate; |
| 1610 | unsigned char spec1; |
| 1611 | unsigned char fmt_gap; |
| 1612 | const compat_caddr_t name; |
| 1613 | }; |
| 1614 | |
| 1615 | struct floppy_drive_params32 { |
| 1616 | char cmos; |
| 1617 | compat_ulong_t max_dtr; |
| 1618 | compat_ulong_t hlt; |
| 1619 | compat_ulong_t hut; |
| 1620 | compat_ulong_t srt; |
| 1621 | compat_ulong_t spinup; |
| 1622 | compat_ulong_t spindown; |
| 1623 | unsigned char spindown_offset; |
| 1624 | unsigned char select_delay; |
| 1625 | unsigned char rps; |
| 1626 | unsigned char tracks; |
| 1627 | compat_ulong_t timeout; |
| 1628 | unsigned char interleave_sect; |
| 1629 | struct floppy_max_errors max_errors; |
| 1630 | char flags; |
| 1631 | char read_track; |
| 1632 | short autodetect[8]; |
| 1633 | compat_int_t checkfreq; |
| 1634 | compat_int_t native_format; |
| 1635 | }; |
| 1636 | |
| 1637 | struct floppy_drive_struct32 { |
| 1638 | signed char flags; |
| 1639 | compat_ulong_t spinup_date; |
| 1640 | compat_ulong_t select_date; |
| 1641 | compat_ulong_t first_read_date; |
| 1642 | short probed_format; |
| 1643 | short track; |
| 1644 | short maxblock; |
| 1645 | short maxtrack; |
| 1646 | compat_int_t generation; |
| 1647 | compat_int_t keep_data; |
| 1648 | compat_int_t fd_ref; |
| 1649 | compat_int_t fd_device; |
| 1650 | compat_int_t last_checked; |
| 1651 | compat_caddr_t dmabuf; |
| 1652 | compat_int_t bufblocks; |
| 1653 | }; |
| 1654 | |
| 1655 | struct floppy_fdc_state32 { |
| 1656 | compat_int_t spec1; |
| 1657 | compat_int_t spec2; |
| 1658 | compat_int_t dtr; |
| 1659 | unsigned char version; |
| 1660 | unsigned char dor; |
| 1661 | compat_ulong_t address; |
| 1662 | unsigned int rawcmd:2; |
| 1663 | unsigned int reset:1; |
| 1664 | unsigned int need_configure:1; |
| 1665 | unsigned int perp_mode:2; |
| 1666 | unsigned int has_fifo:1; |
| 1667 | unsigned int driver_version; |
| 1668 | unsigned char track[4]; |
| 1669 | }; |
| 1670 | |
| 1671 | struct floppy_write_errors32 { |
| 1672 | unsigned int write_errors; |
| 1673 | compat_ulong_t first_error_sector; |
| 1674 | compat_int_t first_error_generation; |
| 1675 | compat_ulong_t last_error_sector; |
| 1676 | compat_int_t last_error_generation; |
| 1677 | compat_uint_t badness; |
| 1678 | }; |
| 1679 | |
| 1680 | #define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32) |
| 1681 | #define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32) |
| 1682 | #define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32) |
| 1683 | #define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32) |
| 1684 | #define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32) |
| 1685 | #define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32) |
| 1686 | #define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32) |
| 1687 | #define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32) |
| 1688 | #define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32) |
| 1689 | |
| 1690 | static struct { |
| 1691 | unsigned int cmd32; |
| 1692 | unsigned int cmd; |
| 1693 | } fd_ioctl_trans_table[] = { |
| 1694 | { FDSETPRM32, FDSETPRM }, |
| 1695 | { FDDEFPRM32, FDDEFPRM }, |
| 1696 | { FDGETPRM32, FDGETPRM }, |
| 1697 | { FDSETDRVPRM32, FDSETDRVPRM }, |
| 1698 | { FDGETDRVPRM32, FDGETDRVPRM }, |
| 1699 | { FDGETDRVSTAT32, FDGETDRVSTAT }, |
| 1700 | { FDPOLLDRVSTAT32, FDPOLLDRVSTAT }, |
| 1701 | { FDGETFDCSTAT32, FDGETFDCSTAT }, |
| 1702 | { FDWERRORGET32, FDWERRORGET } |
| 1703 | }; |
| 1704 | |
Tobias Klauser | e8c96f8 | 2006-03-24 03:15:34 -0800 | [diff] [blame] | 1705 | #define NR_FD_IOCTL_TRANS ARRAY_SIZE(fd_ioctl_trans_table) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1706 | |
| 1707 | static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1708 | { |
| 1709 | mm_segment_t old_fs = get_fs(); |
| 1710 | void *karg = NULL; |
| 1711 | unsigned int kcmd = 0; |
| 1712 | int i, err; |
| 1713 | |
| 1714 | for (i = 0; i < NR_FD_IOCTL_TRANS; i++) |
| 1715 | if (cmd == fd_ioctl_trans_table[i].cmd32) { |
| 1716 | kcmd = fd_ioctl_trans_table[i].cmd; |
| 1717 | break; |
| 1718 | } |
| 1719 | if (!kcmd) |
| 1720 | return -EINVAL; |
| 1721 | |
| 1722 | switch (cmd) { |
| 1723 | case FDSETPRM32: |
| 1724 | case FDDEFPRM32: |
| 1725 | case FDGETPRM32: |
| 1726 | { |
| 1727 | compat_uptr_t name; |
| 1728 | struct floppy_struct32 __user *uf; |
| 1729 | struct floppy_struct *f; |
| 1730 | |
| 1731 | uf = compat_ptr(arg); |
| 1732 | f = karg = kmalloc(sizeof(struct floppy_struct), GFP_KERNEL); |
| 1733 | if (!karg) |
| 1734 | return -ENOMEM; |
| 1735 | if (cmd == FDGETPRM32) |
| 1736 | break; |
| 1737 | err = __get_user(f->size, &uf->size); |
| 1738 | err |= __get_user(f->sect, &uf->sect); |
| 1739 | err |= __get_user(f->head, &uf->head); |
| 1740 | err |= __get_user(f->track, &uf->track); |
| 1741 | err |= __get_user(f->stretch, &uf->stretch); |
| 1742 | err |= __get_user(f->gap, &uf->gap); |
| 1743 | err |= __get_user(f->rate, &uf->rate); |
| 1744 | err |= __get_user(f->spec1, &uf->spec1); |
| 1745 | err |= __get_user(f->fmt_gap, &uf->fmt_gap); |
| 1746 | err |= __get_user(name, &uf->name); |
| 1747 | f->name = compat_ptr(name); |
| 1748 | if (err) { |
| 1749 | err = -EFAULT; |
| 1750 | goto out; |
| 1751 | } |
| 1752 | break; |
| 1753 | } |
| 1754 | case FDSETDRVPRM32: |
| 1755 | case FDGETDRVPRM32: |
| 1756 | { |
| 1757 | struct floppy_drive_params32 __user *uf; |
| 1758 | struct floppy_drive_params *f; |
| 1759 | |
| 1760 | uf = compat_ptr(arg); |
| 1761 | f = karg = kmalloc(sizeof(struct floppy_drive_params), GFP_KERNEL); |
| 1762 | if (!karg) |
| 1763 | return -ENOMEM; |
| 1764 | if (cmd == FDGETDRVPRM32) |
| 1765 | break; |
| 1766 | err = __get_user(f->cmos, &uf->cmos); |
| 1767 | err |= __get_user(f->max_dtr, &uf->max_dtr); |
| 1768 | err |= __get_user(f->hlt, &uf->hlt); |
| 1769 | err |= __get_user(f->hut, &uf->hut); |
| 1770 | err |= __get_user(f->srt, &uf->srt); |
| 1771 | err |= __get_user(f->spinup, &uf->spinup); |
| 1772 | err |= __get_user(f->spindown, &uf->spindown); |
| 1773 | err |= __get_user(f->spindown_offset, &uf->spindown_offset); |
| 1774 | err |= __get_user(f->select_delay, &uf->select_delay); |
| 1775 | err |= __get_user(f->rps, &uf->rps); |
| 1776 | err |= __get_user(f->tracks, &uf->tracks); |
| 1777 | err |= __get_user(f->timeout, &uf->timeout); |
| 1778 | err |= __get_user(f->interleave_sect, &uf->interleave_sect); |
| 1779 | err |= __copy_from_user(&f->max_errors, &uf->max_errors, sizeof(f->max_errors)); |
| 1780 | err |= __get_user(f->flags, &uf->flags); |
| 1781 | err |= __get_user(f->read_track, &uf->read_track); |
| 1782 | err |= __copy_from_user(f->autodetect, uf->autodetect, sizeof(f->autodetect)); |
| 1783 | err |= __get_user(f->checkfreq, &uf->checkfreq); |
| 1784 | err |= __get_user(f->native_format, &uf->native_format); |
| 1785 | if (err) { |
| 1786 | err = -EFAULT; |
| 1787 | goto out; |
| 1788 | } |
| 1789 | break; |
| 1790 | } |
| 1791 | case FDGETDRVSTAT32: |
| 1792 | case FDPOLLDRVSTAT32: |
| 1793 | karg = kmalloc(sizeof(struct floppy_drive_struct), GFP_KERNEL); |
| 1794 | if (!karg) |
| 1795 | return -ENOMEM; |
| 1796 | break; |
| 1797 | case FDGETFDCSTAT32: |
| 1798 | karg = kmalloc(sizeof(struct floppy_fdc_state), GFP_KERNEL); |
| 1799 | if (!karg) |
| 1800 | return -ENOMEM; |
| 1801 | break; |
| 1802 | case FDWERRORGET32: |
| 1803 | karg = kmalloc(sizeof(struct floppy_write_errors), GFP_KERNEL); |
| 1804 | if (!karg) |
| 1805 | return -ENOMEM; |
| 1806 | break; |
| 1807 | default: |
| 1808 | return -EINVAL; |
| 1809 | } |
| 1810 | set_fs (KERNEL_DS); |
| 1811 | err = sys_ioctl (fd, kcmd, (unsigned long)karg); |
| 1812 | set_fs (old_fs); |
| 1813 | if (err) |
| 1814 | goto out; |
| 1815 | switch (cmd) { |
| 1816 | case FDGETPRM32: |
| 1817 | { |
| 1818 | struct floppy_struct *f = karg; |
| 1819 | struct floppy_struct32 __user *uf = compat_ptr(arg); |
| 1820 | |
| 1821 | err = __put_user(f->size, &uf->size); |
| 1822 | err |= __put_user(f->sect, &uf->sect); |
| 1823 | err |= __put_user(f->head, &uf->head); |
| 1824 | err |= __put_user(f->track, &uf->track); |
| 1825 | err |= __put_user(f->stretch, &uf->stretch); |
| 1826 | err |= __put_user(f->gap, &uf->gap); |
| 1827 | err |= __put_user(f->rate, &uf->rate); |
| 1828 | err |= __put_user(f->spec1, &uf->spec1); |
| 1829 | err |= __put_user(f->fmt_gap, &uf->fmt_gap); |
| 1830 | err |= __put_user((u64)f->name, (compat_caddr_t __user *)&uf->name); |
| 1831 | break; |
| 1832 | } |
| 1833 | case FDGETDRVPRM32: |
| 1834 | { |
| 1835 | struct floppy_drive_params32 __user *uf; |
| 1836 | struct floppy_drive_params *f = karg; |
| 1837 | |
| 1838 | uf = compat_ptr(arg); |
| 1839 | err = __put_user(f->cmos, &uf->cmos); |
| 1840 | err |= __put_user(f->max_dtr, &uf->max_dtr); |
| 1841 | err |= __put_user(f->hlt, &uf->hlt); |
| 1842 | err |= __put_user(f->hut, &uf->hut); |
| 1843 | err |= __put_user(f->srt, &uf->srt); |
| 1844 | err |= __put_user(f->spinup, &uf->spinup); |
| 1845 | err |= __put_user(f->spindown, &uf->spindown); |
| 1846 | err |= __put_user(f->spindown_offset, &uf->spindown_offset); |
| 1847 | err |= __put_user(f->select_delay, &uf->select_delay); |
| 1848 | err |= __put_user(f->rps, &uf->rps); |
| 1849 | err |= __put_user(f->tracks, &uf->tracks); |
| 1850 | err |= __put_user(f->timeout, &uf->timeout); |
| 1851 | err |= __put_user(f->interleave_sect, &uf->interleave_sect); |
| 1852 | err |= __copy_to_user(&uf->max_errors, &f->max_errors, sizeof(f->max_errors)); |
| 1853 | err |= __put_user(f->flags, &uf->flags); |
| 1854 | err |= __put_user(f->read_track, &uf->read_track); |
| 1855 | err |= __copy_to_user(uf->autodetect, f->autodetect, sizeof(f->autodetect)); |
| 1856 | err |= __put_user(f->checkfreq, &uf->checkfreq); |
| 1857 | err |= __put_user(f->native_format, &uf->native_format); |
| 1858 | break; |
| 1859 | } |
| 1860 | case FDGETDRVSTAT32: |
| 1861 | case FDPOLLDRVSTAT32: |
| 1862 | { |
| 1863 | struct floppy_drive_struct32 __user *uf; |
| 1864 | struct floppy_drive_struct *f = karg; |
| 1865 | |
| 1866 | uf = compat_ptr(arg); |
| 1867 | err = __put_user(f->flags, &uf->flags); |
| 1868 | err |= __put_user(f->spinup_date, &uf->spinup_date); |
| 1869 | err |= __put_user(f->select_date, &uf->select_date); |
| 1870 | err |= __put_user(f->first_read_date, &uf->first_read_date); |
| 1871 | err |= __put_user(f->probed_format, &uf->probed_format); |
| 1872 | err |= __put_user(f->track, &uf->track); |
| 1873 | err |= __put_user(f->maxblock, &uf->maxblock); |
| 1874 | err |= __put_user(f->maxtrack, &uf->maxtrack); |
| 1875 | err |= __put_user(f->generation, &uf->generation); |
| 1876 | err |= __put_user(f->keep_data, &uf->keep_data); |
| 1877 | err |= __put_user(f->fd_ref, &uf->fd_ref); |
| 1878 | err |= __put_user(f->fd_device, &uf->fd_device); |
| 1879 | err |= __put_user(f->last_checked, &uf->last_checked); |
| 1880 | err |= __put_user((u64)f->dmabuf, &uf->dmabuf); |
| 1881 | err |= __put_user((u64)f->bufblocks, &uf->bufblocks); |
| 1882 | break; |
| 1883 | } |
| 1884 | case FDGETFDCSTAT32: |
| 1885 | { |
| 1886 | struct floppy_fdc_state32 __user *uf; |
| 1887 | struct floppy_fdc_state *f = karg; |
| 1888 | |
| 1889 | uf = compat_ptr(arg); |
| 1890 | err = __put_user(f->spec1, &uf->spec1); |
| 1891 | err |= __put_user(f->spec2, &uf->spec2); |
| 1892 | err |= __put_user(f->dtr, &uf->dtr); |
| 1893 | err |= __put_user(f->version, &uf->version); |
| 1894 | err |= __put_user(f->dor, &uf->dor); |
| 1895 | err |= __put_user(f->address, &uf->address); |
| 1896 | err |= __copy_to_user((char __user *)&uf->address + sizeof(uf->address), |
| 1897 | (char *)&f->address + sizeof(f->address), sizeof(int)); |
| 1898 | err |= __put_user(f->driver_version, &uf->driver_version); |
| 1899 | err |= __copy_to_user(uf->track, f->track, sizeof(f->track)); |
| 1900 | break; |
| 1901 | } |
| 1902 | case FDWERRORGET32: |
| 1903 | { |
| 1904 | struct floppy_write_errors32 __user *uf; |
| 1905 | struct floppy_write_errors *f = karg; |
| 1906 | |
| 1907 | uf = compat_ptr(arg); |
| 1908 | err = __put_user(f->write_errors, &uf->write_errors); |
| 1909 | err |= __put_user(f->first_error_sector, &uf->first_error_sector); |
| 1910 | err |= __put_user(f->first_error_generation, &uf->first_error_generation); |
| 1911 | err |= __put_user(f->last_error_sector, &uf->last_error_sector); |
| 1912 | err |= __put_user(f->last_error_generation, &uf->last_error_generation); |
| 1913 | err |= __put_user(f->badness, &uf->badness); |
| 1914 | break; |
| 1915 | } |
| 1916 | default: |
| 1917 | break; |
| 1918 | } |
| 1919 | if (err) |
| 1920 | err = -EFAULT; |
| 1921 | |
Jesper Juhl | f99d49a | 2005-11-07 01:01:34 -0800 | [diff] [blame] | 1922 | out: |
| 1923 | kfree(karg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1924 | return err; |
| 1925 | } |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 1926 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1927 | |
| 1928 | struct mtd_oob_buf32 { |
| 1929 | u_int32_t start; |
| 1930 | u_int32_t length; |
| 1931 | compat_caddr_t ptr; /* unsigned char* */ |
| 1932 | }; |
| 1933 | |
| 1934 | #define MEMWRITEOOB32 _IOWR('M',3,struct mtd_oob_buf32) |
| 1935 | #define MEMREADOOB32 _IOWR('M',4,struct mtd_oob_buf32) |
| 1936 | |
| 1937 | static int mtd_rw_oob(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1938 | { |
| 1939 | struct mtd_oob_buf __user *buf = compat_alloc_user_space(sizeof(*buf)); |
| 1940 | struct mtd_oob_buf32 __user *buf32 = compat_ptr(arg); |
| 1941 | u32 data; |
| 1942 | char __user *datap; |
| 1943 | unsigned int real_cmd; |
| 1944 | int err; |
| 1945 | |
| 1946 | real_cmd = (cmd == MEMREADOOB32) ? |
| 1947 | MEMREADOOB : MEMWRITEOOB; |
| 1948 | |
| 1949 | if (copy_in_user(&buf->start, &buf32->start, |
| 1950 | 2 * sizeof(u32)) || |
| 1951 | get_user(data, &buf32->ptr)) |
| 1952 | return -EFAULT; |
| 1953 | datap = compat_ptr(data); |
| 1954 | if (put_user(datap, &buf->ptr)) |
| 1955 | return -EFAULT; |
| 1956 | |
| 1957 | err = sys_ioctl(fd, real_cmd, (unsigned long) buf); |
| 1958 | |
| 1959 | if (!err) { |
| 1960 | if (copy_in_user(&buf32->start, &buf->start, |
| 1961 | 2 * sizeof(u32))) |
| 1962 | err = -EFAULT; |
| 1963 | } |
| 1964 | |
| 1965 | return err; |
| 1966 | } |
| 1967 | |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 1968 | #ifdef CONFIG_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1969 | struct raw32_config_request |
| 1970 | { |
| 1971 | compat_int_t raw_minor; |
| 1972 | __u64 block_major; |
| 1973 | __u64 block_minor; |
| 1974 | } __attribute__((packed)); |
| 1975 | |
| 1976 | static int get_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req) |
| 1977 | { |
| 1978 | int ret; |
| 1979 | |
| 1980 | if (!access_ok(VERIFY_READ, user_req, sizeof(struct raw32_config_request))) |
| 1981 | return -EFAULT; |
| 1982 | |
| 1983 | ret = __get_user(req->raw_minor, &user_req->raw_minor); |
| 1984 | ret |= __get_user(req->block_major, &user_req->block_major); |
| 1985 | ret |= __get_user(req->block_minor, &user_req->block_minor); |
| 1986 | |
| 1987 | return ret ? -EFAULT : 0; |
| 1988 | } |
| 1989 | |
| 1990 | static int set_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req) |
| 1991 | { |
| 1992 | int ret; |
| 1993 | |
| 1994 | if (!access_ok(VERIFY_WRITE, user_req, sizeof(struct raw32_config_request))) |
| 1995 | return -EFAULT; |
| 1996 | |
| 1997 | ret = __put_user(req->raw_minor, &user_req->raw_minor); |
| 1998 | ret |= __put_user(req->block_major, &user_req->block_major); |
| 1999 | ret |= __put_user(req->block_minor, &user_req->block_minor); |
| 2000 | |
| 2001 | return ret ? -EFAULT : 0; |
| 2002 | } |
| 2003 | |
| 2004 | static int raw_ioctl(unsigned fd, unsigned cmd, unsigned long arg) |
| 2005 | { |
| 2006 | int ret; |
| 2007 | |
| 2008 | switch (cmd) { |
| 2009 | case RAW_SETBIND: |
| 2010 | case RAW_GETBIND: { |
| 2011 | struct raw_config_request req; |
| 2012 | struct raw32_config_request __user *user_req = compat_ptr(arg); |
| 2013 | mm_segment_t oldfs = get_fs(); |
| 2014 | |
| 2015 | if ((ret = get_raw32_request(&req, user_req))) |
| 2016 | return ret; |
| 2017 | |
| 2018 | set_fs(KERNEL_DS); |
| 2019 | ret = sys_ioctl(fd,cmd,(unsigned long)&req); |
| 2020 | set_fs(oldfs); |
| 2021 | |
| 2022 | if ((!ret) && (cmd == RAW_GETBIND)) { |
| 2023 | ret = set_raw32_request(&req, user_req); |
| 2024 | } |
| 2025 | break; |
| 2026 | } |
| 2027 | default: |
| 2028 | ret = sys_ioctl(fd, cmd, arg); |
| 2029 | break; |
| 2030 | } |
| 2031 | return ret; |
| 2032 | } |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 2033 | #endif /* CONFIG_BLOCK */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2034 | |
| 2035 | struct serial_struct32 { |
| 2036 | compat_int_t type; |
| 2037 | compat_int_t line; |
| 2038 | compat_uint_t port; |
| 2039 | compat_int_t irq; |
| 2040 | compat_int_t flags; |
| 2041 | compat_int_t xmit_fifo_size; |
| 2042 | compat_int_t custom_divisor; |
| 2043 | compat_int_t baud_base; |
| 2044 | unsigned short close_delay; |
| 2045 | char io_type; |
| 2046 | char reserved_char[1]; |
| 2047 | compat_int_t hub6; |
| 2048 | unsigned short closing_wait; /* time to wait before closing */ |
| 2049 | unsigned short closing_wait2; /* no longer used... */ |
| 2050 | compat_uint_t iomem_base; |
| 2051 | unsigned short iomem_reg_shift; |
| 2052 | unsigned int port_high; |
| 2053 | /* compat_ulong_t iomap_base FIXME */ |
| 2054 | compat_int_t reserved[1]; |
| 2055 | }; |
| 2056 | |
| 2057 | static int serial_struct_ioctl(unsigned fd, unsigned cmd, unsigned long arg) |
| 2058 | { |
| 2059 | typedef struct serial_struct SS; |
| 2060 | typedef struct serial_struct32 SS32; |
| 2061 | struct serial_struct32 __user *ss32 = compat_ptr(arg); |
| 2062 | int err; |
| 2063 | struct serial_struct ss; |
| 2064 | mm_segment_t oldseg = get_fs(); |
| 2065 | __u32 udata; |
Heiko Carstens | 7116e99 | 2006-12-06 20:36:36 -0800 | [diff] [blame] | 2066 | unsigned int base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2067 | |
| 2068 | if (cmd == TIOCSSERIAL) { |
| 2069 | if (!access_ok(VERIFY_READ, ss32, sizeof(SS32))) |
| 2070 | return -EFAULT; |
| 2071 | if (__copy_from_user(&ss, ss32, offsetof(SS32, iomem_base))) |
| 2072 | return -EFAULT; |
Heiko Carstens | 7116e99 | 2006-12-06 20:36:36 -0800 | [diff] [blame] | 2073 | if (__get_user(udata, &ss32->iomem_base)) |
| 2074 | return -EFAULT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2075 | ss.iomem_base = compat_ptr(udata); |
Heiko Carstens | 7116e99 | 2006-12-06 20:36:36 -0800 | [diff] [blame] | 2076 | if (__get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift) || |
| 2077 | __get_user(ss.port_high, &ss32->port_high)) |
| 2078 | return -EFAULT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2079 | ss.iomap_base = 0UL; |
| 2080 | } |
| 2081 | set_fs(KERNEL_DS); |
| 2082 | err = sys_ioctl(fd,cmd,(unsigned long)(&ss)); |
| 2083 | set_fs(oldseg); |
| 2084 | if (cmd == TIOCGSERIAL && err >= 0) { |
| 2085 | if (!access_ok(VERIFY_WRITE, ss32, sizeof(SS32))) |
| 2086 | return -EFAULT; |
| 2087 | if (__copy_to_user(ss32,&ss,offsetof(SS32,iomem_base))) |
| 2088 | return -EFAULT; |
Heiko Carstens | 7116e99 | 2006-12-06 20:36:36 -0800 | [diff] [blame] | 2089 | base = (unsigned long)ss.iomem_base >> 32 ? |
| 2090 | 0xffffffff : (unsigned)(unsigned long)ss.iomem_base; |
| 2091 | if (__put_user(base, &ss32->iomem_base) || |
| 2092 | __put_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift) || |
| 2093 | __put_user(ss.port_high, &ss32->port_high)) |
| 2094 | return -EFAULT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2095 | } |
| 2096 | return err; |
| 2097 | } |
| 2098 | |
| 2099 | struct usbdevfs_ctrltransfer32 { |
| 2100 | u8 bRequestType; |
| 2101 | u8 bRequest; |
| 2102 | u16 wValue; |
| 2103 | u16 wIndex; |
| 2104 | u16 wLength; |
| 2105 | u32 timeout; /* in milliseconds */ |
| 2106 | compat_caddr_t data; |
| 2107 | }; |
| 2108 | |
| 2109 | #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32) |
| 2110 | |
| 2111 | static int do_usbdevfs_control(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 2112 | { |
| 2113 | struct usbdevfs_ctrltransfer32 __user *p32 = compat_ptr(arg); |
| 2114 | struct usbdevfs_ctrltransfer __user *p; |
| 2115 | __u32 udata; |
| 2116 | p = compat_alloc_user_space(sizeof(*p)); |
| 2117 | if (copy_in_user(p, p32, (sizeof(*p32) - sizeof(compat_caddr_t))) || |
| 2118 | get_user(udata, &p32->data) || |
| 2119 | put_user(compat_ptr(udata), &p->data)) |
| 2120 | return -EFAULT; |
| 2121 | return sys_ioctl(fd, USBDEVFS_CONTROL, (unsigned long)p); |
| 2122 | } |
| 2123 | |
| 2124 | |
| 2125 | struct usbdevfs_bulktransfer32 { |
| 2126 | compat_uint_t ep; |
| 2127 | compat_uint_t len; |
| 2128 | compat_uint_t timeout; /* in milliseconds */ |
| 2129 | compat_caddr_t data; |
| 2130 | }; |
| 2131 | |
| 2132 | #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32) |
| 2133 | |
| 2134 | static int do_usbdevfs_bulk(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 2135 | { |
| 2136 | struct usbdevfs_bulktransfer32 __user *p32 = compat_ptr(arg); |
| 2137 | struct usbdevfs_bulktransfer __user *p; |
| 2138 | compat_uint_t n; |
| 2139 | compat_caddr_t addr; |
| 2140 | |
| 2141 | p = compat_alloc_user_space(sizeof(*p)); |
| 2142 | |
| 2143 | if (get_user(n, &p32->ep) || put_user(n, &p->ep) || |
| 2144 | get_user(n, &p32->len) || put_user(n, &p->len) || |
| 2145 | get_user(n, &p32->timeout) || put_user(n, &p->timeout) || |
| 2146 | get_user(addr, &p32->data) || put_user(compat_ptr(addr), &p->data)) |
| 2147 | return -EFAULT; |
| 2148 | |
| 2149 | return sys_ioctl(fd, USBDEVFS_BULK, (unsigned long)p); |
| 2150 | } |
| 2151 | |
| 2152 | |
| 2153 | /* |
| 2154 | * USBDEVFS_SUBMITURB, USBDEVFS_REAPURB and USBDEVFS_REAPURBNDELAY |
| 2155 | * are handled in usbdevfs core. -Christopher Li |
| 2156 | */ |
| 2157 | |
| 2158 | struct usbdevfs_disconnectsignal32 { |
| 2159 | compat_int_t signr; |
| 2160 | compat_caddr_t context; |
| 2161 | }; |
| 2162 | |
| 2163 | #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32) |
| 2164 | |
| 2165 | static int do_usbdevfs_discsignal(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 2166 | { |
| 2167 | struct usbdevfs_disconnectsignal kdis; |
| 2168 | struct usbdevfs_disconnectsignal32 __user *udis; |
| 2169 | mm_segment_t old_fs; |
| 2170 | u32 uctx; |
| 2171 | int err; |
| 2172 | |
| 2173 | udis = compat_ptr(arg); |
| 2174 | |
| 2175 | if (get_user(kdis.signr, &udis->signr) || |
| 2176 | __get_user(uctx, &udis->context)) |
| 2177 | return -EFAULT; |
| 2178 | |
| 2179 | kdis.context = compat_ptr(uctx); |
| 2180 | |
| 2181 | old_fs = get_fs(); |
| 2182 | set_fs(KERNEL_DS); |
| 2183 | err = sys_ioctl(fd, USBDEVFS_DISCSIGNAL, (unsigned long) &kdis); |
| 2184 | set_fs(old_fs); |
| 2185 | |
| 2186 | return err; |
| 2187 | } |
| 2188 | |
| 2189 | /* |
| 2190 | * I2C layer ioctls |
| 2191 | */ |
| 2192 | |
| 2193 | struct i2c_msg32 { |
| 2194 | u16 addr; |
| 2195 | u16 flags; |
| 2196 | u16 len; |
| 2197 | compat_caddr_t buf; |
| 2198 | }; |
| 2199 | |
| 2200 | struct i2c_rdwr_ioctl_data32 { |
| 2201 | compat_caddr_t msgs; /* struct i2c_msg __user *msgs */ |
| 2202 | u32 nmsgs; |
| 2203 | }; |
| 2204 | |
| 2205 | struct i2c_smbus_ioctl_data32 { |
| 2206 | u8 read_write; |
| 2207 | u8 command; |
| 2208 | u32 size; |
| 2209 | compat_caddr_t data; /* union i2c_smbus_data *data */ |
| 2210 | }; |
| 2211 | |
| 2212 | struct i2c_rdwr_aligned { |
| 2213 | struct i2c_rdwr_ioctl_data cmd; |
| 2214 | struct i2c_msg msgs[0]; |
| 2215 | }; |
| 2216 | |
| 2217 | static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 2218 | { |
| 2219 | struct i2c_rdwr_ioctl_data32 __user *udata = compat_ptr(arg); |
| 2220 | struct i2c_rdwr_aligned __user *tdata; |
| 2221 | struct i2c_msg __user *tmsgs; |
| 2222 | struct i2c_msg32 __user *umsgs; |
| 2223 | compat_caddr_t datap; |
| 2224 | int nmsgs, i; |
| 2225 | |
| 2226 | if (get_user(nmsgs, &udata->nmsgs)) |
| 2227 | return -EFAULT; |
| 2228 | if (nmsgs > I2C_RDRW_IOCTL_MAX_MSGS) |
| 2229 | return -EINVAL; |
| 2230 | |
| 2231 | if (get_user(datap, &udata->msgs)) |
| 2232 | return -EFAULT; |
| 2233 | umsgs = compat_ptr(datap); |
| 2234 | |
| 2235 | tdata = compat_alloc_user_space(sizeof(*tdata) + |
| 2236 | nmsgs * sizeof(struct i2c_msg)); |
| 2237 | tmsgs = &tdata->msgs[0]; |
| 2238 | |
| 2239 | if (put_user(nmsgs, &tdata->cmd.nmsgs) || |
| 2240 | put_user(tmsgs, &tdata->cmd.msgs)) |
| 2241 | return -EFAULT; |
| 2242 | |
| 2243 | for (i = 0; i < nmsgs; i++) { |
| 2244 | if (copy_in_user(&tmsgs[i].addr, &umsgs[i].addr, 3*sizeof(u16))) |
| 2245 | return -EFAULT; |
| 2246 | if (get_user(datap, &umsgs[i].buf) || |
| 2247 | put_user(compat_ptr(datap), &tmsgs[i].buf)) |
| 2248 | return -EFAULT; |
| 2249 | } |
| 2250 | return sys_ioctl(fd, cmd, (unsigned long)tdata); |
| 2251 | } |
| 2252 | |
| 2253 | static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 2254 | { |
| 2255 | struct i2c_smbus_ioctl_data __user *tdata; |
| 2256 | struct i2c_smbus_ioctl_data32 __user *udata; |
| 2257 | compat_caddr_t datap; |
| 2258 | |
| 2259 | tdata = compat_alloc_user_space(sizeof(*tdata)); |
| 2260 | if (tdata == NULL) |
| 2261 | return -ENOMEM; |
| 2262 | if (!access_ok(VERIFY_WRITE, tdata, sizeof(*tdata))) |
| 2263 | return -EFAULT; |
| 2264 | |
| 2265 | udata = compat_ptr(arg); |
| 2266 | if (!access_ok(VERIFY_READ, udata, sizeof(*udata))) |
| 2267 | return -EFAULT; |
| 2268 | |
| 2269 | if (__copy_in_user(&tdata->read_write, &udata->read_write, 2 * sizeof(u8))) |
| 2270 | return -EFAULT; |
| 2271 | if (__copy_in_user(&tdata->size, &udata->size, 2 * sizeof(u32))) |
| 2272 | return -EFAULT; |
| 2273 | if (__get_user(datap, &udata->data) || |
| 2274 | __put_user(compat_ptr(datap), &tdata->data)) |
| 2275 | return -EFAULT; |
| 2276 | |
| 2277 | return sys_ioctl(fd, cmd, (unsigned long)tdata); |
| 2278 | } |
| 2279 | |
| 2280 | struct compat_iw_point { |
| 2281 | compat_caddr_t pointer; |
| 2282 | __u16 length; |
| 2283 | __u16 flags; |
| 2284 | }; |
| 2285 | |
| 2286 | static int do_wireless_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 2287 | { |
| 2288 | struct iwreq __user *iwr; |
| 2289 | struct iwreq __user *iwr_u; |
| 2290 | struct iw_point __user *iwp; |
| 2291 | struct compat_iw_point __user *iwp_u; |
| 2292 | compat_caddr_t pointer; |
| 2293 | __u16 length, flags; |
| 2294 | |
| 2295 | iwr_u = compat_ptr(arg); |
| 2296 | iwp_u = (struct compat_iw_point __user *) &iwr_u->u.data; |
| 2297 | iwr = compat_alloc_user_space(sizeof(*iwr)); |
| 2298 | if (iwr == NULL) |
| 2299 | return -ENOMEM; |
| 2300 | |
| 2301 | iwp = &iwr->u.data; |
| 2302 | |
| 2303 | if (!access_ok(VERIFY_WRITE, iwr, sizeof(*iwr))) |
| 2304 | return -EFAULT; |
| 2305 | |
| 2306 | if (__copy_in_user(&iwr->ifr_ifrn.ifrn_name[0], |
| 2307 | &iwr_u->ifr_ifrn.ifrn_name[0], |
| 2308 | sizeof(iwr->ifr_ifrn.ifrn_name))) |
| 2309 | return -EFAULT; |
| 2310 | |
| 2311 | if (__get_user(pointer, &iwp_u->pointer) || |
| 2312 | __get_user(length, &iwp_u->length) || |
| 2313 | __get_user(flags, &iwp_u->flags)) |
| 2314 | return -EFAULT; |
| 2315 | |
| 2316 | if (__put_user(compat_ptr(pointer), &iwp->pointer) || |
| 2317 | __put_user(length, &iwp->length) || |
| 2318 | __put_user(flags, &iwp->flags)) |
| 2319 | return -EFAULT; |
| 2320 | |
| 2321 | return sys_ioctl(fd, cmd, (unsigned long) iwr); |
| 2322 | } |
| 2323 | |
| 2324 | /* Since old style bridge ioctl's endup using SIOCDEVPRIVATE |
| 2325 | * for some operations; this forces use of the newer bridge-utils that |
| 2326 | * use compatiable ioctls |
| 2327 | */ |
| 2328 | static int old_bridge_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 2329 | { |
| 2330 | u32 tmp; |
| 2331 | |
| 2332 | if (get_user(tmp, (u32 __user *) arg)) |
| 2333 | return -EFAULT; |
| 2334 | if (tmp == BRCTL_GET_VERSION) |
| 2335 | return BRCTL_VERSION + 1; |
| 2336 | return -EINVAL; |
| 2337 | } |
| 2338 | |
Christoph Hellwig | ec3cad9 | 2006-01-09 20:52:11 -0800 | [diff] [blame] | 2339 | #define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t) |
| 2340 | #define RTC_IRQP_SET32 _IOW('p', 0x0c, compat_ulong_t) |
| 2341 | #define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t) |
| 2342 | #define RTC_EPOCH_SET32 _IOW('p', 0x0e, compat_ulong_t) |
| 2343 | |
| 2344 | static int rtc_ioctl(unsigned fd, unsigned cmd, unsigned long arg) |
| 2345 | { |
| 2346 | mm_segment_t oldfs = get_fs(); |
| 2347 | compat_ulong_t val32; |
| 2348 | unsigned long kval; |
| 2349 | int ret; |
| 2350 | |
| 2351 | switch (cmd) { |
| 2352 | case RTC_IRQP_READ32: |
| 2353 | case RTC_EPOCH_READ32: |
| 2354 | set_fs(KERNEL_DS); |
| 2355 | ret = sys_ioctl(fd, (cmd == RTC_IRQP_READ32) ? |
| 2356 | RTC_IRQP_READ : RTC_EPOCH_READ, |
| 2357 | (unsigned long)&kval); |
| 2358 | set_fs(oldfs); |
| 2359 | if (ret) |
| 2360 | return ret; |
| 2361 | val32 = kval; |
| 2362 | return put_user(val32, (unsigned int __user *)arg); |
| 2363 | case RTC_IRQP_SET32: |
Andi Kleen | fc5870f | 2006-02-26 04:18:55 +0100 | [diff] [blame] | 2364 | return sys_ioctl(fd, RTC_IRQP_SET, arg); |
Christoph Hellwig | ec3cad9 | 2006-01-09 20:52:11 -0800 | [diff] [blame] | 2365 | case RTC_EPOCH_SET32: |
Andi Kleen | fc5870f | 2006-02-26 04:18:55 +0100 | [diff] [blame] | 2366 | return sys_ioctl(fd, RTC_EPOCH_SET, arg); |
Christoph Hellwig | ec3cad9 | 2006-01-09 20:52:11 -0800 | [diff] [blame] | 2367 | default: |
| 2368 | /* unreached */ |
| 2369 | return -ENOIOCTLCMD; |
| 2370 | } |
| 2371 | } |
| 2372 | |
Andi Kleen | c6b44d1 | 2006-01-12 01:05:26 -0800 | [diff] [blame] | 2373 | static int |
| 2374 | lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 2375 | { |
Al Viro | 6b2b4e5 | 2006-02-01 06:33:33 -0500 | [diff] [blame] | 2376 | struct compat_timeval __user *tc = (struct compat_timeval __user *)arg; |
| 2377 | struct timeval __user *tn = compat_alloc_user_space(sizeof(struct timeval)); |
Andi Kleen | c6b44d1 | 2006-01-12 01:05:26 -0800 | [diff] [blame] | 2378 | struct timeval ts; |
| 2379 | if (get_user(ts.tv_sec, &tc->tv_sec) || |
| 2380 | get_user(ts.tv_usec, &tc->tv_usec) || |
| 2381 | put_user(ts.tv_sec, &tn->tv_sec) || |
| 2382 | put_user(ts.tv_usec, &tn->tv_usec)) |
| 2383 | return -EFAULT; |
| 2384 | return sys_ioctl(fd, cmd, (unsigned long)tn); |
| 2385 | } |
| 2386 | |
Christoph Hellwig | e6a6d2e | 2006-01-09 20:52:14 -0800 | [diff] [blame] | 2387 | #define HANDLE_IOCTL(cmd,handler) \ |
| 2388 | { (cmd), (ioctl_trans_handler_t)(handler) }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2389 | |
Christoph Hellwig | e6a6d2e | 2006-01-09 20:52:14 -0800 | [diff] [blame] | 2390 | /* pointer to compatible structure or no argument */ |
| 2391 | #define COMPATIBLE_IOCTL(cmd) \ |
| 2392 | { (cmd), do_ioctl32_pointer }, |
| 2393 | |
| 2394 | /* argument is an unsigned long integer, not a pointer */ |
| 2395 | #define ULONG_IOCTL(cmd) \ |
| 2396 | { (cmd), (ioctl_trans_handler_t)sys_ioctl }, |
| 2397 | |
Andi Kleen | 421f028 | 2007-05-02 19:27:20 +0200 | [diff] [blame] | 2398 | /* ioctl should not be warned about even if it's not implemented. |
| 2399 | Valid reasons to use this: |
| 2400 | - It is implemented with ->compat_ioctl on some device, but programs |
| 2401 | call it on others too. |
| 2402 | - The ioctl is not implemented in the native kernel, but programs |
| 2403 | call it commonly anyways. |
| 2404 | Most other reasons are not valid. */ |
| 2405 | #define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd) |
Christoph Hellwig | e6a6d2e | 2006-01-09 20:52:14 -0800 | [diff] [blame] | 2406 | |
| 2407 | struct ioctl_trans ioctl_start[] = { |
Christoph Hellwig | 644fd4f | 2007-05-08 00:29:07 -0700 | [diff] [blame^] | 2408 | /* compatible ioctls first */ |
| 2409 | COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */ |
| 2410 | COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */ |
| 2411 | |
| 2412 | /* Big T */ |
| 2413 | COMPATIBLE_IOCTL(TCGETA) |
| 2414 | COMPATIBLE_IOCTL(TCSETA) |
| 2415 | COMPATIBLE_IOCTL(TCSETAW) |
| 2416 | COMPATIBLE_IOCTL(TCSETAF) |
| 2417 | COMPATIBLE_IOCTL(TCSBRK) |
| 2418 | ULONG_IOCTL(TCSBRKP) |
| 2419 | COMPATIBLE_IOCTL(TCXONC) |
| 2420 | COMPATIBLE_IOCTL(TCFLSH) |
| 2421 | COMPATIBLE_IOCTL(TCGETS) |
| 2422 | COMPATIBLE_IOCTL(TCSETS) |
| 2423 | COMPATIBLE_IOCTL(TCSETSW) |
| 2424 | COMPATIBLE_IOCTL(TCSETSF) |
| 2425 | COMPATIBLE_IOCTL(TIOCLINUX) |
| 2426 | COMPATIBLE_IOCTL(TIOCSBRK) |
| 2427 | COMPATIBLE_IOCTL(TIOCCBRK) |
| 2428 | ULONG_IOCTL(TIOCMIWAIT) |
| 2429 | COMPATIBLE_IOCTL(TIOCGICOUNT) |
| 2430 | /* Little t */ |
| 2431 | COMPATIBLE_IOCTL(TIOCGETD) |
| 2432 | COMPATIBLE_IOCTL(TIOCSETD) |
| 2433 | COMPATIBLE_IOCTL(TIOCEXCL) |
| 2434 | COMPATIBLE_IOCTL(TIOCNXCL) |
| 2435 | COMPATIBLE_IOCTL(TIOCCONS) |
| 2436 | COMPATIBLE_IOCTL(TIOCGSOFTCAR) |
| 2437 | COMPATIBLE_IOCTL(TIOCSSOFTCAR) |
| 2438 | COMPATIBLE_IOCTL(TIOCSWINSZ) |
| 2439 | COMPATIBLE_IOCTL(TIOCGWINSZ) |
| 2440 | COMPATIBLE_IOCTL(TIOCMGET) |
| 2441 | COMPATIBLE_IOCTL(TIOCMBIC) |
| 2442 | COMPATIBLE_IOCTL(TIOCMBIS) |
| 2443 | COMPATIBLE_IOCTL(TIOCMSET) |
| 2444 | COMPATIBLE_IOCTL(TIOCPKT) |
| 2445 | COMPATIBLE_IOCTL(TIOCNOTTY) |
| 2446 | COMPATIBLE_IOCTL(TIOCSTI) |
| 2447 | COMPATIBLE_IOCTL(TIOCOUTQ) |
| 2448 | COMPATIBLE_IOCTL(TIOCSPGRP) |
| 2449 | COMPATIBLE_IOCTL(TIOCGPGRP) |
| 2450 | ULONG_IOCTL(TIOCSCTTY) |
| 2451 | COMPATIBLE_IOCTL(TIOCGPTN) |
| 2452 | COMPATIBLE_IOCTL(TIOCSPTLCK) |
| 2453 | COMPATIBLE_IOCTL(TIOCSERGETLSR) |
| 2454 | /* Little f */ |
| 2455 | COMPATIBLE_IOCTL(FIOCLEX) |
| 2456 | COMPATIBLE_IOCTL(FIONCLEX) |
| 2457 | COMPATIBLE_IOCTL(FIOASYNC) |
| 2458 | COMPATIBLE_IOCTL(FIONBIO) |
| 2459 | COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */ |
| 2460 | /* 0x00 */ |
| 2461 | COMPATIBLE_IOCTL(FIBMAP) |
| 2462 | COMPATIBLE_IOCTL(FIGETBSZ) |
| 2463 | /* 0x03 -- HD/IDE ioctl's used by hdparm and friends. |
| 2464 | * Some need translations, these do not. |
| 2465 | */ |
| 2466 | COMPATIBLE_IOCTL(HDIO_GET_IDENTITY) |
| 2467 | COMPATIBLE_IOCTL(HDIO_DRIVE_TASK) |
| 2468 | COMPATIBLE_IOCTL(HDIO_DRIVE_CMD) |
| 2469 | ULONG_IOCTL(HDIO_SET_MULTCOUNT) |
| 2470 | ULONG_IOCTL(HDIO_SET_UNMASKINTR) |
| 2471 | ULONG_IOCTL(HDIO_SET_KEEPSETTINGS) |
| 2472 | ULONG_IOCTL(HDIO_SET_32BIT) |
| 2473 | ULONG_IOCTL(HDIO_SET_NOWERR) |
| 2474 | ULONG_IOCTL(HDIO_SET_DMA) |
| 2475 | ULONG_IOCTL(HDIO_SET_PIO_MODE) |
| 2476 | ULONG_IOCTL(HDIO_SET_NICE) |
| 2477 | ULONG_IOCTL(HDIO_SET_WCACHE) |
| 2478 | ULONG_IOCTL(HDIO_SET_ACOUSTIC) |
| 2479 | ULONG_IOCTL(HDIO_SET_BUSSTATE) |
| 2480 | ULONG_IOCTL(HDIO_SET_ADDRESS) |
| 2481 | COMPATIBLE_IOCTL(HDIO_SCAN_HWIF) |
| 2482 | /* 0x330 is reserved -- it used to be HDIO_GETGEO_BIG */ |
| 2483 | COMPATIBLE_IOCTL(0x330) |
| 2484 | /* 0x02 -- Floppy ioctls */ |
| 2485 | COMPATIBLE_IOCTL(FDMSGON) |
| 2486 | COMPATIBLE_IOCTL(FDMSGOFF) |
| 2487 | COMPATIBLE_IOCTL(FDSETEMSGTRESH) |
| 2488 | COMPATIBLE_IOCTL(FDFLUSH) |
| 2489 | COMPATIBLE_IOCTL(FDWERRORCLR) |
| 2490 | COMPATIBLE_IOCTL(FDSETMAXERRS) |
| 2491 | COMPATIBLE_IOCTL(FDGETMAXERRS) |
| 2492 | COMPATIBLE_IOCTL(FDGETDRVTYP) |
| 2493 | COMPATIBLE_IOCTL(FDEJECT) |
| 2494 | COMPATIBLE_IOCTL(FDCLRPRM) |
| 2495 | COMPATIBLE_IOCTL(FDFMTBEG) |
| 2496 | COMPATIBLE_IOCTL(FDFMTEND) |
| 2497 | COMPATIBLE_IOCTL(FDRESET) |
| 2498 | COMPATIBLE_IOCTL(FDTWADDLE) |
| 2499 | COMPATIBLE_IOCTL(FDFMTTRK) |
| 2500 | COMPATIBLE_IOCTL(FDRAWCMD) |
| 2501 | /* 0x12 */ |
| 2502 | #ifdef CONFIG_BLOCK |
| 2503 | COMPATIBLE_IOCTL(BLKRASET) |
| 2504 | COMPATIBLE_IOCTL(BLKROSET) |
| 2505 | COMPATIBLE_IOCTL(BLKROGET) |
| 2506 | COMPATIBLE_IOCTL(BLKRRPART) |
| 2507 | COMPATIBLE_IOCTL(BLKFLSBUF) |
| 2508 | COMPATIBLE_IOCTL(BLKSECTSET) |
| 2509 | COMPATIBLE_IOCTL(BLKSSZGET) |
| 2510 | COMPATIBLE_IOCTL(BLKTRACESTART) |
| 2511 | COMPATIBLE_IOCTL(BLKTRACESTOP) |
| 2512 | COMPATIBLE_IOCTL(BLKTRACESETUP) |
| 2513 | COMPATIBLE_IOCTL(BLKTRACETEARDOWN) |
| 2514 | ULONG_IOCTL(BLKRASET) |
| 2515 | ULONG_IOCTL(BLKFRASET) |
| 2516 | #endif |
| 2517 | /* RAID */ |
| 2518 | COMPATIBLE_IOCTL(RAID_VERSION) |
| 2519 | COMPATIBLE_IOCTL(GET_ARRAY_INFO) |
| 2520 | COMPATIBLE_IOCTL(GET_DISK_INFO) |
| 2521 | COMPATIBLE_IOCTL(PRINT_RAID_DEBUG) |
| 2522 | COMPATIBLE_IOCTL(RAID_AUTORUN) |
| 2523 | COMPATIBLE_IOCTL(CLEAR_ARRAY) |
| 2524 | COMPATIBLE_IOCTL(ADD_NEW_DISK) |
| 2525 | ULONG_IOCTL(HOT_REMOVE_DISK) |
| 2526 | COMPATIBLE_IOCTL(SET_ARRAY_INFO) |
| 2527 | COMPATIBLE_IOCTL(SET_DISK_INFO) |
| 2528 | COMPATIBLE_IOCTL(WRITE_RAID_INFO) |
| 2529 | COMPATIBLE_IOCTL(UNPROTECT_ARRAY) |
| 2530 | COMPATIBLE_IOCTL(PROTECT_ARRAY) |
| 2531 | ULONG_IOCTL(HOT_ADD_DISK) |
| 2532 | ULONG_IOCTL(SET_DISK_FAULTY) |
| 2533 | COMPATIBLE_IOCTL(RUN_ARRAY) |
| 2534 | COMPATIBLE_IOCTL(STOP_ARRAY) |
| 2535 | COMPATIBLE_IOCTL(STOP_ARRAY_RO) |
| 2536 | COMPATIBLE_IOCTL(RESTART_ARRAY_RW) |
| 2537 | COMPATIBLE_IOCTL(GET_BITMAP_FILE) |
| 2538 | ULONG_IOCTL(SET_BITMAP_FILE) |
| 2539 | /* DM */ |
| 2540 | COMPATIBLE_IOCTL(DM_VERSION_32) |
| 2541 | COMPATIBLE_IOCTL(DM_REMOVE_ALL_32) |
| 2542 | COMPATIBLE_IOCTL(DM_LIST_DEVICES_32) |
| 2543 | COMPATIBLE_IOCTL(DM_DEV_CREATE_32) |
| 2544 | COMPATIBLE_IOCTL(DM_DEV_REMOVE_32) |
| 2545 | COMPATIBLE_IOCTL(DM_DEV_RENAME_32) |
| 2546 | COMPATIBLE_IOCTL(DM_DEV_SUSPEND_32) |
| 2547 | COMPATIBLE_IOCTL(DM_DEV_STATUS_32) |
| 2548 | COMPATIBLE_IOCTL(DM_DEV_WAIT_32) |
| 2549 | COMPATIBLE_IOCTL(DM_TABLE_LOAD_32) |
| 2550 | COMPATIBLE_IOCTL(DM_TABLE_CLEAR_32) |
| 2551 | COMPATIBLE_IOCTL(DM_TABLE_DEPS_32) |
| 2552 | COMPATIBLE_IOCTL(DM_TABLE_STATUS_32) |
| 2553 | COMPATIBLE_IOCTL(DM_LIST_VERSIONS_32) |
| 2554 | COMPATIBLE_IOCTL(DM_TARGET_MSG_32) |
| 2555 | COMPATIBLE_IOCTL(DM_DEV_SET_GEOMETRY_32) |
| 2556 | COMPATIBLE_IOCTL(DM_VERSION) |
| 2557 | COMPATIBLE_IOCTL(DM_REMOVE_ALL) |
| 2558 | COMPATIBLE_IOCTL(DM_LIST_DEVICES) |
| 2559 | COMPATIBLE_IOCTL(DM_DEV_CREATE) |
| 2560 | COMPATIBLE_IOCTL(DM_DEV_REMOVE) |
| 2561 | COMPATIBLE_IOCTL(DM_DEV_RENAME) |
| 2562 | COMPATIBLE_IOCTL(DM_DEV_SUSPEND) |
| 2563 | COMPATIBLE_IOCTL(DM_DEV_STATUS) |
| 2564 | COMPATIBLE_IOCTL(DM_DEV_WAIT) |
| 2565 | COMPATIBLE_IOCTL(DM_TABLE_LOAD) |
| 2566 | COMPATIBLE_IOCTL(DM_TABLE_CLEAR) |
| 2567 | COMPATIBLE_IOCTL(DM_TABLE_DEPS) |
| 2568 | COMPATIBLE_IOCTL(DM_TABLE_STATUS) |
| 2569 | COMPATIBLE_IOCTL(DM_LIST_VERSIONS) |
| 2570 | COMPATIBLE_IOCTL(DM_TARGET_MSG) |
| 2571 | COMPATIBLE_IOCTL(DM_DEV_SET_GEOMETRY) |
| 2572 | /* Big K */ |
| 2573 | COMPATIBLE_IOCTL(PIO_FONT) |
| 2574 | COMPATIBLE_IOCTL(GIO_FONT) |
| 2575 | ULONG_IOCTL(KDSIGACCEPT) |
| 2576 | COMPATIBLE_IOCTL(KDGETKEYCODE) |
| 2577 | COMPATIBLE_IOCTL(KDSETKEYCODE) |
| 2578 | ULONG_IOCTL(KIOCSOUND) |
| 2579 | ULONG_IOCTL(KDMKTONE) |
| 2580 | COMPATIBLE_IOCTL(KDGKBTYPE) |
| 2581 | ULONG_IOCTL(KDSETMODE) |
| 2582 | COMPATIBLE_IOCTL(KDGETMODE) |
| 2583 | ULONG_IOCTL(KDSKBMODE) |
| 2584 | COMPATIBLE_IOCTL(KDGKBMODE) |
| 2585 | ULONG_IOCTL(KDSKBMETA) |
| 2586 | COMPATIBLE_IOCTL(KDGKBMETA) |
| 2587 | COMPATIBLE_IOCTL(KDGKBENT) |
| 2588 | COMPATIBLE_IOCTL(KDSKBENT) |
| 2589 | COMPATIBLE_IOCTL(KDGKBSENT) |
| 2590 | COMPATIBLE_IOCTL(KDSKBSENT) |
| 2591 | COMPATIBLE_IOCTL(KDGKBDIACR) |
| 2592 | COMPATIBLE_IOCTL(KDSKBDIACR) |
| 2593 | COMPATIBLE_IOCTL(KDKBDREP) |
| 2594 | COMPATIBLE_IOCTL(KDGKBLED) |
| 2595 | ULONG_IOCTL(KDSKBLED) |
| 2596 | COMPATIBLE_IOCTL(KDGETLED) |
| 2597 | ULONG_IOCTL(KDSETLED) |
| 2598 | COMPATIBLE_IOCTL(GIO_SCRNMAP) |
| 2599 | COMPATIBLE_IOCTL(PIO_SCRNMAP) |
| 2600 | COMPATIBLE_IOCTL(GIO_UNISCRNMAP) |
| 2601 | COMPATIBLE_IOCTL(PIO_UNISCRNMAP) |
| 2602 | COMPATIBLE_IOCTL(PIO_FONTRESET) |
| 2603 | COMPATIBLE_IOCTL(PIO_UNIMAPCLR) |
| 2604 | /* Big S */ |
| 2605 | COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN) |
| 2606 | COMPATIBLE_IOCTL(SCSI_IOCTL_DOORLOCK) |
| 2607 | COMPATIBLE_IOCTL(SCSI_IOCTL_DOORUNLOCK) |
| 2608 | COMPATIBLE_IOCTL(SCSI_IOCTL_TEST_UNIT_READY) |
| 2609 | COMPATIBLE_IOCTL(SCSI_IOCTL_GET_BUS_NUMBER) |
| 2610 | COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND) |
| 2611 | COMPATIBLE_IOCTL(SCSI_IOCTL_PROBE_HOST) |
| 2612 | COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI) |
| 2613 | /* Big T */ |
| 2614 | COMPATIBLE_IOCTL(TUNSETNOCSUM) |
| 2615 | COMPATIBLE_IOCTL(TUNSETDEBUG) |
| 2616 | COMPATIBLE_IOCTL(TUNSETPERSIST) |
| 2617 | COMPATIBLE_IOCTL(TUNSETOWNER) |
| 2618 | /* Big V */ |
| 2619 | COMPATIBLE_IOCTL(VT_SETMODE) |
| 2620 | COMPATIBLE_IOCTL(VT_GETMODE) |
| 2621 | COMPATIBLE_IOCTL(VT_GETSTATE) |
| 2622 | COMPATIBLE_IOCTL(VT_OPENQRY) |
| 2623 | ULONG_IOCTL(VT_ACTIVATE) |
| 2624 | ULONG_IOCTL(VT_WAITACTIVE) |
| 2625 | ULONG_IOCTL(VT_RELDISP) |
| 2626 | ULONG_IOCTL(VT_DISALLOCATE) |
| 2627 | COMPATIBLE_IOCTL(VT_RESIZE) |
| 2628 | COMPATIBLE_IOCTL(VT_RESIZEX) |
| 2629 | COMPATIBLE_IOCTL(VT_LOCKSWITCH) |
| 2630 | COMPATIBLE_IOCTL(VT_UNLOCKSWITCH) |
| 2631 | COMPATIBLE_IOCTL(VT_GETHIFONTMASK) |
| 2632 | /* Little p (/dev/rtc, /dev/envctrl, etc.) */ |
| 2633 | COMPATIBLE_IOCTL(RTC_AIE_ON) |
| 2634 | COMPATIBLE_IOCTL(RTC_AIE_OFF) |
| 2635 | COMPATIBLE_IOCTL(RTC_UIE_ON) |
| 2636 | COMPATIBLE_IOCTL(RTC_UIE_OFF) |
| 2637 | COMPATIBLE_IOCTL(RTC_PIE_ON) |
| 2638 | COMPATIBLE_IOCTL(RTC_PIE_OFF) |
| 2639 | COMPATIBLE_IOCTL(RTC_WIE_ON) |
| 2640 | COMPATIBLE_IOCTL(RTC_WIE_OFF) |
| 2641 | COMPATIBLE_IOCTL(RTC_ALM_SET) |
| 2642 | COMPATIBLE_IOCTL(RTC_ALM_READ) |
| 2643 | COMPATIBLE_IOCTL(RTC_RD_TIME) |
| 2644 | COMPATIBLE_IOCTL(RTC_SET_TIME) |
| 2645 | COMPATIBLE_IOCTL(RTC_WKALM_SET) |
| 2646 | COMPATIBLE_IOCTL(RTC_WKALM_RD) |
| 2647 | /* |
| 2648 | * These two are only for the sbus rtc driver, but |
| 2649 | * hwclock tries them on every rtc device first when |
| 2650 | * running on sparc. On other architectures the entries |
| 2651 | * are useless but harmless. |
| 2652 | */ |
| 2653 | COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */ |
| 2654 | COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */ |
| 2655 | /* Little m */ |
| 2656 | COMPATIBLE_IOCTL(MTIOCTOP) |
| 2657 | /* Socket level stuff */ |
| 2658 | COMPATIBLE_IOCTL(FIOQSIZE) |
| 2659 | COMPATIBLE_IOCTL(FIOSETOWN) |
| 2660 | COMPATIBLE_IOCTL(SIOCSPGRP) |
| 2661 | COMPATIBLE_IOCTL(FIOGETOWN) |
| 2662 | COMPATIBLE_IOCTL(SIOCGPGRP) |
| 2663 | COMPATIBLE_IOCTL(SIOCATMARK) |
| 2664 | COMPATIBLE_IOCTL(SIOCSIFLINK) |
| 2665 | COMPATIBLE_IOCTL(SIOCSIFENCAP) |
| 2666 | COMPATIBLE_IOCTL(SIOCGIFENCAP) |
| 2667 | COMPATIBLE_IOCTL(SIOCSIFNAME) |
| 2668 | COMPATIBLE_IOCTL(SIOCSARP) |
| 2669 | COMPATIBLE_IOCTL(SIOCGARP) |
| 2670 | COMPATIBLE_IOCTL(SIOCDARP) |
| 2671 | COMPATIBLE_IOCTL(SIOCSRARP) |
| 2672 | COMPATIBLE_IOCTL(SIOCGRARP) |
| 2673 | COMPATIBLE_IOCTL(SIOCDRARP) |
| 2674 | COMPATIBLE_IOCTL(SIOCADDDLCI) |
| 2675 | COMPATIBLE_IOCTL(SIOCDELDLCI) |
| 2676 | COMPATIBLE_IOCTL(SIOCGMIIPHY) |
| 2677 | COMPATIBLE_IOCTL(SIOCGMIIREG) |
| 2678 | COMPATIBLE_IOCTL(SIOCSMIIREG) |
| 2679 | COMPATIBLE_IOCTL(SIOCGIFVLAN) |
| 2680 | COMPATIBLE_IOCTL(SIOCSIFVLAN) |
| 2681 | COMPATIBLE_IOCTL(SIOCBRADDBR) |
| 2682 | COMPATIBLE_IOCTL(SIOCBRDELBR) |
| 2683 | /* SG stuff */ |
| 2684 | COMPATIBLE_IOCTL(SG_SET_TIMEOUT) |
| 2685 | COMPATIBLE_IOCTL(SG_GET_TIMEOUT) |
| 2686 | COMPATIBLE_IOCTL(SG_EMULATED_HOST) |
| 2687 | ULONG_IOCTL(SG_SET_TRANSFORM) |
| 2688 | COMPATIBLE_IOCTL(SG_GET_TRANSFORM) |
| 2689 | COMPATIBLE_IOCTL(SG_SET_RESERVED_SIZE) |
| 2690 | COMPATIBLE_IOCTL(SG_GET_RESERVED_SIZE) |
| 2691 | COMPATIBLE_IOCTL(SG_GET_SCSI_ID) |
| 2692 | COMPATIBLE_IOCTL(SG_SET_FORCE_LOW_DMA) |
| 2693 | COMPATIBLE_IOCTL(SG_GET_LOW_DMA) |
| 2694 | COMPATIBLE_IOCTL(SG_SET_FORCE_PACK_ID) |
| 2695 | COMPATIBLE_IOCTL(SG_GET_PACK_ID) |
| 2696 | COMPATIBLE_IOCTL(SG_GET_NUM_WAITING) |
| 2697 | COMPATIBLE_IOCTL(SG_SET_DEBUG) |
| 2698 | COMPATIBLE_IOCTL(SG_GET_SG_TABLESIZE) |
| 2699 | COMPATIBLE_IOCTL(SG_GET_COMMAND_Q) |
| 2700 | COMPATIBLE_IOCTL(SG_SET_COMMAND_Q) |
| 2701 | COMPATIBLE_IOCTL(SG_GET_VERSION_NUM) |
| 2702 | COMPATIBLE_IOCTL(SG_NEXT_CMD_LEN) |
| 2703 | COMPATIBLE_IOCTL(SG_SCSI_RESET) |
| 2704 | COMPATIBLE_IOCTL(SG_GET_REQUEST_TABLE) |
| 2705 | COMPATIBLE_IOCTL(SG_SET_KEEP_ORPHAN) |
| 2706 | COMPATIBLE_IOCTL(SG_GET_KEEP_ORPHAN) |
| 2707 | /* PPP stuff */ |
| 2708 | COMPATIBLE_IOCTL(PPPIOCGFLAGS) |
| 2709 | COMPATIBLE_IOCTL(PPPIOCSFLAGS) |
| 2710 | COMPATIBLE_IOCTL(PPPIOCGASYNCMAP) |
| 2711 | COMPATIBLE_IOCTL(PPPIOCSASYNCMAP) |
| 2712 | COMPATIBLE_IOCTL(PPPIOCGUNIT) |
| 2713 | COMPATIBLE_IOCTL(PPPIOCGRASYNCMAP) |
| 2714 | COMPATIBLE_IOCTL(PPPIOCSRASYNCMAP) |
| 2715 | COMPATIBLE_IOCTL(PPPIOCGMRU) |
| 2716 | COMPATIBLE_IOCTL(PPPIOCSMRU) |
| 2717 | COMPATIBLE_IOCTL(PPPIOCSMAXCID) |
| 2718 | COMPATIBLE_IOCTL(PPPIOCGXASYNCMAP) |
| 2719 | COMPATIBLE_IOCTL(PPPIOCSXASYNCMAP) |
| 2720 | COMPATIBLE_IOCTL(PPPIOCXFERUNIT) |
| 2721 | /* PPPIOCSCOMPRESS is translated */ |
| 2722 | COMPATIBLE_IOCTL(PPPIOCGNPMODE) |
| 2723 | COMPATIBLE_IOCTL(PPPIOCSNPMODE) |
| 2724 | COMPATIBLE_IOCTL(PPPIOCGDEBUG) |
| 2725 | COMPATIBLE_IOCTL(PPPIOCSDEBUG) |
| 2726 | /* PPPIOCSPASS is translated */ |
| 2727 | /* PPPIOCSACTIVE is translated */ |
| 2728 | /* PPPIOCGIDLE is translated */ |
| 2729 | COMPATIBLE_IOCTL(PPPIOCNEWUNIT) |
| 2730 | COMPATIBLE_IOCTL(PPPIOCATTACH) |
| 2731 | COMPATIBLE_IOCTL(PPPIOCDETACH) |
| 2732 | COMPATIBLE_IOCTL(PPPIOCSMRRU) |
| 2733 | COMPATIBLE_IOCTL(PPPIOCCONNECT) |
| 2734 | COMPATIBLE_IOCTL(PPPIOCDISCONN) |
| 2735 | COMPATIBLE_IOCTL(PPPIOCATTCHAN) |
| 2736 | COMPATIBLE_IOCTL(PPPIOCGCHAN) |
| 2737 | /* PPPOX */ |
| 2738 | COMPATIBLE_IOCTL(PPPOEIOCSFWD) |
| 2739 | COMPATIBLE_IOCTL(PPPOEIOCDFWD) |
| 2740 | /* LP */ |
| 2741 | COMPATIBLE_IOCTL(LPGETSTATUS) |
| 2742 | /* ppdev */ |
| 2743 | COMPATIBLE_IOCTL(PPSETMODE) |
| 2744 | COMPATIBLE_IOCTL(PPRSTATUS) |
| 2745 | COMPATIBLE_IOCTL(PPRCONTROL) |
| 2746 | COMPATIBLE_IOCTL(PPWCONTROL) |
| 2747 | COMPATIBLE_IOCTL(PPFCONTROL) |
| 2748 | COMPATIBLE_IOCTL(PPRDATA) |
| 2749 | COMPATIBLE_IOCTL(PPWDATA) |
| 2750 | COMPATIBLE_IOCTL(PPCLAIM) |
| 2751 | COMPATIBLE_IOCTL(PPRELEASE) |
| 2752 | COMPATIBLE_IOCTL(PPYIELD) |
| 2753 | COMPATIBLE_IOCTL(PPEXCL) |
| 2754 | COMPATIBLE_IOCTL(PPDATADIR) |
| 2755 | COMPATIBLE_IOCTL(PPNEGOT) |
| 2756 | COMPATIBLE_IOCTL(PPWCTLONIRQ) |
| 2757 | COMPATIBLE_IOCTL(PPCLRIRQ) |
| 2758 | COMPATIBLE_IOCTL(PPSETPHASE) |
| 2759 | COMPATIBLE_IOCTL(PPGETMODES) |
| 2760 | COMPATIBLE_IOCTL(PPGETMODE) |
| 2761 | COMPATIBLE_IOCTL(PPGETPHASE) |
| 2762 | COMPATIBLE_IOCTL(PPGETFLAGS) |
| 2763 | COMPATIBLE_IOCTL(PPSETFLAGS) |
| 2764 | /* CDROM stuff */ |
| 2765 | COMPATIBLE_IOCTL(CDROMPAUSE) |
| 2766 | COMPATIBLE_IOCTL(CDROMRESUME) |
| 2767 | COMPATIBLE_IOCTL(CDROMPLAYMSF) |
| 2768 | COMPATIBLE_IOCTL(CDROMPLAYTRKIND) |
| 2769 | COMPATIBLE_IOCTL(CDROMREADTOCHDR) |
| 2770 | COMPATIBLE_IOCTL(CDROMREADTOCENTRY) |
| 2771 | COMPATIBLE_IOCTL(CDROMSTOP) |
| 2772 | COMPATIBLE_IOCTL(CDROMSTART) |
| 2773 | COMPATIBLE_IOCTL(CDROMEJECT) |
| 2774 | COMPATIBLE_IOCTL(CDROMVOLCTRL) |
| 2775 | COMPATIBLE_IOCTL(CDROMSUBCHNL) |
| 2776 | ULONG_IOCTL(CDROMEJECT_SW) |
| 2777 | COMPATIBLE_IOCTL(CDROMMULTISESSION) |
| 2778 | COMPATIBLE_IOCTL(CDROM_GET_MCN) |
| 2779 | COMPATIBLE_IOCTL(CDROMRESET) |
| 2780 | COMPATIBLE_IOCTL(CDROMVOLREAD) |
| 2781 | COMPATIBLE_IOCTL(CDROMSEEK) |
| 2782 | COMPATIBLE_IOCTL(CDROMPLAYBLK) |
| 2783 | COMPATIBLE_IOCTL(CDROMCLOSETRAY) |
| 2784 | ULONG_IOCTL(CDROM_SET_OPTIONS) |
| 2785 | ULONG_IOCTL(CDROM_CLEAR_OPTIONS) |
| 2786 | ULONG_IOCTL(CDROM_SELECT_SPEED) |
| 2787 | ULONG_IOCTL(CDROM_SELECT_DISC) |
| 2788 | ULONG_IOCTL(CDROM_MEDIA_CHANGED) |
| 2789 | ULONG_IOCTL(CDROM_DRIVE_STATUS) |
| 2790 | COMPATIBLE_IOCTL(CDROM_DISC_STATUS) |
| 2791 | COMPATIBLE_IOCTL(CDROM_CHANGER_NSLOTS) |
| 2792 | ULONG_IOCTL(CDROM_LOCKDOOR) |
| 2793 | ULONG_IOCTL(CDROM_DEBUG) |
| 2794 | COMPATIBLE_IOCTL(CDROM_GET_CAPABILITY) |
| 2795 | /* Ignore cdrom.h about these next 5 ioctls, they absolutely do |
| 2796 | * not take a struct cdrom_read, instead they take a struct cdrom_msf |
| 2797 | * which is compatible. |
| 2798 | */ |
| 2799 | COMPATIBLE_IOCTL(CDROMREADMODE2) |
| 2800 | COMPATIBLE_IOCTL(CDROMREADMODE1) |
| 2801 | COMPATIBLE_IOCTL(CDROMREADRAW) |
| 2802 | COMPATIBLE_IOCTL(CDROMREADCOOKED) |
| 2803 | COMPATIBLE_IOCTL(CDROMREADALL) |
| 2804 | /* DVD ioctls */ |
| 2805 | COMPATIBLE_IOCTL(DVD_READ_STRUCT) |
| 2806 | COMPATIBLE_IOCTL(DVD_WRITE_STRUCT) |
| 2807 | COMPATIBLE_IOCTL(DVD_AUTH) |
| 2808 | /* pktcdvd */ |
| 2809 | COMPATIBLE_IOCTL(PACKET_CTRL_CMD) |
| 2810 | /* Big A */ |
| 2811 | /* sparc only */ |
| 2812 | /* Big Q for sound/OSS */ |
| 2813 | COMPATIBLE_IOCTL(SNDCTL_SEQ_RESET) |
| 2814 | COMPATIBLE_IOCTL(SNDCTL_SEQ_SYNC) |
| 2815 | COMPATIBLE_IOCTL(SNDCTL_SYNTH_INFO) |
| 2816 | COMPATIBLE_IOCTL(SNDCTL_SEQ_CTRLRATE) |
| 2817 | COMPATIBLE_IOCTL(SNDCTL_SEQ_GETOUTCOUNT) |
| 2818 | COMPATIBLE_IOCTL(SNDCTL_SEQ_GETINCOUNT) |
| 2819 | COMPATIBLE_IOCTL(SNDCTL_SEQ_PERCMODE) |
| 2820 | COMPATIBLE_IOCTL(SNDCTL_FM_LOAD_INSTR) |
| 2821 | COMPATIBLE_IOCTL(SNDCTL_SEQ_TESTMIDI) |
| 2822 | COMPATIBLE_IOCTL(SNDCTL_SEQ_RESETSAMPLES) |
| 2823 | COMPATIBLE_IOCTL(SNDCTL_SEQ_NRSYNTHS) |
| 2824 | COMPATIBLE_IOCTL(SNDCTL_SEQ_NRMIDIS) |
| 2825 | COMPATIBLE_IOCTL(SNDCTL_MIDI_INFO) |
| 2826 | COMPATIBLE_IOCTL(SNDCTL_SEQ_THRESHOLD) |
| 2827 | COMPATIBLE_IOCTL(SNDCTL_SYNTH_MEMAVL) |
| 2828 | COMPATIBLE_IOCTL(SNDCTL_FM_4OP_ENABLE) |
| 2829 | COMPATIBLE_IOCTL(SNDCTL_SEQ_PANIC) |
| 2830 | COMPATIBLE_IOCTL(SNDCTL_SEQ_OUTOFBAND) |
| 2831 | COMPATIBLE_IOCTL(SNDCTL_SEQ_GETTIME) |
| 2832 | COMPATIBLE_IOCTL(SNDCTL_SYNTH_ID) |
| 2833 | COMPATIBLE_IOCTL(SNDCTL_SYNTH_CONTROL) |
| 2834 | COMPATIBLE_IOCTL(SNDCTL_SYNTH_REMOVESAMPLE) |
| 2835 | /* Big T for sound/OSS */ |
| 2836 | COMPATIBLE_IOCTL(SNDCTL_TMR_TIMEBASE) |
| 2837 | COMPATIBLE_IOCTL(SNDCTL_TMR_START) |
| 2838 | COMPATIBLE_IOCTL(SNDCTL_TMR_STOP) |
| 2839 | COMPATIBLE_IOCTL(SNDCTL_TMR_CONTINUE) |
| 2840 | COMPATIBLE_IOCTL(SNDCTL_TMR_TEMPO) |
| 2841 | COMPATIBLE_IOCTL(SNDCTL_TMR_SOURCE) |
| 2842 | COMPATIBLE_IOCTL(SNDCTL_TMR_METRONOME) |
| 2843 | COMPATIBLE_IOCTL(SNDCTL_TMR_SELECT) |
| 2844 | /* Little m for sound/OSS */ |
| 2845 | COMPATIBLE_IOCTL(SNDCTL_MIDI_PRETIME) |
| 2846 | COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUMODE) |
| 2847 | COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUCMD) |
| 2848 | /* Big P for sound/OSS */ |
| 2849 | COMPATIBLE_IOCTL(SNDCTL_DSP_RESET) |
| 2850 | COMPATIBLE_IOCTL(SNDCTL_DSP_SYNC) |
| 2851 | COMPATIBLE_IOCTL(SNDCTL_DSP_SPEED) |
| 2852 | COMPATIBLE_IOCTL(SNDCTL_DSP_STEREO) |
| 2853 | COMPATIBLE_IOCTL(SNDCTL_DSP_GETBLKSIZE) |
| 2854 | COMPATIBLE_IOCTL(SNDCTL_DSP_CHANNELS) |
| 2855 | COMPATIBLE_IOCTL(SOUND_PCM_WRITE_FILTER) |
| 2856 | COMPATIBLE_IOCTL(SNDCTL_DSP_POST) |
| 2857 | COMPATIBLE_IOCTL(SNDCTL_DSP_SUBDIVIDE) |
| 2858 | COMPATIBLE_IOCTL(SNDCTL_DSP_SETFRAGMENT) |
| 2859 | COMPATIBLE_IOCTL(SNDCTL_DSP_GETFMTS) |
| 2860 | COMPATIBLE_IOCTL(SNDCTL_DSP_SETFMT) |
| 2861 | COMPATIBLE_IOCTL(SNDCTL_DSP_GETOSPACE) |
| 2862 | COMPATIBLE_IOCTL(SNDCTL_DSP_GETISPACE) |
| 2863 | COMPATIBLE_IOCTL(SNDCTL_DSP_NONBLOCK) |
| 2864 | COMPATIBLE_IOCTL(SNDCTL_DSP_GETCAPS) |
| 2865 | COMPATIBLE_IOCTL(SNDCTL_DSP_GETTRIGGER) |
| 2866 | COMPATIBLE_IOCTL(SNDCTL_DSP_SETTRIGGER) |
| 2867 | COMPATIBLE_IOCTL(SNDCTL_DSP_GETIPTR) |
| 2868 | COMPATIBLE_IOCTL(SNDCTL_DSP_GETOPTR) |
| 2869 | /* SNDCTL_DSP_MAPINBUF, XXX needs translation */ |
| 2870 | /* SNDCTL_DSP_MAPOUTBUF, XXX needs translation */ |
| 2871 | COMPATIBLE_IOCTL(SNDCTL_DSP_SETSYNCRO) |
| 2872 | COMPATIBLE_IOCTL(SNDCTL_DSP_SETDUPLEX) |
| 2873 | COMPATIBLE_IOCTL(SNDCTL_DSP_GETODELAY) |
| 2874 | COMPATIBLE_IOCTL(SNDCTL_DSP_PROFILE) |
| 2875 | COMPATIBLE_IOCTL(SOUND_PCM_READ_RATE) |
| 2876 | COMPATIBLE_IOCTL(SOUND_PCM_READ_CHANNELS) |
| 2877 | COMPATIBLE_IOCTL(SOUND_PCM_READ_BITS) |
| 2878 | COMPATIBLE_IOCTL(SOUND_PCM_READ_FILTER) |
| 2879 | /* Big C for sound/OSS */ |
| 2880 | COMPATIBLE_IOCTL(SNDCTL_COPR_RESET) |
| 2881 | COMPATIBLE_IOCTL(SNDCTL_COPR_LOAD) |
| 2882 | COMPATIBLE_IOCTL(SNDCTL_COPR_RDATA) |
| 2883 | COMPATIBLE_IOCTL(SNDCTL_COPR_RCODE) |
| 2884 | COMPATIBLE_IOCTL(SNDCTL_COPR_WDATA) |
| 2885 | COMPATIBLE_IOCTL(SNDCTL_COPR_WCODE) |
| 2886 | COMPATIBLE_IOCTL(SNDCTL_COPR_RUN) |
| 2887 | COMPATIBLE_IOCTL(SNDCTL_COPR_HALT) |
| 2888 | COMPATIBLE_IOCTL(SNDCTL_COPR_SENDMSG) |
| 2889 | COMPATIBLE_IOCTL(SNDCTL_COPR_RCVMSG) |
| 2890 | /* Big M for sound/OSS */ |
| 2891 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_VOLUME) |
| 2892 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_BASS) |
| 2893 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_TREBLE) |
| 2894 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_SYNTH) |
| 2895 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_PCM) |
| 2896 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_SPEAKER) |
| 2897 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE) |
| 2898 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_MIC) |
| 2899 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_CD) |
| 2900 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_IMIX) |
| 2901 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_ALTPCM) |
| 2902 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECLEV) |
| 2903 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_IGAIN) |
| 2904 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_OGAIN) |
| 2905 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE1) |
| 2906 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE2) |
| 2907 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE3) |
| 2908 | COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL1)) |
| 2909 | COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL2)) |
| 2910 | COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL3)) |
| 2911 | COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEIN)) |
| 2912 | COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEOUT)) |
| 2913 | COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_VIDEO)) |
| 2914 | COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_RADIO)) |
| 2915 | COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_MONITOR)) |
| 2916 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_MUTE) |
| 2917 | /* SOUND_MIXER_READ_ENHANCE, same value as READ_MUTE */ |
| 2918 | /* SOUND_MIXER_READ_LOUD, same value as READ_MUTE */ |
| 2919 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECSRC) |
| 2920 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_DEVMASK) |
| 2921 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECMASK) |
| 2922 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_STEREODEVS) |
| 2923 | COMPATIBLE_IOCTL(SOUND_MIXER_READ_CAPS) |
| 2924 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_VOLUME) |
| 2925 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_BASS) |
| 2926 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_TREBLE) |
| 2927 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SYNTH) |
| 2928 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_PCM) |
| 2929 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SPEAKER) |
| 2930 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE) |
| 2931 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MIC) |
| 2932 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_CD) |
| 2933 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IMIX) |
| 2934 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_ALTPCM) |
| 2935 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECLEV) |
| 2936 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IGAIN) |
| 2937 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_OGAIN) |
| 2938 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE1) |
| 2939 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE2) |
| 2940 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE3) |
| 2941 | COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL1)) |
| 2942 | COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL2)) |
| 2943 | COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL3)) |
| 2944 | COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEIN)) |
| 2945 | COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEOUT)) |
| 2946 | COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_VIDEO)) |
| 2947 | COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_RADIO)) |
| 2948 | COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_MONITOR)) |
| 2949 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MUTE) |
| 2950 | /* SOUND_MIXER_WRITE_ENHANCE, same value as WRITE_MUTE */ |
| 2951 | /* SOUND_MIXER_WRITE_LOUD, same value as WRITE_MUTE */ |
| 2952 | COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECSRC) |
| 2953 | COMPATIBLE_IOCTL(SOUND_MIXER_INFO) |
| 2954 | COMPATIBLE_IOCTL(SOUND_OLD_MIXER_INFO) |
| 2955 | COMPATIBLE_IOCTL(SOUND_MIXER_ACCESS) |
| 2956 | COMPATIBLE_IOCTL(SOUND_MIXER_AGC) |
| 2957 | COMPATIBLE_IOCTL(SOUND_MIXER_3DSE) |
| 2958 | COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE1) |
| 2959 | COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE2) |
| 2960 | COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE3) |
| 2961 | COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE4) |
| 2962 | COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE5) |
| 2963 | COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS) |
| 2964 | COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS) |
| 2965 | COMPATIBLE_IOCTL(OSS_GETVERSION) |
| 2966 | /* AUTOFS */ |
| 2967 | ULONG_IOCTL(AUTOFS_IOC_READY) |
| 2968 | ULONG_IOCTL(AUTOFS_IOC_FAIL) |
| 2969 | COMPATIBLE_IOCTL(AUTOFS_IOC_CATATONIC) |
| 2970 | COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOVER) |
| 2971 | COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE) |
| 2972 | COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE_MULTI) |
| 2973 | COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOSUBVER) |
| 2974 | COMPATIBLE_IOCTL(AUTOFS_IOC_ASKREGHOST) |
| 2975 | COMPATIBLE_IOCTL(AUTOFS_IOC_TOGGLEREGHOST) |
| 2976 | COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT) |
| 2977 | /* Raw devices */ |
| 2978 | COMPATIBLE_IOCTL(RAW_SETBIND) |
| 2979 | COMPATIBLE_IOCTL(RAW_GETBIND) |
| 2980 | /* SMB ioctls which do not need any translations */ |
| 2981 | COMPATIBLE_IOCTL(SMB_IOC_NEWCONN) |
| 2982 | /* Little a */ |
| 2983 | COMPATIBLE_IOCTL(ATMSIGD_CTRL) |
| 2984 | COMPATIBLE_IOCTL(ATMARPD_CTRL) |
| 2985 | COMPATIBLE_IOCTL(ATMLEC_CTRL) |
| 2986 | COMPATIBLE_IOCTL(ATMLEC_MCAST) |
| 2987 | COMPATIBLE_IOCTL(ATMLEC_DATA) |
| 2988 | COMPATIBLE_IOCTL(ATM_SETSC) |
| 2989 | COMPATIBLE_IOCTL(SIOCSIFATMTCP) |
| 2990 | COMPATIBLE_IOCTL(SIOCMKCLIP) |
| 2991 | COMPATIBLE_IOCTL(ATMARP_MKIP) |
| 2992 | COMPATIBLE_IOCTL(ATMARP_SETENTRY) |
| 2993 | COMPATIBLE_IOCTL(ATMARP_ENCAP) |
| 2994 | COMPATIBLE_IOCTL(ATMTCP_CREATE) |
| 2995 | COMPATIBLE_IOCTL(ATMTCP_REMOVE) |
| 2996 | COMPATIBLE_IOCTL(ATMMPC_CTRL) |
| 2997 | COMPATIBLE_IOCTL(ATMMPC_DATA) |
| 2998 | /* Watchdog */ |
| 2999 | COMPATIBLE_IOCTL(WDIOC_GETSUPPORT) |
| 3000 | COMPATIBLE_IOCTL(WDIOC_GETSTATUS) |
| 3001 | COMPATIBLE_IOCTL(WDIOC_GETBOOTSTATUS) |
| 3002 | COMPATIBLE_IOCTL(WDIOC_GETTEMP) |
| 3003 | COMPATIBLE_IOCTL(WDIOC_SETOPTIONS) |
| 3004 | COMPATIBLE_IOCTL(WDIOC_KEEPALIVE) |
| 3005 | COMPATIBLE_IOCTL(WDIOC_SETTIMEOUT) |
| 3006 | COMPATIBLE_IOCTL(WDIOC_GETTIMEOUT) |
| 3007 | /* Big R */ |
| 3008 | COMPATIBLE_IOCTL(RNDGETENTCNT) |
| 3009 | COMPATIBLE_IOCTL(RNDADDTOENTCNT) |
| 3010 | COMPATIBLE_IOCTL(RNDGETPOOL) |
| 3011 | COMPATIBLE_IOCTL(RNDADDENTROPY) |
| 3012 | COMPATIBLE_IOCTL(RNDZAPENTCNT) |
| 3013 | COMPATIBLE_IOCTL(RNDCLEARPOOL) |
| 3014 | /* Bluetooth */ |
| 3015 | COMPATIBLE_IOCTL(HCIDEVUP) |
| 3016 | COMPATIBLE_IOCTL(HCIDEVDOWN) |
| 3017 | COMPATIBLE_IOCTL(HCIDEVRESET) |
| 3018 | COMPATIBLE_IOCTL(HCIDEVRESTAT) |
| 3019 | COMPATIBLE_IOCTL(HCIGETDEVLIST) |
| 3020 | COMPATIBLE_IOCTL(HCIGETDEVINFO) |
| 3021 | COMPATIBLE_IOCTL(HCIGETCONNLIST) |
| 3022 | COMPATIBLE_IOCTL(HCIGETCONNINFO) |
| 3023 | COMPATIBLE_IOCTL(HCISETRAW) |
| 3024 | COMPATIBLE_IOCTL(HCISETSCAN) |
| 3025 | COMPATIBLE_IOCTL(HCISETAUTH) |
| 3026 | COMPATIBLE_IOCTL(HCISETENCRYPT) |
| 3027 | COMPATIBLE_IOCTL(HCISETPTYPE) |
| 3028 | COMPATIBLE_IOCTL(HCISETLINKPOL) |
| 3029 | COMPATIBLE_IOCTL(HCISETLINKMODE) |
| 3030 | COMPATIBLE_IOCTL(HCISETACLMTU) |
| 3031 | COMPATIBLE_IOCTL(HCISETSCOMTU) |
| 3032 | COMPATIBLE_IOCTL(HCIINQUIRY) |
| 3033 | COMPATIBLE_IOCTL(HCIUARTSETPROTO) |
| 3034 | COMPATIBLE_IOCTL(HCIUARTGETPROTO) |
| 3035 | COMPATIBLE_IOCTL(RFCOMMCREATEDEV) |
| 3036 | COMPATIBLE_IOCTL(RFCOMMRELEASEDEV) |
| 3037 | COMPATIBLE_IOCTL(RFCOMMGETDEVLIST) |
| 3038 | COMPATIBLE_IOCTL(RFCOMMGETDEVINFO) |
| 3039 | COMPATIBLE_IOCTL(RFCOMMSTEALDLC) |
| 3040 | COMPATIBLE_IOCTL(BNEPCONNADD) |
| 3041 | COMPATIBLE_IOCTL(BNEPCONNDEL) |
| 3042 | COMPATIBLE_IOCTL(BNEPGETCONNLIST) |
| 3043 | COMPATIBLE_IOCTL(BNEPGETCONNINFO) |
| 3044 | COMPATIBLE_IOCTL(CMTPCONNADD) |
| 3045 | COMPATIBLE_IOCTL(CMTPCONNDEL) |
| 3046 | COMPATIBLE_IOCTL(CMTPGETCONNLIST) |
| 3047 | COMPATIBLE_IOCTL(CMTPGETCONNINFO) |
| 3048 | COMPATIBLE_IOCTL(HIDPCONNADD) |
| 3049 | COMPATIBLE_IOCTL(HIDPCONNDEL) |
| 3050 | COMPATIBLE_IOCTL(HIDPGETCONNLIST) |
| 3051 | COMPATIBLE_IOCTL(HIDPGETCONNINFO) |
| 3052 | /* CAPI */ |
| 3053 | COMPATIBLE_IOCTL(CAPI_REGISTER) |
| 3054 | COMPATIBLE_IOCTL(CAPI_GET_MANUFACTURER) |
| 3055 | COMPATIBLE_IOCTL(CAPI_GET_VERSION) |
| 3056 | COMPATIBLE_IOCTL(CAPI_GET_SERIAL) |
| 3057 | COMPATIBLE_IOCTL(CAPI_GET_PROFILE) |
| 3058 | COMPATIBLE_IOCTL(CAPI_MANUFACTURER_CMD) |
| 3059 | COMPATIBLE_IOCTL(CAPI_GET_ERRCODE) |
| 3060 | COMPATIBLE_IOCTL(CAPI_INSTALLED) |
| 3061 | COMPATIBLE_IOCTL(CAPI_GET_FLAGS) |
| 3062 | COMPATIBLE_IOCTL(CAPI_SET_FLAGS) |
| 3063 | COMPATIBLE_IOCTL(CAPI_CLR_FLAGS) |
| 3064 | COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT) |
| 3065 | COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT) |
| 3066 | /* Siemens Gigaset */ |
| 3067 | COMPATIBLE_IOCTL(GIGASET_REDIR) |
| 3068 | COMPATIBLE_IOCTL(GIGASET_CONFIG) |
| 3069 | COMPATIBLE_IOCTL(GIGASET_BRKCHARS) |
| 3070 | COMPATIBLE_IOCTL(GIGASET_VERSION) |
| 3071 | /* Misc. */ |
| 3072 | COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */ |
| 3073 | COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */ |
| 3074 | COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) |
| 3075 | COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) |
| 3076 | COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) |
| 3077 | COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) |
| 3078 | /* USB */ |
| 3079 | COMPATIBLE_IOCTL(USBDEVFS_RESETEP) |
| 3080 | COMPATIBLE_IOCTL(USBDEVFS_SETINTERFACE) |
| 3081 | COMPATIBLE_IOCTL(USBDEVFS_SETCONFIGURATION) |
| 3082 | COMPATIBLE_IOCTL(USBDEVFS_GETDRIVER) |
| 3083 | COMPATIBLE_IOCTL(USBDEVFS_DISCARDURB) |
| 3084 | COMPATIBLE_IOCTL(USBDEVFS_CLAIMINTERFACE) |
| 3085 | COMPATIBLE_IOCTL(USBDEVFS_RELEASEINTERFACE) |
| 3086 | COMPATIBLE_IOCTL(USBDEVFS_CONNECTINFO) |
| 3087 | COMPATIBLE_IOCTL(USBDEVFS_HUB_PORTINFO) |
| 3088 | COMPATIBLE_IOCTL(USBDEVFS_RESET) |
| 3089 | COMPATIBLE_IOCTL(USBDEVFS_SUBMITURB32) |
| 3090 | COMPATIBLE_IOCTL(USBDEVFS_REAPURB32) |
| 3091 | COMPATIBLE_IOCTL(USBDEVFS_REAPURBNDELAY32) |
| 3092 | COMPATIBLE_IOCTL(USBDEVFS_CLEAR_HALT) |
| 3093 | /* MTD */ |
| 3094 | COMPATIBLE_IOCTL(MEMGETINFO) |
| 3095 | COMPATIBLE_IOCTL(MEMERASE) |
| 3096 | COMPATIBLE_IOCTL(MEMLOCK) |
| 3097 | COMPATIBLE_IOCTL(MEMUNLOCK) |
| 3098 | COMPATIBLE_IOCTL(MEMGETREGIONCOUNT) |
| 3099 | COMPATIBLE_IOCTL(MEMGETREGIONINFO) |
| 3100 | COMPATIBLE_IOCTL(MEMGETBADBLOCK) |
| 3101 | COMPATIBLE_IOCTL(MEMSETBADBLOCK) |
| 3102 | /* NBD */ |
| 3103 | ULONG_IOCTL(NBD_SET_SOCK) |
| 3104 | ULONG_IOCTL(NBD_SET_BLKSIZE) |
| 3105 | ULONG_IOCTL(NBD_SET_SIZE) |
| 3106 | COMPATIBLE_IOCTL(NBD_DO_IT) |
| 3107 | COMPATIBLE_IOCTL(NBD_CLEAR_SOCK) |
| 3108 | COMPATIBLE_IOCTL(NBD_CLEAR_QUE) |
| 3109 | COMPATIBLE_IOCTL(NBD_PRINT_DEBUG) |
| 3110 | ULONG_IOCTL(NBD_SET_SIZE_BLOCKS) |
| 3111 | COMPATIBLE_IOCTL(NBD_DISCONNECT) |
| 3112 | /* i2c */ |
| 3113 | COMPATIBLE_IOCTL(I2C_SLAVE) |
| 3114 | COMPATIBLE_IOCTL(I2C_SLAVE_FORCE) |
| 3115 | COMPATIBLE_IOCTL(I2C_TENBIT) |
| 3116 | COMPATIBLE_IOCTL(I2C_PEC) |
| 3117 | COMPATIBLE_IOCTL(I2C_RETRIES) |
| 3118 | COMPATIBLE_IOCTL(I2C_TIMEOUT) |
| 3119 | /* wireless */ |
| 3120 | COMPATIBLE_IOCTL(SIOCSIWCOMMIT) |
| 3121 | COMPATIBLE_IOCTL(SIOCGIWNAME) |
| 3122 | COMPATIBLE_IOCTL(SIOCSIWNWID) |
| 3123 | COMPATIBLE_IOCTL(SIOCGIWNWID) |
| 3124 | COMPATIBLE_IOCTL(SIOCSIWFREQ) |
| 3125 | COMPATIBLE_IOCTL(SIOCGIWFREQ) |
| 3126 | COMPATIBLE_IOCTL(SIOCSIWMODE) |
| 3127 | COMPATIBLE_IOCTL(SIOCGIWMODE) |
| 3128 | COMPATIBLE_IOCTL(SIOCSIWSENS) |
| 3129 | COMPATIBLE_IOCTL(SIOCGIWSENS) |
| 3130 | COMPATIBLE_IOCTL(SIOCSIWRANGE) |
| 3131 | COMPATIBLE_IOCTL(SIOCSIWPRIV) |
| 3132 | COMPATIBLE_IOCTL(SIOCGIWPRIV) |
| 3133 | COMPATIBLE_IOCTL(SIOCSIWSTATS) |
| 3134 | COMPATIBLE_IOCTL(SIOCGIWSTATS) |
| 3135 | COMPATIBLE_IOCTL(SIOCSIWAP) |
| 3136 | COMPATIBLE_IOCTL(SIOCGIWAP) |
| 3137 | COMPATIBLE_IOCTL(SIOCSIWSCAN) |
| 3138 | COMPATIBLE_IOCTL(SIOCSIWRATE) |
| 3139 | COMPATIBLE_IOCTL(SIOCGIWRATE) |
| 3140 | COMPATIBLE_IOCTL(SIOCSIWRTS) |
| 3141 | COMPATIBLE_IOCTL(SIOCGIWRTS) |
| 3142 | COMPATIBLE_IOCTL(SIOCSIWFRAG) |
| 3143 | COMPATIBLE_IOCTL(SIOCGIWFRAG) |
| 3144 | COMPATIBLE_IOCTL(SIOCSIWTXPOW) |
| 3145 | COMPATIBLE_IOCTL(SIOCGIWTXPOW) |
| 3146 | COMPATIBLE_IOCTL(SIOCSIWRETRY) |
| 3147 | COMPATIBLE_IOCTL(SIOCGIWRETRY) |
| 3148 | COMPATIBLE_IOCTL(SIOCSIWPOWER) |
| 3149 | COMPATIBLE_IOCTL(SIOCGIWPOWER) |
| 3150 | /* hiddev */ |
| 3151 | COMPATIBLE_IOCTL(HIDIOCGVERSION) |
| 3152 | COMPATIBLE_IOCTL(HIDIOCAPPLICATION) |
| 3153 | COMPATIBLE_IOCTL(HIDIOCGDEVINFO) |
| 3154 | COMPATIBLE_IOCTL(HIDIOCGSTRING) |
| 3155 | COMPATIBLE_IOCTL(HIDIOCINITREPORT) |
| 3156 | COMPATIBLE_IOCTL(HIDIOCGREPORT) |
| 3157 | COMPATIBLE_IOCTL(HIDIOCSREPORT) |
| 3158 | COMPATIBLE_IOCTL(HIDIOCGREPORTINFO) |
| 3159 | COMPATIBLE_IOCTL(HIDIOCGFIELDINFO) |
| 3160 | COMPATIBLE_IOCTL(HIDIOCGUSAGE) |
| 3161 | COMPATIBLE_IOCTL(HIDIOCSUSAGE) |
| 3162 | COMPATIBLE_IOCTL(HIDIOCGUCODE) |
| 3163 | COMPATIBLE_IOCTL(HIDIOCGFLAG) |
| 3164 | COMPATIBLE_IOCTL(HIDIOCSFLAG) |
| 3165 | COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX) |
| 3166 | COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO) |
| 3167 | /* dvb */ |
| 3168 | COMPATIBLE_IOCTL(AUDIO_STOP) |
| 3169 | COMPATIBLE_IOCTL(AUDIO_PLAY) |
| 3170 | COMPATIBLE_IOCTL(AUDIO_PAUSE) |
| 3171 | COMPATIBLE_IOCTL(AUDIO_CONTINUE) |
| 3172 | COMPATIBLE_IOCTL(AUDIO_SELECT_SOURCE) |
| 3173 | COMPATIBLE_IOCTL(AUDIO_SET_MUTE) |
| 3174 | COMPATIBLE_IOCTL(AUDIO_SET_AV_SYNC) |
| 3175 | COMPATIBLE_IOCTL(AUDIO_SET_BYPASS_MODE) |
| 3176 | COMPATIBLE_IOCTL(AUDIO_CHANNEL_SELECT) |
| 3177 | COMPATIBLE_IOCTL(AUDIO_GET_STATUS) |
| 3178 | COMPATIBLE_IOCTL(AUDIO_GET_CAPABILITIES) |
| 3179 | COMPATIBLE_IOCTL(AUDIO_CLEAR_BUFFER) |
| 3180 | COMPATIBLE_IOCTL(AUDIO_SET_ID) |
| 3181 | COMPATIBLE_IOCTL(AUDIO_SET_MIXER) |
| 3182 | COMPATIBLE_IOCTL(AUDIO_SET_STREAMTYPE) |
| 3183 | COMPATIBLE_IOCTL(AUDIO_SET_EXT_ID) |
| 3184 | COMPATIBLE_IOCTL(AUDIO_SET_ATTRIBUTES) |
| 3185 | COMPATIBLE_IOCTL(AUDIO_SET_KARAOKE) |
| 3186 | COMPATIBLE_IOCTL(DMX_START) |
| 3187 | COMPATIBLE_IOCTL(DMX_STOP) |
| 3188 | COMPATIBLE_IOCTL(DMX_SET_FILTER) |
| 3189 | COMPATIBLE_IOCTL(DMX_SET_PES_FILTER) |
| 3190 | COMPATIBLE_IOCTL(DMX_SET_BUFFER_SIZE) |
| 3191 | COMPATIBLE_IOCTL(DMX_GET_PES_PIDS) |
| 3192 | COMPATIBLE_IOCTL(DMX_GET_CAPS) |
| 3193 | COMPATIBLE_IOCTL(DMX_SET_SOURCE) |
| 3194 | COMPATIBLE_IOCTL(DMX_GET_STC) |
| 3195 | COMPATIBLE_IOCTL(FE_GET_INFO) |
| 3196 | COMPATIBLE_IOCTL(FE_DISEQC_RESET_OVERLOAD) |
| 3197 | COMPATIBLE_IOCTL(FE_DISEQC_SEND_MASTER_CMD) |
| 3198 | COMPATIBLE_IOCTL(FE_DISEQC_RECV_SLAVE_REPLY) |
| 3199 | COMPATIBLE_IOCTL(FE_DISEQC_SEND_BURST) |
| 3200 | COMPATIBLE_IOCTL(FE_SET_TONE) |
| 3201 | COMPATIBLE_IOCTL(FE_SET_VOLTAGE) |
| 3202 | COMPATIBLE_IOCTL(FE_ENABLE_HIGH_LNB_VOLTAGE) |
| 3203 | COMPATIBLE_IOCTL(FE_READ_STATUS) |
| 3204 | COMPATIBLE_IOCTL(FE_READ_BER) |
| 3205 | COMPATIBLE_IOCTL(FE_READ_SIGNAL_STRENGTH) |
| 3206 | COMPATIBLE_IOCTL(FE_READ_SNR) |
| 3207 | COMPATIBLE_IOCTL(FE_READ_UNCORRECTED_BLOCKS) |
| 3208 | COMPATIBLE_IOCTL(FE_SET_FRONTEND) |
| 3209 | COMPATIBLE_IOCTL(FE_GET_FRONTEND) |
| 3210 | COMPATIBLE_IOCTL(FE_GET_EVENT) |
| 3211 | COMPATIBLE_IOCTL(FE_DISHNETWORK_SEND_LEGACY_CMD) |
| 3212 | COMPATIBLE_IOCTL(VIDEO_STOP) |
| 3213 | COMPATIBLE_IOCTL(VIDEO_PLAY) |
| 3214 | COMPATIBLE_IOCTL(VIDEO_FREEZE) |
| 3215 | COMPATIBLE_IOCTL(VIDEO_CONTINUE) |
| 3216 | COMPATIBLE_IOCTL(VIDEO_SELECT_SOURCE) |
| 3217 | COMPATIBLE_IOCTL(VIDEO_SET_BLANK) |
| 3218 | COMPATIBLE_IOCTL(VIDEO_GET_STATUS) |
| 3219 | COMPATIBLE_IOCTL(VIDEO_SET_DISPLAY_FORMAT) |
| 3220 | COMPATIBLE_IOCTL(VIDEO_FAST_FORWARD) |
| 3221 | COMPATIBLE_IOCTL(VIDEO_SLOWMOTION) |
| 3222 | COMPATIBLE_IOCTL(VIDEO_GET_CAPABILITIES) |
| 3223 | COMPATIBLE_IOCTL(VIDEO_CLEAR_BUFFER) |
| 3224 | COMPATIBLE_IOCTL(VIDEO_SET_ID) |
| 3225 | COMPATIBLE_IOCTL(VIDEO_SET_STREAMTYPE) |
| 3226 | COMPATIBLE_IOCTL(VIDEO_SET_FORMAT) |
| 3227 | COMPATIBLE_IOCTL(VIDEO_SET_SYSTEM) |
| 3228 | COMPATIBLE_IOCTL(VIDEO_SET_HIGHLIGHT) |
| 3229 | COMPATIBLE_IOCTL(VIDEO_SET_SPU) |
| 3230 | COMPATIBLE_IOCTL(VIDEO_GET_NAVI) |
| 3231 | COMPATIBLE_IOCTL(VIDEO_SET_ATTRIBUTES) |
| 3232 | COMPATIBLE_IOCTL(VIDEO_GET_SIZE) |
| 3233 | COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE) |
| 3234 | |
| 3235 | /* now things that need handlers */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3236 | HANDLE_IOCTL(MEMREADOOB32, mtd_rw_oob) |
| 3237 | HANDLE_IOCTL(MEMWRITEOOB32, mtd_rw_oob) |
| 3238 | #ifdef CONFIG_NET |
| 3239 | HANDLE_IOCTL(SIOCGIFNAME, dev_ifname32) |
| 3240 | HANDLE_IOCTL(SIOCGIFCONF, dev_ifconf) |
| 3241 | HANDLE_IOCTL(SIOCGIFFLAGS, dev_ifsioc) |
| 3242 | HANDLE_IOCTL(SIOCSIFFLAGS, dev_ifsioc) |
| 3243 | HANDLE_IOCTL(SIOCGIFMETRIC, dev_ifsioc) |
| 3244 | HANDLE_IOCTL(SIOCSIFMETRIC, dev_ifsioc) |
| 3245 | HANDLE_IOCTL(SIOCGIFMTU, dev_ifsioc) |
| 3246 | HANDLE_IOCTL(SIOCSIFMTU, dev_ifsioc) |
| 3247 | HANDLE_IOCTL(SIOCGIFMEM, dev_ifsioc) |
| 3248 | HANDLE_IOCTL(SIOCSIFMEM, dev_ifsioc) |
| 3249 | HANDLE_IOCTL(SIOCGIFHWADDR, dev_ifsioc) |
| 3250 | HANDLE_IOCTL(SIOCSIFHWADDR, dev_ifsioc) |
| 3251 | HANDLE_IOCTL(SIOCADDMULTI, dev_ifsioc) |
| 3252 | HANDLE_IOCTL(SIOCDELMULTI, dev_ifsioc) |
| 3253 | HANDLE_IOCTL(SIOCGIFINDEX, dev_ifsioc) |
| 3254 | HANDLE_IOCTL(SIOCGIFMAP, dev_ifsioc) |
| 3255 | HANDLE_IOCTL(SIOCSIFMAP, dev_ifsioc) |
| 3256 | HANDLE_IOCTL(SIOCGIFADDR, dev_ifsioc) |
| 3257 | HANDLE_IOCTL(SIOCSIFADDR, dev_ifsioc) |
Andi Kleen | 67fd44f | 2006-12-07 02:14:03 +0100 | [diff] [blame] | 3258 | HANDLE_IOCTL(SIOCSIFHWBROADCAST, dev_ifsioc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3259 | |
| 3260 | /* ioctls used by appletalk ddp.c */ |
| 3261 | HANDLE_IOCTL(SIOCATALKDIFADDR, dev_ifsioc) |
| 3262 | HANDLE_IOCTL(SIOCDIFADDR, dev_ifsioc) |
| 3263 | HANDLE_IOCTL(SIOCSARP, dev_ifsioc) |
| 3264 | HANDLE_IOCTL(SIOCDARP, dev_ifsioc) |
| 3265 | |
| 3266 | HANDLE_IOCTL(SIOCGIFBRDADDR, dev_ifsioc) |
| 3267 | HANDLE_IOCTL(SIOCSIFBRDADDR, dev_ifsioc) |
| 3268 | HANDLE_IOCTL(SIOCGIFDSTADDR, dev_ifsioc) |
| 3269 | HANDLE_IOCTL(SIOCSIFDSTADDR, dev_ifsioc) |
| 3270 | HANDLE_IOCTL(SIOCGIFNETMASK, dev_ifsioc) |
| 3271 | HANDLE_IOCTL(SIOCSIFNETMASK, dev_ifsioc) |
| 3272 | HANDLE_IOCTL(SIOCSIFPFLAGS, dev_ifsioc) |
| 3273 | HANDLE_IOCTL(SIOCGIFPFLAGS, dev_ifsioc) |
| 3274 | HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc) |
| 3275 | HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc) |
| 3276 | HANDLE_IOCTL(TUNSETIFF, dev_ifsioc) |
| 3277 | HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl) |
| 3278 | HANDLE_IOCTL(SIOCBONDENSLAVE, bond_ioctl) |
| 3279 | HANDLE_IOCTL(SIOCBONDRELEASE, bond_ioctl) |
| 3280 | HANDLE_IOCTL(SIOCBONDSETHWADDR, bond_ioctl) |
| 3281 | HANDLE_IOCTL(SIOCBONDSLAVEINFOQUERY, bond_ioctl) |
| 3282 | HANDLE_IOCTL(SIOCBONDINFOQUERY, bond_ioctl) |
| 3283 | HANDLE_IOCTL(SIOCBONDCHANGEACTIVE, bond_ioctl) |
| 3284 | HANDLE_IOCTL(SIOCADDRT, routing_ioctl) |
| 3285 | HANDLE_IOCTL(SIOCDELRT, routing_ioctl) |
| 3286 | HANDLE_IOCTL(SIOCBRADDIF, dev_ifsioc) |
| 3287 | HANDLE_IOCTL(SIOCBRDELIF, dev_ifsioc) |
| 3288 | /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */ |
| 3289 | HANDLE_IOCTL(SIOCRTMSG, ret_einval) |
| 3290 | HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) |
Eric Dumazet | ae40eb1 | 2007-03-18 17:33:16 -0700 | [diff] [blame] | 3291 | HANDLE_IOCTL(SIOCGSTAMPNS, do_siocgstampns) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3292 | #endif |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 3293 | #ifdef CONFIG_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3294 | HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) |
| 3295 | HANDLE_IOCTL(BLKRAGET, w_long) |
| 3296 | HANDLE_IOCTL(BLKGETSIZE, w_long) |
| 3297 | HANDLE_IOCTL(0x1260, broken_blkgetsize) |
| 3298 | HANDLE_IOCTL(BLKFRAGET, w_long) |
| 3299 | HANDLE_IOCTL(BLKSECTGET, w_long) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3300 | HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3301 | HANDLE_IOCTL(HDIO_GET_UNMASKINTR, hdio_ioctl_trans) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3302 | HANDLE_IOCTL(HDIO_GET_MULTCOUNT, hdio_ioctl_trans) |
Maciej W. Rozycki | 39484e5 | 2006-10-11 01:21:54 -0700 | [diff] [blame] | 3303 | HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans) |
| 3304 | HANDLE_IOCTL(HDIO_GET_32BIT, hdio_ioctl_trans) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3305 | HANDLE_IOCTL(HDIO_GET_NOWERR, hdio_ioctl_trans) |
Maciej W. Rozycki | 39484e5 | 2006-10-11 01:21:54 -0700 | [diff] [blame] | 3306 | HANDLE_IOCTL(HDIO_GET_DMA, hdio_ioctl_trans) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3307 | HANDLE_IOCTL(HDIO_GET_NICE, hdio_ioctl_trans) |
Maciej W. Rozycki | 39484e5 | 2006-10-11 01:21:54 -0700 | [diff] [blame] | 3308 | HANDLE_IOCTL(HDIO_GET_WCACHE, hdio_ioctl_trans) |
| 3309 | HANDLE_IOCTL(HDIO_GET_ACOUSTIC, hdio_ioctl_trans) |
| 3310 | HANDLE_IOCTL(HDIO_GET_ADDRESS, hdio_ioctl_trans) |
| 3311 | HANDLE_IOCTL(HDIO_GET_BUSSTATE, hdio_ioctl_trans) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3312 | HANDLE_IOCTL(FDSETPRM32, fd_ioctl_trans) |
| 3313 | HANDLE_IOCTL(FDDEFPRM32, fd_ioctl_trans) |
| 3314 | HANDLE_IOCTL(FDGETPRM32, fd_ioctl_trans) |
| 3315 | HANDLE_IOCTL(FDSETDRVPRM32, fd_ioctl_trans) |
| 3316 | HANDLE_IOCTL(FDGETDRVPRM32, fd_ioctl_trans) |
| 3317 | HANDLE_IOCTL(FDGETDRVSTAT32, fd_ioctl_trans) |
| 3318 | HANDLE_IOCTL(FDPOLLDRVSTAT32, fd_ioctl_trans) |
| 3319 | HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans) |
| 3320 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) |
| 3321 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) |
Andi Kleen | 2966387 | 2006-01-11 22:44:03 +0100 | [diff] [blame] | 3322 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 3323 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3324 | HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) |
| 3325 | HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) |
| 3326 | HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) |
| 3327 | HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans) |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 3328 | #ifdef CONFIG_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3329 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) |
| 3330 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) |
| 3331 | HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) |
| 3332 | HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 3333 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3334 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) |
| 3335 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) |
| 3336 | #ifdef CONFIG_VT |
| 3337 | HANDLE_IOCTL(PIO_FONTX, do_fontx_ioctl) |
| 3338 | HANDLE_IOCTL(GIO_FONTX, do_fontx_ioctl) |
| 3339 | HANDLE_IOCTL(PIO_UNIMAP, do_unimap_ioctl) |
| 3340 | HANDLE_IOCTL(GIO_UNIMAP, do_unimap_ioctl) |
| 3341 | HANDLE_IOCTL(KDFONTOP, do_kdfontop_ioctl) |
| 3342 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3343 | /* One SMB ioctl needs translations. */ |
| 3344 | #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t) |
| 3345 | HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid) |
| 3346 | HANDLE_IOCTL(ATM_GETLINKRATE32, do_atm_ioctl) |
| 3347 | HANDLE_IOCTL(ATM_GETNAMES32, do_atm_ioctl) |
| 3348 | HANDLE_IOCTL(ATM_GETTYPE32, do_atm_ioctl) |
| 3349 | HANDLE_IOCTL(ATM_GETESI32, do_atm_ioctl) |
| 3350 | HANDLE_IOCTL(ATM_GETADDR32, do_atm_ioctl) |
| 3351 | HANDLE_IOCTL(ATM_RSTADDR32, do_atm_ioctl) |
| 3352 | HANDLE_IOCTL(ATM_ADDADDR32, do_atm_ioctl) |
| 3353 | HANDLE_IOCTL(ATM_DELADDR32, do_atm_ioctl) |
| 3354 | HANDLE_IOCTL(ATM_GETCIRANGE32, do_atm_ioctl) |
| 3355 | HANDLE_IOCTL(ATM_SETCIRANGE32, do_atm_ioctl) |
| 3356 | HANDLE_IOCTL(ATM_SETESI32, do_atm_ioctl) |
| 3357 | HANDLE_IOCTL(ATM_SETESIF32, do_atm_ioctl) |
| 3358 | HANDLE_IOCTL(ATM_GETSTAT32, do_atm_ioctl) |
| 3359 | HANDLE_IOCTL(ATM_GETSTATZ32, do_atm_ioctl) |
| 3360 | HANDLE_IOCTL(ATM_GETLOOP32, do_atm_ioctl) |
| 3361 | HANDLE_IOCTL(ATM_SETLOOP32, do_atm_ioctl) |
| 3362 | HANDLE_IOCTL(ATM_QUERYLOOP32, do_atm_ioctl) |
| 3363 | HANDLE_IOCTL(SONET_GETSTAT, do_atm_ioctl) |
| 3364 | HANDLE_IOCTL(SONET_GETSTATZ, do_atm_ioctl) |
| 3365 | HANDLE_IOCTL(SONET_GETDIAG, do_atm_ioctl) |
| 3366 | HANDLE_IOCTL(SONET_SETDIAG, do_atm_ioctl) |
| 3367 | HANDLE_IOCTL(SONET_CLRDIAG, do_atm_ioctl) |
| 3368 | HANDLE_IOCTL(SONET_SETFRAMING, do_atm_ioctl) |
| 3369 | HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl) |
| 3370 | HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) |
| 3371 | /* block stuff */ |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 3372 | #ifdef CONFIG_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3373 | HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget) |
| 3374 | HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset) |
| 3375 | HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3376 | /* Raw devices */ |
| 3377 | HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) |
| 3378 | HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) |
David Howells | 9361401 | 2006-09-30 20:45:40 +0200 | [diff] [blame] | 3379 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3380 | /* Serial */ |
| 3381 | HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl) |
| 3382 | HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl) |
Christoph Hellwig | 9c0cbd5 | 2005-10-30 15:01:41 -0800 | [diff] [blame] | 3383 | #ifdef TIOCGLTC |
| 3384 | COMPATIBLE_IOCTL(TIOCGLTC) |
| 3385 | COMPATIBLE_IOCTL(TIOCSLTC) |
| 3386 | #endif |
Christoph Hellwig | 7a81e31 | 2005-11-08 21:35:07 -0800 | [diff] [blame] | 3387 | #ifdef TIOCSTART |
| 3388 | /* |
| 3389 | * For these two we have defintions in ioctls.h and/or termios.h on |
| 3390 | * some architectures but no actual implemention. Some applications |
| 3391 | * like bash call them if they are defined in the headers, so we provide |
| 3392 | * entries here to avoid syslog message spew. |
| 3393 | */ |
| 3394 | COMPATIBLE_IOCTL(TIOCSTART) |
| 3395 | COMPATIBLE_IOCTL(TIOCSTOP) |
| 3396 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3397 | /* Usbdevfs */ |
| 3398 | HANDLE_IOCTL(USBDEVFS_CONTROL32, do_usbdevfs_control) |
| 3399 | HANDLE_IOCTL(USBDEVFS_BULK32, do_usbdevfs_bulk) |
| 3400 | HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal) |
Pete Zaitcev | c36fc88 | 2005-10-17 18:15:54 -0700 | [diff] [blame] | 3401 | COMPATIBLE_IOCTL(USBDEVFS_IOCTL32) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3402 | /* i2c */ |
| 3403 | HANDLE_IOCTL(I2C_FUNCS, w_long) |
| 3404 | HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl) |
| 3405 | HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl) |
| 3406 | /* wireless */ |
| 3407 | HANDLE_IOCTL(SIOCGIWRANGE, do_wireless_ioctl) |
Jean Tourrilhes | ed4bb10 | 2007-03-23 00:26:49 +0000 | [diff] [blame] | 3408 | HANDLE_IOCTL(SIOCGIWPRIV, do_wireless_ioctl) |
| 3409 | HANDLE_IOCTL(SIOCGIWSTATS, do_wireless_ioctl) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3410 | HANDLE_IOCTL(SIOCSIWSPY, do_wireless_ioctl) |
| 3411 | HANDLE_IOCTL(SIOCGIWSPY, do_wireless_ioctl) |
| 3412 | HANDLE_IOCTL(SIOCSIWTHRSPY, do_wireless_ioctl) |
| 3413 | HANDLE_IOCTL(SIOCGIWTHRSPY, do_wireless_ioctl) |
Jean Tourrilhes | ed4bb10 | 2007-03-23 00:26:49 +0000 | [diff] [blame] | 3414 | HANDLE_IOCTL(SIOCSIWMLME, do_wireless_ioctl) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3415 | HANDLE_IOCTL(SIOCGIWAPLIST, do_wireless_ioctl) |
Jean Tourrilhes | ed4bb10 | 2007-03-23 00:26:49 +0000 | [diff] [blame] | 3416 | HANDLE_IOCTL(SIOCSIWSCAN, do_wireless_ioctl) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3417 | HANDLE_IOCTL(SIOCGIWSCAN, do_wireless_ioctl) |
| 3418 | HANDLE_IOCTL(SIOCSIWESSID, do_wireless_ioctl) |
| 3419 | HANDLE_IOCTL(SIOCGIWESSID, do_wireless_ioctl) |
| 3420 | HANDLE_IOCTL(SIOCSIWNICKN, do_wireless_ioctl) |
| 3421 | HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl) |
| 3422 | HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl) |
| 3423 | HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl) |
Jean Tourrilhes | ed4bb10 | 2007-03-23 00:26:49 +0000 | [diff] [blame] | 3424 | HANDLE_IOCTL(SIOCSIWGENIE, do_wireless_ioctl) |
| 3425 | HANDLE_IOCTL(SIOCGIWGENIE, do_wireless_ioctl) |
| 3426 | HANDLE_IOCTL(SIOCSIWENCODEEXT, do_wireless_ioctl) |
| 3427 | HANDLE_IOCTL(SIOCGIWENCODEEXT, do_wireless_ioctl) |
| 3428 | HANDLE_IOCTL(SIOCSIWPMKSA, do_wireless_ioctl) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3429 | HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl) |
| 3430 | HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl) |
Andi Kleen | 9d016dd | 2007-05-02 19:27:20 +0200 | [diff] [blame] | 3431 | /* Not implemented in the native kernel */ |
| 3432 | IGNORE_IOCTL(SIOCGIFCOUNT) |
Christoph Hellwig | ec3cad9 | 2006-01-09 20:52:11 -0800 | [diff] [blame] | 3433 | HANDLE_IOCTL(RTC_IRQP_READ32, rtc_ioctl) |
| 3434 | HANDLE_IOCTL(RTC_IRQP_SET32, rtc_ioctl) |
| 3435 | HANDLE_IOCTL(RTC_EPOCH_READ32, rtc_ioctl) |
| 3436 | HANDLE_IOCTL(RTC_EPOCH_SET32, rtc_ioctl) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3437 | |
David S. Miller | 6e87abd | 2005-11-16 00:52:57 -0800 | [diff] [blame] | 3438 | /* dvb */ |
David S. Miller | 6e87abd | 2005-11-16 00:52:57 -0800 | [diff] [blame] | 3439 | HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event) |
| 3440 | HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture) |
| 3441 | HANDLE_IOCTL(VIDEO_SET_SPU_PALETTE, do_video_set_spu_palette) |
Andi Kleen | c6b44d1 | 2006-01-12 01:05:26 -0800 | [diff] [blame] | 3442 | |
| 3443 | /* parport */ |
| 3444 | COMPATIBLE_IOCTL(LPTIME) |
| 3445 | COMPATIBLE_IOCTL(LPCHAR) |
| 3446 | COMPATIBLE_IOCTL(LPABORTOPEN) |
| 3447 | COMPATIBLE_IOCTL(LPCAREFUL) |
| 3448 | COMPATIBLE_IOCTL(LPWAIT) |
| 3449 | COMPATIBLE_IOCTL(LPSETIRQ) |
| 3450 | COMPATIBLE_IOCTL(LPGETSTATUS) |
| 3451 | COMPATIBLE_IOCTL(LPGETSTATUS) |
| 3452 | COMPATIBLE_IOCTL(LPRESET) |
| 3453 | /*LPGETSTATS not implemented, but no kernels seem to compile it in anyways*/ |
| 3454 | COMPATIBLE_IOCTL(LPGETFLAGS) |
| 3455 | HANDLE_IOCTL(LPSETTIMEOUT, lp_timeout_trans) |
Andi Kleen | 2724b6d | 2007-05-02 19:27:21 +0200 | [diff] [blame] | 3456 | |
| 3457 | /* fat 'r' ioctls. These are handled by fat with ->compat_ioctl, |
| 3458 | but we don't want warnings on other file systems. So declare |
| 3459 | them as compatible here. */ |
| 3460 | #define VFAT_IOCTL_READDIR_BOTH32 _IOR('r', 1, struct compat_dirent[2]) |
| 3461 | #define VFAT_IOCTL_READDIR_SHORT32 _IOR('r', 2, struct compat_dirent[2]) |
| 3462 | |
| 3463 | IGNORE_IOCTL(VFAT_IOCTL_READDIR_BOTH32) |
| 3464 | IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32) |
Christoph Hellwig | e6a6d2e | 2006-01-09 20:52:14 -0800 | [diff] [blame] | 3465 | }; |
David S. Miller | 6e87abd | 2005-11-16 00:52:57 -0800 | [diff] [blame] | 3466 | |
Christoph Hellwig | e6a6d2e | 2006-01-09 20:52:14 -0800 | [diff] [blame] | 3467 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); |