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
14 #include <linux/config.h>
15 #include <linux/types.h>
16 #include <linux/compat.h>
17 #include <linux/kernel.h>
18 #include <linux/compiler.h>
19 #include <linux/sched.h>
20 #include <linux/smp.h>
21 #include <linux/smp_lock.h>
22 #include <linux/ioctl.h>
24 #include <linux/if_bridge.h>
25 #include <linux/slab.h>
26 #include <linux/hdreg.h>
27 #include <linux/raid/md.h>
29 #include <linux/dirent.h>
30 #include <linux/route.h>
31 #include <linux/in6.h>
32 #include <linux/ipv6_route.h>
33 #include <linux/skbuff.h>
34 #include <linux/netlink.h>
37 #include <linux/file.h>
39 #include <linux/ppp_defs.h>
40 #include <linux/if_ppp.h>
41 #include <linux/if_pppox.h>
42 #include <linux/mtio.h>
43 #include <linux/cdrom.h>
44 #include <linux/loop.h>
45 #include <linux/auto_fs.h>
46 #include <linux/auto_fs4.h>
47 #include <linux/devfs_fs.h>
48 #include <linux/tty.h>
49 #include <linux/vt_kern.h>
51 #include <linux/ext2_fs.h>
52 #include <linux/videodev.h>
53 #include <linux/netdevice.h>
54 #include <linux/raw.h>
55 #include <linux/smb_fs.h>
56 #include <linux/blkpg.h>
57 #include <linux/blkdev.h>
58 #include <linux/elevator.h>
59 #include <linux/rtc.h>
60 #include <linux/pci.h>
61 #include <linux/module.h>
62 #include <linux/serial.h>
63 #include <linux/reiserfs_fs.h>
64 #include <linux/if_tun.h>
65 #include <linux/ctype.h>
66 #include <linux/ioctl32.h>
67 #include <linux/syscalls.h>
68 #include <linux/ncp_fs.h>
69 #include <linux/i2c.h>
70 #include <linux/i2c-dev.h>
71 #include <linux/wireless.h>
72 #include <linux/atalk.h>
74 #include <net/sock.h> /* siocdevprivate_ioctl */
75 #include <net/bluetooth/bluetooth.h>
76 #include <net/bluetooth/hci.h>
77 #include <net/bluetooth/rfcomm.h>
79 #include <linux/capi.h>
81 #include <scsi/scsi.h>
84 #include <scsi/scsi_ioctl.h>
88 #include <asm/types.h>
89 #include <asm/uaccess.h>
90 #include <linux/ethtool.h>
91 #include <linux/mii.h>
92 #include <linux/if_bonding.h>
93 #include <linux/watchdog.h>
94 #include <linux/dm-ioctl.h>
96 #include <asm/module.h>
97 #include <linux/soundcard.h>
99 #include <linux/ppdev.h>
101 #include <linux/atm.h>
102 #include <linux/atmarp.h>
103 #include <linux/atmclip.h>
104 #include <linux/atmdev.h>
105 #include <linux/atmioc.h>
106 #include <linux/atmlec.h>
107 #include <linux/atmmpc.h>
108 #include <linux/atmsvc.h>
109 #include <linux/atm_tcp.h>
110 #include <linux/sonet.h>
111 #include <linux/atm_suni.h>
112 #include <linux/mtd/mtd.h>
114 #include <linux/usb.h>
115 #include <linux/usbdevice_fs.h>
116 #include <linux/nbd.h>
117 #include <linux/random.h>
118 #include <linux/filter.h>
119 #include <linux/msdos_fs.h>
120 #include <linux/pktcdvd.h>
122 #include <linux/hiddev.h>
129 /* Aiee. Someone does not find a difference between int and long */
130 #define EXT2_IOC32_GETFLAGS _IOR('f', 1, int)
131 #define EXT2_IOC32_SETFLAGS _IOW('f', 2, int)
132 #define EXT2_IOC32_GETVERSION _IOR('v', 1, int)
133 #define EXT2_IOC32_SETVERSION _IOW('v', 2, int)
135 static int w_long(unsigned int fd, unsigned int cmd, unsigned long arg)
137 mm_segment_t old_fs = get_fs();
142 err = sys_ioctl(fd, cmd, (unsigned long)&val);
144 if (!err && put_user(val, (u32 __user *)compat_ptr(arg)))
149 static int rw_long(unsigned int fd, unsigned int cmd, unsigned long arg)
151 mm_segment_t old_fs = get_fs();
152 u32 __user *argptr = compat_ptr(arg);
156 if(get_user(val, argptr))
159 err = sys_ioctl(fd, cmd, (unsigned long)&val);
161 if (!err && put_user(val, argptr))
166 static int do_ext2_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
168 /* These are just misnamed, they actually get/put from/to user an int */
170 case EXT2_IOC32_GETFLAGS: cmd = EXT2_IOC_GETFLAGS; break;
171 case EXT2_IOC32_SETFLAGS: cmd = EXT2_IOC_SETFLAGS; break;
172 case EXT2_IOC32_GETVERSION: cmd = EXT2_IOC_GETVERSION; break;
173 case EXT2_IOC32_SETVERSION: cmd = EXT2_IOC_SETVERSION; break;
175 return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg));
178 struct video_tuner32 {
181 compat_ulong_t rangelow, rangehigh;
182 u32 flags; /* It is really u32 in videodev.h */
186 static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
190 if(get_user(kp->tuner, &up->tuner))
192 for(i = 0; i < 32; i++)
193 __get_user(kp->name[i], &up->name[i]);
194 __get_user(kp->rangelow, &up->rangelow);
195 __get_user(kp->rangehigh, &up->rangehigh);
196 __get_user(kp->flags, &up->flags);
197 __get_user(kp->mode, &up->mode);
198 __get_user(kp->signal, &up->signal);
202 static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
206 if(put_user(kp->tuner, &up->tuner))
208 for(i = 0; i < 32; i++)
209 __put_user(kp->name[i], &up->name[i]);
210 __put_user(kp->rangelow, &up->rangelow);
211 __put_user(kp->rangehigh, &up->rangehigh);
212 __put_user(kp->flags, &up->flags);
213 __put_user(kp->mode, &up->mode);
214 __put_user(kp->signal, &up->signal);
218 struct video_buffer32 {
220 compat_int_t height, width, depth, bytesperline;
223 static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
227 if (get_user(tmp, &up->base))
230 /* This is actually a physical address stored
233 kp->base = (void *)(unsigned long) tmp;
235 __get_user(kp->height, &up->height);
236 __get_user(kp->width, &up->width);
237 __get_user(kp->depth, &up->depth);
238 __get_user(kp->bytesperline, &up->bytesperline);
242 static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
244 u32 tmp = (u32)((unsigned long)kp->base);
246 if(put_user(tmp, &up->base))
248 __put_user(kp->height, &up->height);
249 __put_user(kp->width, &up->width);
250 __put_user(kp->depth, &up->depth);
251 __put_user(kp->bytesperline, &up->bytesperline);
255 struct video_clip32 {
256 s32 x, y, width, height; /* Its really s32 in videodev.h */
260 struct video_window32 {
261 u32 x, y, width, height, chromakey, flags;
262 compat_caddr_t clips;
263 compat_int_t clipcount;
266 /* You get back everything except the clips... */
267 static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
269 if(put_user(kp->x, &up->x))
271 __put_user(kp->y, &up->y);
272 __put_user(kp->width, &up->width);
273 __put_user(kp->height, &up->height);
274 __put_user(kp->chromakey, &up->chromakey);
275 __put_user(kp->flags, &up->flags);
276 __put_user(kp->clipcount, &up->clipcount);
280 #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32)
281 #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32)
282 #define VIDIOCGWIN32 _IOR('v',9, struct video_window32)
283 #define VIDIOCSWIN32 _IOW('v',10, struct video_window32)
284 #define VIDIOCGFBUF32 _IOR('v',11, struct video_buffer32)
285 #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32)
286 #define VIDIOCGFREQ32 _IOR('v',14, u32)
287 #define VIDIOCSFREQ32 _IOW('v',15, u32)
290 MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip)
293 static int do_set_window(unsigned int fd, unsigned int cmd, unsigned long arg)
295 struct video_window32 __user *up = compat_ptr(arg);
296 struct video_window __user *vw;
297 struct video_clip __user *p;
301 if (get_user(nclips, &up->clipcount))
304 /* Peculiar interface... */
306 nclips = VIDEO_CLIPMAP_SIZE;
308 if (nclips > MaxClips)
311 vw = compat_alloc_user_space(sizeof(struct video_window) +
312 nclips * sizeof(struct video_clip));
314 p = nclips ? (struct video_clip __user *)(vw + 1) : NULL;
316 if (get_user(n, &up->x) || put_user(n, &vw->x) ||
317 get_user(n, &up->y) || put_user(n, &vw->y) ||
318 get_user(n, &up->width) || put_user(n, &vw->width) ||
319 get_user(n, &up->height) || put_user(n, &vw->height) ||
320 get_user(n, &up->chromakey) || put_user(n, &vw->chromakey) ||
321 get_user(n, &up->flags) || put_user(n, &vw->flags) ||
322 get_user(n, &up->clipcount) || put_user(n, &vw->clipcount) ||
323 get_user(n, &up->clips) || put_user(p, &vw->clips))
327 struct video_clip32 __user *u = compat_ptr(n);
331 for (i = 0; i < nclips; i++, u++, p++) {
333 if (get_user(v, &u->x) ||
334 put_user(v, &p->x) ||
335 get_user(v, &u->y) ||
336 put_user(v, &p->y) ||
337 get_user(v, &u->width) ||
338 put_user(v, &p->width) ||
339 get_user(v, &u->height) ||
340 put_user(v, &p->height) ||
341 put_user(NULL, &p->next))
346 return sys_ioctl(fd, VIDIOCSWIN, (unsigned long)p);
349 static int do_video_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
352 struct video_tuner vt;
353 struct video_buffer vb;
354 struct video_window vw;
357 mm_segment_t old_fs = get_fs();
358 void __user *up = compat_ptr(arg);
361 /* First, convert the command. */
363 case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break;
364 case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break;
365 case VIDIOCGWIN32: cmd = VIDIOCGWIN; break;
366 case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break;
367 case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break;
368 case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break;
369 case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break;
375 err = get_video_tuner32(&karg.vt, up);
379 err = get_video_buffer32(&karg.vb, up);
383 err = get_user(karg.vx, (u32 __user *)up);
390 err = sys_ioctl(fd, cmd, (unsigned long)&karg);
396 err = put_video_tuner32(&karg.vt, up);
400 err = put_video_window32(&karg.vw, up);
404 err = put_video_buffer32(&karg.vb, up);
408 err = put_user(((u32)karg.vx), (u32 __user *)up);
417 static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg)
419 struct compat_timeval __user *up = compat_ptr(arg);
421 mm_segment_t old_fs = get_fs();
425 err = sys_ioctl(fd, cmd, (unsigned long)&ktv);
428 err = put_user(ktv.tv_sec, &up->tv_sec);
429 err |= __put_user(ktv.tv_usec, &up->tv_usec);
435 compat_ulong_t mem_start;
436 compat_ulong_t mem_end;
437 unsigned short base_addr;
444 #define IFHWADDRLEN 6
447 char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
450 struct sockaddr ifru_addr;
451 struct sockaddr ifru_dstaddr;
452 struct sockaddr ifru_broadaddr;
453 struct sockaddr ifru_netmask;
454 struct sockaddr ifru_hwaddr;
456 compat_int_t ifru_ivalue;
457 compat_int_t ifru_mtu;
458 struct ifmap32 ifru_map;
459 char ifru_slave[IFNAMSIZ]; /* Just fits the size */
460 char ifru_newname[IFNAMSIZ];
461 compat_caddr_t ifru_data;
462 /* XXXX? ifru_settings should be here */
467 compat_int_t ifc_len; /* size of buffer */
468 compat_caddr_t ifcbuf;
471 static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg)
473 struct net_device *dev;
474 struct ifreq32 ifr32;
477 if (copy_from_user(&ifr32, compat_ptr(arg), sizeof(ifr32)))
480 dev = dev_get_by_index(ifr32.ifr_ifindex);
484 strlcpy(ifr32.ifr_name, dev->name, sizeof(ifr32.ifr_name));
487 err = copy_to_user(compat_ptr(arg), &ifr32, sizeof(ifr32));
488 return (err ? -EFAULT : 0);
491 static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg)
493 struct ifconf32 ifc32;
495 struct ifconf __user *uifc;
496 struct ifreq32 __user *ifr32;
497 struct ifreq __user *ifr;
501 if (copy_from_user(&ifc32, compat_ptr(arg), sizeof(struct ifconf32)))
504 if (ifc32.ifcbuf == 0) {
508 uifc = compat_alloc_user_space(sizeof(struct ifconf));
510 size_t len =((ifc32.ifc_len / sizeof (struct ifreq32)) + 1) *
511 sizeof (struct ifreq);
512 uifc = compat_alloc_user_space(sizeof(struct ifconf) + len);
514 ifr = ifc.ifc_req = (void __user *)(uifc + 1);
515 ifr32 = compat_ptr(ifc32.ifcbuf);
516 for (i = 0; i < ifc32.ifc_len; i += sizeof (struct ifreq32)) {
517 if (copy_in_user(ifr, ifr32, sizeof(struct ifreq32)))
523 if (copy_to_user(uifc, &ifc, sizeof(struct ifconf)))
526 err = sys_ioctl (fd, SIOCGIFCONF, (unsigned long)uifc);
530 if (copy_from_user(&ifc, uifc, sizeof(struct ifconf)))
534 ifr32 = compat_ptr(ifc32.ifcbuf);
535 for (i = 0, j = 0; i < ifc32.ifc_len && j < ifc.ifc_len;
536 i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) {
537 if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32)))
543 if (ifc32.ifcbuf == 0) {
544 /* Translate from 64-bit structure multiple to
548 i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32));
551 if (i <= ifc32.ifc_len)
554 ifc32.ifc_len = i - sizeof (struct ifreq32);
556 if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32)))
562 static int ethtool_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
564 struct ifreq __user *ifr;
565 struct ifreq32 __user *ifr32;
569 ifr = compat_alloc_user_space(sizeof(*ifr));
570 ifr32 = compat_ptr(arg);
572 if (copy_in_user(&ifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ))
575 if (get_user(data, &ifr32->ifr_ifru.ifru_data))
578 datap = compat_ptr(data);
579 if (put_user(datap, &ifr->ifr_ifru.ifru_data))
582 return sys_ioctl(fd, cmd, (unsigned long) ifr);
585 static int bond_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
588 struct ifreq __user *uifr;
589 struct ifreq32 __user *ifr32 = compat_ptr(arg);
596 case SIOCBONDENSLAVE:
597 case SIOCBONDRELEASE:
598 case SIOCBONDSETHWADDR:
599 case SIOCBONDCHANGEACTIVE:
600 if (copy_from_user(&kifr, ifr32, sizeof(struct ifreq32)))
605 err = sys_ioctl (fd, cmd, (unsigned long)&kifr);
609 case SIOCBONDSLAVEINFOQUERY:
610 case SIOCBONDINFOQUERY:
611 uifr = compat_alloc_user_space(sizeof(*uifr));
612 if (copy_in_user(&uifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ))
615 if (get_user(data, &ifr32->ifr_ifru.ifru_data))
618 datap = compat_ptr(data);
619 if (put_user(datap, &uifr->ifr_ifru.ifru_data))
622 return sys_ioctl (fd, cmd, (unsigned long)uifr);
628 int siocdevprivate_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
630 struct ifreq __user *u_ifreq64;
631 struct ifreq32 __user *u_ifreq32 = compat_ptr(arg);
632 char tmp_buf[IFNAMSIZ];
636 if (copy_from_user(&tmp_buf[0], &(u_ifreq32->ifr_ifrn.ifrn_name[0]),
639 if (__get_user(data32, &u_ifreq32->ifr_ifru.ifru_data))
641 data64 = compat_ptr(data32);
643 u_ifreq64 = compat_alloc_user_space(sizeof(*u_ifreq64));
645 /* Don't check these user accesses, just let that get trapped
646 * in the ioctl handler instead.
648 if (copy_to_user(&u_ifreq64->ifr_ifrn.ifrn_name[0], &tmp_buf[0],
651 if (__put_user(data64, &u_ifreq64->ifr_ifru.ifru_data))
654 return sys_ioctl(fd, cmd, (unsigned long) u_ifreq64);
657 static int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg)
660 struct ifreq32 __user *uifr32;
661 struct ifmap32 __user *uifmap32;
665 uifr32 = compat_ptr(arg);
666 uifmap32 = &uifr32->ifr_ifru.ifru_map;
669 err = copy_from_user(&ifr, uifr32, sizeof(ifr.ifr_name));
670 err |= __get_user(ifr.ifr_map.mem_start, &uifmap32->mem_start);
671 err |= __get_user(ifr.ifr_map.mem_end, &uifmap32->mem_end);
672 err |= __get_user(ifr.ifr_map.base_addr, &uifmap32->base_addr);
673 err |= __get_user(ifr.ifr_map.irq, &uifmap32->irq);
674 err |= __get_user(ifr.ifr_map.dma, &uifmap32->dma);
675 err |= __get_user(ifr.ifr_map.port, &uifmap32->port);
680 if (copy_from_user(&ifr, uifr32, sizeof(*uifr32)))
686 err = sys_ioctl (fd, cmd, (unsigned long)&ifr);
690 /* TUNSETIFF is defined as _IOW, it should be _IORW
691 * as the data is copied back to user space, but that
692 * cannot be fixed without breaking all existing apps.
706 if (copy_to_user(uifr32, &ifr, sizeof(*uifr32)))
710 err = copy_to_user(uifr32, &ifr, sizeof(ifr.ifr_name));
711 err |= __put_user(ifr.ifr_map.mem_start, &uifmap32->mem_start);
712 err |= __put_user(ifr.ifr_map.mem_end, &uifmap32->mem_end);
713 err |= __put_user(ifr.ifr_map.base_addr, &uifmap32->base_addr);
714 err |= __put_user(ifr.ifr_map.irq, &uifmap32->irq);
715 err |= __put_user(ifr.ifr_map.dma, &uifmap32->dma);
716 err |= __put_user(ifr.ifr_map.port, &uifmap32->port);
727 struct sockaddr rt_dst; /* target address */
728 struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */
729 struct sockaddr rt_genmask; /* target network mask (IP) */
730 unsigned short rt_flags;
733 unsigned char rt_tos;
734 unsigned char rt_class;
736 short rt_metric; /* +1 for binary compatibility! */
737 /* char * */ u32 rt_dev; /* forcing the device at add */
738 u32 rt_mtu; /* per route MTU/Window */
739 u32 rt_window; /* Window clamping */
740 unsigned short rt_irtt; /* Initial RTT */
745 struct in6_addr rtmsg_dst;
746 struct in6_addr rtmsg_src;
747 struct in6_addr rtmsg_gateway;
757 static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
765 mm_segment_t old_fs = get_fs();
767 struct socket *mysock = sockfd_lookup(fd, &ret);
769 if (mysock && mysock->sk && mysock->sk->sk_family == AF_INET6) { /* ipv6 */
770 struct in6_rtmsg32 __user *ur6 = compat_ptr(arg);
771 ret = copy_from_user (&r6.rtmsg_dst, &(ur6->rtmsg_dst),
772 3 * sizeof(struct in6_addr));
773 ret |= __get_user (r6.rtmsg_type, &(ur6->rtmsg_type));
774 ret |= __get_user (r6.rtmsg_dst_len, &(ur6->rtmsg_dst_len));
775 ret |= __get_user (r6.rtmsg_src_len, &(ur6->rtmsg_src_len));
776 ret |= __get_user (r6.rtmsg_metric, &(ur6->rtmsg_metric));
777 ret |= __get_user (r6.rtmsg_info, &(ur6->rtmsg_info));
778 ret |= __get_user (r6.rtmsg_flags, &(ur6->rtmsg_flags));
779 ret |= __get_user (r6.rtmsg_ifindex, &(ur6->rtmsg_ifindex));
783 struct rtentry32 __user *ur4 = compat_ptr(arg);
784 ret = copy_from_user (&r4.rt_dst, &(ur4->rt_dst),
785 3 * sizeof(struct sockaddr));
786 ret |= __get_user (r4.rt_flags, &(ur4->rt_flags));
787 ret |= __get_user (r4.rt_metric, &(ur4->rt_metric));
788 ret |= __get_user (r4.rt_mtu, &(ur4->rt_mtu));
789 ret |= __get_user (r4.rt_window, &(ur4->rt_window));
790 ret |= __get_user (r4.rt_irtt, &(ur4->rt_irtt));
791 ret |= __get_user (rtdev, &(ur4->rt_dev));
793 ret |= copy_from_user (devname, compat_ptr(rtdev), 15);
794 r4.rt_dev = devname; devname[15] = 0;
807 ret = sys_ioctl (fd, cmd, (unsigned long) r);
818 struct hd_geometry32 {
820 unsigned char sectors;
821 unsigned short cylinders;
825 static int hdio_getgeo(unsigned int fd, unsigned int cmd, unsigned long arg)
827 mm_segment_t old_fs = get_fs();
828 struct hd_geometry geo;
829 struct hd_geometry32 __user *ugeo;
833 err = sys_ioctl(fd, HDIO_GETGEO, (unsigned long)&geo);
835 ugeo = compat_ptr(arg);
837 err = copy_to_user (ugeo, &geo, 4);
838 err |= __put_user (geo.start, &ugeo->start);
840 return err ? -EFAULT : 0;
843 static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
845 mm_segment_t old_fs = get_fs();
847 unsigned int __user *uvp;
851 error = sys_ioctl(fd, cmd, (long)&kval);
855 uvp = compat_ptr(arg);
856 if(put_user(kval, uvp))
863 typedef struct sg_io_hdr32 {
864 compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */
865 compat_int_t dxfer_direction; /* [i] data transfer direction */
866 unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */
867 unsigned char mx_sb_len; /* [i] max length to write to sbp */
868 unsigned short iovec_count; /* [i] 0 implies no scatter gather */
869 compat_uint_t dxfer_len; /* [i] byte count of data transfer */
870 compat_uint_t dxferp; /* [i], [*io] points to data transfer memory
871 or scatter gather list */
872 compat_uptr_t cmdp; /* [i], [*i] points to command to perform */
873 compat_uptr_t sbp; /* [i], [*o] points to sense_buffer memory */
874 compat_uint_t timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */
875 compat_uint_t flags; /* [i] 0 -> default, see SG_FLAG... */
876 compat_int_t pack_id; /* [i->o] unused internally (normally) */
877 compat_uptr_t usr_ptr; /* [i->o] unused internally */
878 unsigned char status; /* [o] scsi status */
879 unsigned char masked_status; /* [o] shifted, masked scsi status */
880 unsigned char msg_status; /* [o] messaging level data (optional) */
881 unsigned char sb_len_wr; /* [o] byte count actually written to sbp */
882 unsigned short host_status; /* [o] errors from host adapter */
883 unsigned short driver_status; /* [o] errors from software driver */
884 compat_int_t resid; /* [o] dxfer_len - actual_transferred */
885 compat_uint_t duration; /* [o] time taken by cmd (unit: millisec) */
886 compat_uint_t info; /* [o] auxiliary information */
887 } sg_io_hdr32_t; /* 64 bytes long (on sparc32) */
889 typedef struct sg_iovec32 {
890 compat_uint_t iov_base;
891 compat_uint_t iov_len;
894 static int sg_build_iovec(sg_io_hdr_t __user *sgio, void __user *dxferp, u16 iovec_count)
896 sg_iovec_t __user *iov = (sg_iovec_t __user *) (sgio + 1);
897 sg_iovec32_t __user *iov32 = dxferp;
900 for (i = 0; i < iovec_count; i++) {
903 if (get_user(base, &iov32[i].iov_base) ||
904 get_user(len, &iov32[i].iov_len) ||
905 put_user(compat_ptr(base), &iov[i].iov_base) ||
906 put_user(len, &iov[i].iov_len))
910 if (put_user(iov, &sgio->dxferp))
915 static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
917 sg_io_hdr_t __user *sgio;
918 sg_io_hdr32_t __user *sgio32;
924 sgio32 = compat_ptr(arg);
925 if (get_user(iovec_count, &sgio32->iovec_count))
929 void __user *top = compat_alloc_user_space(0);
930 void __user *new = compat_alloc_user_space(sizeof(sg_io_hdr_t) +
931 (iovec_count * sizeof(sg_iovec_t)));
938 /* Ok, now construct. */
939 if (copy_in_user(&sgio->interface_id, &sgio32->interface_id,
941 (2 * sizeof(unsigned char)) +
942 (1 * sizeof(unsigned short)) +
943 (1 * sizeof(unsigned int))))
946 if (get_user(data, &sgio32->dxferp))
948 dxferp = compat_ptr(data);
950 if (sg_build_iovec(sgio, dxferp, iovec_count))
953 if (put_user(dxferp, &sgio->dxferp))
958 unsigned char __user *cmdp;
959 unsigned char __user *sbp;
961 if (get_user(data, &sgio32->cmdp))
963 cmdp = compat_ptr(data);
965 if (get_user(data, &sgio32->sbp))
967 sbp = compat_ptr(data);
969 if (put_user(cmdp, &sgio->cmdp) ||
970 put_user(sbp, &sgio->sbp))
974 if (copy_in_user(&sgio->timeout, &sgio32->timeout,
978 if (get_user(data, &sgio32->usr_ptr))
980 if (put_user(compat_ptr(data), &sgio->usr_ptr))
983 if (copy_in_user(&sgio->status, &sgio32->status,
984 (4 * sizeof(unsigned char)) +
985 (2 * sizeof(unsigned (short))) +
989 err = sys_ioctl(fd, cmd, (unsigned long) sgio);
994 if (copy_in_user(&sgio32->pack_id, &sgio->pack_id,
996 get_user(datap, &sgio->usr_ptr) ||
997 put_user((u32)(unsigned long)datap,
999 copy_in_user(&sgio32->status, &sgio->status,
1000 (4 * sizeof(unsigned char)) +
1001 (2 * sizeof(unsigned short)) +
1009 struct sock_fprog32 {
1011 compat_caddr_t filter;
1014 #define PPPIOCSPASS32 _IOW('t', 71, struct sock_fprog32)
1015 #define PPPIOCSACTIVE32 _IOW('t', 70, struct sock_fprog32)
1017 static int ppp_sock_fprog_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
1019 struct sock_fprog32 __user *u_fprog32 = compat_ptr(arg);
1020 struct sock_fprog __user *u_fprog64 = compat_alloc_user_space(sizeof(struct sock_fprog));
1021 void __user *fptr64;
1025 if (get_user(flen, &u_fprog32->len) ||
1026 get_user(fptr32, &u_fprog32->filter))
1029 fptr64 = compat_ptr(fptr32);
1031 if (put_user(flen, &u_fprog64->len) ||
1032 put_user(fptr64, &u_fprog64->filter))
1035 if (cmd == PPPIOCSPASS32)
1038 cmd = PPPIOCSACTIVE;
1040 return sys_ioctl(fd, cmd, (unsigned long) u_fprog64);
1043 struct ppp_option_data32 {
1046 compat_int_t transmit;
1048 #define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
1051 compat_time_t xmit_idle;
1052 compat_time_t recv_idle;
1054 #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
1056 static int ppp_gidle(unsigned int fd, unsigned int cmd, unsigned long arg)
1058 struct ppp_idle __user *idle;
1059 struct ppp_idle32 __user *idle32;
1060 __kernel_time_t xmit, recv;
1063 idle = compat_alloc_user_space(sizeof(*idle));
1064 idle32 = compat_ptr(arg);
1066 err = sys_ioctl(fd, PPPIOCGIDLE, (unsigned long) idle);
1069 if (get_user(xmit, &idle->xmit_idle) ||
1070 get_user(recv, &idle->recv_idle) ||
1071 put_user(xmit, &idle32->xmit_idle) ||
1072 put_user(recv, &idle32->recv_idle))
1078 static int ppp_scompress(unsigned int fd, unsigned int cmd, unsigned long arg)
1080 struct ppp_option_data __user *odata;
1081 struct ppp_option_data32 __user *odata32;
1085 odata = compat_alloc_user_space(sizeof(*odata));
1086 odata32 = compat_ptr(arg);
1088 if (get_user(data, &odata32->ptr))
1091 datap = compat_ptr(data);
1092 if (put_user(datap, &odata->ptr))
1095 if (copy_in_user(&odata->length, &odata32->length,
1096 sizeof(__u32) + sizeof(int)))
1099 return sys_ioctl(fd, PPPIOCSCOMPRESS, (unsigned long) odata);
1102 static int ppp_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
1108 err = ppp_gidle(fd, cmd, arg);
1111 case PPPIOCSCOMPRESS32:
1112 err = ppp_scompress(fd, cmd, arg);
1119 printk("ppp_ioctl: Unknown cmd fd(%d) "
1120 "cmd(%08x) arg(%08x)\n",
1121 (int)fd, (unsigned int)cmd, (unsigned int)arg);
1132 compat_long_t mt_type;
1133 compat_long_t mt_resid;
1134 compat_long_t mt_dsreg;
1135 compat_long_t mt_gstat;
1136 compat_long_t mt_erreg;
1137 compat_daddr_t mt_fileno;
1138 compat_daddr_t mt_blkno;
1140 #define MTIOCGET32 _IOR('m', 2, struct mtget32)
1143 compat_long_t mt_blkno;
1145 #define MTIOCPOS32 _IOR('m', 3, struct mtpos32)
1147 static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
1149 mm_segment_t old_fs = get_fs();
1151 struct mtget32 __user *umget32;
1153 struct mtpos32 __user *upos32;
1171 printk("mt_ioctl: Unknown cmd fd(%d) "
1172 "cmd(%08x) arg(%08x)\n",
1173 (int)fd, (unsigned int)cmd, (unsigned int)arg);
1178 err = sys_ioctl (fd, kcmd, (unsigned long)karg);
1184 upos32 = compat_ptr(arg);
1185 err = __put_user(pos.mt_blkno, &upos32->mt_blkno);
1188 umget32 = compat_ptr(arg);
1189 err = __put_user(get.mt_type, &umget32->mt_type);
1190 err |= __put_user(get.mt_resid, &umget32->mt_resid);
1191 err |= __put_user(get.mt_dsreg, &umget32->mt_dsreg);
1192 err |= __put_user(get.mt_gstat, &umget32->mt_gstat);
1193 err |= __put_user(get.mt_erreg, &umget32->mt_erreg);
1194 err |= __put_user(get.mt_fileno, &umget32->mt_fileno);
1195 err |= __put_user(get.mt_blkno, &umget32->mt_blkno);
1198 return err ? -EFAULT: 0;
1201 struct cdrom_read_audio32 {
1202 union cdrom_addr addr;
1204 compat_int_t nframes;
1208 struct cdrom_generic_command32 {
1209 unsigned char cmd[CDROM_PACKET_SIZE];
1210 compat_caddr_t buffer;
1211 compat_uint_t buflen;
1213 compat_caddr_t sense;
1214 unsigned char data_direction;
1216 compat_int_t timeout;
1217 compat_caddr_t reserved[1];
1220 static int cdrom_do_read_audio(unsigned int fd, unsigned int cmd, unsigned long arg)
1222 struct cdrom_read_audio __user *cdread_audio;
1223 struct cdrom_read_audio32 __user *cdread_audio32;
1227 cdread_audio = compat_alloc_user_space(sizeof(*cdread_audio));
1228 cdread_audio32 = compat_ptr(arg);
1230 if (copy_in_user(&cdread_audio->addr,
1231 &cdread_audio32->addr,
1232 (sizeof(*cdread_audio32) -
1233 sizeof(compat_caddr_t))))
1236 if (get_user(data, &cdread_audio32->buf))
1238 datap = compat_ptr(data);
1239 if (put_user(datap, &cdread_audio->buf))
1242 return sys_ioctl(fd, cmd, (unsigned long) cdread_audio);
1245 static int cdrom_do_generic_command(unsigned int fd, unsigned int cmd, unsigned long arg)
1247 struct cdrom_generic_command __user *cgc;
1248 struct cdrom_generic_command32 __user *cgc32;
1253 cgc = compat_alloc_user_space(sizeof(*cgc));
1254 cgc32 = compat_ptr(arg);
1256 if (copy_in_user(&cgc->cmd, &cgc32->cmd, sizeof(cgc->cmd)) ||
1257 get_user(data, &cgc32->buffer) ||
1258 put_user(compat_ptr(data), &cgc->buffer) ||
1259 copy_in_user(&cgc->buflen, &cgc32->buflen,
1260 (sizeof(unsigned int) + sizeof(int))) ||
1261 get_user(data, &cgc32->sense) ||
1262 put_user(compat_ptr(data), &cgc->sense) ||
1263 get_user(dir, &cgc32->data_direction) ||
1264 put_user(dir, &cgc->data_direction) ||
1265 get_user(itmp, &cgc32->quiet) ||
1266 put_user(itmp, &cgc->quiet) ||
1267 get_user(itmp, &cgc32->timeout) ||
1268 put_user(itmp, &cgc->timeout) ||
1269 get_user(data, &cgc32->reserved[0]) ||
1270 put_user(compat_ptr(data), &cgc->reserved[0]))
1273 return sys_ioctl(fd, cmd, (unsigned long) cgc);
1276 static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
1281 case CDROMREADAUDIO:
1282 err = cdrom_do_read_audio(fd, cmd, arg);
1285 case CDROM_SEND_PACKET:
1286 err = cdrom_do_generic_command(fd, cmd, arg);
1293 printk("cdrom_ioctl: Unknown cmd fd(%d) "
1294 "cmd(%08x) arg(%08x)\n",
1295 (int)fd, (unsigned int)cmd, (unsigned int)arg);
1304 struct loop_info32 {
1305 compat_int_t lo_number; /* ioctl r/o */
1306 compat_dev_t lo_device; /* ioctl r/o */
1307 compat_ulong_t lo_inode; /* ioctl r/o */
1308 compat_dev_t lo_rdevice; /* ioctl r/o */
1309 compat_int_t lo_offset;
1310 compat_int_t lo_encrypt_type;
1311 compat_int_t lo_encrypt_key_size; /* ioctl w/o */
1312 compat_int_t lo_flags; /* ioctl r/o */
1313 char lo_name[LO_NAME_SIZE];
1314 unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
1315 compat_ulong_t lo_init[2];
1319 static int loop_status(unsigned int fd, unsigned int cmd, unsigned long arg)
1321 mm_segment_t old_fs = get_fs();
1323 struct loop_info32 __user *ul;
1326 ul = compat_ptr(arg);
1328 case LOOP_SET_STATUS:
1329 err = get_user(l.lo_number, &ul->lo_number);
1330 err |= __get_user(l.lo_device, &ul->lo_device);
1331 err |= __get_user(l.lo_inode, &ul->lo_inode);
1332 err |= __get_user(l.lo_rdevice, &ul->lo_rdevice);
1333 err |= __copy_from_user(&l.lo_offset, &ul->lo_offset,
1334 8 + (unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
1339 err = sys_ioctl (fd, cmd, (unsigned long)&l);
1343 case LOOP_GET_STATUS:
1345 err = sys_ioctl (fd, cmd, (unsigned long)&l);
1348 err = put_user(l.lo_number, &ul->lo_number);
1349 err |= __put_user(l.lo_device, &ul->lo_device);
1350 err |= __put_user(l.lo_inode, &ul->lo_inode);
1351 err |= __put_user(l.lo_rdevice, &ul->lo_rdevice);
1352 err |= __copy_to_user(&ul->lo_offset, &l.lo_offset,
1353 (unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
1361 printk("%s: Unknown loop ioctl cmd, fd(%d) "
1362 "cmd(%08x) arg(%08lx)\n",
1363 __FUNCTION__, fd, cmd, arg);
1369 extern int tty_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg);
1373 static int vt_check(struct file *file)
1375 struct tty_struct *tty;
1376 struct inode *inode = file->f_dentry->d_inode;
1378 if (file->f_op->ioctl != tty_ioctl)
1381 tty = (struct tty_struct *)file->private_data;
1382 if (tty_paranoia_check(tty, inode, "tty_ioctl"))
1385 if (tty->driver->ioctl != vt_ioctl)
1389 * To have permissions to do most of the vt ioctls, we either have
1390 * to be the owner of the tty, or super-user.
1392 if (current->signal->tty == tty || capable(CAP_SYS_ADMIN))
1397 struct consolefontdesc32 {
1398 unsigned short charcount; /* characters in font (256 or 512) */
1399 unsigned short charheight; /* scan lines per character (1-32) */
1400 compat_caddr_t chardata; /* font data in expanded form */
1403 static int do_fontx_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file)
1405 struct consolefontdesc32 __user *user_cfd = compat_ptr(arg);
1406 struct console_font_op op;
1407 compat_caddr_t data;
1410 perm = vt_check(file);
1411 if (perm < 0) return perm;
1417 op.op = KD_FONT_OP_SET;
1420 if (get_user(op.height, &user_cfd->charheight) ||
1421 get_user(op.charcount, &user_cfd->charcount) ||
1422 get_user(data, &user_cfd->chardata))
1424 op.data = compat_ptr(data);
1425 return con_font_op(vc_cons[fg_console].d, &op);
1427 op.op = KD_FONT_OP_GET;
1430 if (get_user(op.height, &user_cfd->charheight) ||
1431 get_user(op.charcount, &user_cfd->charcount) ||
1432 get_user(data, &user_cfd->chardata))
1436 op.data = compat_ptr(data);
1437 i = con_font_op(vc_cons[fg_console].d, &op);
1440 if (put_user(op.height, &user_cfd->charheight) ||
1441 put_user(op.charcount, &user_cfd->charcount) ||
1442 put_user((compat_caddr_t)(unsigned long)op.data,
1443 &user_cfd->chardata))
1450 struct console_font_op32 {
1451 compat_uint_t op; /* operation code KD_FONT_OP_* */
1452 compat_uint_t flags; /* KD_FONT_FLAG_* */
1453 compat_uint_t width, height; /* font size */
1454 compat_uint_t charcount;
1455 compat_caddr_t data; /* font data with height fixed to 32 */
1458 static int do_kdfontop_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file)
1460 struct console_font_op op;
1461 struct console_font_op32 __user *fontop = compat_ptr(arg);
1462 int perm = vt_check(file), i;
1465 if (perm < 0) return perm;
1467 if (copy_from_user(&op, fontop, sizeof(struct console_font_op32)))
1469 if (!perm && op.op != KD_FONT_OP_GET)
1471 op.data = compat_ptr(((struct console_font_op32 *)&op)->data);
1472 op.flags |= KD_FONT_FLAG_OLD;
1473 vc = ((struct tty_struct *)file->private_data)->driver_data;
1474 i = con_font_op(vc, &op);
1477 ((struct console_font_op32 *)&op)->data = (unsigned long)op.data;
1478 if (copy_to_user(fontop, &op, sizeof(struct console_font_op32)))
1483 struct unimapdesc32 {
1484 unsigned short entry_ct;
1485 compat_caddr_t entries;
1488 static int do_unimap_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file)
1490 struct unimapdesc32 tmp;
1491 struct unimapdesc32 __user *user_ud = compat_ptr(arg);
1492 int perm = vt_check(file);
1494 if (perm < 0) return perm;
1495 if (copy_from_user(&tmp, user_ud, sizeof tmp))
1499 if (!perm) return -EPERM;
1500 return con_set_unimap(vc_cons[fg_console].d, tmp.entry_ct, compat_ptr(tmp.entries));
1502 return con_get_unimap(vc_cons[fg_console].d, tmp.entry_ct, &(user_ud->entry_ct), compat_ptr(tmp.entries));
1507 #endif /* CONFIG_VT */
1509 static int do_smb_getmountuid(unsigned int fd, unsigned int cmd, unsigned long arg)
1511 mm_segment_t old_fs = get_fs();
1512 __kernel_uid_t kuid;
1515 cmd = SMB_IOC_GETMOUNTUID;
1518 err = sys_ioctl(fd, cmd, (unsigned long)&kuid);
1522 err = put_user(kuid, (compat_uid_t __user *)compat_ptr(arg));
1527 struct atmif_sioc32 {
1528 compat_int_t number;
1529 compat_int_t length;
1533 struct atm_iobuf32 {
1534 compat_int_t length;
1535 compat_caddr_t buffer;
1538 #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32)
1539 #define ATM_GETNAMES32 _IOW('a', ATMIOC_ITF+3, struct atm_iobuf32)
1540 #define ATM_GETTYPE32 _IOW('a', ATMIOC_ITF+4, struct atmif_sioc32)
1541 #define ATM_GETESI32 _IOW('a', ATMIOC_ITF+5, struct atmif_sioc32)
1542 #define ATM_GETADDR32 _IOW('a', ATMIOC_ITF+6, struct atmif_sioc32)
1543 #define ATM_RSTADDR32 _IOW('a', ATMIOC_ITF+7, struct atmif_sioc32)
1544 #define ATM_ADDADDR32 _IOW('a', ATMIOC_ITF+8, struct atmif_sioc32)
1545 #define ATM_DELADDR32 _IOW('a', ATMIOC_ITF+9, struct atmif_sioc32)
1546 #define ATM_GETCIRANGE32 _IOW('a', ATMIOC_ITF+10, struct atmif_sioc32)
1547 #define ATM_SETCIRANGE32 _IOW('a', ATMIOC_ITF+11, struct atmif_sioc32)
1548 #define ATM_SETESI32 _IOW('a', ATMIOC_ITF+12, struct atmif_sioc32)
1549 #define ATM_SETESIF32 _IOW('a', ATMIOC_ITF+13, struct atmif_sioc32)
1550 #define ATM_GETSTAT32 _IOW('a', ATMIOC_SARCOM+0, struct atmif_sioc32)
1551 #define ATM_GETSTATZ32 _IOW('a', ATMIOC_SARCOM+1, struct atmif_sioc32)
1552 #define ATM_GETLOOP32 _IOW('a', ATMIOC_SARCOM+2, struct atmif_sioc32)
1553 #define ATM_SETLOOP32 _IOW('a', ATMIOC_SARCOM+3, struct atmif_sioc32)
1554 #define ATM_QUERYLOOP32 _IOW('a', ATMIOC_SARCOM+4, struct atmif_sioc32)
1559 } atm_ioctl_map[] = {
1560 { ATM_GETLINKRATE32, ATM_GETLINKRATE },
1561 { ATM_GETNAMES32, ATM_GETNAMES },
1562 { ATM_GETTYPE32, ATM_GETTYPE },
1563 { ATM_GETESI32, ATM_GETESI },
1564 { ATM_GETADDR32, ATM_GETADDR },
1565 { ATM_RSTADDR32, ATM_RSTADDR },
1566 { ATM_ADDADDR32, ATM_ADDADDR },
1567 { ATM_DELADDR32, ATM_DELADDR },
1568 { ATM_GETCIRANGE32, ATM_GETCIRANGE },
1569 { ATM_SETCIRANGE32, ATM_SETCIRANGE },
1570 { ATM_SETESI32, ATM_SETESI },
1571 { ATM_SETESIF32, ATM_SETESIF },
1572 { ATM_GETSTAT32, ATM_GETSTAT },
1573 { ATM_GETSTATZ32, ATM_GETSTATZ },
1574 { ATM_GETLOOP32, ATM_GETLOOP },
1575 { ATM_SETLOOP32, ATM_SETLOOP },
1576 { ATM_QUERYLOOP32, ATM_QUERYLOOP }
1579 #define NR_ATM_IOCTL (sizeof(atm_ioctl_map)/sizeof(atm_ioctl_map[0]))
1582 static int do_atm_iobuf(unsigned int fd, unsigned int cmd, unsigned long arg)
1584 struct atm_iobuf __user *iobuf;
1585 struct atm_iobuf32 __user *iobuf32;
1590 iobuf = compat_alloc_user_space(sizeof(*iobuf));
1591 iobuf32 = compat_ptr(arg);
1593 if (get_user(len, &iobuf32->length) ||
1594 get_user(data, &iobuf32->buffer))
1596 datap = compat_ptr(data);
1597 if (put_user(len, &iobuf->length) ||
1598 put_user(datap, &iobuf->buffer))
1601 err = sys_ioctl(fd, cmd, (unsigned long)iobuf);
1604 if (copy_in_user(&iobuf32->length, &iobuf->length,
1612 static int do_atmif_sioc(unsigned int fd, unsigned int cmd, unsigned long arg)
1614 struct atmif_sioc __user *sioc;
1615 struct atmif_sioc32 __user *sioc32;
1620 sioc = compat_alloc_user_space(sizeof(*sioc));
1621 sioc32 = compat_ptr(arg);
1623 if (copy_in_user(&sioc->number, &sioc32->number, 2 * sizeof(int)) ||
1624 get_user(data, &sioc32->arg))
1626 datap = compat_ptr(data);
1627 if (put_user(datap, &sioc->arg))
1630 err = sys_ioctl(fd, cmd, (unsigned long) sioc);
1633 if (copy_in_user(&sioc32->length, &sioc->length,
1640 static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg)
1643 unsigned int cmd = 0;
1647 case SONET_GETSTATZ:
1651 case SONET_SETFRAMING:
1652 case SONET_GETFRAMING:
1653 case SONET_GETFRSENSE:
1654 return do_atmif_sioc(fd, cmd32, arg);
1657 for (i = 0; i < NR_ATM_IOCTL; i++) {
1658 if (cmd32 == atm_ioctl_map[i].cmd32) {
1659 cmd = atm_ioctl_map[i].cmd;
1663 if (i == NR_ATM_IOCTL)
1668 return do_atm_iobuf(fd, cmd, arg);
1670 case ATM_GETLINKRATE:
1677 case ATM_GETCIRANGE:
1678 case ATM_SETCIRANGE:
1686 return do_atmif_sioc(fd, cmd, arg);
1692 static __attribute_used__ int
1693 ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg)
1698 static int broken_blkgetsize(unsigned int fd, unsigned int cmd, unsigned long arg)
1700 /* The mkswap binary hard codes it to Intel value :-((( */
1701 return w_long(fd, BLKGETSIZE, arg);
1704 struct blkpg_ioctl_arg32 {
1707 compat_int_t datalen;
1708 compat_caddr_t data;
1711 static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
1713 struct blkpg_ioctl_arg32 __user *ua32 = compat_ptr(arg);
1714 struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a));
1715 compat_caddr_t udata;
1719 err = get_user(n, &ua32->op);
1720 err |= put_user(n, &a->op);
1721 err |= get_user(n, &ua32->flags);
1722 err |= put_user(n, &a->flags);
1723 err |= get_user(n, &ua32->datalen);
1724 err |= put_user(n, &a->datalen);
1725 err |= get_user(udata, &ua32->data);
1726 err |= put_user(compat_ptr(udata), &a->data);
1730 return sys_ioctl(fd, cmd, (unsigned long)a);
1733 static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg)
1735 return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg);
1738 /* Fix sizeof(sizeof()) breakage */
1739 #define BLKBSZGET_32 _IOR(0x12,112,int)
1740 #define BLKBSZSET_32 _IOW(0x12,113,int)
1741 #define BLKGETSIZE64_32 _IOR(0x12,114,int)
1743 static int do_blkbszget(unsigned int fd, unsigned int cmd, unsigned long arg)
1745 return sys_ioctl(fd, BLKBSZGET, (unsigned long)compat_ptr(arg));
1748 static int do_blkbszset(unsigned int fd, unsigned int cmd, unsigned long arg)
1750 return sys_ioctl(fd, BLKBSZSET, (unsigned long)compat_ptr(arg));
1753 static int do_blkgetsize64(unsigned int fd, unsigned int cmd,
1756 return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg));
1759 /* Bluetooth ioctls */
1760 #define HCIUARTSETPROTO _IOW('U', 200, int)
1761 #define HCIUARTGETPROTO _IOR('U', 201, int)
1763 #define BNEPCONNADD _IOW('B', 200, int)
1764 #define BNEPCONNDEL _IOW('B', 201, int)
1765 #define BNEPGETCONNLIST _IOR('B', 210, int)
1766 #define BNEPGETCONNINFO _IOR('B', 211, int)
1768 #define CMTPCONNADD _IOW('C', 200, int)
1769 #define CMTPCONNDEL _IOW('C', 201, int)
1770 #define CMTPGETCONNLIST _IOR('C', 210, int)
1771 #define CMTPGETCONNINFO _IOR('C', 211, int)
1773 #define HIDPCONNADD _IOW('H', 200, int)
1774 #define HIDPCONNDEL _IOW('H', 201, int)
1775 #define HIDPGETCONNLIST _IOR('H', 210, int)
1776 #define HIDPGETCONNINFO _IOR('H', 211, int)
1778 struct floppy_struct32 {
1782 compat_uint_t track;
1783 compat_uint_t stretch;
1786 unsigned char spec1;
1787 unsigned char fmt_gap;
1788 const compat_caddr_t name;
1791 struct floppy_drive_params32 {
1793 compat_ulong_t max_dtr;
1797 compat_ulong_t spinup;
1798 compat_ulong_t spindown;
1799 unsigned char spindown_offset;
1800 unsigned char select_delay;
1802 unsigned char tracks;
1803 compat_ulong_t timeout;
1804 unsigned char interleave_sect;
1805 struct floppy_max_errors max_errors;
1808 short autodetect[8];
1809 compat_int_t checkfreq;
1810 compat_int_t native_format;
1813 struct floppy_drive_struct32 {
1815 compat_ulong_t spinup_date;
1816 compat_ulong_t select_date;
1817 compat_ulong_t first_read_date;
1818 short probed_format;
1822 compat_int_t generation;
1823 compat_int_t keep_data;
1824 compat_int_t fd_ref;
1825 compat_int_t fd_device;
1826 compat_int_t last_checked;
1827 compat_caddr_t dmabuf;
1828 compat_int_t bufblocks;
1831 struct floppy_fdc_state32 {
1835 unsigned char version;
1837 compat_ulong_t address;
1838 unsigned int rawcmd:2;
1839 unsigned int reset:1;
1840 unsigned int need_configure:1;
1841 unsigned int perp_mode:2;
1842 unsigned int has_fifo:1;
1843 unsigned int driver_version;
1844 unsigned char track[4];
1847 struct floppy_write_errors32 {
1848 unsigned int write_errors;
1849 compat_ulong_t first_error_sector;
1850 compat_int_t first_error_generation;
1851 compat_ulong_t last_error_sector;
1852 compat_int_t last_error_generation;
1853 compat_uint_t badness;
1856 #define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32)
1857 #define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32)
1858 #define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32)
1859 #define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32)
1860 #define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32)
1861 #define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32)
1862 #define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32)
1863 #define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32)
1864 #define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32)
1869 } fd_ioctl_trans_table[] = {
1870 { FDSETPRM32, FDSETPRM },
1871 { FDDEFPRM32, FDDEFPRM },
1872 { FDGETPRM32, FDGETPRM },
1873 { FDSETDRVPRM32, FDSETDRVPRM },
1874 { FDGETDRVPRM32, FDGETDRVPRM },
1875 { FDGETDRVSTAT32, FDGETDRVSTAT },
1876 { FDPOLLDRVSTAT32, FDPOLLDRVSTAT },
1877 { FDGETFDCSTAT32, FDGETFDCSTAT },
1878 { FDWERRORGET32, FDWERRORGET }
1881 #define NR_FD_IOCTL_TRANS (sizeof(fd_ioctl_trans_table)/sizeof(fd_ioctl_trans_table[0]))
1883 static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
1885 mm_segment_t old_fs = get_fs();
1887 unsigned int kcmd = 0;
1890 for (i = 0; i < NR_FD_IOCTL_TRANS; i++)
1891 if (cmd == fd_ioctl_trans_table[i].cmd32) {
1892 kcmd = fd_ioctl_trans_table[i].cmd;
1904 struct floppy_struct32 __user *uf;
1905 struct floppy_struct *f;
1907 uf = compat_ptr(arg);
1908 f = karg = kmalloc(sizeof(struct floppy_struct), GFP_KERNEL);
1911 if (cmd == FDGETPRM32)
1913 err = __get_user(f->size, &uf->size);
1914 err |= __get_user(f->sect, &uf->sect);
1915 err |= __get_user(f->head, &uf->head);
1916 err |= __get_user(f->track, &uf->track);
1917 err |= __get_user(f->stretch, &uf->stretch);
1918 err |= __get_user(f->gap, &uf->gap);
1919 err |= __get_user(f->rate, &uf->rate);
1920 err |= __get_user(f->spec1, &uf->spec1);
1921 err |= __get_user(f->fmt_gap, &uf->fmt_gap);
1922 err |= __get_user(name, &uf->name);
1923 f->name = compat_ptr(name);
1933 struct floppy_drive_params32 __user *uf;
1934 struct floppy_drive_params *f;
1936 uf = compat_ptr(arg);
1937 f = karg = kmalloc(sizeof(struct floppy_drive_params), GFP_KERNEL);
1940 if (cmd == FDGETDRVPRM32)
1942 err = __get_user(f->cmos, &uf->cmos);
1943 err |= __get_user(f->max_dtr, &uf->max_dtr);
1944 err |= __get_user(f->hlt, &uf->hlt);
1945 err |= __get_user(f->hut, &uf->hut);
1946 err |= __get_user(f->srt, &uf->srt);
1947 err |= __get_user(f->spinup, &uf->spinup);
1948 err |= __get_user(f->spindown, &uf->spindown);
1949 err |= __get_user(f->spindown_offset, &uf->spindown_offset);
1950 err |= __get_user(f->select_delay, &uf->select_delay);
1951 err |= __get_user(f->rps, &uf->rps);
1952 err |= __get_user(f->tracks, &uf->tracks);
1953 err |= __get_user(f->timeout, &uf->timeout);
1954 err |= __get_user(f->interleave_sect, &uf->interleave_sect);
1955 err |= __copy_from_user(&f->max_errors, &uf->max_errors, sizeof(f->max_errors));
1956 err |= __get_user(f->flags, &uf->flags);
1957 err |= __get_user(f->read_track, &uf->read_track);
1958 err |= __copy_from_user(f->autodetect, uf->autodetect, sizeof(f->autodetect));
1959 err |= __get_user(f->checkfreq, &uf->checkfreq);
1960 err |= __get_user(f->native_format, &uf->native_format);
1967 case FDGETDRVSTAT32:
1968 case FDPOLLDRVSTAT32:
1969 karg = kmalloc(sizeof(struct floppy_drive_struct), GFP_KERNEL);
1973 case FDGETFDCSTAT32:
1974 karg = kmalloc(sizeof(struct floppy_fdc_state), GFP_KERNEL);
1979 karg = kmalloc(sizeof(struct floppy_write_errors), GFP_KERNEL);
1987 err = sys_ioctl (fd, kcmd, (unsigned long)karg);
1994 struct floppy_struct *f = karg;
1995 struct floppy_struct32 __user *uf = compat_ptr(arg);
1997 err = __put_user(f->size, &uf->size);
1998 err |= __put_user(f->sect, &uf->sect);
1999 err |= __put_user(f->head, &uf->head);
2000 err |= __put_user(f->track, &uf->track);
2001 err |= __put_user(f->stretch, &uf->stretch);
2002 err |= __put_user(f->gap, &uf->gap);
2003 err |= __put_user(f->rate, &uf->rate);
2004 err |= __put_user(f->spec1, &uf->spec1);
2005 err |= __put_user(f->fmt_gap, &uf->fmt_gap);
2006 err |= __put_user((u64)f->name, (compat_caddr_t __user *)&uf->name);
2011 struct floppy_drive_params32 __user *uf;
2012 struct floppy_drive_params *f = karg;
2014 uf = compat_ptr(arg);
2015 err = __put_user(f->cmos, &uf->cmos);
2016 err |= __put_user(f->max_dtr, &uf->max_dtr);
2017 err |= __put_user(f->hlt, &uf->hlt);
2018 err |= __put_user(f->hut, &uf->hut);
2019 err |= __put_user(f->srt, &uf->srt);
2020 err |= __put_user(f->spinup, &uf->spinup);
2021 err |= __put_user(f->spindown, &uf->spindown);
2022 err |= __put_user(f->spindown_offset, &uf->spindown_offset);
2023 err |= __put_user(f->select_delay, &uf->select_delay);
2024 err |= __put_user(f->rps, &uf->rps);
2025 err |= __put_user(f->tracks, &uf->tracks);
2026 err |= __put_user(f->timeout, &uf->timeout);
2027 err |= __put_user(f->interleave_sect, &uf->interleave_sect);
2028 err |= __copy_to_user(&uf->max_errors, &f->max_errors, sizeof(f->max_errors));
2029 err |= __put_user(f->flags, &uf->flags);
2030 err |= __put_user(f->read_track, &uf->read_track);
2031 err |= __copy_to_user(uf->autodetect, f->autodetect, sizeof(f->autodetect));
2032 err |= __put_user(f->checkfreq, &uf->checkfreq);
2033 err |= __put_user(f->native_format, &uf->native_format);
2036 case FDGETDRVSTAT32:
2037 case FDPOLLDRVSTAT32:
2039 struct floppy_drive_struct32 __user *uf;
2040 struct floppy_drive_struct *f = karg;
2042 uf = compat_ptr(arg);
2043 err = __put_user(f->flags, &uf->flags);
2044 err |= __put_user(f->spinup_date, &uf->spinup_date);
2045 err |= __put_user(f->select_date, &uf->select_date);
2046 err |= __put_user(f->first_read_date, &uf->first_read_date);
2047 err |= __put_user(f->probed_format, &uf->probed_format);
2048 err |= __put_user(f->track, &uf->track);
2049 err |= __put_user(f->maxblock, &uf->maxblock);
2050 err |= __put_user(f->maxtrack, &uf->maxtrack);
2051 err |= __put_user(f->generation, &uf->generation);
2052 err |= __put_user(f->keep_data, &uf->keep_data);
2053 err |= __put_user(f->fd_ref, &uf->fd_ref);
2054 err |= __put_user(f->fd_device, &uf->fd_device);
2055 err |= __put_user(f->last_checked, &uf->last_checked);
2056 err |= __put_user((u64)f->dmabuf, &uf->dmabuf);
2057 err |= __put_user((u64)f->bufblocks, &uf->bufblocks);
2060 case FDGETFDCSTAT32:
2062 struct floppy_fdc_state32 __user *uf;
2063 struct floppy_fdc_state *f = karg;
2065 uf = compat_ptr(arg);
2066 err = __put_user(f->spec1, &uf->spec1);
2067 err |= __put_user(f->spec2, &uf->spec2);
2068 err |= __put_user(f->dtr, &uf->dtr);
2069 err |= __put_user(f->version, &uf->version);
2070 err |= __put_user(f->dor, &uf->dor);
2071 err |= __put_user(f->address, &uf->address);
2072 err |= __copy_to_user((char __user *)&uf->address + sizeof(uf->address),
2073 (char *)&f->address + sizeof(f->address), sizeof(int));
2074 err |= __put_user(f->driver_version, &uf->driver_version);
2075 err |= __copy_to_user(uf->track, f->track, sizeof(f->track));
2080 struct floppy_write_errors32 __user *uf;
2081 struct floppy_write_errors *f = karg;
2083 uf = compat_ptr(arg);
2084 err = __put_user(f->write_errors, &uf->write_errors);
2085 err |= __put_user(f->first_error_sector, &uf->first_error_sector);
2086 err |= __put_user(f->first_error_generation, &uf->first_error_generation);
2087 err |= __put_user(f->last_error_sector, &uf->last_error_sector);
2088 err |= __put_user(f->last_error_generation, &uf->last_error_generation);
2089 err |= __put_user(f->badness, &uf->badness);
2103 struct mtd_oob_buf32 {
2106 compat_caddr_t ptr; /* unsigned char* */
2109 #define MEMWRITEOOB32 _IOWR('M',3,struct mtd_oob_buf32)
2110 #define MEMREADOOB32 _IOWR('M',4,struct mtd_oob_buf32)
2112 static int mtd_rw_oob(unsigned int fd, unsigned int cmd, unsigned long arg)
2114 struct mtd_oob_buf __user *buf = compat_alloc_user_space(sizeof(*buf));
2115 struct mtd_oob_buf32 __user *buf32 = compat_ptr(arg);
2118 unsigned int real_cmd;
2121 real_cmd = (cmd == MEMREADOOB32) ?
2122 MEMREADOOB : MEMWRITEOOB;
2124 if (copy_in_user(&buf->start, &buf32->start,
2126 get_user(data, &buf32->ptr))
2128 datap = compat_ptr(data);
2129 if (put_user(datap, &buf->ptr))
2132 err = sys_ioctl(fd, real_cmd, (unsigned long) buf);
2135 if (copy_in_user(&buf32->start, &buf->start,
2143 #define VFAT_IOCTL_READDIR_BOTH32 _IOR('r', 1, struct compat_dirent[2])
2144 #define VFAT_IOCTL_READDIR_SHORT32 _IOR('r', 2, struct compat_dirent[2])
2147 put_dirent32 (struct dirent *d, struct compat_dirent __user *d32)
2149 if (!access_ok(VERIFY_WRITE, d32, sizeof(struct compat_dirent)))
2152 __put_user(d->d_ino, &d32->d_ino);
2153 __put_user(d->d_off, &d32->d_off);
2154 __put_user(d->d_reclen, &d32->d_reclen);
2155 if (__copy_to_user(d32->d_name, d->d_name, d->d_reclen))
2161 static int vfat_ioctl32(unsigned fd, unsigned cmd, unsigned long arg)
2163 struct compat_dirent __user *p = compat_ptr(arg);
2165 mm_segment_t oldfs = get_fs();
2170 case VFAT_IOCTL_READDIR_BOTH32:
2171 cmd = VFAT_IOCTL_READDIR_BOTH;
2173 case VFAT_IOCTL_READDIR_SHORT32:
2174 cmd = VFAT_IOCTL_READDIR_SHORT;
2179 ret = sys_ioctl(fd,cmd,(unsigned long)&d);
2182 ret |= put_dirent32(&d[0], p);
2183 ret |= put_dirent32(&d[1], p + 1);
2188 #define REISERFS_IOC_UNPACK32 _IOW(0xCD,1,int)
2190 static int reiserfs_ioctl32(unsigned fd, unsigned cmd, unsigned long ptr)
2192 if (cmd == REISERFS_IOC_UNPACK32)
2193 cmd = REISERFS_IOC_UNPACK;
2195 return sys_ioctl(fd,cmd,ptr);
2198 struct raw32_config_request
2200 compat_int_t raw_minor;
2203 } __attribute__((packed));
2205 static int get_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req)
2209 if (!access_ok(VERIFY_READ, user_req, sizeof(struct raw32_config_request)))
2212 ret = __get_user(req->raw_minor, &user_req->raw_minor);
2213 ret |= __get_user(req->block_major, &user_req->block_major);
2214 ret |= __get_user(req->block_minor, &user_req->block_minor);
2216 return ret ? -EFAULT : 0;
2219 static int set_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req)
2223 if (!access_ok(VERIFY_WRITE, user_req, sizeof(struct raw32_config_request)))
2226 ret = __put_user(req->raw_minor, &user_req->raw_minor);
2227 ret |= __put_user(req->block_major, &user_req->block_major);
2228 ret |= __put_user(req->block_minor, &user_req->block_minor);
2230 return ret ? -EFAULT : 0;
2233 static int raw_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
2240 struct raw_config_request req;
2241 struct raw32_config_request __user *user_req = compat_ptr(arg);
2242 mm_segment_t oldfs = get_fs();
2244 if ((ret = get_raw32_request(&req, user_req)))
2248 ret = sys_ioctl(fd,cmd,(unsigned long)&req);
2251 if ((!ret) && (cmd == RAW_GETBIND)) {
2252 ret = set_raw32_request(&req, user_req);
2257 ret = sys_ioctl(fd, cmd, arg);
2263 struct serial_struct32 {
2269 compat_int_t xmit_fifo_size;
2270 compat_int_t custom_divisor;
2271 compat_int_t baud_base;
2272 unsigned short close_delay;
2274 char reserved_char[1];
2276 unsigned short closing_wait; /* time to wait before closing */
2277 unsigned short closing_wait2; /* no longer used... */
2278 compat_uint_t iomem_base;
2279 unsigned short iomem_reg_shift;
2280 unsigned int port_high;
2281 /* compat_ulong_t iomap_base FIXME */
2282 compat_int_t reserved[1];
2285 static int serial_struct_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
2287 typedef struct serial_struct SS;
2288 typedef struct serial_struct32 SS32;
2289 struct serial_struct32 __user *ss32 = compat_ptr(arg);
2291 struct serial_struct ss;
2292 mm_segment_t oldseg = get_fs();
2295 if (cmd == TIOCSSERIAL) {
2296 if (!access_ok(VERIFY_READ, ss32, sizeof(SS32)))
2298 if (__copy_from_user(&ss, ss32, offsetof(SS32, iomem_base)))
2300 __get_user(udata, &ss32->iomem_base);
2301 ss.iomem_base = compat_ptr(udata);
2302 __get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
2303 __get_user(ss.port_high, &ss32->port_high);
2304 ss.iomap_base = 0UL;
2307 err = sys_ioctl(fd,cmd,(unsigned long)(&ss));
2309 if (cmd == TIOCGSERIAL && err >= 0) {
2310 if (!access_ok(VERIFY_WRITE, ss32, sizeof(SS32)))
2312 if (__copy_to_user(ss32,&ss,offsetof(SS32,iomem_base)))
2314 __put_user((unsigned long)ss.iomem_base >> 32 ?
2315 0xffffffff : (unsigned)(unsigned long)ss.iomem_base,
2317 __put_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
2318 __put_user(ss.port_high, &ss32->port_high);
2324 struct usbdevfs_ctrltransfer32 {
2330 u32 timeout; /* in milliseconds */
2331 compat_caddr_t data;
2334 #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
2336 static int do_usbdevfs_control(unsigned int fd, unsigned int cmd, unsigned long arg)
2338 struct usbdevfs_ctrltransfer32 __user *p32 = compat_ptr(arg);
2339 struct usbdevfs_ctrltransfer __user *p;
2341 p = compat_alloc_user_space(sizeof(*p));
2342 if (copy_in_user(p, p32, (sizeof(*p32) - sizeof(compat_caddr_t))) ||
2343 get_user(udata, &p32->data) ||
2344 put_user(compat_ptr(udata), &p->data))
2346 return sys_ioctl(fd, USBDEVFS_CONTROL, (unsigned long)p);
2350 struct usbdevfs_bulktransfer32 {
2353 compat_uint_t timeout; /* in milliseconds */
2354 compat_caddr_t data;
2357 #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32)
2359 static int do_usbdevfs_bulk(unsigned int fd, unsigned int cmd, unsigned long arg)
2361 struct usbdevfs_bulktransfer32 __user *p32 = compat_ptr(arg);
2362 struct usbdevfs_bulktransfer __user *p;
2364 compat_caddr_t addr;
2366 p = compat_alloc_user_space(sizeof(*p));
2368 if (get_user(n, &p32->ep) || put_user(n, &p->ep) ||
2369 get_user(n, &p32->len) || put_user(n, &p->len) ||
2370 get_user(n, &p32->timeout) || put_user(n, &p->timeout) ||
2371 get_user(addr, &p32->data) || put_user(compat_ptr(addr), &p->data))
2374 return sys_ioctl(fd, USBDEVFS_BULK, (unsigned long)p);
2379 * USBDEVFS_SUBMITURB, USBDEVFS_REAPURB and USBDEVFS_REAPURBNDELAY
2380 * are handled in usbdevfs core. -Christopher Li
2383 struct usbdevfs_disconnectsignal32 {
2385 compat_caddr_t context;
2388 #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32)
2390 static int do_usbdevfs_discsignal(unsigned int fd, unsigned int cmd, unsigned long arg)
2392 struct usbdevfs_disconnectsignal kdis;
2393 struct usbdevfs_disconnectsignal32 __user *udis;
2394 mm_segment_t old_fs;
2398 udis = compat_ptr(arg);
2400 if (get_user(kdis.signr, &udis->signr) ||
2401 __get_user(uctx, &udis->context))
2404 kdis.context = compat_ptr(uctx);
2408 err = sys_ioctl(fd, USBDEVFS_DISCSIGNAL, (unsigned long) &kdis);
2425 struct i2c_rdwr_ioctl_data32 {
2426 compat_caddr_t msgs; /* struct i2c_msg __user *msgs */
2430 struct i2c_smbus_ioctl_data32 {
2434 compat_caddr_t data; /* union i2c_smbus_data *data */
2437 struct i2c_rdwr_aligned {
2438 struct i2c_rdwr_ioctl_data cmd;
2439 struct i2c_msg msgs[0];
2442 static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
2444 struct i2c_rdwr_ioctl_data32 __user *udata = compat_ptr(arg);
2445 struct i2c_rdwr_aligned __user *tdata;
2446 struct i2c_msg __user *tmsgs;
2447 struct i2c_msg32 __user *umsgs;
2448 compat_caddr_t datap;
2451 if (get_user(nmsgs, &udata->nmsgs))
2453 if (nmsgs > I2C_RDRW_IOCTL_MAX_MSGS)
2456 if (get_user(datap, &udata->msgs))
2458 umsgs = compat_ptr(datap);
2460 tdata = compat_alloc_user_space(sizeof(*tdata) +
2461 nmsgs * sizeof(struct i2c_msg));
2462 tmsgs = &tdata->msgs[0];
2464 if (put_user(nmsgs, &tdata->cmd.nmsgs) ||
2465 put_user(tmsgs, &tdata->cmd.msgs))
2468 for (i = 0; i < nmsgs; i++) {
2469 if (copy_in_user(&tmsgs[i].addr, &umsgs[i].addr, 3*sizeof(u16)))
2471 if (get_user(datap, &umsgs[i].buf) ||
2472 put_user(compat_ptr(datap), &tmsgs[i].buf))
2475 return sys_ioctl(fd, cmd, (unsigned long)tdata);
2478 static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
2480 struct i2c_smbus_ioctl_data __user *tdata;
2481 struct i2c_smbus_ioctl_data32 __user *udata;
2482 compat_caddr_t datap;
2484 tdata = compat_alloc_user_space(sizeof(*tdata));
2487 if (!access_ok(VERIFY_WRITE, tdata, sizeof(*tdata)))
2490 udata = compat_ptr(arg);
2491 if (!access_ok(VERIFY_READ, udata, sizeof(*udata)))
2494 if (__copy_in_user(&tdata->read_write, &udata->read_write, 2 * sizeof(u8)))
2496 if (__copy_in_user(&tdata->size, &udata->size, 2 * sizeof(u32)))
2498 if (__get_user(datap, &udata->data) ||
2499 __put_user(compat_ptr(datap), &tdata->data))
2502 return sys_ioctl(fd, cmd, (unsigned long)tdata);
2505 struct compat_iw_point {
2506 compat_caddr_t pointer;
2511 static int do_wireless_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
2513 struct iwreq __user *iwr;
2514 struct iwreq __user *iwr_u;
2515 struct iw_point __user *iwp;
2516 struct compat_iw_point __user *iwp_u;
2517 compat_caddr_t pointer;
2518 __u16 length, flags;
2520 iwr_u = compat_ptr(arg);
2521 iwp_u = (struct compat_iw_point __user *) &iwr_u->u.data;
2522 iwr = compat_alloc_user_space(sizeof(*iwr));
2528 if (!access_ok(VERIFY_WRITE, iwr, sizeof(*iwr)))
2531 if (__copy_in_user(&iwr->ifr_ifrn.ifrn_name[0],
2532 &iwr_u->ifr_ifrn.ifrn_name[0],
2533 sizeof(iwr->ifr_ifrn.ifrn_name)))
2536 if (__get_user(pointer, &iwp_u->pointer) ||
2537 __get_user(length, &iwp_u->length) ||
2538 __get_user(flags, &iwp_u->flags))
2541 if (__put_user(compat_ptr(pointer), &iwp->pointer) ||
2542 __put_user(length, &iwp->length) ||
2543 __put_user(flags, &iwp->flags))
2546 return sys_ioctl(fd, cmd, (unsigned long) iwr);
2549 /* Since old style bridge ioctl's endup using SIOCDEVPRIVATE
2550 * for some operations; this forces use of the newer bridge-utils that
2551 * use compatiable ioctls
2553 static int old_bridge_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
2557 if (get_user(tmp, (u32 __user *) arg))
2559 if (tmp == BRCTL_GET_VERSION)
2560 return BRCTL_VERSION + 1;
2564 #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE)
2565 struct ncp_ioctl_request_32 {
2568 compat_caddr_t data;
2571 struct ncp_fs_info_v2_32 {
2585 struct ncp_objectname_ioctl_32
2588 u32 object_name_len;
2589 compat_caddr_t object_name; /* an userspace data, in most cases user name */
2592 struct ncp_privatedata_ioctl_32
2595 compat_caddr_t data; /* ~1000 for NDS */
2598 #define NCP_IOC_NCPREQUEST_32 _IOR('n', 1, struct ncp_ioctl_request_32)
2599 #define NCP_IOC_GETMOUNTUID2_32 _IOW('n', 2, u32)
2600 #define NCP_IOC_GET_FS_INFO_V2_32 _IOWR('n', 4, struct ncp_fs_info_v2_32)
2601 #define NCP_IOC_GETOBJECTNAME_32 _IOWR('n', 9, struct ncp_objectname_ioctl_32)
2602 #define NCP_IOC_SETOBJECTNAME_32 _IOR('n', 9, struct ncp_objectname_ioctl_32)
2603 #define NCP_IOC_GETPRIVATEDATA_32 _IOWR('n', 10, struct ncp_privatedata_ioctl_32)
2604 #define NCP_IOC_SETPRIVATEDATA_32 _IOR('n', 10, struct ncp_privatedata_ioctl_32)
2606 static int do_ncp_ncprequest(unsigned int fd, unsigned int cmd, unsigned long arg)
2608 struct ncp_ioctl_request_32 n32;
2609 struct ncp_ioctl_request __user *p = compat_alloc_user_space(sizeof(*p));
2611 if (copy_from_user(&n32, compat_ptr(arg), sizeof(n32)) ||
2612 put_user(n32.function, &p->function) ||
2613 put_user(n32.size, &p->size) ||
2614 put_user(compat_ptr(n32.data), &p->data))
2617 return sys_ioctl(fd, NCP_IOC_NCPREQUEST, (unsigned long)p);
2620 static int do_ncp_getmountuid2(unsigned int fd, unsigned int cmd, unsigned long arg)
2622 mm_segment_t old_fs = get_fs();
2623 __kernel_uid_t kuid;
2626 cmd = NCP_IOC_GETMOUNTUID2;
2629 err = sys_ioctl(fd, cmd, (unsigned long)&kuid);
2633 err = put_user(kuid,
2634 (unsigned int __user *) compat_ptr(arg));
2639 static int do_ncp_getfsinfo2(unsigned int fd, unsigned int cmd, unsigned long arg)
2641 mm_segment_t old_fs = get_fs();
2642 struct ncp_fs_info_v2_32 n32;
2643 struct ncp_fs_info_v2 n;
2646 if (copy_from_user(&n32, compat_ptr(arg), sizeof(n32)))
2648 if (n32.version != NCP_GET_FS_INFO_VERSION_V2)
2650 n.version = NCP_GET_FS_INFO_VERSION_V2;
2653 err = sys_ioctl(fd, NCP_IOC_GET_FS_INFO_V2, (unsigned long)&n);
2657 n32.version = n.version;
2658 n32.mounted_uid = n.mounted_uid;
2659 n32.connection = n.connection;
2660 n32.buffer_size = n.buffer_size;
2661 n32.volume_number = n.volume_number;
2662 n32.directory_id = n.directory_id;
2663 n32.dummy1 = n.dummy1;
2664 n32.dummy2 = n.dummy2;
2665 n32.dummy3 = n.dummy3;
2666 err = copy_to_user(compat_ptr(arg), &n32, sizeof(n32)) ? -EFAULT : 0;
2671 static int do_ncp_getobjectname(unsigned int fd, unsigned int cmd, unsigned long arg)
2673 struct ncp_objectname_ioctl_32 n32, __user *p32 = compat_ptr(arg);
2674 struct ncp_objectname_ioctl __user *p = compat_alloc_user_space(sizeof(*p));
2679 if (copy_from_user(&n32, p32, sizeof(n32)) ||
2680 put_user(n32.object_name_len, &p->object_name_len) ||
2681 put_user(compat_ptr(n32.object_name), &p->object_name))
2684 err = sys_ioctl(fd, NCP_IOC_GETOBJECTNAME, (unsigned long)p);
2688 if (get_user(auth_type, &p->auth_type) ||
2689 put_user(auth_type, &p32->auth_type) ||
2690 get_user(name_len, &p->object_name_len) ||
2691 put_user(name_len, &p32->object_name_len))
2697 static int do_ncp_setobjectname(unsigned int fd, unsigned int cmd, unsigned long arg)
2699 struct ncp_objectname_ioctl_32 n32, __user *p32 = compat_ptr(arg);
2700 struct ncp_objectname_ioctl __user *p = compat_alloc_user_space(sizeof(*p));
2702 if (copy_from_user(&n32, p32, sizeof(n32)) ||
2703 put_user(n32.auth_type, &p->auth_type) ||
2704 put_user(n32.object_name_len, &p->object_name_len) ||
2705 put_user(compat_ptr(n32.object_name), &p->object_name))
2708 return sys_ioctl(fd, NCP_IOC_SETOBJECTNAME, (unsigned long)p);
2711 static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
2713 struct ncp_privatedata_ioctl_32 n32, __user *p32 = compat_ptr(arg);
2714 struct ncp_privatedata_ioctl __user *p =
2715 compat_alloc_user_space(sizeof(*p));
2719 if (copy_from_user(&n32, p32, sizeof(n32)) ||
2720 put_user(n32.len, &p->len) ||
2721 put_user(compat_ptr(n32.data), &p->data))
2724 err = sys_ioctl(fd, NCP_IOC_GETPRIVATEDATA, (unsigned long)p);
2728 if (get_user(len, &p->len) ||
2729 put_user(len, &p32->len))
2735 static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
2737 struct ncp_privatedata_ioctl_32 n32;
2738 struct ncp_privatedata_ioctl_32 __user *p32 = compat_ptr(arg);
2739 struct ncp_privatedata_ioctl __user *p =
2740 compat_alloc_user_space(sizeof(*p));
2742 if (copy_from_user(&n32, p32, sizeof(n32)) ||
2743 put_user(n32.len, &p->len) ||
2744 put_user(compat_ptr(n32.data), &p->data))
2747 return sys_ioctl(fd, NCP_IOC_SETPRIVATEDATA, (unsigned long)p);
2755 HANDLE_IOCTL(MEMREADOOB32, mtd_rw_oob)
2756 HANDLE_IOCTL(MEMWRITEOOB32, mtd_rw_oob)
2758 HANDLE_IOCTL(SIOCGIFNAME, dev_ifname32)
2759 HANDLE_IOCTL(SIOCGIFCONF, dev_ifconf)
2760 HANDLE_IOCTL(SIOCGIFFLAGS, dev_ifsioc)
2761 HANDLE_IOCTL(SIOCSIFFLAGS, dev_ifsioc)
2762 HANDLE_IOCTL(SIOCGIFMETRIC, dev_ifsioc)
2763 HANDLE_IOCTL(SIOCSIFMETRIC, dev_ifsioc)
2764 HANDLE_IOCTL(SIOCGIFMTU, dev_ifsioc)
2765 HANDLE_IOCTL(SIOCSIFMTU, dev_ifsioc)
2766 HANDLE_IOCTL(SIOCGIFMEM, dev_ifsioc)
2767 HANDLE_IOCTL(SIOCSIFMEM, dev_ifsioc)
2768 HANDLE_IOCTL(SIOCGIFHWADDR, dev_ifsioc)
2769 HANDLE_IOCTL(SIOCSIFHWADDR, dev_ifsioc)
2770 HANDLE_IOCTL(SIOCADDMULTI, dev_ifsioc)
2771 HANDLE_IOCTL(SIOCDELMULTI, dev_ifsioc)
2772 HANDLE_IOCTL(SIOCGIFINDEX, dev_ifsioc)
2773 HANDLE_IOCTL(SIOCGIFMAP, dev_ifsioc)
2774 HANDLE_IOCTL(SIOCSIFMAP, dev_ifsioc)
2775 HANDLE_IOCTL(SIOCGIFADDR, dev_ifsioc)
2776 HANDLE_IOCTL(SIOCSIFADDR, dev_ifsioc)
2778 /* ioctls used by appletalk ddp.c */
2779 HANDLE_IOCTL(SIOCATALKDIFADDR, dev_ifsioc)
2780 HANDLE_IOCTL(SIOCDIFADDR, dev_ifsioc)
2781 HANDLE_IOCTL(SIOCSARP, dev_ifsioc)
2782 HANDLE_IOCTL(SIOCDARP, dev_ifsioc)
2784 HANDLE_IOCTL(SIOCGIFBRDADDR, dev_ifsioc)
2785 HANDLE_IOCTL(SIOCSIFBRDADDR, dev_ifsioc)
2786 HANDLE_IOCTL(SIOCGIFDSTADDR, dev_ifsioc)
2787 HANDLE_IOCTL(SIOCSIFDSTADDR, dev_ifsioc)
2788 HANDLE_IOCTL(SIOCGIFNETMASK, dev_ifsioc)
2789 HANDLE_IOCTL(SIOCSIFNETMASK, dev_ifsioc)
2790 HANDLE_IOCTL(SIOCSIFPFLAGS, dev_ifsioc)
2791 HANDLE_IOCTL(SIOCGIFPFLAGS, dev_ifsioc)
2792 HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc)
2793 HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc)
2794 HANDLE_IOCTL(TUNSETIFF, dev_ifsioc)
2795 HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl)
2796 HANDLE_IOCTL(SIOCBONDENSLAVE, bond_ioctl)
2797 HANDLE_IOCTL(SIOCBONDRELEASE, bond_ioctl)
2798 HANDLE_IOCTL(SIOCBONDSETHWADDR, bond_ioctl)
2799 HANDLE_IOCTL(SIOCBONDSLAVEINFOQUERY, bond_ioctl)
2800 HANDLE_IOCTL(SIOCBONDINFOQUERY, bond_ioctl)
2801 HANDLE_IOCTL(SIOCBONDCHANGEACTIVE, bond_ioctl)
2802 HANDLE_IOCTL(SIOCADDRT, routing_ioctl)
2803 HANDLE_IOCTL(SIOCDELRT, routing_ioctl)
2804 HANDLE_IOCTL(SIOCBRADDIF, dev_ifsioc)
2805 HANDLE_IOCTL(SIOCBRDELIF, dev_ifsioc)
2806 /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
2807 HANDLE_IOCTL(SIOCRTMSG, ret_einval)
2808 HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
2810 HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo)
2811 HANDLE_IOCTL(BLKRAGET, w_long)
2812 HANDLE_IOCTL(BLKGETSIZE, w_long)
2813 HANDLE_IOCTL(0x1260, broken_blkgetsize)
2814 HANDLE_IOCTL(BLKFRAGET, w_long)
2815 HANDLE_IOCTL(BLKSECTGET, w_long)
2816 HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans)
2817 HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans)
2818 HANDLE_IOCTL(HDIO_GET_UNMASKINTR, hdio_ioctl_trans)
2819 HANDLE_IOCTL(HDIO_GET_DMA, hdio_ioctl_trans)
2820 HANDLE_IOCTL(HDIO_GET_32BIT, hdio_ioctl_trans)
2821 HANDLE_IOCTL(HDIO_GET_MULTCOUNT, hdio_ioctl_trans)
2822 HANDLE_IOCTL(HDIO_GET_NOWERR, hdio_ioctl_trans)
2823 HANDLE_IOCTL(HDIO_GET_NICE, hdio_ioctl_trans)
2824 HANDLE_IOCTL(FDSETPRM32, fd_ioctl_trans)
2825 HANDLE_IOCTL(FDDEFPRM32, fd_ioctl_trans)
2826 HANDLE_IOCTL(FDGETPRM32, fd_ioctl_trans)
2827 HANDLE_IOCTL(FDSETDRVPRM32, fd_ioctl_trans)
2828 HANDLE_IOCTL(FDGETDRVPRM32, fd_ioctl_trans)
2829 HANDLE_IOCTL(FDGETDRVSTAT32, fd_ioctl_trans)
2830 HANDLE_IOCTL(FDPOLLDRVSTAT32, fd_ioctl_trans)
2831 HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans)
2832 HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans)
2833 HANDLE_IOCTL(SG_IO,sg_ioctl_trans)
2834 HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans)
2835 HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans)
2836 HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans)
2837 HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans)
2838 HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans)
2839 HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans)
2840 HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans)
2841 HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans)
2842 HANDLE_IOCTL(LOOP_SET_STATUS, loop_status)
2843 HANDLE_IOCTL(LOOP_GET_STATUS, loop_status)
2844 #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
2845 HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout)
2847 HANDLE_IOCTL(PIO_FONTX, do_fontx_ioctl)
2848 HANDLE_IOCTL(GIO_FONTX, do_fontx_ioctl)
2849 HANDLE_IOCTL(PIO_UNIMAP, do_unimap_ioctl)
2850 HANDLE_IOCTL(GIO_UNIMAP, do_unimap_ioctl)
2851 HANDLE_IOCTL(KDFONTOP, do_kdfontop_ioctl)
2853 HANDLE_IOCTL(EXT2_IOC32_GETFLAGS, do_ext2_ioctl)
2854 HANDLE_IOCTL(EXT2_IOC32_SETFLAGS, do_ext2_ioctl)
2855 HANDLE_IOCTL(EXT2_IOC32_GETVERSION, do_ext2_ioctl)
2856 HANDLE_IOCTL(EXT2_IOC32_SETVERSION, do_ext2_ioctl)
2857 HANDLE_IOCTL(VIDIOCGTUNER32, do_video_ioctl)
2858 HANDLE_IOCTL(VIDIOCSTUNER32, do_video_ioctl)
2859 HANDLE_IOCTL(VIDIOCGWIN32, do_video_ioctl)
2860 HANDLE_IOCTL(VIDIOCSWIN32, do_set_window)
2861 HANDLE_IOCTL(VIDIOCGFBUF32, do_video_ioctl)
2862 HANDLE_IOCTL(VIDIOCSFBUF32, do_video_ioctl)
2863 HANDLE_IOCTL(VIDIOCGFREQ32, do_video_ioctl)
2864 HANDLE_IOCTL(VIDIOCSFREQ32, do_video_ioctl)
2865 /* One SMB ioctl needs translations. */
2866 #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
2867 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
2868 HANDLE_IOCTL(ATM_GETLINKRATE32, do_atm_ioctl)
2869 HANDLE_IOCTL(ATM_GETNAMES32, do_atm_ioctl)
2870 HANDLE_IOCTL(ATM_GETTYPE32, do_atm_ioctl)
2871 HANDLE_IOCTL(ATM_GETESI32, do_atm_ioctl)
2872 HANDLE_IOCTL(ATM_GETADDR32, do_atm_ioctl)
2873 HANDLE_IOCTL(ATM_RSTADDR32, do_atm_ioctl)
2874 HANDLE_IOCTL(ATM_ADDADDR32, do_atm_ioctl)
2875 HANDLE_IOCTL(ATM_DELADDR32, do_atm_ioctl)
2876 HANDLE_IOCTL(ATM_GETCIRANGE32, do_atm_ioctl)
2877 HANDLE_IOCTL(ATM_SETCIRANGE32, do_atm_ioctl)
2878 HANDLE_IOCTL(ATM_SETESI32, do_atm_ioctl)
2879 HANDLE_IOCTL(ATM_SETESIF32, do_atm_ioctl)
2880 HANDLE_IOCTL(ATM_GETSTAT32, do_atm_ioctl)
2881 HANDLE_IOCTL(ATM_GETSTATZ32, do_atm_ioctl)
2882 HANDLE_IOCTL(ATM_GETLOOP32, do_atm_ioctl)
2883 HANDLE_IOCTL(ATM_SETLOOP32, do_atm_ioctl)
2884 HANDLE_IOCTL(ATM_QUERYLOOP32, do_atm_ioctl)
2885 HANDLE_IOCTL(SONET_GETSTAT, do_atm_ioctl)
2886 HANDLE_IOCTL(SONET_GETSTATZ, do_atm_ioctl)
2887 HANDLE_IOCTL(SONET_GETDIAG, do_atm_ioctl)
2888 HANDLE_IOCTL(SONET_SETDIAG, do_atm_ioctl)
2889 HANDLE_IOCTL(SONET_CLRDIAG, do_atm_ioctl)
2890 HANDLE_IOCTL(SONET_SETFRAMING, do_atm_ioctl)
2891 HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl)
2892 HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl)
2894 HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget)
2895 HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset)
2896 HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64)
2898 HANDLE_IOCTL(VFAT_IOCTL_READDIR_BOTH32, vfat_ioctl32)
2899 HANDLE_IOCTL(VFAT_IOCTL_READDIR_SHORT32, vfat_ioctl32)
2900 HANDLE_IOCTL(REISERFS_IOC_UNPACK32, reiserfs_ioctl32)
2902 HANDLE_IOCTL(RAW_SETBIND, raw_ioctl)
2903 HANDLE_IOCTL(RAW_GETBIND, raw_ioctl)
2905 HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl)
2906 HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl)
2908 COMPATIBLE_IOCTL(TIOCGLTC)
2909 COMPATIBLE_IOCTL(TIOCSLTC)
2913 * For these two we have defintions in ioctls.h and/or termios.h on
2914 * some architectures but no actual implemention. Some applications
2915 * like bash call them if they are defined in the headers, so we provide
2916 * entries here to avoid syslog message spew.
2918 COMPATIBLE_IOCTL(TIOCSTART)
2919 COMPATIBLE_IOCTL(TIOCSTOP)
2922 HANDLE_IOCTL(USBDEVFS_CONTROL32, do_usbdevfs_control)
2923 HANDLE_IOCTL(USBDEVFS_BULK32, do_usbdevfs_bulk)
2924 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal)
2925 COMPATIBLE_IOCTL(USBDEVFS_IOCTL32)
2927 HANDLE_IOCTL(I2C_FUNCS, w_long)
2928 HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl)
2929 HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl)
2931 HANDLE_IOCTL(SIOCGIWRANGE, do_wireless_ioctl)
2932 HANDLE_IOCTL(SIOCSIWSPY, do_wireless_ioctl)
2933 HANDLE_IOCTL(SIOCGIWSPY, do_wireless_ioctl)
2934 HANDLE_IOCTL(SIOCSIWTHRSPY, do_wireless_ioctl)
2935 HANDLE_IOCTL(SIOCGIWTHRSPY, do_wireless_ioctl)
2936 HANDLE_IOCTL(SIOCGIWAPLIST, do_wireless_ioctl)
2937 HANDLE_IOCTL(SIOCGIWSCAN, do_wireless_ioctl)
2938 HANDLE_IOCTL(SIOCSIWESSID, do_wireless_ioctl)
2939 HANDLE_IOCTL(SIOCGIWESSID, do_wireless_ioctl)
2940 HANDLE_IOCTL(SIOCSIWNICKN, do_wireless_ioctl)
2941 HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl)
2942 HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl)
2943 HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl)
2944 HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl)
2945 HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl)
2947 #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE)
2948 HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest)
2949 HANDLE_IOCTL(NCP_IOC_GETMOUNTUID2_32, do_ncp_getmountuid2)
2950 HANDLE_IOCTL(NCP_IOC_GET_FS_INFO_V2_32, do_ncp_getfsinfo2)
2951 HANDLE_IOCTL(NCP_IOC_GETOBJECTNAME_32, do_ncp_getobjectname)
2952 HANDLE_IOCTL(NCP_IOC_SETOBJECTNAME_32, do_ncp_setobjectname)
2953 HANDLE_IOCTL(NCP_IOC_GETPRIVATEDATA_32, do_ncp_getprivatedata)
2954 HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata)