2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
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)
9 * These routines maintain argument size conversion between 32bit and 64bit
13 #include <linux/types.h>
14 #include <linux/compat.h>
15 #include <linux/kernel.h>
16 #include <linux/capability.h>
17 #include <linux/compiler.h>
18 #include <linux/sched.h>
19 #include <linux/smp.h>
20 #include <linux/ioctl.h>
22 #include <linux/if_bridge.h>
23 #include <linux/slab.h>
24 #include <linux/raid/md.h>
26 #include <linux/dirent.h>
27 #include <linux/route.h>
28 #include <linux/in6.h>
29 #include <linux/ipv6_route.h>
30 #include <linux/skbuff.h>
31 #include <linux/netlink.h>
34 #include <linux/file.h>
36 #include <linux/ppp_defs.h>
37 #include <linux/if_ppp.h>
38 #include <linux/if_pppox.h>
39 #include <linux/mtio.h>
40 #include <linux/cdrom.h>
41 #include <linux/auto_fs.h>
42 #include <linux/auto_fs4.h>
43 #include <linux/tty.h>
44 #include <linux/vt_kern.h>
46 #include <linux/videodev.h>
47 #include <linux/netdevice.h>
48 #include <linux/raw.h>
49 #include <linux/smb_fs.h>
50 #include <linux/blkpg.h>
51 #include <linux/blkdev.h>
52 #include <linux/elevator.h>
53 #include <linux/rtc.h>
54 #include <linux/pci.h>
55 #include <linux/module.h>
56 #include <linux/serial.h>
57 #include <linux/if_tun.h>
58 #include <linux/ctype.h>
59 #include <linux/syscalls.h>
60 #include <linux/i2c.h>
61 #include <linux/i2c-dev.h>
62 #include <linux/wireless.h>
63 #include <linux/atalk.h>
64 #include <linux/loop.h>
66 #include <net/bluetooth/bluetooth.h>
67 #include <net/bluetooth/hci.h>
68 #include <net/bluetooth/rfcomm.h>
70 #include <linux/capi.h>
71 #include <linux/gigaset_dev.h>
73 #include <scsi/scsi.h>
74 #include <scsi/scsi_ioctl.h>
77 #include <asm/uaccess.h>
78 #include <linux/ethtool.h>
79 #include <linux/mii.h>
80 #include <linux/if_bonding.h>
81 #include <linux/watchdog.h>
82 #include <linux/dm-ioctl.h>
84 #include <linux/soundcard.h>
86 #include <linux/ppdev.h>
88 #include <linux/atm.h>
89 #include <linux/atmarp.h>
90 #include <linux/atmclip.h>
91 #include <linux/atmdev.h>
92 #include <linux/atmioc.h>
93 #include <linux/atmlec.h>
94 #include <linux/atmmpc.h>
95 #include <linux/atmsvc.h>
96 #include <linux/atm_tcp.h>
97 #include <linux/sonet.h>
98 #include <linux/atm_suni.h>
99 #include <linux/mtd/mtd.h>
101 #include <linux/usb.h>
102 #include <linux/usbdevice_fs.h>
103 #include <linux/nbd.h>
104 #include <linux/random.h>
105 #include <linux/filter.h>
106 #include <linux/pktcdvd.h>
108 #include <linux/hiddev.h>
110 #include <linux/dvb/audio.h>
111 #include <linux/dvb/dmx.h>
112 #include <linux/dvb/frontend.h>
113 #include <linux/dvb/video.h>
114 #include <linux/lp.h>
117 #include <asm/fbio.h>
120 static int do_ioctl32_pointer(unsigned int fd
, unsigned int cmd
,
121 unsigned long arg
, struct file
*f
)
123 return sys_ioctl(fd
, cmd
, (unsigned long)compat_ptr(arg
));
126 static int w_long(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
128 mm_segment_t old_fs
= get_fs();
133 err
= sys_ioctl(fd
, cmd
, (unsigned long)&val
);
135 if (!err
&& put_user(val
, (u32 __user
*)compat_ptr(arg
)))
140 static int rw_long(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
142 mm_segment_t old_fs
= get_fs();
143 u32 __user
*argptr
= compat_ptr(arg
);
147 if(get_user(val
, argptr
))
150 err
= sys_ioctl(fd
, cmd
, (unsigned long)&val
);
152 if (!err
&& put_user(val
, argptr
))
157 struct compat_video_event
{
159 compat_time_t timestamp
;
162 unsigned int frame_rate
;
166 static int do_video_get_event(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
168 struct video_event kevent
;
169 mm_segment_t old_fs
= get_fs();
173 err
= sys_ioctl(fd
, cmd
, (unsigned long) &kevent
);
177 struct compat_video_event __user
*up
= compat_ptr(arg
);
179 err
= put_user(kevent
.type
, &up
->type
);
180 err
|= put_user(kevent
.timestamp
, &up
->timestamp
);
181 err
|= put_user(kevent
.u
.size
.w
, &up
->u
.size
.w
);
182 err
|= put_user(kevent
.u
.size
.h
, &up
->u
.size
.h
);
183 err
|= put_user(kevent
.u
.size
.aspect_ratio
,
184 &up
->u
.size
.aspect_ratio
);
192 struct compat_video_still_picture
{
193 compat_uptr_t iFrame
;
197 static int do_video_stillpicture(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
199 struct compat_video_still_picture __user
*up
;
200 struct video_still_picture __user
*up_native
;
205 up
= (struct compat_video_still_picture __user
*) arg
;
206 err
= get_user(fp
, &up
->iFrame
);
207 err
|= get_user(size
, &up
->size
);
212 compat_alloc_user_space(sizeof(struct video_still_picture
));
214 err
= put_user(compat_ptr(fp
), &up_native
->iFrame
);
215 err
|= put_user(size
, &up_native
->size
);
219 err
= sys_ioctl(fd
, cmd
, (unsigned long) up_native
);
224 struct compat_video_spu_palette
{
226 compat_uptr_t palette
;
229 static int do_video_set_spu_palette(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
231 struct compat_video_spu_palette __user
*up
;
232 struct video_spu_palette __user
*up_native
;
236 up
= (struct compat_video_spu_palette __user
*) arg
;
237 err
= get_user(palp
, &up
->palette
);
238 err
|= get_user(length
, &up
->length
);
240 up_native
= compat_alloc_user_space(sizeof(struct video_spu_palette
));
241 err
= put_user(compat_ptr(palp
), &up_native
->palette
);
242 err
|= put_user(length
, &up_native
->length
);
246 err
= sys_ioctl(fd
, cmd
, (unsigned long) up_native
);
252 static int do_siocgstamp(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
254 struct compat_timeval __user
*up
= compat_ptr(arg
);
256 mm_segment_t old_fs
= get_fs();
260 err
= sys_ioctl(fd
, cmd
, (unsigned long)&ktv
);
263 err
= put_user(ktv
.tv_sec
, &up
->tv_sec
);
264 err
|= __put_user(ktv
.tv_usec
, &up
->tv_usec
);
269 static int do_siocgstampns(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
271 struct compat_timespec __user
*up
= compat_ptr(arg
);
273 mm_segment_t old_fs
= get_fs();
277 err
= sys_ioctl(fd
, cmd
, (unsigned long)&kts
);
280 err
= put_user(kts
.tv_sec
, &up
->tv_sec
);
281 err
|= __put_user(kts
.tv_nsec
, &up
->tv_nsec
);
287 compat_ulong_t mem_start
;
288 compat_ulong_t mem_end
;
289 unsigned short base_addr
;
296 #define IFHWADDRLEN 6
299 char ifrn_name
[IFNAMSIZ
]; /* if name, e.g. "en0" */
302 struct sockaddr ifru_addr
;
303 struct sockaddr ifru_dstaddr
;
304 struct sockaddr ifru_broadaddr
;
305 struct sockaddr ifru_netmask
;
306 struct sockaddr ifru_hwaddr
;
308 compat_int_t ifru_ivalue
;
309 compat_int_t ifru_mtu
;
310 struct ifmap32 ifru_map
;
311 char ifru_slave
[IFNAMSIZ
]; /* Just fits the size */
312 char ifru_newname
[IFNAMSIZ
];
313 compat_caddr_t ifru_data
;
314 /* XXXX? ifru_settings should be here */
319 compat_int_t ifc_len
; /* size of buffer */
320 compat_caddr_t ifcbuf
;
323 static int dev_ifname32(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
325 struct net_device
*dev
;
326 struct ifreq32 ifr32
;
329 if (copy_from_user(&ifr32
, compat_ptr(arg
), sizeof(ifr32
)))
332 dev
= dev_get_by_index(ifr32
.ifr_ifindex
);
336 strlcpy(ifr32
.ifr_name
, dev
->name
, sizeof(ifr32
.ifr_name
));
339 err
= copy_to_user(compat_ptr(arg
), &ifr32
, sizeof(ifr32
));
340 return (err
? -EFAULT
: 0);
343 static int dev_ifconf(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
345 struct ifconf32 ifc32
;
347 struct ifconf __user
*uifc
;
348 struct ifreq32 __user
*ifr32
;
349 struct ifreq __user
*ifr
;
353 if (copy_from_user(&ifc32
, compat_ptr(arg
), sizeof(struct ifconf32
)))
356 if (ifc32
.ifcbuf
== 0) {
360 uifc
= compat_alloc_user_space(sizeof(struct ifconf
));
362 size_t len
=((ifc32
.ifc_len
/ sizeof (struct ifreq32
)) + 1) *
363 sizeof (struct ifreq
);
364 uifc
= compat_alloc_user_space(sizeof(struct ifconf
) + len
);
366 ifr
= ifc
.ifc_req
= (void __user
*)(uifc
+ 1);
367 ifr32
= compat_ptr(ifc32
.ifcbuf
);
368 for (i
= 0; i
< ifc32
.ifc_len
; i
+= sizeof (struct ifreq32
)) {
369 if (copy_in_user(ifr
, ifr32
, sizeof(struct ifreq32
)))
375 if (copy_to_user(uifc
, &ifc
, sizeof(struct ifconf
)))
378 err
= sys_ioctl (fd
, SIOCGIFCONF
, (unsigned long)uifc
);
382 if (copy_from_user(&ifc
, uifc
, sizeof(struct ifconf
)))
386 ifr32
= compat_ptr(ifc32
.ifcbuf
);
388 i
+ sizeof (struct ifreq32
) <= ifc32
.ifc_len
&& j
< ifc
.ifc_len
;
389 i
+= sizeof (struct ifreq32
), j
+= sizeof (struct ifreq
)) {
390 if (copy_in_user(ifr32
, ifr
, sizeof (struct ifreq32
)))
396 if (ifc32
.ifcbuf
== 0) {
397 /* Translate from 64-bit structure multiple to
401 i
= ((i
/ sizeof(struct ifreq
)) * sizeof(struct ifreq32
));
406 if (copy_to_user(compat_ptr(arg
), &ifc32
, sizeof(struct ifconf32
)))
412 static int ethtool_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
414 struct ifreq __user
*ifr
;
415 struct ifreq32 __user
*ifr32
;
419 ifr
= compat_alloc_user_space(sizeof(*ifr
));
420 ifr32
= compat_ptr(arg
);
422 if (copy_in_user(&ifr
->ifr_name
, &ifr32
->ifr_name
, IFNAMSIZ
))
425 if (get_user(data
, &ifr32
->ifr_ifru
.ifru_data
))
428 datap
= compat_ptr(data
);
429 if (put_user(datap
, &ifr
->ifr_ifru
.ifru_data
))
432 return sys_ioctl(fd
, cmd
, (unsigned long) ifr
);
435 static int bond_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
438 struct ifreq __user
*uifr
;
439 struct ifreq32 __user
*ifr32
= compat_ptr(arg
);
446 case SIOCBONDENSLAVE
:
447 case SIOCBONDRELEASE
:
448 case SIOCBONDSETHWADDR
:
449 case SIOCBONDCHANGEACTIVE
:
450 if (copy_from_user(&kifr
, ifr32
, sizeof(struct ifreq32
)))
455 err
= sys_ioctl (fd
, cmd
, (unsigned long)&kifr
);
459 case SIOCBONDSLAVEINFOQUERY
:
460 case SIOCBONDINFOQUERY
:
461 uifr
= compat_alloc_user_space(sizeof(*uifr
));
462 if (copy_in_user(&uifr
->ifr_name
, &ifr32
->ifr_name
, IFNAMSIZ
))
465 if (get_user(data
, &ifr32
->ifr_ifru
.ifru_data
))
468 datap
= compat_ptr(data
);
469 if (put_user(datap
, &uifr
->ifr_ifru
.ifru_data
))
472 return sys_ioctl (fd
, cmd
, (unsigned long)uifr
);
478 static int siocdevprivate_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
480 struct ifreq __user
*u_ifreq64
;
481 struct ifreq32 __user
*u_ifreq32
= compat_ptr(arg
);
482 char tmp_buf
[IFNAMSIZ
];
486 if (copy_from_user(&tmp_buf
[0], &(u_ifreq32
->ifr_ifrn
.ifrn_name
[0]),
489 if (__get_user(data32
, &u_ifreq32
->ifr_ifru
.ifru_data
))
491 data64
= compat_ptr(data32
);
493 u_ifreq64
= compat_alloc_user_space(sizeof(*u_ifreq64
));
495 /* Don't check these user accesses, just let that get trapped
496 * in the ioctl handler instead.
498 if (copy_to_user(&u_ifreq64
->ifr_ifrn
.ifrn_name
[0], &tmp_buf
[0],
501 if (__put_user(data64
, &u_ifreq64
->ifr_ifru
.ifru_data
))
504 return sys_ioctl(fd
, cmd
, (unsigned long) u_ifreq64
);
507 static int dev_ifsioc(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
510 struct ifreq32 __user
*uifr32
;
511 struct ifmap32 __user
*uifmap32
;
515 uifr32
= compat_ptr(arg
);
516 uifmap32
= &uifr32
->ifr_ifru
.ifru_map
;
519 err
= copy_from_user(&ifr
, uifr32
, sizeof(ifr
.ifr_name
));
520 err
|= __get_user(ifr
.ifr_map
.mem_start
, &uifmap32
->mem_start
);
521 err
|= __get_user(ifr
.ifr_map
.mem_end
, &uifmap32
->mem_end
);
522 err
|= __get_user(ifr
.ifr_map
.base_addr
, &uifmap32
->base_addr
);
523 err
|= __get_user(ifr
.ifr_map
.irq
, &uifmap32
->irq
);
524 err
|= __get_user(ifr
.ifr_map
.dma
, &uifmap32
->dma
);
525 err
|= __get_user(ifr
.ifr_map
.port
, &uifmap32
->port
);
530 if (copy_from_user(&ifr
, uifr32
, sizeof(*uifr32
)))
536 err
= sys_ioctl (fd
, cmd
, (unsigned long)&ifr
);
540 /* TUNSETIFF is defined as _IOW, it should be _IORW
541 * as the data is copied back to user space, but that
542 * cannot be fixed without breaking all existing apps.
556 if (copy_to_user(uifr32
, &ifr
, sizeof(*uifr32
)))
560 err
= copy_to_user(uifr32
, &ifr
, sizeof(ifr
.ifr_name
));
561 err
|= __put_user(ifr
.ifr_map
.mem_start
, &uifmap32
->mem_start
);
562 err
|= __put_user(ifr
.ifr_map
.mem_end
, &uifmap32
->mem_end
);
563 err
|= __put_user(ifr
.ifr_map
.base_addr
, &uifmap32
->base_addr
);
564 err
|= __put_user(ifr
.ifr_map
.irq
, &uifmap32
->irq
);
565 err
|= __put_user(ifr
.ifr_map
.dma
, &uifmap32
->dma
);
566 err
|= __put_user(ifr
.ifr_map
.port
, &uifmap32
->port
);
577 struct sockaddr rt_dst
; /* target address */
578 struct sockaddr rt_gateway
; /* gateway addr (RTF_GATEWAY) */
579 struct sockaddr rt_genmask
; /* target network mask (IP) */
580 unsigned short rt_flags
;
583 unsigned char rt_tos
;
584 unsigned char rt_class
;
586 short rt_metric
; /* +1 for binary compatibility! */
587 /* char * */ u32 rt_dev
; /* forcing the device at add */
588 u32 rt_mtu
; /* per route MTU/Window */
589 u32 rt_window
; /* Window clamping */
590 unsigned short rt_irtt
; /* Initial RTT */
595 struct in6_addr rtmsg_dst
;
596 struct in6_addr rtmsg_src
;
597 struct in6_addr rtmsg_gateway
;
607 static int routing_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
615 mm_segment_t old_fs
= get_fs();
617 struct socket
*mysock
= sockfd_lookup(fd
, &ret
);
619 if (mysock
&& mysock
->sk
&& mysock
->sk
->sk_family
== AF_INET6
) { /* ipv6 */
620 struct in6_rtmsg32 __user
*ur6
= compat_ptr(arg
);
621 ret
= copy_from_user (&r6
.rtmsg_dst
, &(ur6
->rtmsg_dst
),
622 3 * sizeof(struct in6_addr
));
623 ret
|= __get_user (r6
.rtmsg_type
, &(ur6
->rtmsg_type
));
624 ret
|= __get_user (r6
.rtmsg_dst_len
, &(ur6
->rtmsg_dst_len
));
625 ret
|= __get_user (r6
.rtmsg_src_len
, &(ur6
->rtmsg_src_len
));
626 ret
|= __get_user (r6
.rtmsg_metric
, &(ur6
->rtmsg_metric
));
627 ret
|= __get_user (r6
.rtmsg_info
, &(ur6
->rtmsg_info
));
628 ret
|= __get_user (r6
.rtmsg_flags
, &(ur6
->rtmsg_flags
));
629 ret
|= __get_user (r6
.rtmsg_ifindex
, &(ur6
->rtmsg_ifindex
));
633 struct rtentry32 __user
*ur4
= compat_ptr(arg
);
634 ret
= copy_from_user (&r4
.rt_dst
, &(ur4
->rt_dst
),
635 3 * sizeof(struct sockaddr
));
636 ret
|= __get_user (r4
.rt_flags
, &(ur4
->rt_flags
));
637 ret
|= __get_user (r4
.rt_metric
, &(ur4
->rt_metric
));
638 ret
|= __get_user (r4
.rt_mtu
, &(ur4
->rt_mtu
));
639 ret
|= __get_user (r4
.rt_window
, &(ur4
->rt_window
));
640 ret
|= __get_user (r4
.rt_irtt
, &(ur4
->rt_irtt
));
641 ret
|= __get_user (rtdev
, &(ur4
->rt_dev
));
643 ret
|= copy_from_user (devname
, compat_ptr(rtdev
), 15);
644 r4
.rt_dev
= devname
; devname
[15] = 0;
657 ret
= sys_ioctl (fd
, cmd
, (unsigned long) r
);
669 typedef struct sg_io_hdr32
{
670 compat_int_t interface_id
; /* [i] 'S' for SCSI generic (required) */
671 compat_int_t dxfer_direction
; /* [i] data transfer direction */
672 unsigned char cmd_len
; /* [i] SCSI command length ( <= 16 bytes) */
673 unsigned char mx_sb_len
; /* [i] max length to write to sbp */
674 unsigned short iovec_count
; /* [i] 0 implies no scatter gather */
675 compat_uint_t dxfer_len
; /* [i] byte count of data transfer */
676 compat_uint_t dxferp
; /* [i], [*io] points to data transfer memory
677 or scatter gather list */
678 compat_uptr_t cmdp
; /* [i], [*i] points to command to perform */
679 compat_uptr_t sbp
; /* [i], [*o] points to sense_buffer memory */
680 compat_uint_t timeout
; /* [i] MAX_UINT->no timeout (unit: millisec) */
681 compat_uint_t flags
; /* [i] 0 -> default, see SG_FLAG... */
682 compat_int_t pack_id
; /* [i->o] unused internally (normally) */
683 compat_uptr_t usr_ptr
; /* [i->o] unused internally */
684 unsigned char status
; /* [o] scsi status */
685 unsigned char masked_status
; /* [o] shifted, masked scsi status */
686 unsigned char msg_status
; /* [o] messaging level data (optional) */
687 unsigned char sb_len_wr
; /* [o] byte count actually written to sbp */
688 unsigned short host_status
; /* [o] errors from host adapter */
689 unsigned short driver_status
; /* [o] errors from software driver */
690 compat_int_t resid
; /* [o] dxfer_len - actual_transferred */
691 compat_uint_t duration
; /* [o] time taken by cmd (unit: millisec) */
692 compat_uint_t info
; /* [o] auxiliary information */
693 } sg_io_hdr32_t
; /* 64 bytes long (on sparc32) */
695 typedef struct sg_iovec32
{
696 compat_uint_t iov_base
;
697 compat_uint_t iov_len
;
700 static int sg_build_iovec(sg_io_hdr_t __user
*sgio
, void __user
*dxferp
, u16 iovec_count
)
702 sg_iovec_t __user
*iov
= (sg_iovec_t __user
*) (sgio
+ 1);
703 sg_iovec32_t __user
*iov32
= dxferp
;
706 for (i
= 0; i
< iovec_count
; i
++) {
709 if (get_user(base
, &iov32
[i
].iov_base
) ||
710 get_user(len
, &iov32
[i
].iov_len
) ||
711 put_user(compat_ptr(base
), &iov
[i
].iov_base
) ||
712 put_user(len
, &iov
[i
].iov_len
))
716 if (put_user(iov
, &sgio
->dxferp
))
721 static int sg_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
723 sg_io_hdr_t __user
*sgio
;
724 sg_io_hdr32_t __user
*sgio32
;
730 sgio32
= compat_ptr(arg
);
731 if (get_user(iovec_count
, &sgio32
->iovec_count
))
735 void __user
*top
= compat_alloc_user_space(0);
736 void __user
*new = compat_alloc_user_space(sizeof(sg_io_hdr_t
) +
737 (iovec_count
* sizeof(sg_iovec_t
)));
744 /* Ok, now construct. */
745 if (copy_in_user(&sgio
->interface_id
, &sgio32
->interface_id
,
747 (2 * sizeof(unsigned char)) +
748 (1 * sizeof(unsigned short)) +
749 (1 * sizeof(unsigned int))))
752 if (get_user(data
, &sgio32
->dxferp
))
754 dxferp
= compat_ptr(data
);
756 if (sg_build_iovec(sgio
, dxferp
, iovec_count
))
759 if (put_user(dxferp
, &sgio
->dxferp
))
764 unsigned char __user
*cmdp
;
765 unsigned char __user
*sbp
;
767 if (get_user(data
, &sgio32
->cmdp
))
769 cmdp
= compat_ptr(data
);
771 if (get_user(data
, &sgio32
->sbp
))
773 sbp
= compat_ptr(data
);
775 if (put_user(cmdp
, &sgio
->cmdp
) ||
776 put_user(sbp
, &sgio
->sbp
))
780 if (copy_in_user(&sgio
->timeout
, &sgio32
->timeout
,
784 if (get_user(data
, &sgio32
->usr_ptr
))
786 if (put_user(compat_ptr(data
), &sgio
->usr_ptr
))
789 if (copy_in_user(&sgio
->status
, &sgio32
->status
,
790 (4 * sizeof(unsigned char)) +
791 (2 * sizeof(unsigned (short))) +
795 err
= sys_ioctl(fd
, cmd
, (unsigned long) sgio
);
800 if (copy_in_user(&sgio32
->pack_id
, &sgio
->pack_id
,
802 get_user(datap
, &sgio
->usr_ptr
) ||
803 put_user((u32
)(unsigned long)datap
,
805 copy_in_user(&sgio32
->status
, &sgio
->status
,
806 (4 * sizeof(unsigned char)) +
807 (2 * sizeof(unsigned short)) +
815 struct compat_sg_req_info
{ /* used by SG_GET_REQUEST_TABLE ioctl() */
821 compat_uptr_t usr_ptr
;
822 unsigned int duration
;
826 static int sg_grt_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
829 sg_req_info_t __user
*r
;
830 struct compat_sg_req_info __user
*o
= (void __user
*)arg
;
831 r
= compat_alloc_user_space(sizeof(sg_req_info_t
)*SG_MAX_QUEUE
);
832 err
= sys_ioctl(fd
,cmd
,(unsigned long)r
);
835 for (i
= 0; i
< SG_MAX_QUEUE
; i
++) {
839 if (copy_in_user(o
+ i
, r
+ i
, offsetof(sg_req_info_t
, usr_ptr
)) ||
840 get_user(ptr
, &r
[i
].usr_ptr
) ||
841 get_user(d
, &r
[i
].duration
) ||
842 put_user((u32
)(unsigned long)(ptr
), &o
[i
].usr_ptr
) ||
843 put_user(d
, &o
[i
].duration
))
848 #endif /* CONFIG_BLOCK */
850 struct sock_fprog32
{
852 compat_caddr_t filter
;
855 #define PPPIOCSPASS32 _IOW('t', 71, struct sock_fprog32)
856 #define PPPIOCSACTIVE32 _IOW('t', 70, struct sock_fprog32)
858 static int ppp_sock_fprog_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
860 struct sock_fprog32 __user
*u_fprog32
= compat_ptr(arg
);
861 struct sock_fprog __user
*u_fprog64
= compat_alloc_user_space(sizeof(struct sock_fprog
));
866 if (get_user(flen
, &u_fprog32
->len
) ||
867 get_user(fptr32
, &u_fprog32
->filter
))
870 fptr64
= compat_ptr(fptr32
);
872 if (put_user(flen
, &u_fprog64
->len
) ||
873 put_user(fptr64
, &u_fprog64
->filter
))
876 if (cmd
== PPPIOCSPASS32
)
881 return sys_ioctl(fd
, cmd
, (unsigned long) u_fprog64
);
884 struct ppp_option_data32
{
887 compat_int_t transmit
;
889 #define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
892 compat_time_t xmit_idle
;
893 compat_time_t recv_idle
;
895 #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
897 static int ppp_gidle(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
899 struct ppp_idle __user
*idle
;
900 struct ppp_idle32 __user
*idle32
;
901 __kernel_time_t xmit
, recv
;
904 idle
= compat_alloc_user_space(sizeof(*idle
));
905 idle32
= compat_ptr(arg
);
907 err
= sys_ioctl(fd
, PPPIOCGIDLE
, (unsigned long) idle
);
910 if (get_user(xmit
, &idle
->xmit_idle
) ||
911 get_user(recv
, &idle
->recv_idle
) ||
912 put_user(xmit
, &idle32
->xmit_idle
) ||
913 put_user(recv
, &idle32
->recv_idle
))
919 static int ppp_scompress(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
921 struct ppp_option_data __user
*odata
;
922 struct ppp_option_data32 __user
*odata32
;
926 odata
= compat_alloc_user_space(sizeof(*odata
));
927 odata32
= compat_ptr(arg
);
929 if (get_user(data
, &odata32
->ptr
))
932 datap
= compat_ptr(data
);
933 if (put_user(datap
, &odata
->ptr
))
936 if (copy_in_user(&odata
->length
, &odata32
->length
,
937 sizeof(__u32
) + sizeof(int)))
940 return sys_ioctl(fd
, PPPIOCSCOMPRESS
, (unsigned long) odata
);
943 static int ppp_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
949 err
= ppp_gidle(fd
, cmd
, arg
);
952 case PPPIOCSCOMPRESS32
:
953 err
= ppp_scompress(fd
, cmd
, arg
);
960 printk("ppp_ioctl: Unknown cmd fd(%d) "
961 "cmd(%08x) arg(%08x)\n",
962 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
974 compat_long_t mt_type
;
975 compat_long_t mt_resid
;
976 compat_long_t mt_dsreg
;
977 compat_long_t mt_gstat
;
978 compat_long_t mt_erreg
;
979 compat_daddr_t mt_fileno
;
980 compat_daddr_t mt_blkno
;
982 #define MTIOCGET32 _IOR('m', 2, struct mtget32)
985 compat_long_t mt_blkno
;
987 #define MTIOCPOS32 _IOR('m', 3, struct mtpos32)
989 static int mt_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
991 mm_segment_t old_fs
= get_fs();
993 struct mtget32 __user
*umget32
;
995 struct mtpos32 __user
*upos32
;
1013 printk("mt_ioctl: Unknown cmd fd(%d) "
1014 "cmd(%08x) arg(%08x)\n",
1015 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1020 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1026 upos32
= compat_ptr(arg
);
1027 err
= __put_user(pos
.mt_blkno
, &upos32
->mt_blkno
);
1030 umget32
= compat_ptr(arg
);
1031 err
= __put_user(get
.mt_type
, &umget32
->mt_type
);
1032 err
|= __put_user(get
.mt_resid
, &umget32
->mt_resid
);
1033 err
|= __put_user(get
.mt_dsreg
, &umget32
->mt_dsreg
);
1034 err
|= __put_user(get
.mt_gstat
, &umget32
->mt_gstat
);
1035 err
|= __put_user(get
.mt_erreg
, &umget32
->mt_erreg
);
1036 err
|= __put_user(get
.mt_fileno
, &umget32
->mt_fileno
);
1037 err
|= __put_user(get
.mt_blkno
, &umget32
->mt_blkno
);
1040 return err
? -EFAULT
: 0;
1043 struct cdrom_read_audio32
{
1044 union cdrom_addr addr
;
1046 compat_int_t nframes
;
1050 struct cdrom_generic_command32
{
1051 unsigned char cmd
[CDROM_PACKET_SIZE
];
1052 compat_caddr_t buffer
;
1053 compat_uint_t buflen
;
1055 compat_caddr_t sense
;
1056 unsigned char data_direction
;
1058 compat_int_t timeout
;
1059 compat_caddr_t reserved
[1];
1062 static int cdrom_do_read_audio(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1064 struct cdrom_read_audio __user
*cdread_audio
;
1065 struct cdrom_read_audio32 __user
*cdread_audio32
;
1069 cdread_audio
= compat_alloc_user_space(sizeof(*cdread_audio
));
1070 cdread_audio32
= compat_ptr(arg
);
1072 if (copy_in_user(&cdread_audio
->addr
,
1073 &cdread_audio32
->addr
,
1074 (sizeof(*cdread_audio32
) -
1075 sizeof(compat_caddr_t
))))
1078 if (get_user(data
, &cdread_audio32
->buf
))
1080 datap
= compat_ptr(data
);
1081 if (put_user(datap
, &cdread_audio
->buf
))
1084 return sys_ioctl(fd
, cmd
, (unsigned long) cdread_audio
);
1087 static int cdrom_do_generic_command(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1089 struct cdrom_generic_command __user
*cgc
;
1090 struct cdrom_generic_command32 __user
*cgc32
;
1095 cgc
= compat_alloc_user_space(sizeof(*cgc
));
1096 cgc32
= compat_ptr(arg
);
1098 if (copy_in_user(&cgc
->cmd
, &cgc32
->cmd
, sizeof(cgc
->cmd
)) ||
1099 get_user(data
, &cgc32
->buffer
) ||
1100 put_user(compat_ptr(data
), &cgc
->buffer
) ||
1101 copy_in_user(&cgc
->buflen
, &cgc32
->buflen
,
1102 (sizeof(unsigned int) + sizeof(int))) ||
1103 get_user(data
, &cgc32
->sense
) ||
1104 put_user(compat_ptr(data
), &cgc
->sense
) ||
1105 get_user(dir
, &cgc32
->data_direction
) ||
1106 put_user(dir
, &cgc
->data_direction
) ||
1107 get_user(itmp
, &cgc32
->quiet
) ||
1108 put_user(itmp
, &cgc
->quiet
) ||
1109 get_user(itmp
, &cgc32
->timeout
) ||
1110 put_user(itmp
, &cgc
->timeout
) ||
1111 get_user(data
, &cgc32
->reserved
[0]) ||
1112 put_user(compat_ptr(data
), &cgc
->reserved
[0]))
1115 return sys_ioctl(fd
, cmd
, (unsigned long) cgc
);
1118 static int cdrom_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1123 case CDROMREADAUDIO
:
1124 err
= cdrom_do_read_audio(fd
, cmd
, arg
);
1127 case CDROM_SEND_PACKET
:
1128 err
= cdrom_do_generic_command(fd
, cmd
, arg
);
1135 printk("cdrom_ioctl: Unknown cmd fd(%d) "
1136 "cmd(%08x) arg(%08x)\n",
1137 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1145 #endif /* CONFIG_BLOCK */
1149 static int vt_check(struct file
*file
)
1151 struct tty_struct
*tty
;
1152 struct inode
*inode
= file
->f_path
.dentry
->d_inode
;
1155 if (file
->f_op
->ioctl
!= tty_ioctl
)
1158 tty
= (struct tty_struct
*)file
->private_data
;
1159 if (tty_paranoia_check(tty
, inode
, "tty_ioctl"))
1162 if (tty
->driver
->ioctl
!= vt_ioctl
)
1165 vc
= (struct vc_data
*)tty
->driver_data
;
1166 if (!vc_cons_allocated(vc
->vc_num
)) /* impossible? */
1167 return -ENOIOCTLCMD
;
1170 * To have permissions to do most of the vt ioctls, we either have
1171 * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
1173 if (current
->signal
->tty
== tty
|| capable(CAP_SYS_TTY_CONFIG
))
1178 struct consolefontdesc32
{
1179 unsigned short charcount
; /* characters in font (256 or 512) */
1180 unsigned short charheight
; /* scan lines per character (1-32) */
1181 compat_caddr_t chardata
; /* font data in expanded form */
1184 static int do_fontx_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
, struct file
*file
)
1186 struct consolefontdesc32 __user
*user_cfd
= compat_ptr(arg
);
1187 struct console_font_op op
;
1188 compat_caddr_t data
;
1191 perm
= vt_check(file
);
1192 if (perm
< 0) return perm
;
1198 op
.op
= KD_FONT_OP_SET
;
1201 if (get_user(op
.height
, &user_cfd
->charheight
) ||
1202 get_user(op
.charcount
, &user_cfd
->charcount
) ||
1203 get_user(data
, &user_cfd
->chardata
))
1205 op
.data
= compat_ptr(data
);
1206 return con_font_op(vc_cons
[fg_console
].d
, &op
);
1208 op
.op
= KD_FONT_OP_GET
;
1211 if (get_user(op
.height
, &user_cfd
->charheight
) ||
1212 get_user(op
.charcount
, &user_cfd
->charcount
) ||
1213 get_user(data
, &user_cfd
->chardata
))
1217 op
.data
= compat_ptr(data
);
1218 i
= con_font_op(vc_cons
[fg_console
].d
, &op
);
1221 if (put_user(op
.height
, &user_cfd
->charheight
) ||
1222 put_user(op
.charcount
, &user_cfd
->charcount
) ||
1223 put_user((compat_caddr_t
)(unsigned long)op
.data
,
1224 &user_cfd
->chardata
))
1231 struct console_font_op32
{
1232 compat_uint_t op
; /* operation code KD_FONT_OP_* */
1233 compat_uint_t flags
; /* KD_FONT_FLAG_* */
1234 compat_uint_t width
, height
; /* font size */
1235 compat_uint_t charcount
;
1236 compat_caddr_t data
; /* font data with height fixed to 32 */
1239 static int do_kdfontop_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
, struct file
*file
)
1241 struct console_font_op op
;
1242 struct console_font_op32 __user
*fontop
= compat_ptr(arg
);
1243 int perm
= vt_check(file
), i
;
1246 if (perm
< 0) return perm
;
1248 if (copy_from_user(&op
, fontop
, sizeof(struct console_font_op32
)))
1250 if (!perm
&& op
.op
!= KD_FONT_OP_GET
)
1252 op
.data
= compat_ptr(((struct console_font_op32
*)&op
)->data
);
1253 op
.flags
|= KD_FONT_FLAG_OLD
;
1254 vc
= ((struct tty_struct
*)file
->private_data
)->driver_data
;
1255 i
= con_font_op(vc
, &op
);
1258 ((struct console_font_op32
*)&op
)->data
= (unsigned long)op
.data
;
1259 if (copy_to_user(fontop
, &op
, sizeof(struct console_font_op32
)))
1264 struct unimapdesc32
{
1265 unsigned short entry_ct
;
1266 compat_caddr_t entries
;
1269 static int do_unimap_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
, struct file
*file
)
1271 struct unimapdesc32 tmp
;
1272 struct unimapdesc32 __user
*user_ud
= compat_ptr(arg
);
1273 int perm
= vt_check(file
);
1278 if (copy_from_user(&tmp
, user_ud
, sizeof tmp
))
1281 if (!access_ok(VERIFY_WRITE
, compat_ptr(tmp
.entries
),
1282 tmp
.entry_ct
*sizeof(struct unipair
)))
1284 vc
= ((struct tty_struct
*)file
->private_data
)->driver_data
;
1289 return con_set_unimap(vc
, tmp
.entry_ct
,
1290 compat_ptr(tmp
.entries
));
1292 if (!perm
&& fg_console
!= vc
->vc_num
)
1294 return con_get_unimap(vc
, tmp
.entry_ct
, &(user_ud
->entry_ct
),
1295 compat_ptr(tmp
.entries
));
1300 #endif /* CONFIG_VT */
1302 static int do_smb_getmountuid(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1304 mm_segment_t old_fs
= get_fs();
1305 __kernel_uid_t kuid
;
1308 cmd
= SMB_IOC_GETMOUNTUID
;
1311 err
= sys_ioctl(fd
, cmd
, (unsigned long)&kuid
);
1315 err
= put_user(kuid
, (compat_uid_t __user
*)compat_ptr(arg
));
1320 struct atmif_sioc32
{
1321 compat_int_t number
;
1322 compat_int_t length
;
1326 struct atm_iobuf32
{
1327 compat_int_t length
;
1328 compat_caddr_t buffer
;
1331 #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32)
1332 #define ATM_GETNAMES32 _IOW('a', ATMIOC_ITF+3, struct atm_iobuf32)
1333 #define ATM_GETTYPE32 _IOW('a', ATMIOC_ITF+4, struct atmif_sioc32)
1334 #define ATM_GETESI32 _IOW('a', ATMIOC_ITF+5, struct atmif_sioc32)
1335 #define ATM_GETADDR32 _IOW('a', ATMIOC_ITF+6, struct atmif_sioc32)
1336 #define ATM_RSTADDR32 _IOW('a', ATMIOC_ITF+7, struct atmif_sioc32)
1337 #define ATM_ADDADDR32 _IOW('a', ATMIOC_ITF+8, struct atmif_sioc32)
1338 #define ATM_DELADDR32 _IOW('a', ATMIOC_ITF+9, struct atmif_sioc32)
1339 #define ATM_GETCIRANGE32 _IOW('a', ATMIOC_ITF+10, struct atmif_sioc32)
1340 #define ATM_SETCIRANGE32 _IOW('a', ATMIOC_ITF+11, struct atmif_sioc32)
1341 #define ATM_SETESI32 _IOW('a', ATMIOC_ITF+12, struct atmif_sioc32)
1342 #define ATM_SETESIF32 _IOW('a', ATMIOC_ITF+13, struct atmif_sioc32)
1343 #define ATM_GETSTAT32 _IOW('a', ATMIOC_SARCOM+0, struct atmif_sioc32)
1344 #define ATM_GETSTATZ32 _IOW('a', ATMIOC_SARCOM+1, struct atmif_sioc32)
1345 #define ATM_GETLOOP32 _IOW('a', ATMIOC_SARCOM+2, struct atmif_sioc32)
1346 #define ATM_SETLOOP32 _IOW('a', ATMIOC_SARCOM+3, struct atmif_sioc32)
1347 #define ATM_QUERYLOOP32 _IOW('a', ATMIOC_SARCOM+4, struct atmif_sioc32)
1352 } atm_ioctl_map
[] = {
1353 { ATM_GETLINKRATE32
, ATM_GETLINKRATE
},
1354 { ATM_GETNAMES32
, ATM_GETNAMES
},
1355 { ATM_GETTYPE32
, ATM_GETTYPE
},
1356 { ATM_GETESI32
, ATM_GETESI
},
1357 { ATM_GETADDR32
, ATM_GETADDR
},
1358 { ATM_RSTADDR32
, ATM_RSTADDR
},
1359 { ATM_ADDADDR32
, ATM_ADDADDR
},
1360 { ATM_DELADDR32
, ATM_DELADDR
},
1361 { ATM_GETCIRANGE32
, ATM_GETCIRANGE
},
1362 { ATM_SETCIRANGE32
, ATM_SETCIRANGE
},
1363 { ATM_SETESI32
, ATM_SETESI
},
1364 { ATM_SETESIF32
, ATM_SETESIF
},
1365 { ATM_GETSTAT32
, ATM_GETSTAT
},
1366 { ATM_GETSTATZ32
, ATM_GETSTATZ
},
1367 { ATM_GETLOOP32
, ATM_GETLOOP
},
1368 { ATM_SETLOOP32
, ATM_SETLOOP
},
1369 { ATM_QUERYLOOP32
, ATM_QUERYLOOP
}
1372 #define NR_ATM_IOCTL ARRAY_SIZE(atm_ioctl_map)
1374 static int do_atm_iobuf(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1376 struct atm_iobuf __user
*iobuf
;
1377 struct atm_iobuf32 __user
*iobuf32
;
1382 iobuf
= compat_alloc_user_space(sizeof(*iobuf
));
1383 iobuf32
= compat_ptr(arg
);
1385 if (get_user(len
, &iobuf32
->length
) ||
1386 get_user(data
, &iobuf32
->buffer
))
1388 datap
= compat_ptr(data
);
1389 if (put_user(len
, &iobuf
->length
) ||
1390 put_user(datap
, &iobuf
->buffer
))
1393 err
= sys_ioctl(fd
, cmd
, (unsigned long)iobuf
);
1396 if (copy_in_user(&iobuf32
->length
, &iobuf
->length
,
1404 static int do_atmif_sioc(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1406 struct atmif_sioc __user
*sioc
;
1407 struct atmif_sioc32 __user
*sioc32
;
1412 sioc
= compat_alloc_user_space(sizeof(*sioc
));
1413 sioc32
= compat_ptr(arg
);
1415 if (copy_in_user(&sioc
->number
, &sioc32
->number
, 2 * sizeof(int)) ||
1416 get_user(data
, &sioc32
->arg
))
1418 datap
= compat_ptr(data
);
1419 if (put_user(datap
, &sioc
->arg
))
1422 err
= sys_ioctl(fd
, cmd
, (unsigned long) sioc
);
1425 if (copy_in_user(&sioc32
->length
, &sioc
->length
,
1432 static int do_atm_ioctl(unsigned int fd
, unsigned int cmd32
, unsigned long arg
)
1435 unsigned int cmd
= 0;
1439 case SONET_GETSTATZ
:
1443 case SONET_SETFRAMING
:
1444 case SONET_GETFRAMING
:
1445 case SONET_GETFRSENSE
:
1446 return do_atmif_sioc(fd
, cmd32
, arg
);
1449 for (i
= 0; i
< NR_ATM_IOCTL
; i
++) {
1450 if (cmd32
== atm_ioctl_map
[i
].cmd32
) {
1451 cmd
= atm_ioctl_map
[i
].cmd
;
1455 if (i
== NR_ATM_IOCTL
)
1460 return do_atm_iobuf(fd
, cmd
, arg
);
1462 case ATM_GETLINKRATE
:
1469 case ATM_GETCIRANGE
:
1470 case ATM_SETCIRANGE
:
1478 return do_atmif_sioc(fd
, cmd
, arg
);
1484 static __attribute_used__
int
1485 ret_einval(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1491 struct blkpg_ioctl_arg32
{
1494 compat_int_t datalen
;
1495 compat_caddr_t data
;
1498 static int blkpg_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1500 struct blkpg_ioctl_arg32 __user
*ua32
= compat_ptr(arg
);
1501 struct blkpg_ioctl_arg __user
*a
= compat_alloc_user_space(sizeof(*a
));
1502 compat_caddr_t udata
;
1506 err
= get_user(n
, &ua32
->op
);
1507 err
|= put_user(n
, &a
->op
);
1508 err
|= get_user(n
, &ua32
->flags
);
1509 err
|= put_user(n
, &a
->flags
);
1510 err
|= get_user(n
, &ua32
->datalen
);
1511 err
|= put_user(n
, &a
->datalen
);
1512 err
|= get_user(udata
, &ua32
->data
);
1513 err
|= put_user(compat_ptr(udata
), &a
->data
);
1517 return sys_ioctl(fd
, cmd
, (unsigned long)a
);
1521 static int ioc_settimeout(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1523 return rw_long(fd
, AUTOFS_IOC_SETTIMEOUT
, arg
);
1526 /* Bluetooth ioctls */
1527 #define HCIUARTSETPROTO _IOW('U', 200, int)
1528 #define HCIUARTGETPROTO _IOR('U', 201, int)
1530 #define BNEPCONNADD _IOW('B', 200, int)
1531 #define BNEPCONNDEL _IOW('B', 201, int)
1532 #define BNEPGETCONNLIST _IOR('B', 210, int)
1533 #define BNEPGETCONNINFO _IOR('B', 211, int)
1535 #define CMTPCONNADD _IOW('C', 200, int)
1536 #define CMTPCONNDEL _IOW('C', 201, int)
1537 #define CMTPGETCONNLIST _IOR('C', 210, int)
1538 #define CMTPGETCONNINFO _IOR('C', 211, int)
1540 #define HIDPCONNADD _IOW('H', 200, int)
1541 #define HIDPCONNDEL _IOW('H', 201, int)
1542 #define HIDPGETCONNLIST _IOR('H', 210, int)
1543 #define HIDPGETCONNINFO _IOR('H', 211, int)
1546 struct floppy_struct32
{
1550 compat_uint_t track
;
1551 compat_uint_t stretch
;
1554 unsigned char spec1
;
1555 unsigned char fmt_gap
;
1556 const compat_caddr_t name
;
1559 struct floppy_drive_params32
{
1561 compat_ulong_t max_dtr
;
1565 compat_ulong_t spinup
;
1566 compat_ulong_t spindown
;
1567 unsigned char spindown_offset
;
1568 unsigned char select_delay
;
1570 unsigned char tracks
;
1571 compat_ulong_t timeout
;
1572 unsigned char interleave_sect
;
1573 struct floppy_max_errors max_errors
;
1576 short autodetect
[8];
1577 compat_int_t checkfreq
;
1578 compat_int_t native_format
;
1581 struct floppy_drive_struct32
{
1583 compat_ulong_t spinup_date
;
1584 compat_ulong_t select_date
;
1585 compat_ulong_t first_read_date
;
1586 short probed_format
;
1590 compat_int_t generation
;
1591 compat_int_t keep_data
;
1592 compat_int_t fd_ref
;
1593 compat_int_t fd_device
;
1594 compat_int_t last_checked
;
1595 compat_caddr_t dmabuf
;
1596 compat_int_t bufblocks
;
1599 struct floppy_fdc_state32
{
1603 unsigned char version
;
1605 compat_ulong_t address
;
1606 unsigned int rawcmd
:2;
1607 unsigned int reset
:1;
1608 unsigned int need_configure
:1;
1609 unsigned int perp_mode
:2;
1610 unsigned int has_fifo
:1;
1611 unsigned int driver_version
;
1612 unsigned char track
[4];
1615 struct floppy_write_errors32
{
1616 unsigned int write_errors
;
1617 compat_ulong_t first_error_sector
;
1618 compat_int_t first_error_generation
;
1619 compat_ulong_t last_error_sector
;
1620 compat_int_t last_error_generation
;
1621 compat_uint_t badness
;
1624 #define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32)
1625 #define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32)
1626 #define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32)
1627 #define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32)
1628 #define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32)
1629 #define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32)
1630 #define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32)
1631 #define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32)
1632 #define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32)
1637 } fd_ioctl_trans_table
[] = {
1638 { FDSETPRM32
, FDSETPRM
},
1639 { FDDEFPRM32
, FDDEFPRM
},
1640 { FDGETPRM32
, FDGETPRM
},
1641 { FDSETDRVPRM32
, FDSETDRVPRM
},
1642 { FDGETDRVPRM32
, FDGETDRVPRM
},
1643 { FDGETDRVSTAT32
, FDGETDRVSTAT
},
1644 { FDPOLLDRVSTAT32
, FDPOLLDRVSTAT
},
1645 { FDGETFDCSTAT32
, FDGETFDCSTAT
},
1646 { FDWERRORGET32
, FDWERRORGET
}
1649 #define NR_FD_IOCTL_TRANS ARRAY_SIZE(fd_ioctl_trans_table)
1651 static int fd_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1653 mm_segment_t old_fs
= get_fs();
1655 unsigned int kcmd
= 0;
1658 for (i
= 0; i
< NR_FD_IOCTL_TRANS
; i
++)
1659 if (cmd
== fd_ioctl_trans_table
[i
].cmd32
) {
1660 kcmd
= fd_ioctl_trans_table
[i
].cmd
;
1672 struct floppy_struct32 __user
*uf
;
1673 struct floppy_struct
*f
;
1675 uf
= compat_ptr(arg
);
1676 f
= karg
= kmalloc(sizeof(struct floppy_struct
), GFP_KERNEL
);
1679 if (cmd
== FDGETPRM32
)
1681 err
= __get_user(f
->size
, &uf
->size
);
1682 err
|= __get_user(f
->sect
, &uf
->sect
);
1683 err
|= __get_user(f
->head
, &uf
->head
);
1684 err
|= __get_user(f
->track
, &uf
->track
);
1685 err
|= __get_user(f
->stretch
, &uf
->stretch
);
1686 err
|= __get_user(f
->gap
, &uf
->gap
);
1687 err
|= __get_user(f
->rate
, &uf
->rate
);
1688 err
|= __get_user(f
->spec1
, &uf
->spec1
);
1689 err
|= __get_user(f
->fmt_gap
, &uf
->fmt_gap
);
1690 err
|= __get_user(name
, &uf
->name
);
1691 f
->name
= compat_ptr(name
);
1701 struct floppy_drive_params32 __user
*uf
;
1702 struct floppy_drive_params
*f
;
1704 uf
= compat_ptr(arg
);
1705 f
= karg
= kmalloc(sizeof(struct floppy_drive_params
), GFP_KERNEL
);
1708 if (cmd
== FDGETDRVPRM32
)
1710 err
= __get_user(f
->cmos
, &uf
->cmos
);
1711 err
|= __get_user(f
->max_dtr
, &uf
->max_dtr
);
1712 err
|= __get_user(f
->hlt
, &uf
->hlt
);
1713 err
|= __get_user(f
->hut
, &uf
->hut
);
1714 err
|= __get_user(f
->srt
, &uf
->srt
);
1715 err
|= __get_user(f
->spinup
, &uf
->spinup
);
1716 err
|= __get_user(f
->spindown
, &uf
->spindown
);
1717 err
|= __get_user(f
->spindown_offset
, &uf
->spindown_offset
);
1718 err
|= __get_user(f
->select_delay
, &uf
->select_delay
);
1719 err
|= __get_user(f
->rps
, &uf
->rps
);
1720 err
|= __get_user(f
->tracks
, &uf
->tracks
);
1721 err
|= __get_user(f
->timeout
, &uf
->timeout
);
1722 err
|= __get_user(f
->interleave_sect
, &uf
->interleave_sect
);
1723 err
|= __copy_from_user(&f
->max_errors
, &uf
->max_errors
, sizeof(f
->max_errors
));
1724 err
|= __get_user(f
->flags
, &uf
->flags
);
1725 err
|= __get_user(f
->read_track
, &uf
->read_track
);
1726 err
|= __copy_from_user(f
->autodetect
, uf
->autodetect
, sizeof(f
->autodetect
));
1727 err
|= __get_user(f
->checkfreq
, &uf
->checkfreq
);
1728 err
|= __get_user(f
->native_format
, &uf
->native_format
);
1735 case FDGETDRVSTAT32
:
1736 case FDPOLLDRVSTAT32
:
1737 karg
= kmalloc(sizeof(struct floppy_drive_struct
), GFP_KERNEL
);
1741 case FDGETFDCSTAT32
:
1742 karg
= kmalloc(sizeof(struct floppy_fdc_state
), GFP_KERNEL
);
1747 karg
= kmalloc(sizeof(struct floppy_write_errors
), GFP_KERNEL
);
1755 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1762 struct floppy_struct
*f
= karg
;
1763 struct floppy_struct32 __user
*uf
= compat_ptr(arg
);
1765 err
= __put_user(f
->size
, &uf
->size
);
1766 err
|= __put_user(f
->sect
, &uf
->sect
);
1767 err
|= __put_user(f
->head
, &uf
->head
);
1768 err
|= __put_user(f
->track
, &uf
->track
);
1769 err
|= __put_user(f
->stretch
, &uf
->stretch
);
1770 err
|= __put_user(f
->gap
, &uf
->gap
);
1771 err
|= __put_user(f
->rate
, &uf
->rate
);
1772 err
|= __put_user(f
->spec1
, &uf
->spec1
);
1773 err
|= __put_user(f
->fmt_gap
, &uf
->fmt_gap
);
1774 err
|= __put_user((u64
)f
->name
, (compat_caddr_t __user
*)&uf
->name
);
1779 struct floppy_drive_params32 __user
*uf
;
1780 struct floppy_drive_params
*f
= karg
;
1782 uf
= compat_ptr(arg
);
1783 err
= __put_user(f
->cmos
, &uf
->cmos
);
1784 err
|= __put_user(f
->max_dtr
, &uf
->max_dtr
);
1785 err
|= __put_user(f
->hlt
, &uf
->hlt
);
1786 err
|= __put_user(f
->hut
, &uf
->hut
);
1787 err
|= __put_user(f
->srt
, &uf
->srt
);
1788 err
|= __put_user(f
->spinup
, &uf
->spinup
);
1789 err
|= __put_user(f
->spindown
, &uf
->spindown
);
1790 err
|= __put_user(f
->spindown_offset
, &uf
->spindown_offset
);
1791 err
|= __put_user(f
->select_delay
, &uf
->select_delay
);
1792 err
|= __put_user(f
->rps
, &uf
->rps
);
1793 err
|= __put_user(f
->tracks
, &uf
->tracks
);
1794 err
|= __put_user(f
->timeout
, &uf
->timeout
);
1795 err
|= __put_user(f
->interleave_sect
, &uf
->interleave_sect
);
1796 err
|= __copy_to_user(&uf
->max_errors
, &f
->max_errors
, sizeof(f
->max_errors
));
1797 err
|= __put_user(f
->flags
, &uf
->flags
);
1798 err
|= __put_user(f
->read_track
, &uf
->read_track
);
1799 err
|= __copy_to_user(uf
->autodetect
, f
->autodetect
, sizeof(f
->autodetect
));
1800 err
|= __put_user(f
->checkfreq
, &uf
->checkfreq
);
1801 err
|= __put_user(f
->native_format
, &uf
->native_format
);
1804 case FDGETDRVSTAT32
:
1805 case FDPOLLDRVSTAT32
:
1807 struct floppy_drive_struct32 __user
*uf
;
1808 struct floppy_drive_struct
*f
= karg
;
1810 uf
= compat_ptr(arg
);
1811 err
= __put_user(f
->flags
, &uf
->flags
);
1812 err
|= __put_user(f
->spinup_date
, &uf
->spinup_date
);
1813 err
|= __put_user(f
->select_date
, &uf
->select_date
);
1814 err
|= __put_user(f
->first_read_date
, &uf
->first_read_date
);
1815 err
|= __put_user(f
->probed_format
, &uf
->probed_format
);
1816 err
|= __put_user(f
->track
, &uf
->track
);
1817 err
|= __put_user(f
->maxblock
, &uf
->maxblock
);
1818 err
|= __put_user(f
->maxtrack
, &uf
->maxtrack
);
1819 err
|= __put_user(f
->generation
, &uf
->generation
);
1820 err
|= __put_user(f
->keep_data
, &uf
->keep_data
);
1821 err
|= __put_user(f
->fd_ref
, &uf
->fd_ref
);
1822 err
|= __put_user(f
->fd_device
, &uf
->fd_device
);
1823 err
|= __put_user(f
->last_checked
, &uf
->last_checked
);
1824 err
|= __put_user((u64
)f
->dmabuf
, &uf
->dmabuf
);
1825 err
|= __put_user((u64
)f
->bufblocks
, &uf
->bufblocks
);
1828 case FDGETFDCSTAT32
:
1830 struct floppy_fdc_state32 __user
*uf
;
1831 struct floppy_fdc_state
*f
= karg
;
1833 uf
= compat_ptr(arg
);
1834 err
= __put_user(f
->spec1
, &uf
->spec1
);
1835 err
|= __put_user(f
->spec2
, &uf
->spec2
);
1836 err
|= __put_user(f
->dtr
, &uf
->dtr
);
1837 err
|= __put_user(f
->version
, &uf
->version
);
1838 err
|= __put_user(f
->dor
, &uf
->dor
);
1839 err
|= __put_user(f
->address
, &uf
->address
);
1840 err
|= __copy_to_user((char __user
*)&uf
->address
+ sizeof(uf
->address
),
1841 (char *)&f
->address
+ sizeof(f
->address
), sizeof(int));
1842 err
|= __put_user(f
->driver_version
, &uf
->driver_version
);
1843 err
|= __copy_to_user(uf
->track
, f
->track
, sizeof(f
->track
));
1848 struct floppy_write_errors32 __user
*uf
;
1849 struct floppy_write_errors
*f
= karg
;
1851 uf
= compat_ptr(arg
);
1852 err
= __put_user(f
->write_errors
, &uf
->write_errors
);
1853 err
|= __put_user(f
->first_error_sector
, &uf
->first_error_sector
);
1854 err
|= __put_user(f
->first_error_generation
, &uf
->first_error_generation
);
1855 err
|= __put_user(f
->last_error_sector
, &uf
->last_error_sector
);
1856 err
|= __put_user(f
->last_error_generation
, &uf
->last_error_generation
);
1857 err
|= __put_user(f
->badness
, &uf
->badness
);
1872 struct mtd_oob_buf32
{
1875 compat_caddr_t ptr
; /* unsigned char* */
1878 #define MEMWRITEOOB32 _IOWR('M',3,struct mtd_oob_buf32)
1879 #define MEMREADOOB32 _IOWR('M',4,struct mtd_oob_buf32)
1881 static int mtd_rw_oob(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1883 struct mtd_oob_buf __user
*buf
= compat_alloc_user_space(sizeof(*buf
));
1884 struct mtd_oob_buf32 __user
*buf32
= compat_ptr(arg
);
1887 unsigned int real_cmd
;
1890 real_cmd
= (cmd
== MEMREADOOB32
) ?
1891 MEMREADOOB
: MEMWRITEOOB
;
1893 if (copy_in_user(&buf
->start
, &buf32
->start
,
1895 get_user(data
, &buf32
->ptr
))
1897 datap
= compat_ptr(data
);
1898 if (put_user(datap
, &buf
->ptr
))
1901 err
= sys_ioctl(fd
, real_cmd
, (unsigned long) buf
);
1904 if (copy_in_user(&buf32
->start
, &buf
->start
,
1913 struct raw32_config_request
1915 compat_int_t raw_minor
;
1918 } __attribute__((packed
));
1920 static int get_raw32_request(struct raw_config_request
*req
, struct raw32_config_request __user
*user_req
)
1924 if (!access_ok(VERIFY_READ
, user_req
, sizeof(struct raw32_config_request
)))
1927 ret
= __get_user(req
->raw_minor
, &user_req
->raw_minor
);
1928 ret
|= __get_user(req
->block_major
, &user_req
->block_major
);
1929 ret
|= __get_user(req
->block_minor
, &user_req
->block_minor
);
1931 return ret
? -EFAULT
: 0;
1934 static int set_raw32_request(struct raw_config_request
*req
, struct raw32_config_request __user
*user_req
)
1938 if (!access_ok(VERIFY_WRITE
, user_req
, sizeof(struct raw32_config_request
)))
1941 ret
= __put_user(req
->raw_minor
, &user_req
->raw_minor
);
1942 ret
|= __put_user(req
->block_major
, &user_req
->block_major
);
1943 ret
|= __put_user(req
->block_minor
, &user_req
->block_minor
);
1945 return ret
? -EFAULT
: 0;
1948 static int raw_ioctl(unsigned fd
, unsigned cmd
, unsigned long arg
)
1955 struct raw_config_request req
;
1956 struct raw32_config_request __user
*user_req
= compat_ptr(arg
);
1957 mm_segment_t oldfs
= get_fs();
1959 if ((ret
= get_raw32_request(&req
, user_req
)))
1963 ret
= sys_ioctl(fd
,cmd
,(unsigned long)&req
);
1966 if ((!ret
) && (cmd
== RAW_GETBIND
)) {
1967 ret
= set_raw32_request(&req
, user_req
);
1972 ret
= sys_ioctl(fd
, cmd
, arg
);
1977 #endif /* CONFIG_BLOCK */
1979 struct serial_struct32
{
1985 compat_int_t xmit_fifo_size
;
1986 compat_int_t custom_divisor
;
1987 compat_int_t baud_base
;
1988 unsigned short close_delay
;
1990 char reserved_char
[1];
1992 unsigned short closing_wait
; /* time to wait before closing */
1993 unsigned short closing_wait2
; /* no longer used... */
1994 compat_uint_t iomem_base
;
1995 unsigned short iomem_reg_shift
;
1996 unsigned int port_high
;
1997 /* compat_ulong_t iomap_base FIXME */
1998 compat_int_t reserved
[1];
2001 static int serial_struct_ioctl(unsigned fd
, unsigned cmd
, unsigned long arg
)
2003 typedef struct serial_struct SS
;
2004 typedef struct serial_struct32 SS32
;
2005 struct serial_struct32 __user
*ss32
= compat_ptr(arg
);
2007 struct serial_struct ss
;
2008 mm_segment_t oldseg
= get_fs();
2012 if (cmd
== TIOCSSERIAL
) {
2013 if (!access_ok(VERIFY_READ
, ss32
, sizeof(SS32
)))
2015 if (__copy_from_user(&ss
, ss32
, offsetof(SS32
, iomem_base
)))
2017 if (__get_user(udata
, &ss32
->iomem_base
))
2019 ss
.iomem_base
= compat_ptr(udata
);
2020 if (__get_user(ss
.iomem_reg_shift
, &ss32
->iomem_reg_shift
) ||
2021 __get_user(ss
.port_high
, &ss32
->port_high
))
2023 ss
.iomap_base
= 0UL;
2026 err
= sys_ioctl(fd
,cmd
,(unsigned long)(&ss
));
2028 if (cmd
== TIOCGSERIAL
&& err
>= 0) {
2029 if (!access_ok(VERIFY_WRITE
, ss32
, sizeof(SS32
)))
2031 if (__copy_to_user(ss32
,&ss
,offsetof(SS32
,iomem_base
)))
2033 base
= (unsigned long)ss
.iomem_base
>> 32 ?
2034 0xffffffff : (unsigned)(unsigned long)ss
.iomem_base
;
2035 if (__put_user(base
, &ss32
->iomem_base
) ||
2036 __put_user(ss
.iomem_reg_shift
, &ss32
->iomem_reg_shift
) ||
2037 __put_user(ss
.port_high
, &ss32
->port_high
))
2043 struct usbdevfs_ctrltransfer32
{
2049 u32 timeout
; /* in milliseconds */
2050 compat_caddr_t data
;
2053 #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
2055 static int do_usbdevfs_control(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2057 struct usbdevfs_ctrltransfer32 __user
*p32
= compat_ptr(arg
);
2058 struct usbdevfs_ctrltransfer __user
*p
;
2060 p
= compat_alloc_user_space(sizeof(*p
));
2061 if (copy_in_user(p
, p32
, (sizeof(*p32
) - sizeof(compat_caddr_t
))) ||
2062 get_user(udata
, &p32
->data
) ||
2063 put_user(compat_ptr(udata
), &p
->data
))
2065 return sys_ioctl(fd
, USBDEVFS_CONTROL
, (unsigned long)p
);
2069 struct usbdevfs_bulktransfer32
{
2072 compat_uint_t timeout
; /* in milliseconds */
2073 compat_caddr_t data
;
2076 #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32)
2078 static int do_usbdevfs_bulk(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2080 struct usbdevfs_bulktransfer32 __user
*p32
= compat_ptr(arg
);
2081 struct usbdevfs_bulktransfer __user
*p
;
2083 compat_caddr_t addr
;
2085 p
= compat_alloc_user_space(sizeof(*p
));
2087 if (get_user(n
, &p32
->ep
) || put_user(n
, &p
->ep
) ||
2088 get_user(n
, &p32
->len
) || put_user(n
, &p
->len
) ||
2089 get_user(n
, &p32
->timeout
) || put_user(n
, &p
->timeout
) ||
2090 get_user(addr
, &p32
->data
) || put_user(compat_ptr(addr
), &p
->data
))
2093 return sys_ioctl(fd
, USBDEVFS_BULK
, (unsigned long)p
);
2098 * USBDEVFS_SUBMITURB, USBDEVFS_REAPURB and USBDEVFS_REAPURBNDELAY
2099 * are handled in usbdevfs core. -Christopher Li
2102 struct usbdevfs_disconnectsignal32
{
2104 compat_caddr_t context
;
2107 #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32)
2109 static int do_usbdevfs_discsignal(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2111 struct usbdevfs_disconnectsignal kdis
;
2112 struct usbdevfs_disconnectsignal32 __user
*udis
;
2113 mm_segment_t old_fs
;
2117 udis
= compat_ptr(arg
);
2119 if (get_user(kdis
.signr
, &udis
->signr
) ||
2120 __get_user(uctx
, &udis
->context
))
2123 kdis
.context
= compat_ptr(uctx
);
2127 err
= sys_ioctl(fd
, USBDEVFS_DISCSIGNAL
, (unsigned long) &kdis
);
2144 struct i2c_rdwr_ioctl_data32
{
2145 compat_caddr_t msgs
; /* struct i2c_msg __user *msgs */
2149 struct i2c_smbus_ioctl_data32
{
2153 compat_caddr_t data
; /* union i2c_smbus_data *data */
2156 struct i2c_rdwr_aligned
{
2157 struct i2c_rdwr_ioctl_data cmd
;
2158 struct i2c_msg msgs
[0];
2161 static int do_i2c_rdwr_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2163 struct i2c_rdwr_ioctl_data32 __user
*udata
= compat_ptr(arg
);
2164 struct i2c_rdwr_aligned __user
*tdata
;
2165 struct i2c_msg __user
*tmsgs
;
2166 struct i2c_msg32 __user
*umsgs
;
2167 compat_caddr_t datap
;
2170 if (get_user(nmsgs
, &udata
->nmsgs
))
2172 if (nmsgs
> I2C_RDRW_IOCTL_MAX_MSGS
)
2175 if (get_user(datap
, &udata
->msgs
))
2177 umsgs
= compat_ptr(datap
);
2179 tdata
= compat_alloc_user_space(sizeof(*tdata
) +
2180 nmsgs
* sizeof(struct i2c_msg
));
2181 tmsgs
= &tdata
->msgs
[0];
2183 if (put_user(nmsgs
, &tdata
->cmd
.nmsgs
) ||
2184 put_user(tmsgs
, &tdata
->cmd
.msgs
))
2187 for (i
= 0; i
< nmsgs
; i
++) {
2188 if (copy_in_user(&tmsgs
[i
].addr
, &umsgs
[i
].addr
, 3*sizeof(u16
)))
2190 if (get_user(datap
, &umsgs
[i
].buf
) ||
2191 put_user(compat_ptr(datap
), &tmsgs
[i
].buf
))
2194 return sys_ioctl(fd
, cmd
, (unsigned long)tdata
);
2197 static int do_i2c_smbus_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2199 struct i2c_smbus_ioctl_data __user
*tdata
;
2200 struct i2c_smbus_ioctl_data32 __user
*udata
;
2201 compat_caddr_t datap
;
2203 tdata
= compat_alloc_user_space(sizeof(*tdata
));
2206 if (!access_ok(VERIFY_WRITE
, tdata
, sizeof(*tdata
)))
2209 udata
= compat_ptr(arg
);
2210 if (!access_ok(VERIFY_READ
, udata
, sizeof(*udata
)))
2213 if (__copy_in_user(&tdata
->read_write
, &udata
->read_write
, 2 * sizeof(u8
)))
2215 if (__copy_in_user(&tdata
->size
, &udata
->size
, 2 * sizeof(u32
)))
2217 if (__get_user(datap
, &udata
->data
) ||
2218 __put_user(compat_ptr(datap
), &tdata
->data
))
2221 return sys_ioctl(fd
, cmd
, (unsigned long)tdata
);
2224 struct compat_iw_point
{
2225 compat_caddr_t pointer
;
2230 static int do_wireless_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2232 struct iwreq __user
*iwr
;
2233 struct iwreq __user
*iwr_u
;
2234 struct iw_point __user
*iwp
;
2235 struct compat_iw_point __user
*iwp_u
;
2236 compat_caddr_t pointer_u
;
2237 void __user
*pointer
;
2238 __u16 length
, flags
;
2241 iwr_u
= compat_ptr(arg
);
2242 iwp_u
= (struct compat_iw_point __user
*) &iwr_u
->u
.data
;
2243 iwr
= compat_alloc_user_space(sizeof(*iwr
));
2249 if (!access_ok(VERIFY_WRITE
, iwr
, sizeof(*iwr
)))
2252 if (__copy_in_user(&iwr
->ifr_ifrn
.ifrn_name
[0],
2253 &iwr_u
->ifr_ifrn
.ifrn_name
[0],
2254 sizeof(iwr
->ifr_ifrn
.ifrn_name
)))
2257 if (__get_user(pointer_u
, &iwp_u
->pointer
) ||
2258 __get_user(length
, &iwp_u
->length
) ||
2259 __get_user(flags
, &iwp_u
->flags
))
2262 if (__put_user(compat_ptr(pointer_u
), &iwp
->pointer
) ||
2263 __put_user(length
, &iwp
->length
) ||
2264 __put_user(flags
, &iwp
->flags
))
2267 ret
= sys_ioctl(fd
, cmd
, (unsigned long) iwr
);
2269 if (__get_user(pointer
, &iwp
->pointer
) ||
2270 __get_user(length
, &iwp
->length
) ||
2271 __get_user(flags
, &iwp
->flags
))
2274 if (__put_user(ptr_to_compat(pointer
), &iwp_u
->pointer
) ||
2275 __put_user(length
, &iwp_u
->length
) ||
2276 __put_user(flags
, &iwp_u
->flags
))
2282 /* Since old style bridge ioctl's endup using SIOCDEVPRIVATE
2283 * for some operations; this forces use of the newer bridge-utils that
2284 * use compatiable ioctls
2286 static int old_bridge_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2290 if (get_user(tmp
, (u32 __user
*) arg
))
2292 if (tmp
== BRCTL_GET_VERSION
)
2293 return BRCTL_VERSION
+ 1;
2297 #define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t)
2298 #define RTC_IRQP_SET32 _IOW('p', 0x0c, compat_ulong_t)
2299 #define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t)
2300 #define RTC_EPOCH_SET32 _IOW('p', 0x0e, compat_ulong_t)
2302 static int rtc_ioctl(unsigned fd
, unsigned cmd
, unsigned long arg
)
2304 mm_segment_t oldfs
= get_fs();
2305 compat_ulong_t val32
;
2310 case RTC_IRQP_READ32
:
2311 case RTC_EPOCH_READ32
:
2313 ret
= sys_ioctl(fd
, (cmd
== RTC_IRQP_READ32
) ?
2314 RTC_IRQP_READ
: RTC_EPOCH_READ
,
2315 (unsigned long)&kval
);
2320 return put_user(val32
, (unsigned int __user
*)arg
);
2321 case RTC_IRQP_SET32
:
2322 return sys_ioctl(fd
, RTC_IRQP_SET
, arg
);
2323 case RTC_EPOCH_SET32
:
2324 return sys_ioctl(fd
, RTC_EPOCH_SET
, arg
);
2327 return -ENOIOCTLCMD
;
2332 lp_timeout_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2334 struct compat_timeval __user
*tc
= (struct compat_timeval __user
*)arg
;
2335 struct timeval __user
*tn
= compat_alloc_user_space(sizeof(struct timeval
));
2337 if (get_user(ts
.tv_sec
, &tc
->tv_sec
) ||
2338 get_user(ts
.tv_usec
, &tc
->tv_usec
) ||
2339 put_user(ts
.tv_sec
, &tn
->tv_sec
) ||
2340 put_user(ts
.tv_usec
, &tn
->tv_usec
))
2342 return sys_ioctl(fd
, cmd
, (unsigned long)tn
);
2346 typedef int (*ioctl_trans_handler_t
)(unsigned int, unsigned int,
2347 unsigned long, struct file
*);
2349 struct ioctl_trans
{
2351 ioctl_trans_handler_t handler
;
2352 struct ioctl_trans
*next
;
2355 #define HANDLE_IOCTL(cmd,handler) \
2356 { (cmd), (ioctl_trans_handler_t)(handler) },
2358 /* pointer to compatible structure or no argument */
2359 #define COMPATIBLE_IOCTL(cmd) \
2360 { (cmd), do_ioctl32_pointer },
2362 /* argument is an unsigned long integer, not a pointer */
2363 #define ULONG_IOCTL(cmd) \
2364 { (cmd), (ioctl_trans_handler_t)sys_ioctl },
2366 /* ioctl should not be warned about even if it's not implemented.
2367 Valid reasons to use this:
2368 - It is implemented with ->compat_ioctl on some device, but programs
2369 call it on others too.
2370 - The ioctl is not implemented in the native kernel, but programs
2371 call it commonly anyways.
2372 Most other reasons are not valid. */
2373 #define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd)
2375 static struct ioctl_trans ioctl_start
[] = {
2376 /* compatible ioctls first */
2377 COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */
2378 COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */
2381 COMPATIBLE_IOCTL(TCGETA
)
2382 COMPATIBLE_IOCTL(TCSETA
)
2383 COMPATIBLE_IOCTL(TCSETAW
)
2384 COMPATIBLE_IOCTL(TCSETAF
)
2385 COMPATIBLE_IOCTL(TCSBRK
)
2386 ULONG_IOCTL(TCSBRKP
)
2387 COMPATIBLE_IOCTL(TCXONC
)
2388 COMPATIBLE_IOCTL(TCFLSH
)
2389 COMPATIBLE_IOCTL(TCGETS
)
2390 COMPATIBLE_IOCTL(TCSETS
)
2391 COMPATIBLE_IOCTL(TCSETSW
)
2392 COMPATIBLE_IOCTL(TCSETSF
)
2393 COMPATIBLE_IOCTL(TIOCLINUX
)
2394 COMPATIBLE_IOCTL(TIOCSBRK
)
2395 COMPATIBLE_IOCTL(TIOCCBRK
)
2396 ULONG_IOCTL(TIOCMIWAIT
)
2397 COMPATIBLE_IOCTL(TIOCGICOUNT
)
2399 COMPATIBLE_IOCTL(TIOCGETD
)
2400 COMPATIBLE_IOCTL(TIOCSETD
)
2401 COMPATIBLE_IOCTL(TIOCEXCL
)
2402 COMPATIBLE_IOCTL(TIOCNXCL
)
2403 COMPATIBLE_IOCTL(TIOCCONS
)
2404 COMPATIBLE_IOCTL(TIOCGSOFTCAR
)
2405 COMPATIBLE_IOCTL(TIOCSSOFTCAR
)
2406 COMPATIBLE_IOCTL(TIOCSWINSZ
)
2407 COMPATIBLE_IOCTL(TIOCGWINSZ
)
2408 COMPATIBLE_IOCTL(TIOCMGET
)
2409 COMPATIBLE_IOCTL(TIOCMBIC
)
2410 COMPATIBLE_IOCTL(TIOCMBIS
)
2411 COMPATIBLE_IOCTL(TIOCMSET
)
2412 COMPATIBLE_IOCTL(TIOCPKT
)
2413 COMPATIBLE_IOCTL(TIOCNOTTY
)
2414 COMPATIBLE_IOCTL(TIOCSTI
)
2415 COMPATIBLE_IOCTL(TIOCOUTQ
)
2416 COMPATIBLE_IOCTL(TIOCSPGRP
)
2417 COMPATIBLE_IOCTL(TIOCGPGRP
)
2418 ULONG_IOCTL(TIOCSCTTY
)
2419 COMPATIBLE_IOCTL(TIOCGPTN
)
2420 COMPATIBLE_IOCTL(TIOCSPTLCK
)
2421 COMPATIBLE_IOCTL(TIOCSERGETLSR
)
2423 COMPATIBLE_IOCTL(FIOCLEX
)
2424 COMPATIBLE_IOCTL(FIONCLEX
)
2425 COMPATIBLE_IOCTL(FIOASYNC
)
2426 COMPATIBLE_IOCTL(FIONBIO
)
2427 COMPATIBLE_IOCTL(FIONREAD
) /* This is also TIOCINQ */
2429 COMPATIBLE_IOCTL(FIBMAP
)
2430 COMPATIBLE_IOCTL(FIGETBSZ
)
2432 COMPATIBLE_IOCTL(RAID_VERSION
)
2433 COMPATIBLE_IOCTL(GET_ARRAY_INFO
)
2434 COMPATIBLE_IOCTL(GET_DISK_INFO
)
2435 COMPATIBLE_IOCTL(PRINT_RAID_DEBUG
)
2436 COMPATIBLE_IOCTL(RAID_AUTORUN
)
2437 COMPATIBLE_IOCTL(CLEAR_ARRAY
)
2438 COMPATIBLE_IOCTL(ADD_NEW_DISK
)
2439 ULONG_IOCTL(HOT_REMOVE_DISK
)
2440 COMPATIBLE_IOCTL(SET_ARRAY_INFO
)
2441 COMPATIBLE_IOCTL(SET_DISK_INFO
)
2442 COMPATIBLE_IOCTL(WRITE_RAID_INFO
)
2443 COMPATIBLE_IOCTL(UNPROTECT_ARRAY
)
2444 COMPATIBLE_IOCTL(PROTECT_ARRAY
)
2445 ULONG_IOCTL(HOT_ADD_DISK
)
2446 ULONG_IOCTL(SET_DISK_FAULTY
)
2447 COMPATIBLE_IOCTL(RUN_ARRAY
)
2448 COMPATIBLE_IOCTL(STOP_ARRAY
)
2449 COMPATIBLE_IOCTL(STOP_ARRAY_RO
)
2450 COMPATIBLE_IOCTL(RESTART_ARRAY_RW
)
2451 COMPATIBLE_IOCTL(GET_BITMAP_FILE
)
2452 ULONG_IOCTL(SET_BITMAP_FILE
)
2454 COMPATIBLE_IOCTL(DM_VERSION_32
)
2455 COMPATIBLE_IOCTL(DM_REMOVE_ALL_32
)
2456 COMPATIBLE_IOCTL(DM_LIST_DEVICES_32
)
2457 COMPATIBLE_IOCTL(DM_DEV_CREATE_32
)
2458 COMPATIBLE_IOCTL(DM_DEV_REMOVE_32
)
2459 COMPATIBLE_IOCTL(DM_DEV_RENAME_32
)
2460 COMPATIBLE_IOCTL(DM_DEV_SUSPEND_32
)
2461 COMPATIBLE_IOCTL(DM_DEV_STATUS_32
)
2462 COMPATIBLE_IOCTL(DM_DEV_WAIT_32
)
2463 COMPATIBLE_IOCTL(DM_TABLE_LOAD_32
)
2464 COMPATIBLE_IOCTL(DM_TABLE_CLEAR_32
)
2465 COMPATIBLE_IOCTL(DM_TABLE_DEPS_32
)
2466 COMPATIBLE_IOCTL(DM_TABLE_STATUS_32
)
2467 COMPATIBLE_IOCTL(DM_LIST_VERSIONS_32
)
2468 COMPATIBLE_IOCTL(DM_TARGET_MSG_32
)
2469 COMPATIBLE_IOCTL(DM_DEV_SET_GEOMETRY_32
)
2470 COMPATIBLE_IOCTL(DM_VERSION
)
2471 COMPATIBLE_IOCTL(DM_REMOVE_ALL
)
2472 COMPATIBLE_IOCTL(DM_LIST_DEVICES
)
2473 COMPATIBLE_IOCTL(DM_DEV_CREATE
)
2474 COMPATIBLE_IOCTL(DM_DEV_REMOVE
)
2475 COMPATIBLE_IOCTL(DM_DEV_RENAME
)
2476 COMPATIBLE_IOCTL(DM_DEV_SUSPEND
)
2477 COMPATIBLE_IOCTL(DM_DEV_STATUS
)
2478 COMPATIBLE_IOCTL(DM_DEV_WAIT
)
2479 COMPATIBLE_IOCTL(DM_TABLE_LOAD
)
2480 COMPATIBLE_IOCTL(DM_TABLE_CLEAR
)
2481 COMPATIBLE_IOCTL(DM_TABLE_DEPS
)
2482 COMPATIBLE_IOCTL(DM_TABLE_STATUS
)
2483 COMPATIBLE_IOCTL(DM_LIST_VERSIONS
)
2484 COMPATIBLE_IOCTL(DM_TARGET_MSG
)
2485 COMPATIBLE_IOCTL(DM_DEV_SET_GEOMETRY
)
2487 COMPATIBLE_IOCTL(PIO_FONT
)
2488 COMPATIBLE_IOCTL(GIO_FONT
)
2489 ULONG_IOCTL(KDSIGACCEPT
)
2490 COMPATIBLE_IOCTL(KDGETKEYCODE
)
2491 COMPATIBLE_IOCTL(KDSETKEYCODE
)
2492 ULONG_IOCTL(KIOCSOUND
)
2493 ULONG_IOCTL(KDMKTONE
)
2494 COMPATIBLE_IOCTL(KDGKBTYPE
)
2495 ULONG_IOCTL(KDSETMODE
)
2496 COMPATIBLE_IOCTL(KDGETMODE
)
2497 ULONG_IOCTL(KDSKBMODE
)
2498 COMPATIBLE_IOCTL(KDGKBMODE
)
2499 ULONG_IOCTL(KDSKBMETA
)
2500 COMPATIBLE_IOCTL(KDGKBMETA
)
2501 COMPATIBLE_IOCTL(KDGKBENT
)
2502 COMPATIBLE_IOCTL(KDSKBENT
)
2503 COMPATIBLE_IOCTL(KDGKBSENT
)
2504 COMPATIBLE_IOCTL(KDSKBSENT
)
2505 COMPATIBLE_IOCTL(KDGKBDIACR
)
2506 COMPATIBLE_IOCTL(KDSKBDIACR
)
2507 COMPATIBLE_IOCTL(KDKBDREP
)
2508 COMPATIBLE_IOCTL(KDGKBLED
)
2509 ULONG_IOCTL(KDSKBLED
)
2510 COMPATIBLE_IOCTL(KDGETLED
)
2511 ULONG_IOCTL(KDSETLED
)
2512 COMPATIBLE_IOCTL(GIO_SCRNMAP
)
2513 COMPATIBLE_IOCTL(PIO_SCRNMAP
)
2514 COMPATIBLE_IOCTL(GIO_UNISCRNMAP
)
2515 COMPATIBLE_IOCTL(PIO_UNISCRNMAP
)
2516 COMPATIBLE_IOCTL(PIO_FONTRESET
)
2517 COMPATIBLE_IOCTL(PIO_UNIMAPCLR
)
2519 COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN
)
2520 COMPATIBLE_IOCTL(SCSI_IOCTL_DOORLOCK
)
2521 COMPATIBLE_IOCTL(SCSI_IOCTL_DOORUNLOCK
)
2522 COMPATIBLE_IOCTL(SCSI_IOCTL_TEST_UNIT_READY
)
2523 COMPATIBLE_IOCTL(SCSI_IOCTL_GET_BUS_NUMBER
)
2524 COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND
)
2525 COMPATIBLE_IOCTL(SCSI_IOCTL_PROBE_HOST
)
2526 COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI
)
2528 COMPATIBLE_IOCTL(TUNSETNOCSUM
)
2529 COMPATIBLE_IOCTL(TUNSETDEBUG
)
2530 COMPATIBLE_IOCTL(TUNSETPERSIST
)
2531 COMPATIBLE_IOCTL(TUNSETOWNER
)
2533 COMPATIBLE_IOCTL(VT_SETMODE
)
2534 COMPATIBLE_IOCTL(VT_GETMODE
)
2535 COMPATIBLE_IOCTL(VT_GETSTATE
)
2536 COMPATIBLE_IOCTL(VT_OPENQRY
)
2537 ULONG_IOCTL(VT_ACTIVATE
)
2538 ULONG_IOCTL(VT_WAITACTIVE
)
2539 ULONG_IOCTL(VT_RELDISP
)
2540 ULONG_IOCTL(VT_DISALLOCATE
)
2541 COMPATIBLE_IOCTL(VT_RESIZE
)
2542 COMPATIBLE_IOCTL(VT_RESIZEX
)
2543 COMPATIBLE_IOCTL(VT_LOCKSWITCH
)
2544 COMPATIBLE_IOCTL(VT_UNLOCKSWITCH
)
2545 COMPATIBLE_IOCTL(VT_GETHIFONTMASK
)
2546 /* Little p (/dev/rtc, /dev/envctrl, etc.) */
2547 COMPATIBLE_IOCTL(RTC_AIE_ON
)
2548 COMPATIBLE_IOCTL(RTC_AIE_OFF
)
2549 COMPATIBLE_IOCTL(RTC_UIE_ON
)
2550 COMPATIBLE_IOCTL(RTC_UIE_OFF
)
2551 COMPATIBLE_IOCTL(RTC_PIE_ON
)
2552 COMPATIBLE_IOCTL(RTC_PIE_OFF
)
2553 COMPATIBLE_IOCTL(RTC_WIE_ON
)
2554 COMPATIBLE_IOCTL(RTC_WIE_OFF
)
2555 COMPATIBLE_IOCTL(RTC_ALM_SET
)
2556 COMPATIBLE_IOCTL(RTC_ALM_READ
)
2557 COMPATIBLE_IOCTL(RTC_RD_TIME
)
2558 COMPATIBLE_IOCTL(RTC_SET_TIME
)
2559 COMPATIBLE_IOCTL(RTC_WKALM_SET
)
2560 COMPATIBLE_IOCTL(RTC_WKALM_RD
)
2562 * These two are only for the sbus rtc driver, but
2563 * hwclock tries them on every rtc device first when
2564 * running on sparc. On other architectures the entries
2565 * are useless but harmless.
2567 COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */
2568 COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */
2570 COMPATIBLE_IOCTL(MTIOCTOP
)
2571 /* Socket level stuff */
2572 COMPATIBLE_IOCTL(FIOQSIZE
)
2573 COMPATIBLE_IOCTL(FIOSETOWN
)
2574 COMPATIBLE_IOCTL(SIOCSPGRP
)
2575 COMPATIBLE_IOCTL(FIOGETOWN
)
2576 COMPATIBLE_IOCTL(SIOCGPGRP
)
2577 COMPATIBLE_IOCTL(SIOCATMARK
)
2578 COMPATIBLE_IOCTL(SIOCSIFLINK
)
2579 COMPATIBLE_IOCTL(SIOCSIFENCAP
)
2580 COMPATIBLE_IOCTL(SIOCGIFENCAP
)
2581 COMPATIBLE_IOCTL(SIOCSIFNAME
)
2582 COMPATIBLE_IOCTL(SIOCSARP
)
2583 COMPATIBLE_IOCTL(SIOCGARP
)
2584 COMPATIBLE_IOCTL(SIOCDARP
)
2585 COMPATIBLE_IOCTL(SIOCSRARP
)
2586 COMPATIBLE_IOCTL(SIOCGRARP
)
2587 COMPATIBLE_IOCTL(SIOCDRARP
)
2588 COMPATIBLE_IOCTL(SIOCADDDLCI
)
2589 COMPATIBLE_IOCTL(SIOCDELDLCI
)
2590 COMPATIBLE_IOCTL(SIOCGMIIPHY
)
2591 COMPATIBLE_IOCTL(SIOCGMIIREG
)
2592 COMPATIBLE_IOCTL(SIOCSMIIREG
)
2593 COMPATIBLE_IOCTL(SIOCGIFVLAN
)
2594 COMPATIBLE_IOCTL(SIOCSIFVLAN
)
2595 COMPATIBLE_IOCTL(SIOCBRADDBR
)
2596 COMPATIBLE_IOCTL(SIOCBRDELBR
)
2598 COMPATIBLE_IOCTL(SG_SET_TIMEOUT
)
2599 COMPATIBLE_IOCTL(SG_GET_TIMEOUT
)
2600 COMPATIBLE_IOCTL(SG_EMULATED_HOST
)
2601 ULONG_IOCTL(SG_SET_TRANSFORM
)
2602 COMPATIBLE_IOCTL(SG_GET_TRANSFORM
)
2603 COMPATIBLE_IOCTL(SG_SET_RESERVED_SIZE
)
2604 COMPATIBLE_IOCTL(SG_GET_RESERVED_SIZE
)
2605 COMPATIBLE_IOCTL(SG_GET_SCSI_ID
)
2606 COMPATIBLE_IOCTL(SG_SET_FORCE_LOW_DMA
)
2607 COMPATIBLE_IOCTL(SG_GET_LOW_DMA
)
2608 COMPATIBLE_IOCTL(SG_SET_FORCE_PACK_ID
)
2609 COMPATIBLE_IOCTL(SG_GET_PACK_ID
)
2610 COMPATIBLE_IOCTL(SG_GET_NUM_WAITING
)
2611 COMPATIBLE_IOCTL(SG_SET_DEBUG
)
2612 COMPATIBLE_IOCTL(SG_GET_SG_TABLESIZE
)
2613 COMPATIBLE_IOCTL(SG_GET_COMMAND_Q
)
2614 COMPATIBLE_IOCTL(SG_SET_COMMAND_Q
)
2615 COMPATIBLE_IOCTL(SG_GET_VERSION_NUM
)
2616 COMPATIBLE_IOCTL(SG_NEXT_CMD_LEN
)
2617 COMPATIBLE_IOCTL(SG_SCSI_RESET
)
2618 COMPATIBLE_IOCTL(SG_GET_REQUEST_TABLE
)
2619 COMPATIBLE_IOCTL(SG_SET_KEEP_ORPHAN
)
2620 COMPATIBLE_IOCTL(SG_GET_KEEP_ORPHAN
)
2622 COMPATIBLE_IOCTL(PPPIOCGFLAGS
)
2623 COMPATIBLE_IOCTL(PPPIOCSFLAGS
)
2624 COMPATIBLE_IOCTL(PPPIOCGASYNCMAP
)
2625 COMPATIBLE_IOCTL(PPPIOCSASYNCMAP
)
2626 COMPATIBLE_IOCTL(PPPIOCGUNIT
)
2627 COMPATIBLE_IOCTL(PPPIOCGRASYNCMAP
)
2628 COMPATIBLE_IOCTL(PPPIOCSRASYNCMAP
)
2629 COMPATIBLE_IOCTL(PPPIOCGMRU
)
2630 COMPATIBLE_IOCTL(PPPIOCSMRU
)
2631 COMPATIBLE_IOCTL(PPPIOCSMAXCID
)
2632 COMPATIBLE_IOCTL(PPPIOCGXASYNCMAP
)
2633 COMPATIBLE_IOCTL(PPPIOCSXASYNCMAP
)
2634 COMPATIBLE_IOCTL(PPPIOCXFERUNIT
)
2635 /* PPPIOCSCOMPRESS is translated */
2636 COMPATIBLE_IOCTL(PPPIOCGNPMODE
)
2637 COMPATIBLE_IOCTL(PPPIOCSNPMODE
)
2638 COMPATIBLE_IOCTL(PPPIOCGDEBUG
)
2639 COMPATIBLE_IOCTL(PPPIOCSDEBUG
)
2640 /* PPPIOCSPASS is translated */
2641 /* PPPIOCSACTIVE is translated */
2642 /* PPPIOCGIDLE is translated */
2643 COMPATIBLE_IOCTL(PPPIOCNEWUNIT
)
2644 COMPATIBLE_IOCTL(PPPIOCATTACH
)
2645 COMPATIBLE_IOCTL(PPPIOCDETACH
)
2646 COMPATIBLE_IOCTL(PPPIOCSMRRU
)
2647 COMPATIBLE_IOCTL(PPPIOCCONNECT
)
2648 COMPATIBLE_IOCTL(PPPIOCDISCONN
)
2649 COMPATIBLE_IOCTL(PPPIOCATTCHAN
)
2650 COMPATIBLE_IOCTL(PPPIOCGCHAN
)
2652 COMPATIBLE_IOCTL(PPPOEIOCSFWD
)
2653 COMPATIBLE_IOCTL(PPPOEIOCDFWD
)
2655 COMPATIBLE_IOCTL(LPGETSTATUS
)
2657 COMPATIBLE_IOCTL(PPSETMODE
)
2658 COMPATIBLE_IOCTL(PPRSTATUS
)
2659 COMPATIBLE_IOCTL(PPRCONTROL
)
2660 COMPATIBLE_IOCTL(PPWCONTROL
)
2661 COMPATIBLE_IOCTL(PPFCONTROL
)
2662 COMPATIBLE_IOCTL(PPRDATA
)
2663 COMPATIBLE_IOCTL(PPWDATA
)
2664 COMPATIBLE_IOCTL(PPCLAIM
)
2665 COMPATIBLE_IOCTL(PPRELEASE
)
2666 COMPATIBLE_IOCTL(PPYIELD
)
2667 COMPATIBLE_IOCTL(PPEXCL
)
2668 COMPATIBLE_IOCTL(PPDATADIR
)
2669 COMPATIBLE_IOCTL(PPNEGOT
)
2670 COMPATIBLE_IOCTL(PPWCTLONIRQ
)
2671 COMPATIBLE_IOCTL(PPCLRIRQ
)
2672 COMPATIBLE_IOCTL(PPSETPHASE
)
2673 COMPATIBLE_IOCTL(PPGETMODES
)
2674 COMPATIBLE_IOCTL(PPGETMODE
)
2675 COMPATIBLE_IOCTL(PPGETPHASE
)
2676 COMPATIBLE_IOCTL(PPGETFLAGS
)
2677 COMPATIBLE_IOCTL(PPSETFLAGS
)
2679 COMPATIBLE_IOCTL(PACKET_CTRL_CMD
)
2682 /* Big Q for sound/OSS */
2683 COMPATIBLE_IOCTL(SNDCTL_SEQ_RESET
)
2684 COMPATIBLE_IOCTL(SNDCTL_SEQ_SYNC
)
2685 COMPATIBLE_IOCTL(SNDCTL_SYNTH_INFO
)
2686 COMPATIBLE_IOCTL(SNDCTL_SEQ_CTRLRATE
)
2687 COMPATIBLE_IOCTL(SNDCTL_SEQ_GETOUTCOUNT
)
2688 COMPATIBLE_IOCTL(SNDCTL_SEQ_GETINCOUNT
)
2689 COMPATIBLE_IOCTL(SNDCTL_SEQ_PERCMODE
)
2690 COMPATIBLE_IOCTL(SNDCTL_FM_LOAD_INSTR
)
2691 COMPATIBLE_IOCTL(SNDCTL_SEQ_TESTMIDI
)
2692 COMPATIBLE_IOCTL(SNDCTL_SEQ_RESETSAMPLES
)
2693 COMPATIBLE_IOCTL(SNDCTL_SEQ_NRSYNTHS
)
2694 COMPATIBLE_IOCTL(SNDCTL_SEQ_NRMIDIS
)
2695 COMPATIBLE_IOCTL(SNDCTL_MIDI_INFO
)
2696 COMPATIBLE_IOCTL(SNDCTL_SEQ_THRESHOLD
)
2697 COMPATIBLE_IOCTL(SNDCTL_SYNTH_MEMAVL
)
2698 COMPATIBLE_IOCTL(SNDCTL_FM_4OP_ENABLE
)
2699 COMPATIBLE_IOCTL(SNDCTL_SEQ_PANIC
)
2700 COMPATIBLE_IOCTL(SNDCTL_SEQ_OUTOFBAND
)
2701 COMPATIBLE_IOCTL(SNDCTL_SEQ_GETTIME
)
2702 COMPATIBLE_IOCTL(SNDCTL_SYNTH_ID
)
2703 COMPATIBLE_IOCTL(SNDCTL_SYNTH_CONTROL
)
2704 COMPATIBLE_IOCTL(SNDCTL_SYNTH_REMOVESAMPLE
)
2705 /* Big T for sound/OSS */
2706 COMPATIBLE_IOCTL(SNDCTL_TMR_TIMEBASE
)
2707 COMPATIBLE_IOCTL(SNDCTL_TMR_START
)
2708 COMPATIBLE_IOCTL(SNDCTL_TMR_STOP
)
2709 COMPATIBLE_IOCTL(SNDCTL_TMR_CONTINUE
)
2710 COMPATIBLE_IOCTL(SNDCTL_TMR_TEMPO
)
2711 COMPATIBLE_IOCTL(SNDCTL_TMR_SOURCE
)
2712 COMPATIBLE_IOCTL(SNDCTL_TMR_METRONOME
)
2713 COMPATIBLE_IOCTL(SNDCTL_TMR_SELECT
)
2714 /* Little m for sound/OSS */
2715 COMPATIBLE_IOCTL(SNDCTL_MIDI_PRETIME
)
2716 COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUMODE
)
2717 COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUCMD
)
2718 /* Big P for sound/OSS */
2719 COMPATIBLE_IOCTL(SNDCTL_DSP_RESET
)
2720 COMPATIBLE_IOCTL(SNDCTL_DSP_SYNC
)
2721 COMPATIBLE_IOCTL(SNDCTL_DSP_SPEED
)
2722 COMPATIBLE_IOCTL(SNDCTL_DSP_STEREO
)
2723 COMPATIBLE_IOCTL(SNDCTL_DSP_GETBLKSIZE
)
2724 COMPATIBLE_IOCTL(SNDCTL_DSP_CHANNELS
)
2725 COMPATIBLE_IOCTL(SOUND_PCM_WRITE_FILTER
)
2726 COMPATIBLE_IOCTL(SNDCTL_DSP_POST
)
2727 COMPATIBLE_IOCTL(SNDCTL_DSP_SUBDIVIDE
)
2728 COMPATIBLE_IOCTL(SNDCTL_DSP_SETFRAGMENT
)
2729 COMPATIBLE_IOCTL(SNDCTL_DSP_GETFMTS
)
2730 COMPATIBLE_IOCTL(SNDCTL_DSP_SETFMT
)
2731 COMPATIBLE_IOCTL(SNDCTL_DSP_GETOSPACE
)
2732 COMPATIBLE_IOCTL(SNDCTL_DSP_GETISPACE
)
2733 COMPATIBLE_IOCTL(SNDCTL_DSP_NONBLOCK
)
2734 COMPATIBLE_IOCTL(SNDCTL_DSP_GETCAPS
)
2735 COMPATIBLE_IOCTL(SNDCTL_DSP_GETTRIGGER
)
2736 COMPATIBLE_IOCTL(SNDCTL_DSP_SETTRIGGER
)
2737 COMPATIBLE_IOCTL(SNDCTL_DSP_GETIPTR
)
2738 COMPATIBLE_IOCTL(SNDCTL_DSP_GETOPTR
)
2739 /* SNDCTL_DSP_MAPINBUF, XXX needs translation */
2740 /* SNDCTL_DSP_MAPOUTBUF, XXX needs translation */
2741 COMPATIBLE_IOCTL(SNDCTL_DSP_SETSYNCRO
)
2742 COMPATIBLE_IOCTL(SNDCTL_DSP_SETDUPLEX
)
2743 COMPATIBLE_IOCTL(SNDCTL_DSP_GETODELAY
)
2744 COMPATIBLE_IOCTL(SNDCTL_DSP_PROFILE
)
2745 COMPATIBLE_IOCTL(SOUND_PCM_READ_RATE
)
2746 COMPATIBLE_IOCTL(SOUND_PCM_READ_CHANNELS
)
2747 COMPATIBLE_IOCTL(SOUND_PCM_READ_BITS
)
2748 COMPATIBLE_IOCTL(SOUND_PCM_READ_FILTER
)
2749 /* Big C for sound/OSS */
2750 COMPATIBLE_IOCTL(SNDCTL_COPR_RESET
)
2751 COMPATIBLE_IOCTL(SNDCTL_COPR_LOAD
)
2752 COMPATIBLE_IOCTL(SNDCTL_COPR_RDATA
)
2753 COMPATIBLE_IOCTL(SNDCTL_COPR_RCODE
)
2754 COMPATIBLE_IOCTL(SNDCTL_COPR_WDATA
)
2755 COMPATIBLE_IOCTL(SNDCTL_COPR_WCODE
)
2756 COMPATIBLE_IOCTL(SNDCTL_COPR_RUN
)
2757 COMPATIBLE_IOCTL(SNDCTL_COPR_HALT
)
2758 COMPATIBLE_IOCTL(SNDCTL_COPR_SENDMSG
)
2759 COMPATIBLE_IOCTL(SNDCTL_COPR_RCVMSG
)
2760 /* Big M for sound/OSS */
2761 COMPATIBLE_IOCTL(SOUND_MIXER_READ_VOLUME
)
2762 COMPATIBLE_IOCTL(SOUND_MIXER_READ_BASS
)
2763 COMPATIBLE_IOCTL(SOUND_MIXER_READ_TREBLE
)
2764 COMPATIBLE_IOCTL(SOUND_MIXER_READ_SYNTH
)
2765 COMPATIBLE_IOCTL(SOUND_MIXER_READ_PCM
)
2766 COMPATIBLE_IOCTL(SOUND_MIXER_READ_SPEAKER
)
2767 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE
)
2768 COMPATIBLE_IOCTL(SOUND_MIXER_READ_MIC
)
2769 COMPATIBLE_IOCTL(SOUND_MIXER_READ_CD
)
2770 COMPATIBLE_IOCTL(SOUND_MIXER_READ_IMIX
)
2771 COMPATIBLE_IOCTL(SOUND_MIXER_READ_ALTPCM
)
2772 COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECLEV
)
2773 COMPATIBLE_IOCTL(SOUND_MIXER_READ_IGAIN
)
2774 COMPATIBLE_IOCTL(SOUND_MIXER_READ_OGAIN
)
2775 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE1
)
2776 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE2
)
2777 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE3
)
2778 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL1
))
2779 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL2
))
2780 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL3
))
2781 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEIN
))
2782 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEOUT
))
2783 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_VIDEO
))
2784 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_RADIO
))
2785 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_MONITOR
))
2786 COMPATIBLE_IOCTL(SOUND_MIXER_READ_MUTE
)
2787 /* SOUND_MIXER_READ_ENHANCE, same value as READ_MUTE */
2788 /* SOUND_MIXER_READ_LOUD, same value as READ_MUTE */
2789 COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECSRC
)
2790 COMPATIBLE_IOCTL(SOUND_MIXER_READ_DEVMASK
)
2791 COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECMASK
)
2792 COMPATIBLE_IOCTL(SOUND_MIXER_READ_STEREODEVS
)
2793 COMPATIBLE_IOCTL(SOUND_MIXER_READ_CAPS
)
2794 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_VOLUME
)
2795 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_BASS
)
2796 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_TREBLE
)
2797 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SYNTH
)
2798 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_PCM
)
2799 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SPEAKER
)
2800 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE
)
2801 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MIC
)
2802 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_CD
)
2803 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IMIX
)
2804 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_ALTPCM
)
2805 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECLEV
)
2806 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IGAIN
)
2807 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_OGAIN
)
2808 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE1
)
2809 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE2
)
2810 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE3
)
2811 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL1
))
2812 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL2
))
2813 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL3
))
2814 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEIN
))
2815 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEOUT
))
2816 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_VIDEO
))
2817 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_RADIO
))
2818 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_MONITOR
))
2819 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MUTE
)
2820 /* SOUND_MIXER_WRITE_ENHANCE, same value as WRITE_MUTE */
2821 /* SOUND_MIXER_WRITE_LOUD, same value as WRITE_MUTE */
2822 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECSRC
)
2823 COMPATIBLE_IOCTL(SOUND_MIXER_INFO
)
2824 COMPATIBLE_IOCTL(SOUND_OLD_MIXER_INFO
)
2825 COMPATIBLE_IOCTL(SOUND_MIXER_ACCESS
)
2826 COMPATIBLE_IOCTL(SOUND_MIXER_AGC
)
2827 COMPATIBLE_IOCTL(SOUND_MIXER_3DSE
)
2828 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE1
)
2829 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE2
)
2830 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE3
)
2831 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE4
)
2832 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE5
)
2833 COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS
)
2834 COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS
)
2835 COMPATIBLE_IOCTL(OSS_GETVERSION
)
2837 ULONG_IOCTL(AUTOFS_IOC_READY
)
2838 ULONG_IOCTL(AUTOFS_IOC_FAIL
)
2839 COMPATIBLE_IOCTL(AUTOFS_IOC_CATATONIC
)
2840 COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOVER
)
2841 COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE
)
2842 COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE_MULTI
)
2843 COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOSUBVER
)
2844 COMPATIBLE_IOCTL(AUTOFS_IOC_ASKREGHOST
)
2845 COMPATIBLE_IOCTL(AUTOFS_IOC_TOGGLEREGHOST
)
2846 COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT
)
2848 COMPATIBLE_IOCTL(RAW_SETBIND
)
2849 COMPATIBLE_IOCTL(RAW_GETBIND
)
2850 /* SMB ioctls which do not need any translations */
2851 COMPATIBLE_IOCTL(SMB_IOC_NEWCONN
)
2853 COMPATIBLE_IOCTL(ATMSIGD_CTRL
)
2854 COMPATIBLE_IOCTL(ATMARPD_CTRL
)
2855 COMPATIBLE_IOCTL(ATMLEC_CTRL
)
2856 COMPATIBLE_IOCTL(ATMLEC_MCAST
)
2857 COMPATIBLE_IOCTL(ATMLEC_DATA
)
2858 COMPATIBLE_IOCTL(ATM_SETSC
)
2859 COMPATIBLE_IOCTL(SIOCSIFATMTCP
)
2860 COMPATIBLE_IOCTL(SIOCMKCLIP
)
2861 COMPATIBLE_IOCTL(ATMARP_MKIP
)
2862 COMPATIBLE_IOCTL(ATMARP_SETENTRY
)
2863 COMPATIBLE_IOCTL(ATMARP_ENCAP
)
2864 COMPATIBLE_IOCTL(ATMTCP_CREATE
)
2865 COMPATIBLE_IOCTL(ATMTCP_REMOVE
)
2866 COMPATIBLE_IOCTL(ATMMPC_CTRL
)
2867 COMPATIBLE_IOCTL(ATMMPC_DATA
)
2869 COMPATIBLE_IOCTL(WDIOC_GETSUPPORT
)
2870 COMPATIBLE_IOCTL(WDIOC_GETSTATUS
)
2871 COMPATIBLE_IOCTL(WDIOC_GETBOOTSTATUS
)
2872 COMPATIBLE_IOCTL(WDIOC_GETTEMP
)
2873 COMPATIBLE_IOCTL(WDIOC_SETOPTIONS
)
2874 COMPATIBLE_IOCTL(WDIOC_KEEPALIVE
)
2875 COMPATIBLE_IOCTL(WDIOC_SETTIMEOUT
)
2876 COMPATIBLE_IOCTL(WDIOC_GETTIMEOUT
)
2878 COMPATIBLE_IOCTL(RNDGETENTCNT
)
2879 COMPATIBLE_IOCTL(RNDADDTOENTCNT
)
2880 COMPATIBLE_IOCTL(RNDGETPOOL
)
2881 COMPATIBLE_IOCTL(RNDADDENTROPY
)
2882 COMPATIBLE_IOCTL(RNDZAPENTCNT
)
2883 COMPATIBLE_IOCTL(RNDCLEARPOOL
)
2885 COMPATIBLE_IOCTL(HCIDEVUP
)
2886 COMPATIBLE_IOCTL(HCIDEVDOWN
)
2887 COMPATIBLE_IOCTL(HCIDEVRESET
)
2888 COMPATIBLE_IOCTL(HCIDEVRESTAT
)
2889 COMPATIBLE_IOCTL(HCIGETDEVLIST
)
2890 COMPATIBLE_IOCTL(HCIGETDEVINFO
)
2891 COMPATIBLE_IOCTL(HCIGETCONNLIST
)
2892 COMPATIBLE_IOCTL(HCIGETCONNINFO
)
2893 COMPATIBLE_IOCTL(HCISETRAW
)
2894 COMPATIBLE_IOCTL(HCISETSCAN
)
2895 COMPATIBLE_IOCTL(HCISETAUTH
)
2896 COMPATIBLE_IOCTL(HCISETENCRYPT
)
2897 COMPATIBLE_IOCTL(HCISETPTYPE
)
2898 COMPATIBLE_IOCTL(HCISETLINKPOL
)
2899 COMPATIBLE_IOCTL(HCISETLINKMODE
)
2900 COMPATIBLE_IOCTL(HCISETACLMTU
)
2901 COMPATIBLE_IOCTL(HCISETSCOMTU
)
2902 COMPATIBLE_IOCTL(HCIINQUIRY
)
2903 COMPATIBLE_IOCTL(HCIUARTSETPROTO
)
2904 COMPATIBLE_IOCTL(HCIUARTGETPROTO
)
2905 COMPATIBLE_IOCTL(RFCOMMCREATEDEV
)
2906 COMPATIBLE_IOCTL(RFCOMMRELEASEDEV
)
2907 COMPATIBLE_IOCTL(RFCOMMGETDEVLIST
)
2908 COMPATIBLE_IOCTL(RFCOMMGETDEVINFO
)
2909 COMPATIBLE_IOCTL(RFCOMMSTEALDLC
)
2910 COMPATIBLE_IOCTL(BNEPCONNADD
)
2911 COMPATIBLE_IOCTL(BNEPCONNDEL
)
2912 COMPATIBLE_IOCTL(BNEPGETCONNLIST
)
2913 COMPATIBLE_IOCTL(BNEPGETCONNINFO
)
2914 COMPATIBLE_IOCTL(CMTPCONNADD
)
2915 COMPATIBLE_IOCTL(CMTPCONNDEL
)
2916 COMPATIBLE_IOCTL(CMTPGETCONNLIST
)
2917 COMPATIBLE_IOCTL(CMTPGETCONNINFO
)
2918 COMPATIBLE_IOCTL(HIDPCONNADD
)
2919 COMPATIBLE_IOCTL(HIDPCONNDEL
)
2920 COMPATIBLE_IOCTL(HIDPGETCONNLIST
)
2921 COMPATIBLE_IOCTL(HIDPGETCONNINFO
)
2923 COMPATIBLE_IOCTL(CAPI_REGISTER
)
2924 COMPATIBLE_IOCTL(CAPI_GET_MANUFACTURER
)
2925 COMPATIBLE_IOCTL(CAPI_GET_VERSION
)
2926 COMPATIBLE_IOCTL(CAPI_GET_SERIAL
)
2927 COMPATIBLE_IOCTL(CAPI_GET_PROFILE
)
2928 COMPATIBLE_IOCTL(CAPI_MANUFACTURER_CMD
)
2929 COMPATIBLE_IOCTL(CAPI_GET_ERRCODE
)
2930 COMPATIBLE_IOCTL(CAPI_INSTALLED
)
2931 COMPATIBLE_IOCTL(CAPI_GET_FLAGS
)
2932 COMPATIBLE_IOCTL(CAPI_SET_FLAGS
)
2933 COMPATIBLE_IOCTL(CAPI_CLR_FLAGS
)
2934 COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT
)
2935 COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT
)
2936 /* Siemens Gigaset */
2937 COMPATIBLE_IOCTL(GIGASET_REDIR
)
2938 COMPATIBLE_IOCTL(GIGASET_CONFIG
)
2939 COMPATIBLE_IOCTL(GIGASET_BRKCHARS
)
2940 COMPATIBLE_IOCTL(GIGASET_VERSION
)
2942 COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */
2943 COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */
2944 COMPATIBLE_IOCTL(PCIIOC_CONTROLLER
)
2945 COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO
)
2946 COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM
)
2947 COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE
)
2949 COMPATIBLE_IOCTL(USBDEVFS_RESETEP
)
2950 COMPATIBLE_IOCTL(USBDEVFS_SETINTERFACE
)
2951 COMPATIBLE_IOCTL(USBDEVFS_SETCONFIGURATION
)
2952 COMPATIBLE_IOCTL(USBDEVFS_GETDRIVER
)
2953 COMPATIBLE_IOCTL(USBDEVFS_DISCARDURB
)
2954 COMPATIBLE_IOCTL(USBDEVFS_CLAIMINTERFACE
)
2955 COMPATIBLE_IOCTL(USBDEVFS_RELEASEINTERFACE
)
2956 COMPATIBLE_IOCTL(USBDEVFS_CONNECTINFO
)
2957 COMPATIBLE_IOCTL(USBDEVFS_HUB_PORTINFO
)
2958 COMPATIBLE_IOCTL(USBDEVFS_RESET
)
2959 COMPATIBLE_IOCTL(USBDEVFS_SUBMITURB32
)
2960 COMPATIBLE_IOCTL(USBDEVFS_REAPURB32
)
2961 COMPATIBLE_IOCTL(USBDEVFS_REAPURBNDELAY32
)
2962 COMPATIBLE_IOCTL(USBDEVFS_CLEAR_HALT
)
2964 COMPATIBLE_IOCTL(MEMGETINFO
)
2965 COMPATIBLE_IOCTL(MEMERASE
)
2966 COMPATIBLE_IOCTL(MEMLOCK
)
2967 COMPATIBLE_IOCTL(MEMUNLOCK
)
2968 COMPATIBLE_IOCTL(MEMGETREGIONCOUNT
)
2969 COMPATIBLE_IOCTL(MEMGETREGIONINFO
)
2970 COMPATIBLE_IOCTL(MEMGETBADBLOCK
)
2971 COMPATIBLE_IOCTL(MEMSETBADBLOCK
)
2973 ULONG_IOCTL(NBD_SET_SOCK
)
2974 ULONG_IOCTL(NBD_SET_BLKSIZE
)
2975 ULONG_IOCTL(NBD_SET_SIZE
)
2976 COMPATIBLE_IOCTL(NBD_DO_IT
)
2977 COMPATIBLE_IOCTL(NBD_CLEAR_SOCK
)
2978 COMPATIBLE_IOCTL(NBD_CLEAR_QUE
)
2979 COMPATIBLE_IOCTL(NBD_PRINT_DEBUG
)
2980 ULONG_IOCTL(NBD_SET_SIZE_BLOCKS
)
2981 COMPATIBLE_IOCTL(NBD_DISCONNECT
)
2983 COMPATIBLE_IOCTL(I2C_SLAVE
)
2984 COMPATIBLE_IOCTL(I2C_SLAVE_FORCE
)
2985 COMPATIBLE_IOCTL(I2C_TENBIT
)
2986 COMPATIBLE_IOCTL(I2C_PEC
)
2987 COMPATIBLE_IOCTL(I2C_RETRIES
)
2988 COMPATIBLE_IOCTL(I2C_TIMEOUT
)
2990 COMPATIBLE_IOCTL(SIOCSIWCOMMIT
)
2991 COMPATIBLE_IOCTL(SIOCGIWNAME
)
2992 COMPATIBLE_IOCTL(SIOCSIWNWID
)
2993 COMPATIBLE_IOCTL(SIOCGIWNWID
)
2994 COMPATIBLE_IOCTL(SIOCSIWFREQ
)
2995 COMPATIBLE_IOCTL(SIOCGIWFREQ
)
2996 COMPATIBLE_IOCTL(SIOCSIWMODE
)
2997 COMPATIBLE_IOCTL(SIOCGIWMODE
)
2998 COMPATIBLE_IOCTL(SIOCSIWSENS
)
2999 COMPATIBLE_IOCTL(SIOCGIWSENS
)
3000 COMPATIBLE_IOCTL(SIOCSIWRANGE
)
3001 COMPATIBLE_IOCTL(SIOCSIWPRIV
)
3002 COMPATIBLE_IOCTL(SIOCSIWSTATS
)
3003 COMPATIBLE_IOCTL(SIOCSIWAP
)
3004 COMPATIBLE_IOCTL(SIOCGIWAP
)
3005 COMPATIBLE_IOCTL(SIOCSIWRATE
)
3006 COMPATIBLE_IOCTL(SIOCGIWRATE
)
3007 COMPATIBLE_IOCTL(SIOCSIWRTS
)
3008 COMPATIBLE_IOCTL(SIOCGIWRTS
)
3009 COMPATIBLE_IOCTL(SIOCSIWFRAG
)
3010 COMPATIBLE_IOCTL(SIOCGIWFRAG
)
3011 COMPATIBLE_IOCTL(SIOCSIWTXPOW
)
3012 COMPATIBLE_IOCTL(SIOCGIWTXPOW
)
3013 COMPATIBLE_IOCTL(SIOCSIWRETRY
)
3014 COMPATIBLE_IOCTL(SIOCGIWRETRY
)
3015 COMPATIBLE_IOCTL(SIOCSIWPOWER
)
3016 COMPATIBLE_IOCTL(SIOCGIWPOWER
)
3017 COMPATIBLE_IOCTL(SIOCSIWAUTH
)
3018 COMPATIBLE_IOCTL(SIOCGIWAUTH
)
3020 COMPATIBLE_IOCTL(HIDIOCGVERSION
)
3021 COMPATIBLE_IOCTL(HIDIOCAPPLICATION
)
3022 COMPATIBLE_IOCTL(HIDIOCGDEVINFO
)
3023 COMPATIBLE_IOCTL(HIDIOCGSTRING
)
3024 COMPATIBLE_IOCTL(HIDIOCINITREPORT
)
3025 COMPATIBLE_IOCTL(HIDIOCGREPORT
)
3026 COMPATIBLE_IOCTL(HIDIOCSREPORT
)
3027 COMPATIBLE_IOCTL(HIDIOCGREPORTINFO
)
3028 COMPATIBLE_IOCTL(HIDIOCGFIELDINFO
)
3029 COMPATIBLE_IOCTL(HIDIOCGUSAGE
)
3030 COMPATIBLE_IOCTL(HIDIOCSUSAGE
)
3031 COMPATIBLE_IOCTL(HIDIOCGUCODE
)
3032 COMPATIBLE_IOCTL(HIDIOCGFLAG
)
3033 COMPATIBLE_IOCTL(HIDIOCSFLAG
)
3034 COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX
)
3035 COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO
)
3037 COMPATIBLE_IOCTL(AUDIO_STOP
)
3038 COMPATIBLE_IOCTL(AUDIO_PLAY
)
3039 COMPATIBLE_IOCTL(AUDIO_PAUSE
)
3040 COMPATIBLE_IOCTL(AUDIO_CONTINUE
)
3041 COMPATIBLE_IOCTL(AUDIO_SELECT_SOURCE
)
3042 COMPATIBLE_IOCTL(AUDIO_SET_MUTE
)
3043 COMPATIBLE_IOCTL(AUDIO_SET_AV_SYNC
)
3044 COMPATIBLE_IOCTL(AUDIO_SET_BYPASS_MODE
)
3045 COMPATIBLE_IOCTL(AUDIO_CHANNEL_SELECT
)
3046 COMPATIBLE_IOCTL(AUDIO_GET_STATUS
)
3047 COMPATIBLE_IOCTL(AUDIO_GET_CAPABILITIES
)
3048 COMPATIBLE_IOCTL(AUDIO_CLEAR_BUFFER
)
3049 COMPATIBLE_IOCTL(AUDIO_SET_ID
)
3050 COMPATIBLE_IOCTL(AUDIO_SET_MIXER
)
3051 COMPATIBLE_IOCTL(AUDIO_SET_STREAMTYPE
)
3052 COMPATIBLE_IOCTL(AUDIO_SET_EXT_ID
)
3053 COMPATIBLE_IOCTL(AUDIO_SET_ATTRIBUTES
)
3054 COMPATIBLE_IOCTL(AUDIO_SET_KARAOKE
)
3055 COMPATIBLE_IOCTL(DMX_START
)
3056 COMPATIBLE_IOCTL(DMX_STOP
)
3057 COMPATIBLE_IOCTL(DMX_SET_FILTER
)
3058 COMPATIBLE_IOCTL(DMX_SET_PES_FILTER
)
3059 COMPATIBLE_IOCTL(DMX_SET_BUFFER_SIZE
)
3060 COMPATIBLE_IOCTL(DMX_GET_PES_PIDS
)
3061 COMPATIBLE_IOCTL(DMX_GET_CAPS
)
3062 COMPATIBLE_IOCTL(DMX_SET_SOURCE
)
3063 COMPATIBLE_IOCTL(DMX_GET_STC
)
3064 COMPATIBLE_IOCTL(FE_GET_INFO
)
3065 COMPATIBLE_IOCTL(FE_DISEQC_RESET_OVERLOAD
)
3066 COMPATIBLE_IOCTL(FE_DISEQC_SEND_MASTER_CMD
)
3067 COMPATIBLE_IOCTL(FE_DISEQC_RECV_SLAVE_REPLY
)
3068 COMPATIBLE_IOCTL(FE_DISEQC_SEND_BURST
)
3069 COMPATIBLE_IOCTL(FE_SET_TONE
)
3070 COMPATIBLE_IOCTL(FE_SET_VOLTAGE
)
3071 COMPATIBLE_IOCTL(FE_ENABLE_HIGH_LNB_VOLTAGE
)
3072 COMPATIBLE_IOCTL(FE_READ_STATUS
)
3073 COMPATIBLE_IOCTL(FE_READ_BER
)
3074 COMPATIBLE_IOCTL(FE_READ_SIGNAL_STRENGTH
)
3075 COMPATIBLE_IOCTL(FE_READ_SNR
)
3076 COMPATIBLE_IOCTL(FE_READ_UNCORRECTED_BLOCKS
)
3077 COMPATIBLE_IOCTL(FE_SET_FRONTEND
)
3078 COMPATIBLE_IOCTL(FE_GET_FRONTEND
)
3079 COMPATIBLE_IOCTL(FE_GET_EVENT
)
3080 COMPATIBLE_IOCTL(FE_DISHNETWORK_SEND_LEGACY_CMD
)
3081 COMPATIBLE_IOCTL(VIDEO_STOP
)
3082 COMPATIBLE_IOCTL(VIDEO_PLAY
)
3083 COMPATIBLE_IOCTL(VIDEO_FREEZE
)
3084 COMPATIBLE_IOCTL(VIDEO_CONTINUE
)
3085 COMPATIBLE_IOCTL(VIDEO_SELECT_SOURCE
)
3086 COMPATIBLE_IOCTL(VIDEO_SET_BLANK
)
3087 COMPATIBLE_IOCTL(VIDEO_GET_STATUS
)
3088 COMPATIBLE_IOCTL(VIDEO_SET_DISPLAY_FORMAT
)
3089 COMPATIBLE_IOCTL(VIDEO_FAST_FORWARD
)
3090 COMPATIBLE_IOCTL(VIDEO_SLOWMOTION
)
3091 COMPATIBLE_IOCTL(VIDEO_GET_CAPABILITIES
)
3092 COMPATIBLE_IOCTL(VIDEO_CLEAR_BUFFER
)
3093 COMPATIBLE_IOCTL(VIDEO_SET_ID
)
3094 COMPATIBLE_IOCTL(VIDEO_SET_STREAMTYPE
)
3095 COMPATIBLE_IOCTL(VIDEO_SET_FORMAT
)
3096 COMPATIBLE_IOCTL(VIDEO_SET_SYSTEM
)
3097 COMPATIBLE_IOCTL(VIDEO_SET_HIGHLIGHT
)
3098 COMPATIBLE_IOCTL(VIDEO_SET_SPU
)
3099 COMPATIBLE_IOCTL(VIDEO_GET_NAVI
)
3100 COMPATIBLE_IOCTL(VIDEO_SET_ATTRIBUTES
)
3101 COMPATIBLE_IOCTL(VIDEO_GET_SIZE
)
3102 COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE
)
3104 /* now things that need handlers */
3105 HANDLE_IOCTL(MEMREADOOB32
, mtd_rw_oob
)
3106 HANDLE_IOCTL(MEMWRITEOOB32
, mtd_rw_oob
)
3108 HANDLE_IOCTL(SIOCGIFNAME
, dev_ifname32
)
3109 HANDLE_IOCTL(SIOCGIFCONF
, dev_ifconf
)
3110 HANDLE_IOCTL(SIOCGIFFLAGS
, dev_ifsioc
)
3111 HANDLE_IOCTL(SIOCSIFFLAGS
, dev_ifsioc
)
3112 HANDLE_IOCTL(SIOCGIFMETRIC
, dev_ifsioc
)
3113 HANDLE_IOCTL(SIOCSIFMETRIC
, dev_ifsioc
)
3114 HANDLE_IOCTL(SIOCGIFMTU
, dev_ifsioc
)
3115 HANDLE_IOCTL(SIOCSIFMTU
, dev_ifsioc
)
3116 HANDLE_IOCTL(SIOCGIFMEM
, dev_ifsioc
)
3117 HANDLE_IOCTL(SIOCSIFMEM
, dev_ifsioc
)
3118 HANDLE_IOCTL(SIOCGIFHWADDR
, dev_ifsioc
)
3119 HANDLE_IOCTL(SIOCSIFHWADDR
, dev_ifsioc
)
3120 HANDLE_IOCTL(SIOCADDMULTI
, dev_ifsioc
)
3121 HANDLE_IOCTL(SIOCDELMULTI
, dev_ifsioc
)
3122 HANDLE_IOCTL(SIOCGIFINDEX
, dev_ifsioc
)
3123 HANDLE_IOCTL(SIOCGIFMAP
, dev_ifsioc
)
3124 HANDLE_IOCTL(SIOCSIFMAP
, dev_ifsioc
)
3125 HANDLE_IOCTL(SIOCGIFADDR
, dev_ifsioc
)
3126 HANDLE_IOCTL(SIOCSIFADDR
, dev_ifsioc
)
3127 HANDLE_IOCTL(SIOCSIFHWBROADCAST
, dev_ifsioc
)
3129 /* ioctls used by appletalk ddp.c */
3130 HANDLE_IOCTL(SIOCATALKDIFADDR
, dev_ifsioc
)
3131 HANDLE_IOCTL(SIOCDIFADDR
, dev_ifsioc
)
3132 HANDLE_IOCTL(SIOCSARP
, dev_ifsioc
)
3133 HANDLE_IOCTL(SIOCDARP
, dev_ifsioc
)
3135 HANDLE_IOCTL(SIOCGIFBRDADDR
, dev_ifsioc
)
3136 HANDLE_IOCTL(SIOCSIFBRDADDR
, dev_ifsioc
)
3137 HANDLE_IOCTL(SIOCGIFDSTADDR
, dev_ifsioc
)
3138 HANDLE_IOCTL(SIOCSIFDSTADDR
, dev_ifsioc
)
3139 HANDLE_IOCTL(SIOCGIFNETMASK
, dev_ifsioc
)
3140 HANDLE_IOCTL(SIOCSIFNETMASK
, dev_ifsioc
)
3141 HANDLE_IOCTL(SIOCSIFPFLAGS
, dev_ifsioc
)
3142 HANDLE_IOCTL(SIOCGIFPFLAGS
, dev_ifsioc
)
3143 HANDLE_IOCTL(SIOCGIFTXQLEN
, dev_ifsioc
)
3144 HANDLE_IOCTL(SIOCSIFTXQLEN
, dev_ifsioc
)
3145 HANDLE_IOCTL(TUNSETIFF
, dev_ifsioc
)
3146 HANDLE_IOCTL(SIOCETHTOOL
, ethtool_ioctl
)
3147 HANDLE_IOCTL(SIOCBONDENSLAVE
, bond_ioctl
)
3148 HANDLE_IOCTL(SIOCBONDRELEASE
, bond_ioctl
)
3149 HANDLE_IOCTL(SIOCBONDSETHWADDR
, bond_ioctl
)
3150 HANDLE_IOCTL(SIOCBONDSLAVEINFOQUERY
, bond_ioctl
)
3151 HANDLE_IOCTL(SIOCBONDINFOQUERY
, bond_ioctl
)
3152 HANDLE_IOCTL(SIOCBONDCHANGEACTIVE
, bond_ioctl
)
3153 HANDLE_IOCTL(SIOCADDRT
, routing_ioctl
)
3154 HANDLE_IOCTL(SIOCDELRT
, routing_ioctl
)
3155 HANDLE_IOCTL(SIOCBRADDIF
, dev_ifsioc
)
3156 HANDLE_IOCTL(SIOCBRDELIF
, dev_ifsioc
)
3157 /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
3158 HANDLE_IOCTL(SIOCRTMSG
, ret_einval
)
3159 HANDLE_IOCTL(SIOCGSTAMP
, do_siocgstamp
)
3160 HANDLE_IOCTL(SIOCGSTAMPNS
, do_siocgstampns
)
3163 HANDLE_IOCTL(BLKPG
, blkpg_ioctl_trans
)
3164 HANDLE_IOCTL(FDSETPRM32
, fd_ioctl_trans
)
3165 HANDLE_IOCTL(FDDEFPRM32
, fd_ioctl_trans
)
3166 HANDLE_IOCTL(FDGETPRM32
, fd_ioctl_trans
)
3167 HANDLE_IOCTL(FDSETDRVPRM32
, fd_ioctl_trans
)
3168 HANDLE_IOCTL(FDGETDRVPRM32
, fd_ioctl_trans
)
3169 HANDLE_IOCTL(FDGETDRVSTAT32
, fd_ioctl_trans
)
3170 HANDLE_IOCTL(FDPOLLDRVSTAT32
, fd_ioctl_trans
)
3171 HANDLE_IOCTL(FDGETFDCSTAT32
, fd_ioctl_trans
)
3172 HANDLE_IOCTL(FDWERRORGET32
, fd_ioctl_trans
)
3173 HANDLE_IOCTL(SG_IO
,sg_ioctl_trans
)
3174 HANDLE_IOCTL(SG_GET_REQUEST_TABLE
, sg_grt_trans
)
3176 HANDLE_IOCTL(PPPIOCGIDLE32
, ppp_ioctl_trans
)
3177 HANDLE_IOCTL(PPPIOCSCOMPRESS32
, ppp_ioctl_trans
)
3178 HANDLE_IOCTL(PPPIOCSPASS32
, ppp_sock_fprog_ioctl_trans
)
3179 HANDLE_IOCTL(PPPIOCSACTIVE32
, ppp_sock_fprog_ioctl_trans
)
3181 HANDLE_IOCTL(MTIOCGET32
, mt_ioctl_trans
)
3182 HANDLE_IOCTL(MTIOCPOS32
, mt_ioctl_trans
)
3183 HANDLE_IOCTL(CDROMREADAUDIO
, cdrom_ioctl_trans
)
3184 HANDLE_IOCTL(CDROM_SEND_PACKET
, cdrom_ioctl_trans
)
3186 #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
3187 HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32
, ioc_settimeout
)
3189 HANDLE_IOCTL(PIO_FONTX
, do_fontx_ioctl
)
3190 HANDLE_IOCTL(GIO_FONTX
, do_fontx_ioctl
)
3191 HANDLE_IOCTL(PIO_UNIMAP
, do_unimap_ioctl
)
3192 HANDLE_IOCTL(GIO_UNIMAP
, do_unimap_ioctl
)
3193 HANDLE_IOCTL(KDFONTOP
, do_kdfontop_ioctl
)
3195 /* One SMB ioctl needs translations. */
3196 #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
3197 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32
, do_smb_getmountuid
)
3198 HANDLE_IOCTL(ATM_GETLINKRATE32
, do_atm_ioctl
)
3199 HANDLE_IOCTL(ATM_GETNAMES32
, do_atm_ioctl
)
3200 HANDLE_IOCTL(ATM_GETTYPE32
, do_atm_ioctl
)
3201 HANDLE_IOCTL(ATM_GETESI32
, do_atm_ioctl
)
3202 HANDLE_IOCTL(ATM_GETADDR32
, do_atm_ioctl
)
3203 HANDLE_IOCTL(ATM_RSTADDR32
, do_atm_ioctl
)
3204 HANDLE_IOCTL(ATM_ADDADDR32
, do_atm_ioctl
)
3205 HANDLE_IOCTL(ATM_DELADDR32
, do_atm_ioctl
)
3206 HANDLE_IOCTL(ATM_GETCIRANGE32
, do_atm_ioctl
)
3207 HANDLE_IOCTL(ATM_SETCIRANGE32
, do_atm_ioctl
)
3208 HANDLE_IOCTL(ATM_SETESI32
, do_atm_ioctl
)
3209 HANDLE_IOCTL(ATM_SETESIF32
, do_atm_ioctl
)
3210 HANDLE_IOCTL(ATM_GETSTAT32
, do_atm_ioctl
)
3211 HANDLE_IOCTL(ATM_GETSTATZ32
, do_atm_ioctl
)
3212 HANDLE_IOCTL(ATM_GETLOOP32
, do_atm_ioctl
)
3213 HANDLE_IOCTL(ATM_SETLOOP32
, do_atm_ioctl
)
3214 HANDLE_IOCTL(ATM_QUERYLOOP32
, do_atm_ioctl
)
3215 HANDLE_IOCTL(SONET_GETSTAT
, do_atm_ioctl
)
3216 HANDLE_IOCTL(SONET_GETSTATZ
, do_atm_ioctl
)
3217 HANDLE_IOCTL(SONET_GETDIAG
, do_atm_ioctl
)
3218 HANDLE_IOCTL(SONET_SETDIAG
, do_atm_ioctl
)
3219 HANDLE_IOCTL(SONET_CLRDIAG
, do_atm_ioctl
)
3220 HANDLE_IOCTL(SONET_SETFRAMING
, do_atm_ioctl
)
3221 HANDLE_IOCTL(SONET_GETFRAMING
, do_atm_ioctl
)
3222 HANDLE_IOCTL(SONET_GETFRSENSE
, do_atm_ioctl
)
3226 HANDLE_IOCTL(RAW_SETBIND
, raw_ioctl
)
3227 HANDLE_IOCTL(RAW_GETBIND
, raw_ioctl
)
3230 HANDLE_IOCTL(TIOCGSERIAL
, serial_struct_ioctl
)
3231 HANDLE_IOCTL(TIOCSSERIAL
, serial_struct_ioctl
)
3233 COMPATIBLE_IOCTL(TIOCGLTC
)
3234 COMPATIBLE_IOCTL(TIOCSLTC
)
3238 * For these two we have defintions in ioctls.h and/or termios.h on
3239 * some architectures but no actual implemention. Some applications
3240 * like bash call them if they are defined in the headers, so we provide
3241 * entries here to avoid syslog message spew.
3243 COMPATIBLE_IOCTL(TIOCSTART
)
3244 COMPATIBLE_IOCTL(TIOCSTOP
)
3247 HANDLE_IOCTL(USBDEVFS_CONTROL32
, do_usbdevfs_control
)
3248 HANDLE_IOCTL(USBDEVFS_BULK32
, do_usbdevfs_bulk
)
3249 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32
, do_usbdevfs_discsignal
)
3250 COMPATIBLE_IOCTL(USBDEVFS_IOCTL32
)
3252 HANDLE_IOCTL(I2C_FUNCS
, w_long
)
3253 HANDLE_IOCTL(I2C_RDWR
, do_i2c_rdwr_ioctl
)
3254 HANDLE_IOCTL(I2C_SMBUS
, do_i2c_smbus_ioctl
)
3256 HANDLE_IOCTL(SIOCGIWRANGE
, do_wireless_ioctl
)
3257 HANDLE_IOCTL(SIOCGIWPRIV
, do_wireless_ioctl
)
3258 HANDLE_IOCTL(SIOCGIWSTATS
, do_wireless_ioctl
)
3259 HANDLE_IOCTL(SIOCSIWSPY
, do_wireless_ioctl
)
3260 HANDLE_IOCTL(SIOCGIWSPY
, do_wireless_ioctl
)
3261 HANDLE_IOCTL(SIOCSIWTHRSPY
, do_wireless_ioctl
)
3262 HANDLE_IOCTL(SIOCGIWTHRSPY
, do_wireless_ioctl
)
3263 HANDLE_IOCTL(SIOCSIWMLME
, do_wireless_ioctl
)
3264 HANDLE_IOCTL(SIOCGIWAPLIST
, do_wireless_ioctl
)
3265 HANDLE_IOCTL(SIOCSIWSCAN
, do_wireless_ioctl
)
3266 HANDLE_IOCTL(SIOCGIWSCAN
, do_wireless_ioctl
)
3267 HANDLE_IOCTL(SIOCSIWESSID
, do_wireless_ioctl
)
3268 HANDLE_IOCTL(SIOCGIWESSID
, do_wireless_ioctl
)
3269 HANDLE_IOCTL(SIOCSIWNICKN
, do_wireless_ioctl
)
3270 HANDLE_IOCTL(SIOCGIWNICKN
, do_wireless_ioctl
)
3271 HANDLE_IOCTL(SIOCSIWENCODE
, do_wireless_ioctl
)
3272 HANDLE_IOCTL(SIOCGIWENCODE
, do_wireless_ioctl
)
3273 HANDLE_IOCTL(SIOCSIWGENIE
, do_wireless_ioctl
)
3274 HANDLE_IOCTL(SIOCGIWGENIE
, do_wireless_ioctl
)
3275 HANDLE_IOCTL(SIOCSIWENCODEEXT
, do_wireless_ioctl
)
3276 HANDLE_IOCTL(SIOCGIWENCODEEXT
, do_wireless_ioctl
)
3277 HANDLE_IOCTL(SIOCSIWPMKSA
, do_wireless_ioctl
)
3278 HANDLE_IOCTL(SIOCSIFBR
, old_bridge_ioctl
)
3279 HANDLE_IOCTL(SIOCGIFBR
, old_bridge_ioctl
)
3280 /* Not implemented in the native kernel */
3281 IGNORE_IOCTL(SIOCGIFCOUNT
)
3282 HANDLE_IOCTL(RTC_IRQP_READ32
, rtc_ioctl
)
3283 HANDLE_IOCTL(RTC_IRQP_SET32
, rtc_ioctl
)
3284 HANDLE_IOCTL(RTC_EPOCH_READ32
, rtc_ioctl
)
3285 HANDLE_IOCTL(RTC_EPOCH_SET32
, rtc_ioctl
)
3288 HANDLE_IOCTL(VIDEO_GET_EVENT
, do_video_get_event
)
3289 HANDLE_IOCTL(VIDEO_STILLPICTURE
, do_video_stillpicture
)
3290 HANDLE_IOCTL(VIDEO_SET_SPU_PALETTE
, do_video_set_spu_palette
)
3293 COMPATIBLE_IOCTL(LPTIME
)
3294 COMPATIBLE_IOCTL(LPCHAR
)
3295 COMPATIBLE_IOCTL(LPABORTOPEN
)
3296 COMPATIBLE_IOCTL(LPCAREFUL
)
3297 COMPATIBLE_IOCTL(LPWAIT
)
3298 COMPATIBLE_IOCTL(LPSETIRQ
)
3299 COMPATIBLE_IOCTL(LPGETSTATUS
)
3300 COMPATIBLE_IOCTL(LPGETSTATUS
)
3301 COMPATIBLE_IOCTL(LPRESET
)
3302 /*LPGETSTATS not implemented, but no kernels seem to compile it in anyways*/
3303 COMPATIBLE_IOCTL(LPGETFLAGS
)
3304 HANDLE_IOCTL(LPSETTIMEOUT
, lp_timeout_trans
)
3306 /* fat 'r' ioctls. These are handled by fat with ->compat_ioctl,
3307 but we don't want warnings on other file systems. So declare
3308 them as compatible here. */
3309 #define VFAT_IOCTL_READDIR_BOTH32 _IOR('r', 1, struct compat_dirent[2])
3310 #define VFAT_IOCTL_READDIR_SHORT32 _IOR('r', 2, struct compat_dirent[2])
3312 IGNORE_IOCTL(VFAT_IOCTL_READDIR_BOTH32
)
3313 IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32
)
3316 IGNORE_IOCTL(LOOP_CLR_FD
)
3319 /* Sparc framebuffers, handled in sbusfb_compat_ioctl() */
3320 IGNORE_IOCTL(FBIOGTYPE
)
3321 IGNORE_IOCTL(FBIOSATTR
)
3322 IGNORE_IOCTL(FBIOGATTR
)
3323 IGNORE_IOCTL(FBIOSVIDEO
)
3324 IGNORE_IOCTL(FBIOGVIDEO
)
3325 IGNORE_IOCTL(FBIOSCURPOS
)
3326 IGNORE_IOCTL(FBIOGCURPOS
)
3327 IGNORE_IOCTL(FBIOGCURMAX
)
3328 IGNORE_IOCTL(FBIOPUTCMAP32
)
3329 IGNORE_IOCTL(FBIOGETCMAP32
)
3330 IGNORE_IOCTL(FBIOSCURSOR32
)
3331 IGNORE_IOCTL(FBIOGCURSOR32
)
3335 #define IOCTL_HASHSIZE 256
3336 static struct ioctl_trans
*ioctl32_hash_table
[IOCTL_HASHSIZE
];
3338 static inline unsigned long ioctl32_hash(unsigned long cmd
)
3340 return (((cmd
>> 6) ^ (cmd
>> 4) ^ cmd
)) % IOCTL_HASHSIZE
;
3343 static void compat_ioctl_error(struct file
*filp
, unsigned int fd
,
3344 unsigned int cmd
, unsigned long arg
)
3350 /* find the name of the device. */
3351 path
= (char *)__get_free_page(GFP_KERNEL
);
3353 fn
= d_path(filp
->f_path
.dentry
, filp
->f_path
.mnt
, path
, PAGE_SIZE
);
3358 sprintf(buf
,"'%c'", (cmd
>>_IOC_TYPESHIFT
) & _IOC_TYPEMASK
);
3359 if (!isprint(buf
[1]))
3360 sprintf(buf
, "%02x", buf
[1]);
3361 compat_printk("ioctl32(%s:%d): Unknown cmd fd(%d) "
3362 "cmd(%08x){t:%s;sz:%u} arg(%08x) on %s\n",
3363 current
->comm
, current
->pid
,
3364 (int)fd
, (unsigned int)cmd
, buf
,
3365 (cmd
>> _IOC_SIZESHIFT
) & _IOC_SIZEMASK
,
3366 (unsigned int)arg
, fn
);
3369 free_page((unsigned long)path
);
3372 asmlinkage
long compat_sys_ioctl(unsigned int fd
, unsigned int cmd
,
3377 struct ioctl_trans
*t
;
3380 filp
= fget_light(fd
, &fput_needed
);
3384 /* RED-PEN how should LSM module know it's handling 32bit? */
3385 error
= security_file_ioctl(filp
, cmd
, arg
);
3390 * To allow the compat_ioctl handlers to be self contained
3391 * we need to check the common ioctls here first.
3392 * Just handle them with the standard handlers below.
3405 if (S_ISREG(filp
->f_path
.dentry
->d_inode
->i_mode
))
3410 if (filp
->f_op
&& filp
->f_op
->compat_ioctl
) {
3411 error
= filp
->f_op
->compat_ioctl(filp
, cmd
, arg
);
3412 if (error
!= -ENOIOCTLCMD
)
3417 (!filp
->f_op
->ioctl
&& !filp
->f_op
->unlocked_ioctl
))
3422 for (t
= ioctl32_hash_table
[ioctl32_hash(cmd
)]; t
; t
= t
->next
) {
3428 if (S_ISSOCK(filp
->f_path
.dentry
->d_inode
->i_mode
) &&
3429 cmd
>= SIOCDEVPRIVATE
&& cmd
<= (SIOCDEVPRIVATE
+ 15)) {
3430 error
= siocdevprivate_ioctl(fd
, cmd
, arg
);
3437 compat_ioctl_error(filp
, fd
, cmd
, arg
);
3446 error
= t
->handler(fd
, cmd
, arg
, filp
);
3452 error
= vfs_ioctl(filp
, fd
, cmd
, arg
);
3454 fput_light(filp
, fput_needed
);
3459 static void ioctl32_insert_translation(struct ioctl_trans
*trans
)
3462 struct ioctl_trans
*t
;
3464 hash
= ioctl32_hash (trans
->cmd
);
3465 if (!ioctl32_hash_table
[hash
])
3466 ioctl32_hash_table
[hash
] = trans
;
3468 t
= ioctl32_hash_table
[hash
];
3476 static int __init
init_sys32_ioctl(void)
3480 for (i
= 0; i
< ARRAY_SIZE(ioctl_start
); i
++) {
3481 if (ioctl_start
[i
].next
!= 0) {
3482 printk("ioctl translation %d bad\n",i
);
3486 ioctl32_insert_translation(&ioctl_start
[i
]);
3490 __initcall(init_sys32_ioctl
);