1
2
3
4
5
6
7
8
9
10
11
12
13
14#include <linux/joystick.h>
15
16#include <linux/types.h>
17#include <linux/compat.h>
18#include <linux/kernel.h>
19#include <linux/capability.h>
20#include <linux/compiler.h>
21#include <linux/sched.h>
22#include <linux/smp.h>
23#include <linux/ioctl.h>
24#include <linux/if.h>
25#include <linux/if_bridge.h>
26#include <linux/raid/md_u.h>
27#include <linux/kd.h>
28#include <linux/route.h>
29#include <linux/in6.h>
30#include <linux/ipv6_route.h>
31#include <linux/skbuff.h>
32#include <linux/netlink.h>
33#include <linux/vt.h>
34#include <linux/falloc.h>
35#include <linux/fs.h>
36#include <linux/file.h>
37#include <linux/ppp_defs.h>
38#include <linux/ppp-ioctl.h>
39#include <linux/if_pppox.h>
40#include <linux/mtio.h>
41#include <linux/tty.h>
42#include <linux/vt_kern.h>
43#include <linux/fb.h>
44#include <linux/videodev2.h>
45#include <linux/netdevice.h>
46#include <linux/raw.h>
47#include <linux/blkdev.h>
48#include <linux/elevator.h>
49#include <linux/pci.h>
50#include <linux/serial.h>
51#include <linux/if_tun.h>
52#include <linux/ctype.h>
53#include <linux/syscalls.h>
54#include <linux/atalk.h>
55#include <linux/gfp.h>
56#include <linux/cec.h>
57
58#include "internal.h"
59
60#include <linux/capi.h>
61#include <linux/gigaset_dev.h>
62
63#ifdef CONFIG_BLOCK
64#include <linux/cdrom.h>
65#include <linux/fd.h>
66#include <scsi/scsi.h>
67#include <scsi/scsi_ioctl.h>
68#include <scsi/sg.h>
69#endif
70
71#include <linux/uaccess.h>
72#include <linux/ethtool.h>
73#include <linux/mii.h>
74#include <linux/if_bonding.h>
75#include <linux/watchdog.h>
76
77#include <linux/soundcard.h>
78#include <linux/lp.h>
79#include <linux/ppdev.h>
80
81#include <linux/atm.h>
82#include <linux/atmarp.h>
83#include <linux/atmclip.h>
84#include <linux/atmdev.h>
85#include <linux/atmioc.h>
86#include <linux/atmlec.h>
87#include <linux/atmmpc.h>
88#include <linux/atmsvc.h>
89#include <linux/atm_tcp.h>
90#include <linux/sonet.h>
91#include <linux/atm_suni.h>
92
93#include <linux/usb.h>
94#include <linux/usbdevice_fs.h>
95#include <linux/nbd.h>
96#include <linux/random.h>
97#include <linux/filter.h>
98
99#include <linux/hiddev.h>
100
101#define __DVB_CORE__
102#include <linux/dvb/audio.h>
103#include <linux/dvb/dmx.h>
104#include <linux/dvb/frontend.h>
105#include <linux/dvb/video.h>
106
107#include <linux/sort.h>
108
109#ifdef CONFIG_SPARC
110#include <asm/fbio.h>
111#endif
112
113#define convert_in_user(srcptr, dstptr) \
114({ \
115 typeof(*srcptr) val; \
116 \
117 get_user(val, srcptr) || put_user(val, dstptr); \
118})
119
120static int do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
121{
122 int err;
123
124 err = security_file_ioctl(file, cmd, arg);
125 if (err)
126 return err;
127
128 return vfs_ioctl(file, cmd, arg);
129}
130
131struct compat_video_event {
132 int32_t type;
133 compat_time_t timestamp;
134 union {
135 video_size_t size;
136 unsigned int frame_rate;
137 } u;
138};
139
140static int do_video_get_event(struct file *file,
141 unsigned int cmd, struct compat_video_event __user *up)
142{
143 struct video_event __user *kevent =
144 compat_alloc_user_space(sizeof(*kevent));
145 int err;
146
147 if (kevent == NULL)
148 return -EFAULT;
149
150 err = do_ioctl(file, cmd, (unsigned long)kevent);
151 if (!err) {
152 err = convert_in_user(&kevent->type, &up->type);
153 err |= convert_in_user(&kevent->timestamp, &up->timestamp);
154 err |= convert_in_user(&kevent->u.size.w, &up->u.size.w);
155 err |= convert_in_user(&kevent->u.size.h, &up->u.size.h);
156 err |= convert_in_user(&kevent->u.size.aspect_ratio,
157 &up->u.size.aspect_ratio);
158 if (err)
159 err = -EFAULT;
160 }
161
162 return err;
163}
164
165struct compat_video_still_picture {
166 compat_uptr_t iFrame;
167 int32_t size;
168};
169
170static int do_video_stillpicture(struct file *file,
171 unsigned int cmd, struct compat_video_still_picture __user *up)
172{
173 struct video_still_picture __user *up_native;
174 compat_uptr_t fp;
175 int32_t size;
176 int err;
177
178 err = get_user(fp, &up->iFrame);
179 err |= get_user(size, &up->size);
180 if (err)
181 return -EFAULT;
182
183 up_native =
184 compat_alloc_user_space(sizeof(struct video_still_picture));
185
186 err = put_user(compat_ptr(fp), &up_native->iFrame);
187 err |= put_user(size, &up_native->size);
188 if (err)
189 return -EFAULT;
190
191 err = do_ioctl(file, cmd, (unsigned long) up_native);
192
193 return err;
194}
195
196struct compat_video_spu_palette {
197 int length;
198 compat_uptr_t palette;
199};
200
201static int do_video_set_spu_palette(struct file *file,
202 unsigned int cmd, struct compat_video_spu_palette __user *up)
203{
204 struct video_spu_palette __user *up_native;
205 compat_uptr_t palp;
206 int length, err;
207
208 err = get_user(palp, &up->palette);
209 err |= get_user(length, &up->length);
210 if (err)
211 return -EFAULT;
212
213 up_native = compat_alloc_user_space(sizeof(struct video_spu_palette));
214 err = put_user(compat_ptr(palp), &up_native->palette);
215 err |= put_user(length, &up_native->length);
216 if (err)
217 return -EFAULT;
218
219 err = do_ioctl(file, cmd, (unsigned long) up_native);
220
221 return err;
222}
223
224#ifdef CONFIG_BLOCK
225typedef struct sg_io_hdr32 {
226 compat_int_t interface_id;
227 compat_int_t dxfer_direction;
228 unsigned char cmd_len;
229 unsigned char mx_sb_len;
230 unsigned short iovec_count;
231 compat_uint_t dxfer_len;
232 compat_uint_t dxferp;
233
234 compat_uptr_t cmdp;
235 compat_uptr_t sbp;
236 compat_uint_t timeout;
237 compat_uint_t flags;
238 compat_int_t pack_id;
239 compat_uptr_t usr_ptr;
240 unsigned char status;
241 unsigned char masked_status;
242 unsigned char msg_status;
243 unsigned char sb_len_wr;
244 unsigned short host_status;
245 unsigned short driver_status;
246 compat_int_t resid;
247 compat_uint_t duration;
248 compat_uint_t info;
249} sg_io_hdr32_t;
250
251typedef struct sg_iovec32 {
252 compat_uint_t iov_base;
253 compat_uint_t iov_len;
254} sg_iovec32_t;
255
256static int sg_build_iovec(sg_io_hdr_t __user *sgio, void __user *dxferp, u16 iovec_count)
257{
258 sg_iovec_t __user *iov = (sg_iovec_t __user *) (sgio + 1);
259 sg_iovec32_t __user *iov32 = dxferp;
260 int i;
261
262 for (i = 0; i < iovec_count; i++) {
263 u32 base, len;
264
265 if (get_user(base, &iov32[i].iov_base) ||
266 get_user(len, &iov32[i].iov_len) ||
267 put_user(compat_ptr(base), &iov[i].iov_base) ||
268 put_user(len, &iov[i].iov_len))
269 return -EFAULT;
270 }
271
272 if (put_user(iov, &sgio->dxferp))
273 return -EFAULT;
274 return 0;
275}
276
277static int sg_ioctl_trans(struct file *file, unsigned int cmd,
278 sg_io_hdr32_t __user *sgio32)
279{
280 sg_io_hdr_t __user *sgio;
281 u16 iovec_count;
282 u32 data;
283 void __user *dxferp;
284 int err;
285 int interface_id;
286
287 if (get_user(interface_id, &sgio32->interface_id))
288 return -EFAULT;
289 if (interface_id != 'S')
290 return do_ioctl(file, cmd, (unsigned long)sgio32);
291
292 if (get_user(iovec_count, &sgio32->iovec_count))
293 return -EFAULT;
294
295 {
296 void __user *top = compat_alloc_user_space(0);
297 void __user *new = compat_alloc_user_space(sizeof(sg_io_hdr_t) +
298 (iovec_count * sizeof(sg_iovec_t)));
299 if (new > top)
300 return -EINVAL;
301
302 sgio = new;
303 }
304
305
306 if (copy_in_user(&sgio->interface_id, &sgio32->interface_id,
307 (2 * sizeof(int)) +
308 (2 * sizeof(unsigned char)) +
309 (1 * sizeof(unsigned short)) +
310 (1 * sizeof(unsigned int))))
311 return -EFAULT;
312
313 if (get_user(data, &sgio32->dxferp))
314 return -EFAULT;
315 dxferp = compat_ptr(data);
316 if (iovec_count) {
317 if (sg_build_iovec(sgio, dxferp, iovec_count))
318 return -EFAULT;
319 } else {
320 if (put_user(dxferp, &sgio->dxferp))
321 return -EFAULT;
322 }
323
324 {
325 unsigned char __user *cmdp;
326 unsigned char __user *sbp;
327
328 if (get_user(data, &sgio32->cmdp))
329 return -EFAULT;
330 cmdp = compat_ptr(data);
331
332 if (get_user(data, &sgio32->sbp))
333 return -EFAULT;
334 sbp = compat_ptr(data);
335
336 if (put_user(cmdp, &sgio->cmdp) ||
337 put_user(sbp, &sgio->sbp))
338 return -EFAULT;
339 }
340
341 if (copy_in_user(&sgio->timeout, &sgio32->timeout,
342 3 * sizeof(int)))
343 return -EFAULT;
344
345 if (get_user(data, &sgio32->usr_ptr))
346 return -EFAULT;
347 if (put_user(compat_ptr(data), &sgio->usr_ptr))
348 return -EFAULT;
349
350 err = do_ioctl(file, cmd, (unsigned long) sgio);
351
352 if (err >= 0) {
353 void __user *datap;
354
355 if (copy_in_user(&sgio32->pack_id, &sgio->pack_id,
356 sizeof(int)) ||
357 get_user(datap, &sgio->usr_ptr) ||
358 put_user((u32)(unsigned long)datap,
359 &sgio32->usr_ptr) ||
360 copy_in_user(&sgio32->status, &sgio->status,
361 (4 * sizeof(unsigned char)) +
362 (2 * sizeof(unsigned short)) +
363 (3 * sizeof(int))))
364 err = -EFAULT;
365 }
366
367 return err;
368}
369
370struct compat_sg_req_info {
371 char req_state;
372 char orphan;
373 char sg_io_owned;
374 char problem;
375 int pack_id;
376 compat_uptr_t usr_ptr;
377 unsigned int duration;
378 int unused;
379};
380
381static int sg_grt_trans(struct file *file,
382 unsigned int cmd, struct compat_sg_req_info __user *o)
383{
384 int err, i;
385 sg_req_info_t __user *r;
386 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE);
387 err = do_ioctl(file, cmd, (unsigned long)r);
388 if (err < 0)
389 return err;
390 for (i = 0; i < SG_MAX_QUEUE; i++) {
391 void __user *ptr;
392 int d;
393
394 if (copy_in_user(o + i, r + i, offsetof(sg_req_info_t, usr_ptr)) ||
395 get_user(ptr, &r[i].usr_ptr) ||
396 get_user(d, &r[i].duration) ||
397 put_user((u32)(unsigned long)(ptr), &o[i].usr_ptr) ||
398 put_user(d, &o[i].duration))
399 return -EFAULT;
400 }
401 return err;
402}
403#endif
404
405struct sock_fprog32 {
406 unsigned short len;
407 compat_caddr_t filter;
408};
409
410#define PPPIOCSPASS32 _IOW('t', 71, struct sock_fprog32)
411#define PPPIOCSACTIVE32 _IOW('t', 70, struct sock_fprog32)
412
413static int ppp_sock_fprog_ioctl_trans(struct file *file,
414 unsigned int cmd, struct sock_fprog32 __user *u_fprog32)
415{
416 struct sock_fprog __user *u_fprog64 = compat_alloc_user_space(sizeof(struct sock_fprog));
417 void __user *fptr64;
418 u32 fptr32;
419 u16 flen;
420
421 if (get_user(flen, &u_fprog32->len) ||
422 get_user(fptr32, &u_fprog32->filter))
423 return -EFAULT;
424
425 fptr64 = compat_ptr(fptr32);
426
427 if (put_user(flen, &u_fprog64->len) ||
428 put_user(fptr64, &u_fprog64->filter))
429 return -EFAULT;
430
431 if (cmd == PPPIOCSPASS32)
432 cmd = PPPIOCSPASS;
433 else
434 cmd = PPPIOCSACTIVE;
435
436 return do_ioctl(file, cmd, (unsigned long) u_fprog64);
437}
438
439struct ppp_option_data32 {
440 compat_caddr_t ptr;
441 u32 length;
442 compat_int_t transmit;
443};
444#define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
445
446struct ppp_idle32 {
447 compat_time_t xmit_idle;
448 compat_time_t recv_idle;
449};
450#define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
451
452static int ppp_gidle(struct file *file, unsigned int cmd,
453 struct ppp_idle32 __user *idle32)
454{
455 struct ppp_idle __user *idle;
456 __kernel_time_t xmit, recv;
457 int err;
458
459 idle = compat_alloc_user_space(sizeof(*idle));
460
461 err = do_ioctl(file, PPPIOCGIDLE, (unsigned long) idle);
462
463 if (!err) {
464 if (get_user(xmit, &idle->xmit_idle) ||
465 get_user(recv, &idle->recv_idle) ||
466 put_user(xmit, &idle32->xmit_idle) ||
467 put_user(recv, &idle32->recv_idle))
468 err = -EFAULT;
469 }
470 return err;
471}
472
473static int ppp_scompress(struct file *file, unsigned int cmd,
474 struct ppp_option_data32 __user *odata32)
475{
476 struct ppp_option_data __user *odata;
477 __u32 data;
478 void __user *datap;
479
480 odata = compat_alloc_user_space(sizeof(*odata));
481
482 if (get_user(data, &odata32->ptr))
483 return -EFAULT;
484
485 datap = compat_ptr(data);
486 if (put_user(datap, &odata->ptr))
487 return -EFAULT;
488
489 if (copy_in_user(&odata->length, &odata32->length,
490 sizeof(__u32) + sizeof(int)))
491 return -EFAULT;
492
493 return do_ioctl(file, PPPIOCSCOMPRESS, (unsigned long) odata);
494}
495
496#ifdef CONFIG_BLOCK
497struct mtget32 {
498 compat_long_t mt_type;
499 compat_long_t mt_resid;
500 compat_long_t mt_dsreg;
501 compat_long_t mt_gstat;
502 compat_long_t mt_erreg;
503 compat_daddr_t mt_fileno;
504 compat_daddr_t mt_blkno;
505};
506#define MTIOCGET32 _IOR('m', 2, struct mtget32)
507
508struct mtpos32 {
509 compat_long_t mt_blkno;
510};
511#define MTIOCPOS32 _IOR('m', 3, struct mtpos32)
512
513static int mt_ioctl_trans(struct file *file,
514 unsigned int cmd, void __user *argp)
515{
516
517 struct mtget __user *get = NULL;
518 struct mtget32 __user *umget32;
519 struct mtpos __user *pos = NULL;
520 struct mtpos32 __user *upos32;
521 unsigned long kcmd;
522 void *karg;
523 int err = 0;
524
525 switch(cmd) {
526 case MTIOCPOS32:
527 kcmd = MTIOCPOS;
528 pos = compat_alloc_user_space(sizeof(*pos));
529 karg = pos;
530 break;
531 default:
532 kcmd = MTIOCGET;
533 get = compat_alloc_user_space(sizeof(*get));
534 karg = get;
535 break;
536 }
537 if (karg == NULL)
538 return -EFAULT;
539 err = do_ioctl(file, kcmd, (unsigned long)karg);
540 if (err)
541 return err;
542 switch (cmd) {
543 case MTIOCPOS32:
544 upos32 = argp;
545 err = convert_in_user(&pos->mt_blkno, &upos32->mt_blkno);
546 break;
547 case MTIOCGET32:
548 umget32 = argp;
549 err = convert_in_user(&get->mt_type, &umget32->mt_type);
550 err |= convert_in_user(&get->mt_resid, &umget32->mt_resid);
551 err |= convert_in_user(&get->mt_dsreg, &umget32->mt_dsreg);
552 err |= convert_in_user(&get->mt_gstat, &umget32->mt_gstat);
553 err |= convert_in_user(&get->mt_erreg, &umget32->mt_erreg);
554 err |= convert_in_user(&get->mt_fileno, &umget32->mt_fileno);
555 err |= convert_in_user(&get->mt_blkno, &umget32->mt_blkno);
556 break;
557 }
558 return err ? -EFAULT: 0;
559}
560
561#endif
562
563
564#define HCIUARTSETPROTO _IOW('U', 200, int)
565#define HCIUARTGETPROTO _IOR('U', 201, int)
566#define HCIUARTGETDEVICE _IOR('U', 202, int)
567#define HCIUARTSETFLAGS _IOW('U', 203, int)
568#define HCIUARTGETFLAGS _IOR('U', 204, int)
569
570struct serial_struct32 {
571 compat_int_t type;
572 compat_int_t line;
573 compat_uint_t port;
574 compat_int_t irq;
575 compat_int_t flags;
576 compat_int_t xmit_fifo_size;
577 compat_int_t custom_divisor;
578 compat_int_t baud_base;
579 unsigned short close_delay;
580 char io_type;
581 char reserved_char[1];
582 compat_int_t hub6;
583 unsigned short closing_wait;
584 unsigned short closing_wait2;
585 compat_uint_t iomem_base;
586 unsigned short iomem_reg_shift;
587 unsigned int port_high;
588
589 compat_int_t reserved[1];
590};
591
592static int serial_struct_ioctl(struct file *file,
593 unsigned cmd, struct serial_struct32 __user *ss32)
594{
595 typedef struct serial_struct32 SS32;
596 int err;
597 struct serial_struct __user *ss = compat_alloc_user_space(sizeof(*ss));
598 __u32 udata;
599 unsigned int base;
600 unsigned char *iomem_base;
601
602 if (ss == NULL)
603 return -EFAULT;
604 if (cmd == TIOCSSERIAL) {
605 if (copy_in_user(ss, ss32, offsetof(SS32, iomem_base)) ||
606 get_user(udata, &ss32->iomem_base))
607 return -EFAULT;
608 iomem_base = compat_ptr(udata);
609 if (put_user(iomem_base, &ss->iomem_base) ||
610 convert_in_user(&ss32->iomem_reg_shift,
611 &ss->iomem_reg_shift) ||
612 convert_in_user(&ss32->port_high, &ss->port_high) ||
613 put_user(0UL, &ss->iomap_base))
614 return -EFAULT;
615 }
616 err = do_ioctl(file, cmd, (unsigned long)ss);
617 if (cmd == TIOCGSERIAL && err >= 0) {
618 if (copy_in_user(ss32, ss, offsetof(SS32, iomem_base)) ||
619 get_user(iomem_base, &ss->iomem_base))
620 return -EFAULT;
621 base = (unsigned long)iomem_base >> 32 ?
622 0xffffffff : (unsigned)(unsigned long)iomem_base;
623 if (put_user(base, &ss32->iomem_base) ||
624 convert_in_user(&ss->iomem_reg_shift,
625 &ss32->iomem_reg_shift) ||
626 convert_in_user(&ss->port_high, &ss32->port_high))
627 return -EFAULT;
628 }
629 return err;
630}
631
632
633
634
635
636#define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff)
637
638#define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd),
639
640
641
642
643
644
645
646#define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd)
647
648static unsigned int ioctl_pointer[] = {
649
650COMPATIBLE_IOCTL(0x4B50)
651COMPATIBLE_IOCTL(0x4B51)
652
653
654COMPATIBLE_IOCTL(TCGETA)
655COMPATIBLE_IOCTL(TCSETA)
656COMPATIBLE_IOCTL(TCSETAW)
657COMPATIBLE_IOCTL(TCSETAF)
658COMPATIBLE_IOCTL(TCSBRK)
659COMPATIBLE_IOCTL(TCXONC)
660COMPATIBLE_IOCTL(TCFLSH)
661COMPATIBLE_IOCTL(TCGETS)
662COMPATIBLE_IOCTL(TCSETS)
663COMPATIBLE_IOCTL(TCSETSW)
664COMPATIBLE_IOCTL(TCSETSF)
665COMPATIBLE_IOCTL(TIOCLINUX)
666COMPATIBLE_IOCTL(TIOCSBRK)
667COMPATIBLE_IOCTL(TIOCGDEV)
668COMPATIBLE_IOCTL(TIOCCBRK)
669COMPATIBLE_IOCTL(TIOCGSID)
670COMPATIBLE_IOCTL(TIOCGICOUNT)
671COMPATIBLE_IOCTL(TIOCGEXCL)
672
673COMPATIBLE_IOCTL(TIOCGETD)
674COMPATIBLE_IOCTL(TIOCSETD)
675COMPATIBLE_IOCTL(TIOCEXCL)
676COMPATIBLE_IOCTL(TIOCNXCL)
677COMPATIBLE_IOCTL(TIOCCONS)
678COMPATIBLE_IOCTL(TIOCGSOFTCAR)
679COMPATIBLE_IOCTL(TIOCSSOFTCAR)
680COMPATIBLE_IOCTL(TIOCSWINSZ)
681COMPATIBLE_IOCTL(TIOCGWINSZ)
682COMPATIBLE_IOCTL(TIOCMGET)
683COMPATIBLE_IOCTL(TIOCMBIC)
684COMPATIBLE_IOCTL(TIOCMBIS)
685COMPATIBLE_IOCTL(TIOCMSET)
686COMPATIBLE_IOCTL(TIOCNOTTY)
687COMPATIBLE_IOCTL(TIOCSTI)
688COMPATIBLE_IOCTL(TIOCOUTQ)
689COMPATIBLE_IOCTL(TIOCSPGRP)
690COMPATIBLE_IOCTL(TIOCGPGRP)
691COMPATIBLE_IOCTL(TIOCSERGETLSR)
692#ifdef TIOCSRS485
693COMPATIBLE_IOCTL(TIOCSRS485)
694#endif
695#ifdef TIOCGRS485
696COMPATIBLE_IOCTL(TIOCGRS485)
697#endif
698#ifdef TCGETS2
699COMPATIBLE_IOCTL(TCGETS2)
700COMPATIBLE_IOCTL(TCSETS2)
701COMPATIBLE_IOCTL(TCSETSW2)
702COMPATIBLE_IOCTL(TCSETSF2)
703#endif
704
705COMPATIBLE_IOCTL(FITRIM)
706COMPATIBLE_IOCTL(KDGETKEYCODE)
707COMPATIBLE_IOCTL(KDSETKEYCODE)
708COMPATIBLE_IOCTL(KDGKBTYPE)
709COMPATIBLE_IOCTL(KDGETMODE)
710COMPATIBLE_IOCTL(KDGKBMODE)
711COMPATIBLE_IOCTL(KDGKBMETA)
712COMPATIBLE_IOCTL(KDGKBENT)
713COMPATIBLE_IOCTL(KDSKBENT)
714COMPATIBLE_IOCTL(KDGKBSENT)
715COMPATIBLE_IOCTL(KDSKBSENT)
716COMPATIBLE_IOCTL(KDGKBDIACR)
717COMPATIBLE_IOCTL(KDSKBDIACR)
718COMPATIBLE_IOCTL(KDGKBDIACRUC)
719COMPATIBLE_IOCTL(KDSKBDIACRUC)
720COMPATIBLE_IOCTL(KDKBDREP)
721COMPATIBLE_IOCTL(KDGKBLED)
722COMPATIBLE_IOCTL(KDGETLED)
723#ifdef CONFIG_BLOCK
724
725COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN)
726COMPATIBLE_IOCTL(SCSI_IOCTL_DOORLOCK)
727COMPATIBLE_IOCTL(SCSI_IOCTL_DOORUNLOCK)
728COMPATIBLE_IOCTL(SCSI_IOCTL_TEST_UNIT_READY)
729COMPATIBLE_IOCTL(SCSI_IOCTL_GET_BUS_NUMBER)
730COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND)
731COMPATIBLE_IOCTL(SCSI_IOCTL_PROBE_HOST)
732COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI)
733#endif
734
735IGNORE_IOCTL(VT_OPENQRY)
736IGNORE_IOCTL(VT_GETMODE)
737
738
739
740
741
742
743COMPATIBLE_IOCTL(_IOR('p', 20, int[7]))
744COMPATIBLE_IOCTL(_IOW('p', 21, int[7]))
745
746COMPATIBLE_IOCTL(MTIOCTOP)
747#ifdef CONFIG_BLOCK
748
749IGNORE_IOCTL(RAID_VERSION)
750
751IGNORE_IOCTL(CDROM_DRIVE_STATUS)
752IGNORE_IOCTL(FDGETPRM32)
753
754COMPATIBLE_IOCTL(SG_SET_TIMEOUT)
755COMPATIBLE_IOCTL(SG_GET_TIMEOUT)
756COMPATIBLE_IOCTL(SG_EMULATED_HOST)
757COMPATIBLE_IOCTL(SG_GET_TRANSFORM)
758COMPATIBLE_IOCTL(SG_SET_RESERVED_SIZE)
759COMPATIBLE_IOCTL(SG_GET_RESERVED_SIZE)
760COMPATIBLE_IOCTL(SG_GET_SCSI_ID)
761COMPATIBLE_IOCTL(SG_SET_FORCE_LOW_DMA)
762COMPATIBLE_IOCTL(SG_GET_LOW_DMA)
763COMPATIBLE_IOCTL(SG_SET_FORCE_PACK_ID)
764COMPATIBLE_IOCTL(SG_GET_PACK_ID)
765COMPATIBLE_IOCTL(SG_GET_NUM_WAITING)
766COMPATIBLE_IOCTL(SG_SET_DEBUG)
767COMPATIBLE_IOCTL(SG_GET_SG_TABLESIZE)
768COMPATIBLE_IOCTL(SG_GET_COMMAND_Q)
769COMPATIBLE_IOCTL(SG_SET_COMMAND_Q)
770COMPATIBLE_IOCTL(SG_GET_VERSION_NUM)
771COMPATIBLE_IOCTL(SG_NEXT_CMD_LEN)
772COMPATIBLE_IOCTL(SG_SCSI_RESET)
773COMPATIBLE_IOCTL(SG_GET_REQUEST_TABLE)
774COMPATIBLE_IOCTL(SG_SET_KEEP_ORPHAN)
775COMPATIBLE_IOCTL(SG_GET_KEEP_ORPHAN)
776#endif
777
778COMPATIBLE_IOCTL(PPPIOCGFLAGS)
779COMPATIBLE_IOCTL(PPPIOCSFLAGS)
780COMPATIBLE_IOCTL(PPPIOCGASYNCMAP)
781COMPATIBLE_IOCTL(PPPIOCSASYNCMAP)
782COMPATIBLE_IOCTL(PPPIOCGUNIT)
783COMPATIBLE_IOCTL(PPPIOCGRASYNCMAP)
784COMPATIBLE_IOCTL(PPPIOCSRASYNCMAP)
785COMPATIBLE_IOCTL(PPPIOCGMRU)
786COMPATIBLE_IOCTL(PPPIOCSMRU)
787COMPATIBLE_IOCTL(PPPIOCSMAXCID)
788COMPATIBLE_IOCTL(PPPIOCGXASYNCMAP)
789COMPATIBLE_IOCTL(PPPIOCSXASYNCMAP)
790COMPATIBLE_IOCTL(PPPIOCXFERUNIT)
791
792COMPATIBLE_IOCTL(PPPIOCGNPMODE)
793COMPATIBLE_IOCTL(PPPIOCSNPMODE)
794COMPATIBLE_IOCTL(PPPIOCGDEBUG)
795COMPATIBLE_IOCTL(PPPIOCSDEBUG)
796
797
798
799COMPATIBLE_IOCTL(PPPIOCNEWUNIT)
800COMPATIBLE_IOCTL(PPPIOCATTACH)
801COMPATIBLE_IOCTL(PPPIOCDETACH)
802COMPATIBLE_IOCTL(PPPIOCSMRRU)
803COMPATIBLE_IOCTL(PPPIOCCONNECT)
804COMPATIBLE_IOCTL(PPPIOCDISCONN)
805COMPATIBLE_IOCTL(PPPIOCATTCHAN)
806COMPATIBLE_IOCTL(PPPIOCGCHAN)
807COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS)
808
809COMPATIBLE_IOCTL(PPPOEIOCSFWD)
810COMPATIBLE_IOCTL(PPPOEIOCDFWD)
811
812
813
814COMPATIBLE_IOCTL(SNDCTL_SEQ_RESET)
815COMPATIBLE_IOCTL(SNDCTL_SEQ_SYNC)
816COMPATIBLE_IOCTL(SNDCTL_SYNTH_INFO)
817COMPATIBLE_IOCTL(SNDCTL_SEQ_CTRLRATE)
818COMPATIBLE_IOCTL(SNDCTL_SEQ_GETOUTCOUNT)
819COMPATIBLE_IOCTL(SNDCTL_SEQ_GETINCOUNT)
820COMPATIBLE_IOCTL(SNDCTL_SEQ_PERCMODE)
821COMPATIBLE_IOCTL(SNDCTL_FM_LOAD_INSTR)
822COMPATIBLE_IOCTL(SNDCTL_SEQ_TESTMIDI)
823COMPATIBLE_IOCTL(SNDCTL_SEQ_RESETSAMPLES)
824COMPATIBLE_IOCTL(SNDCTL_SEQ_NRSYNTHS)
825COMPATIBLE_IOCTL(SNDCTL_SEQ_NRMIDIS)
826COMPATIBLE_IOCTL(SNDCTL_MIDI_INFO)
827COMPATIBLE_IOCTL(SNDCTL_SEQ_THRESHOLD)
828COMPATIBLE_IOCTL(SNDCTL_SYNTH_MEMAVL)
829COMPATIBLE_IOCTL(SNDCTL_FM_4OP_ENABLE)
830COMPATIBLE_IOCTL(SNDCTL_SEQ_PANIC)
831COMPATIBLE_IOCTL(SNDCTL_SEQ_OUTOFBAND)
832COMPATIBLE_IOCTL(SNDCTL_SEQ_GETTIME)
833COMPATIBLE_IOCTL(SNDCTL_SYNTH_ID)
834COMPATIBLE_IOCTL(SNDCTL_SYNTH_CONTROL)
835COMPATIBLE_IOCTL(SNDCTL_SYNTH_REMOVESAMPLE)
836
837COMPATIBLE_IOCTL(SNDCTL_TMR_TIMEBASE)
838COMPATIBLE_IOCTL(SNDCTL_TMR_START)
839COMPATIBLE_IOCTL(SNDCTL_TMR_STOP)
840COMPATIBLE_IOCTL(SNDCTL_TMR_CONTINUE)
841COMPATIBLE_IOCTL(SNDCTL_TMR_TEMPO)
842COMPATIBLE_IOCTL(SNDCTL_TMR_SOURCE)
843COMPATIBLE_IOCTL(SNDCTL_TMR_METRONOME)
844COMPATIBLE_IOCTL(SNDCTL_TMR_SELECT)
845
846COMPATIBLE_IOCTL(SNDCTL_MIDI_PRETIME)
847COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUMODE)
848COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUCMD)
849
850COMPATIBLE_IOCTL(SNDCTL_DSP_RESET)
851COMPATIBLE_IOCTL(SNDCTL_DSP_SYNC)
852COMPATIBLE_IOCTL(SNDCTL_DSP_SPEED)
853COMPATIBLE_IOCTL(SNDCTL_DSP_STEREO)
854COMPATIBLE_IOCTL(SNDCTL_DSP_GETBLKSIZE)
855COMPATIBLE_IOCTL(SNDCTL_DSP_CHANNELS)
856COMPATIBLE_IOCTL(SOUND_PCM_WRITE_FILTER)
857COMPATIBLE_IOCTL(SNDCTL_DSP_POST)
858COMPATIBLE_IOCTL(SNDCTL_DSP_SUBDIVIDE)
859COMPATIBLE_IOCTL(SNDCTL_DSP_SETFRAGMENT)
860COMPATIBLE_IOCTL(SNDCTL_DSP_GETFMTS)
861COMPATIBLE_IOCTL(SNDCTL_DSP_SETFMT)
862COMPATIBLE_IOCTL(SNDCTL_DSP_GETOSPACE)
863COMPATIBLE_IOCTL(SNDCTL_DSP_GETISPACE)
864COMPATIBLE_IOCTL(SNDCTL_DSP_NONBLOCK)
865COMPATIBLE_IOCTL(SNDCTL_DSP_GETCAPS)
866COMPATIBLE_IOCTL(SNDCTL_DSP_GETTRIGGER)
867COMPATIBLE_IOCTL(SNDCTL_DSP_SETTRIGGER)
868COMPATIBLE_IOCTL(SNDCTL_DSP_GETIPTR)
869COMPATIBLE_IOCTL(SNDCTL_DSP_GETOPTR)
870
871
872COMPATIBLE_IOCTL(SNDCTL_DSP_SETSYNCRO)
873COMPATIBLE_IOCTL(SNDCTL_DSP_SETDUPLEX)
874COMPATIBLE_IOCTL(SNDCTL_DSP_GETODELAY)
875COMPATIBLE_IOCTL(SNDCTL_DSP_PROFILE)
876COMPATIBLE_IOCTL(SOUND_PCM_READ_RATE)
877COMPATIBLE_IOCTL(SOUND_PCM_READ_CHANNELS)
878COMPATIBLE_IOCTL(SOUND_PCM_READ_BITS)
879COMPATIBLE_IOCTL(SOUND_PCM_READ_FILTER)
880
881COMPATIBLE_IOCTL(SNDCTL_COPR_RESET)
882COMPATIBLE_IOCTL(SNDCTL_COPR_LOAD)
883COMPATIBLE_IOCTL(SNDCTL_COPR_RDATA)
884COMPATIBLE_IOCTL(SNDCTL_COPR_RCODE)
885COMPATIBLE_IOCTL(SNDCTL_COPR_WDATA)
886COMPATIBLE_IOCTL(SNDCTL_COPR_WCODE)
887COMPATIBLE_IOCTL(SNDCTL_COPR_RUN)
888COMPATIBLE_IOCTL(SNDCTL_COPR_HALT)
889COMPATIBLE_IOCTL(SNDCTL_COPR_SENDMSG)
890COMPATIBLE_IOCTL(SNDCTL_COPR_RCVMSG)
891
892COMPATIBLE_IOCTL(SOUND_MIXER_READ_VOLUME)
893COMPATIBLE_IOCTL(SOUND_MIXER_READ_BASS)
894COMPATIBLE_IOCTL(SOUND_MIXER_READ_TREBLE)
895COMPATIBLE_IOCTL(SOUND_MIXER_READ_SYNTH)
896COMPATIBLE_IOCTL(SOUND_MIXER_READ_PCM)
897COMPATIBLE_IOCTL(SOUND_MIXER_READ_SPEAKER)
898COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE)
899COMPATIBLE_IOCTL(SOUND_MIXER_READ_MIC)
900COMPATIBLE_IOCTL(SOUND_MIXER_READ_CD)
901COMPATIBLE_IOCTL(SOUND_MIXER_READ_IMIX)
902COMPATIBLE_IOCTL(SOUND_MIXER_READ_ALTPCM)
903COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECLEV)
904COMPATIBLE_IOCTL(SOUND_MIXER_READ_IGAIN)
905COMPATIBLE_IOCTL(SOUND_MIXER_READ_OGAIN)
906COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE1)
907COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE2)
908COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE3)
909COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL1))
910COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL2))
911COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL3))
912COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEIN))
913COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEOUT))
914COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_VIDEO))
915COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_RADIO))
916COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_MONITOR))
917COMPATIBLE_IOCTL(SOUND_MIXER_READ_MUTE)
918
919
920COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECSRC)
921COMPATIBLE_IOCTL(SOUND_MIXER_READ_DEVMASK)
922COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECMASK)
923COMPATIBLE_IOCTL(SOUND_MIXER_READ_STEREODEVS)
924COMPATIBLE_IOCTL(SOUND_MIXER_READ_CAPS)
925COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_VOLUME)
926COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_BASS)
927COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_TREBLE)
928COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SYNTH)
929COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_PCM)
930COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SPEAKER)
931COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE)
932COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MIC)
933COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_CD)
934COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IMIX)
935COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_ALTPCM)
936COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECLEV)
937COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IGAIN)
938COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_OGAIN)
939COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE1)
940COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE2)
941COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE3)
942COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL1))
943COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL2))
944COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL3))
945COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEIN))
946COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEOUT))
947COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_VIDEO))
948COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_RADIO))
949COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_MONITOR))
950COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MUTE)
951
952
953COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECSRC)
954COMPATIBLE_IOCTL(SOUND_MIXER_INFO)
955COMPATIBLE_IOCTL(SOUND_OLD_MIXER_INFO)
956COMPATIBLE_IOCTL(SOUND_MIXER_ACCESS)
957COMPATIBLE_IOCTL(SOUND_MIXER_AGC)
958COMPATIBLE_IOCTL(SOUND_MIXER_3DSE)
959COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE1)
960COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE2)
961COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE3)
962COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE4)
963COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE5)
964COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS)
965COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS)
966COMPATIBLE_IOCTL(OSS_GETVERSION)
967
968COMPATIBLE_IOCTL(RAW_SETBIND)
969COMPATIBLE_IOCTL(RAW_GETBIND)
970
971COMPATIBLE_IOCTL(WDIOC_GETSUPPORT)
972COMPATIBLE_IOCTL(WDIOC_GETSTATUS)
973COMPATIBLE_IOCTL(WDIOC_GETBOOTSTATUS)
974COMPATIBLE_IOCTL(WDIOC_GETTEMP)
975COMPATIBLE_IOCTL(WDIOC_SETOPTIONS)
976COMPATIBLE_IOCTL(WDIOC_KEEPALIVE)
977COMPATIBLE_IOCTL(WDIOC_SETTIMEOUT)
978COMPATIBLE_IOCTL(WDIOC_GETTIMEOUT)
979COMPATIBLE_IOCTL(WDIOC_SETPRETIMEOUT)
980COMPATIBLE_IOCTL(WDIOC_GETPRETIMEOUT)
981
982COMPATIBLE_IOCTL(RNDGETENTCNT)
983COMPATIBLE_IOCTL(RNDADDTOENTCNT)
984COMPATIBLE_IOCTL(RNDGETPOOL)
985COMPATIBLE_IOCTL(RNDADDENTROPY)
986COMPATIBLE_IOCTL(RNDZAPENTCNT)
987COMPATIBLE_IOCTL(RNDCLEARPOOL)
988
989COMPATIBLE_IOCTL(HCIUARTSETPROTO)
990COMPATIBLE_IOCTL(HCIUARTGETPROTO)
991COMPATIBLE_IOCTL(HCIUARTGETDEVICE)
992COMPATIBLE_IOCTL(HCIUARTSETFLAGS)
993COMPATIBLE_IOCTL(HCIUARTGETFLAGS)
994
995COMPATIBLE_IOCTL(CAPI_REGISTER)
996COMPATIBLE_IOCTL(CAPI_GET_MANUFACTURER)
997COMPATIBLE_IOCTL(CAPI_GET_VERSION)
998COMPATIBLE_IOCTL(CAPI_GET_SERIAL)
999COMPATIBLE_IOCTL(CAPI_GET_PROFILE)
1000COMPATIBLE_IOCTL(CAPI_MANUFACTURER_CMD)
1001COMPATIBLE_IOCTL(CAPI_GET_ERRCODE)
1002COMPATIBLE_IOCTL(CAPI_INSTALLED)
1003COMPATIBLE_IOCTL(CAPI_GET_FLAGS)
1004COMPATIBLE_IOCTL(CAPI_SET_FLAGS)
1005COMPATIBLE_IOCTL(CAPI_CLR_FLAGS)
1006COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT)
1007COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT)
1008
1009COMPATIBLE_IOCTL(GIGASET_REDIR)
1010COMPATIBLE_IOCTL(GIGASET_CONFIG)
1011COMPATIBLE_IOCTL(GIGASET_BRKCHARS)
1012COMPATIBLE_IOCTL(GIGASET_VERSION)
1013
1014COMPATIBLE_IOCTL(0x41545900)
1015COMPATIBLE_IOCTL(0x41545901)
1016COMPATIBLE_IOCTL(PCIIOC_CONTROLLER)
1017COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO)
1018COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM)
1019COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE)
1020
1021COMPATIBLE_IOCTL(HIDIOCGVERSION)
1022COMPATIBLE_IOCTL(HIDIOCAPPLICATION)
1023COMPATIBLE_IOCTL(HIDIOCGDEVINFO)
1024COMPATIBLE_IOCTL(HIDIOCGSTRING)
1025COMPATIBLE_IOCTL(HIDIOCINITREPORT)
1026COMPATIBLE_IOCTL(HIDIOCGREPORT)
1027COMPATIBLE_IOCTL(HIDIOCSREPORT)
1028COMPATIBLE_IOCTL(HIDIOCGREPORTINFO)
1029COMPATIBLE_IOCTL(HIDIOCGFIELDINFO)
1030COMPATIBLE_IOCTL(HIDIOCGUSAGE)
1031COMPATIBLE_IOCTL(HIDIOCSUSAGE)
1032COMPATIBLE_IOCTL(HIDIOCGUCODE)
1033COMPATIBLE_IOCTL(HIDIOCGFLAG)
1034COMPATIBLE_IOCTL(HIDIOCSFLAG)
1035COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX)
1036COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO)
1037
1038COMPATIBLE_IOCTL(AUDIO_STOP)
1039COMPATIBLE_IOCTL(AUDIO_PLAY)
1040COMPATIBLE_IOCTL(AUDIO_PAUSE)
1041COMPATIBLE_IOCTL(AUDIO_CONTINUE)
1042COMPATIBLE_IOCTL(AUDIO_SELECT_SOURCE)
1043COMPATIBLE_IOCTL(AUDIO_SET_MUTE)
1044COMPATIBLE_IOCTL(AUDIO_SET_AV_SYNC)
1045COMPATIBLE_IOCTL(AUDIO_SET_BYPASS_MODE)
1046COMPATIBLE_IOCTL(AUDIO_CHANNEL_SELECT)
1047COMPATIBLE_IOCTL(AUDIO_GET_STATUS)
1048COMPATIBLE_IOCTL(AUDIO_GET_CAPABILITIES)
1049COMPATIBLE_IOCTL(AUDIO_CLEAR_BUFFER)
1050COMPATIBLE_IOCTL(AUDIO_SET_ID)
1051COMPATIBLE_IOCTL(AUDIO_SET_MIXER)
1052COMPATIBLE_IOCTL(AUDIO_SET_STREAMTYPE)
1053COMPATIBLE_IOCTL(AUDIO_SET_EXT_ID)
1054COMPATIBLE_IOCTL(AUDIO_SET_ATTRIBUTES)
1055COMPATIBLE_IOCTL(AUDIO_SET_KARAOKE)
1056COMPATIBLE_IOCTL(DMX_START)
1057COMPATIBLE_IOCTL(DMX_STOP)
1058COMPATIBLE_IOCTL(DMX_SET_FILTER)
1059COMPATIBLE_IOCTL(DMX_SET_PES_FILTER)
1060COMPATIBLE_IOCTL(DMX_SET_BUFFER_SIZE)
1061COMPATIBLE_IOCTL(DMX_GET_PES_PIDS)
1062COMPATIBLE_IOCTL(DMX_GET_STC)
1063COMPATIBLE_IOCTL(DMX_REQBUFS)
1064COMPATIBLE_IOCTL(DMX_QUERYBUF)
1065COMPATIBLE_IOCTL(DMX_EXPBUF)
1066COMPATIBLE_IOCTL(DMX_QBUF)
1067COMPATIBLE_IOCTL(DMX_DQBUF)
1068COMPATIBLE_IOCTL(VIDEO_STOP)
1069COMPATIBLE_IOCTL(VIDEO_PLAY)
1070COMPATIBLE_IOCTL(VIDEO_FREEZE)
1071COMPATIBLE_IOCTL(VIDEO_CONTINUE)
1072COMPATIBLE_IOCTL(VIDEO_SELECT_SOURCE)
1073COMPATIBLE_IOCTL(VIDEO_SET_BLANK)
1074COMPATIBLE_IOCTL(VIDEO_GET_STATUS)
1075COMPATIBLE_IOCTL(VIDEO_SET_DISPLAY_FORMAT)
1076COMPATIBLE_IOCTL(VIDEO_FAST_FORWARD)
1077COMPATIBLE_IOCTL(VIDEO_SLOWMOTION)
1078COMPATIBLE_IOCTL(VIDEO_GET_CAPABILITIES)
1079COMPATIBLE_IOCTL(VIDEO_CLEAR_BUFFER)
1080COMPATIBLE_IOCTL(VIDEO_SET_ID)
1081COMPATIBLE_IOCTL(VIDEO_SET_STREAMTYPE)
1082COMPATIBLE_IOCTL(VIDEO_SET_FORMAT)
1083COMPATIBLE_IOCTL(VIDEO_SET_SYSTEM)
1084COMPATIBLE_IOCTL(VIDEO_SET_HIGHLIGHT)
1085COMPATIBLE_IOCTL(VIDEO_SET_SPU)
1086COMPATIBLE_IOCTL(VIDEO_GET_NAVI)
1087COMPATIBLE_IOCTL(VIDEO_SET_ATTRIBUTES)
1088COMPATIBLE_IOCTL(VIDEO_GET_SIZE)
1089COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE)
1090
1091
1092COMPATIBLE_IOCTL(JSIOCGVERSION)
1093COMPATIBLE_IOCTL(JSIOCGAXES)
1094COMPATIBLE_IOCTL(JSIOCGBUTTONS)
1095COMPATIBLE_IOCTL(JSIOCGNAME(0))
1096
1097#ifdef TIOCGLTC
1098COMPATIBLE_IOCTL(TIOCGLTC)
1099COMPATIBLE_IOCTL(TIOCSLTC)
1100#endif
1101#ifdef TIOCSTART
1102
1103
1104
1105
1106
1107
1108COMPATIBLE_IOCTL(TIOCSTART)
1109COMPATIBLE_IOCTL(TIOCSTOP)
1110#endif
1111
1112
1113
1114
1115#define VFAT_IOCTL_READDIR_BOTH32 _IOR('r', 1, struct compat_dirent[2])
1116#define VFAT_IOCTL_READDIR_SHORT32 _IOR('r', 2, struct compat_dirent[2])
1117
1118IGNORE_IOCTL(VFAT_IOCTL_READDIR_BOTH32)
1119IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32)
1120
1121#ifdef CONFIG_SPARC
1122
1123IGNORE_IOCTL(FBIOGTYPE)
1124IGNORE_IOCTL(FBIOSATTR)
1125IGNORE_IOCTL(FBIOGATTR)
1126IGNORE_IOCTL(FBIOSVIDEO)
1127IGNORE_IOCTL(FBIOGVIDEO)
1128IGNORE_IOCTL(FBIOSCURPOS)
1129IGNORE_IOCTL(FBIOGCURPOS)
1130IGNORE_IOCTL(FBIOGCURMAX)
1131IGNORE_IOCTL(FBIOPUTCMAP32)
1132IGNORE_IOCTL(FBIOGETCMAP32)
1133IGNORE_IOCTL(FBIOSCURSOR32)
1134IGNORE_IOCTL(FBIOGCURSOR32)
1135#endif
1136};
1137
1138
1139
1140
1141
1142
1143
1144
1145static long do_ioctl_trans(unsigned int cmd,
1146 unsigned long arg, struct file *file)
1147{
1148 void __user *argp = compat_ptr(arg);
1149
1150 switch (cmd) {
1151 case PPPIOCGIDLE32:
1152 return ppp_gidle(file, cmd, argp);
1153 case PPPIOCSCOMPRESS32:
1154 return ppp_scompress(file, cmd, argp);
1155 case PPPIOCSPASS32:
1156 case PPPIOCSACTIVE32:
1157 return ppp_sock_fprog_ioctl_trans(file, cmd, argp);
1158#ifdef CONFIG_BLOCK
1159 case SG_IO:
1160 return sg_ioctl_trans(file, cmd, argp);
1161 case SG_GET_REQUEST_TABLE:
1162 return sg_grt_trans(file, cmd, argp);
1163 case MTIOCGET32:
1164 case MTIOCPOS32:
1165 return mt_ioctl_trans(file, cmd, argp);
1166#endif
1167
1168 case TIOCGSERIAL:
1169 case TIOCSSERIAL:
1170 return serial_struct_ioctl(file, cmd, argp);
1171
1172
1173 case VIDEO_GET_EVENT:
1174 return do_video_get_event(file, cmd, argp);
1175 case VIDEO_STILLPICTURE:
1176 return do_video_stillpicture(file, cmd, argp);
1177 case VIDEO_SET_SPU_PALETTE:
1178 return do_video_set_spu_palette(file, cmd, argp);
1179 }
1180
1181
1182
1183
1184
1185 switch (cmd) {
1186
1187 case TCSBRKP:
1188 case TIOCMIWAIT:
1189 case TIOCSCTTY:
1190
1191 case HOT_REMOVE_DISK:
1192 case HOT_ADD_DISK:
1193 case SET_DISK_FAULTY:
1194 case SET_BITMAP_FILE:
1195
1196 case KDSIGACCEPT:
1197 case KIOCSOUND:
1198 case KDMKTONE:
1199 case KDSETMODE:
1200 case KDSKBMODE:
1201 case KDSKBMETA:
1202 case KDSKBLED:
1203 case KDSETLED:
1204 return vfs_ioctl(file, cmd, arg);
1205 }
1206
1207 return -ENOIOCTLCMD;
1208}
1209
1210static int compat_ioctl_check_table(unsigned int xcmd)
1211{
1212 int i;
1213 const int max = ARRAY_SIZE(ioctl_pointer) - 1;
1214
1215 BUILD_BUG_ON(max >= (1 << 16));
1216
1217
1218
1219 i = ((xcmd >> 16) * max) >> 16;
1220
1221
1222 while (ioctl_pointer[i] < xcmd && i < max)
1223 i++;
1224
1225
1226 while (ioctl_pointer[i] > xcmd && i > 0)
1227 i--;
1228
1229 return ioctl_pointer[i] == xcmd;
1230}
1231
1232COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd,
1233 compat_ulong_t, arg32)
1234{
1235 unsigned long arg = arg32;
1236 struct fd f = fdget(fd);
1237 int error = -EBADF;
1238 if (!f.file)
1239 goto out;
1240
1241
1242 error = security_file_ioctl(f.file, cmd, arg);
1243 if (error)
1244 goto out_fput;
1245
1246 switch (cmd) {
1247
1248 case FIOCLEX:
1249 case FIONCLEX:
1250 case FIFREEZE:
1251 case FITHAW:
1252 case FICLONE:
1253 goto do_ioctl;
1254
1255 case FIONBIO:
1256 case FIOASYNC:
1257 case FIOQSIZE:
1258 case FS_IOC_FIEMAP:
1259 case FIGETBSZ:
1260 case FICLONERANGE:
1261 case FIDEDUPERANGE:
1262 goto found_handler;
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273 case FIBMAP:
1274 goto found_handler;
1275
1276 case FIONREAD:
1277 goto found_handler;
1278
1279#if defined(CONFIG_X86_64)
1280 case FS_IOC_RESVSP_32:
1281 case FS_IOC_RESVSP64_32:
1282 error = compat_ioctl_preallocate(f.file, compat_ptr(arg));
1283 goto out_fput;
1284#else
1285 case FS_IOC_RESVSP:
1286 case FS_IOC_RESVSP64:
1287 goto found_handler;
1288#endif
1289
1290 default:
1291 if (f.file->f_op->compat_ioctl) {
1292 error = f.file->f_op->compat_ioctl(f.file, cmd, arg);
1293 if (error != -ENOIOCTLCMD)
1294 goto out_fput;
1295 }
1296
1297 if (!f.file->f_op->unlocked_ioctl)
1298 goto do_ioctl;
1299 break;
1300 }
1301
1302 if (compat_ioctl_check_table(XFORM(cmd)))
1303 goto found_handler;
1304
1305 error = do_ioctl_trans(cmd, arg, f.file);
1306 if (error == -ENOIOCTLCMD)
1307 error = -ENOTTY;
1308
1309 goto out_fput;
1310
1311 found_handler:
1312 arg = (unsigned long)compat_ptr(arg);
1313 do_ioctl:
1314 error = do_vfs_ioctl(f.file, fd, cmd, arg);
1315 out_fput:
1316 fdput(f);
1317 out:
1318 return error;
1319}
1320
1321static int __init init_sys32_ioctl_cmp(const void *p, const void *q)
1322{
1323 unsigned int a, b;
1324 a = *(unsigned int *)p;
1325 b = *(unsigned int *)q;
1326 if (a > b)
1327 return 1;
1328 if (a < b)
1329 return -1;
1330 return 0;
1331}
1332
1333static int __init init_sys32_ioctl(void)
1334{
1335 sort(ioctl_pointer, ARRAY_SIZE(ioctl_pointer), sizeof(*ioctl_pointer),
1336 init_sys32_ioctl_cmp, NULL);
1337 return 0;
1338}
1339__initcall(init_sys32_ioctl);
1340