1 /* $Id: ioctl32.c,v 1.66 1999/08/08 01:37:06 davem Exp $
2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
7 * These routines maintain argument size conversion between 32bit and 64bit
11 #include <linux/types.h>
12 #include <linux/kernel.h>
13 #include <linux/sched.h>
14 #include <linux/smp.h>
15 #include <linux/smp_lock.h>
16 #include <linux/ioctl.h>
18 #include <linux/malloc.h>
19 #include <linux/hdreg.h>
22 #include <linux/route.h>
23 #include <linux/skbuff.h>
24 #include <linux/netlink.h>
27 #include <linux/file.h>
29 #include <linux/ppp_defs.h>
30 #include <linux/if_ppp.h>
31 #include <linux/mtio.h>
32 #include <linux/cdrom.h>
33 #include <linux/loop.h>
34 #include <linux/auto_fs.h>
35 #include <linux/tty.h>
36 #include <linux/vt_kern.h>
38 #include <linux/ext2_fs.h>
39 #include <linux/videodev.h>
40 #include <linux/netdevice.h>
41 #include <linux/raw.h>
43 #include <scsi/scsi.h>
46 #include <scsi/scsi_ioctl.h>
50 #include <asm/types.h>
51 #include <asm/uaccess.h>
54 #include <asm/vuid_event.h>
56 #include <asm/openpromio.h>
57 #include <asm/envctrl.h>
58 #include <asm/audioio.h>
59 #include <asm/ethtool.h>
61 #include <linux/soundcard.h>
63 /* Use this to get at 32-bit user passed pointers.
64 See sys_sparc32.c for description about these. */
65 #define A(__x) ((unsigned long)(__x))
67 ({ unsigned long __ret; \
68 __asm__ ("srl %0, 0, %0" \
74 /* Aiee. Someone does not find a difference between int and long */
75 #define EXT2_IOC32_GETFLAGS _IOR('f', 1, int)
76 #define EXT2_IOC32_SETFLAGS _IOW('f', 2, int)
77 #define EXT2_IOC32_GETVERSION _IOR('v', 1, int)
78 #define EXT2_IOC32_SETVERSION _IOW('v', 2, int)
80 extern asmlinkage
int sys_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
);
82 static int w_long(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
84 mm_segment_t old_fs
= get_fs();
89 err
= sys_ioctl(fd
, cmd
, (unsigned long)&val
);
91 if (!err
&& put_user(val
, (u32
*)arg
))
96 static int rw_long(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
98 mm_segment_t old_fs
= get_fs();
102 if(get_user(val
, (u32
*)arg
))
105 err
= sys_ioctl(fd
, cmd
, (unsigned long)&val
);
107 if (!err
&& put_user(val
, (u32
*)arg
))
112 static int do_ext2_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
114 /* These are just misnamed, they actually get/put from/to user an int */
116 case EXT2_IOC32_GETFLAGS
: cmd
= EXT2_IOC_GETFLAGS
; break;
117 case EXT2_IOC32_SETFLAGS
: cmd
= EXT2_IOC_SETFLAGS
; break;
118 case EXT2_IOC32_GETVERSION
: cmd
= EXT2_IOC_GETVERSION
; break;
119 case EXT2_IOC32_SETVERSION
: cmd
= EXT2_IOC_SETVERSION
; break;
121 return sys_ioctl(fd
, cmd
, arg
);
124 struct video_tuner32
{
127 u32 rangelow
, rangehigh
;
132 static int get_video_tuner32(struct video_tuner
*kp
, struct video_tuner32
*up
)
136 if(get_user(kp
->tuner
, &up
->tuner
))
138 for(i
= 0; i
< 32; i
++)
139 __get_user(kp
->name
[i
], &up
->name
[i
]);
140 __get_user(kp
->rangelow
, &up
->rangelow
);
141 __get_user(kp
->rangehigh
, &up
->rangehigh
);
142 __get_user(kp
->flags
, &up
->flags
);
143 __get_user(kp
->mode
, &up
->mode
);
144 __get_user(kp
->signal
, &up
->signal
);
148 static int put_video_tuner32(struct video_tuner
*kp
, struct video_tuner32
*up
)
152 if(put_user(kp
->tuner
, &up
->tuner
))
154 for(i
= 0; i
< 32; i
++)
155 __put_user(kp
->name
[i
], &up
->name
[i
]);
156 __put_user(kp
->rangelow
, &up
->rangelow
);
157 __put_user(kp
->rangehigh
, &up
->rangehigh
);
158 __put_user(kp
->flags
, &up
->flags
);
159 __put_user(kp
->mode
, &up
->mode
);
160 __put_user(kp
->signal
, &up
->signal
);
164 struct video_buffer32
{
165 /* void * */ u32 base
;
166 s32 height
, width
, depth
, bytesperline
;
169 static int get_video_buffer32(struct video_buffer
*kp
, struct video_buffer32
*up
)
173 if(get_user(tmp
, &up
->base
))
175 kp
->base
= (void *) ((unsigned long)tmp
);
176 __get_user(kp
->height
, &up
->height
);
177 __get_user(kp
->width
, &up
->width
);
178 __get_user(kp
->depth
, &up
->depth
);
179 __get_user(kp
->bytesperline
, &up
->bytesperline
);
183 static int put_video_buffer32(struct video_buffer
*kp
, struct video_buffer32
*up
)
185 u32 tmp
= (u32
)((unsigned long)kp
->base
);
187 if(put_user(tmp
, &up
->base
))
189 __put_user(kp
->height
, &up
->height
);
190 __put_user(kp
->width
, &up
->width
);
191 __put_user(kp
->depth
, &up
->depth
);
192 __put_user(kp
->bytesperline
, &up
->bytesperline
);
196 struct video_clip32
{
197 s32 x
, y
, width
, height
;
198 /* struct video_clip32 * */ u32 next
;
201 struct video_window32
{
202 u32 x
, y
, width
, height
, chromakey
, flags
;
203 /* struct video_clip32 * */ u32 clips
;
207 static void free_kvideo_clips(struct video_window
*kp
)
209 struct video_clip
*cp
;
216 static int get_video_window32(struct video_window
*kp
, struct video_window32
*up
)
218 struct video_clip32
*ucp
;
219 struct video_clip
*kcp
;
223 if(get_user(kp
->x
, &up
->x
))
225 __get_user(kp
->y
, &up
->y
);
226 __get_user(kp
->width
, &up
->width
);
227 __get_user(kp
->height
, &up
->height
);
228 __get_user(kp
->chromakey
, &up
->chromakey
);
229 __get_user(kp
->flags
, &up
->flags
);
230 __get_user(kp
->clipcount
, &up
->clipcount
);
231 __get_user(tmp
, &up
->clips
);
232 ucp
= (struct video_clip32
*)A(tmp
);
235 nclips
= kp
->clipcount
;
242 /* Peculiar interface... */
244 nclips
= VIDEO_CLIPMAP_SIZE
;
246 kcp
= kmalloc(nclips
* sizeof(struct video_clip
), GFP_KERNEL
);
249 goto cleanup_and_err
;
252 for(i
= 0; i
< nclips
; i
++) {
253 __get_user(kcp
[i
].x
, &ucp
[i
].x
);
254 __get_user(kcp
[i
].y
, &ucp
[i
].y
);
255 __get_user(kcp
[i
].width
, &ucp
[i
].width
);
256 __get_user(kcp
[i
].height
, &ucp
[i
].height
);
257 kcp
[nclips
].next
= NULL
;
263 free_kvideo_clips(kp
);
267 /* You get back everything except the clips... */
268 static int put_video_window32(struct video_window
*kp
, struct video_window32
*up
)
270 if(put_user(kp
->x
, &up
->x
))
272 __put_user(kp
->y
, &up
->y
);
273 __put_user(kp
->width
, &up
->width
);
274 __put_user(kp
->height
, &up
->height
);
275 __put_user(kp
->chromakey
, &up
->chromakey
);
276 __put_user(kp
->flags
, &up
->flags
);
277 __put_user(kp
->clipcount
, &up
->clipcount
);
281 #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32)
282 #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32)
283 #define VIDIOCGWIN32 _IOR('v',9, struct video_window32)
284 #define VIDIOCSWIN32 _IOW('v',10, struct video_window32)
285 #define VIDIOCGFBUF32 _IOR('v',11, struct video_buffer32)
286 #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32)
287 #define VIDIOCGFREQ32 _IOR('v',14, u32)
288 #define VIDIOCSFREQ32 _IOW('v',15, u32)
290 static int do_video_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
293 struct video_tuner vt
;
294 struct video_buffer vb
;
295 struct video_window vw
;
298 mm_segment_t old_fs
= get_fs();
299 void *up
= (void *)arg
;
302 /* First, convert the command. */
304 case VIDIOCGTUNER32
: cmd
= VIDIOCGTUNER
; break;
305 case VIDIOCSTUNER32
: cmd
= VIDIOCSTUNER
; break;
306 case VIDIOCGWIN32
: cmd
= VIDIOCGWIN
; break;
307 case VIDIOCSWIN32
: cmd
= VIDIOCSWIN
; break;
308 case VIDIOCGFBUF32
: cmd
= VIDIOCGFBUF
; break;
309 case VIDIOCSFBUF32
: cmd
= VIDIOCSFBUF
; break;
310 case VIDIOCGFREQ32
: cmd
= VIDIOCGFREQ
; break;
311 case VIDIOCSFREQ32
: cmd
= VIDIOCSFREQ
; break;
317 err
= get_video_tuner32(&karg
.vt
, up
);
321 err
= get_video_window32(&karg
.vw
, up
);
325 err
= get_video_buffer32(&karg
.vb
, up
);
329 err
= get_user(karg
.vx
, (u32
*)up
);
336 err
= sys_ioctl(fd
, cmd
, (unsigned long)&karg
);
339 if(cmd
== VIDIOCSWIN
)
340 free_kvideo_clips(&karg
.vw
);
345 err
= put_video_tuner32(&karg
.vt
, up
);
349 err
= put_video_window32(&karg
.vw
, up
);
353 err
= put_video_buffer32(&karg
.vb
, up
);
357 err
= put_user(((u32
)karg
.vx
), (u32
*)up
);
370 static int do_siocgstamp(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
372 struct timeval32
*up
= (struct timeval32
*)arg
;
374 mm_segment_t old_fs
= get_fs();
378 err
= sys_ioctl(fd
, cmd
, (unsigned long)&ktv
);
381 err
= put_user(ktv
.tv_sec
, &up
->tv_sec
);
382 err
|= __put_user(ktv
.tv_usec
, &up
->tv_usec
);
390 unsigned short base_addr
;
397 #define IFHWADDRLEN 6
400 char ifrn_name
[IFNAMSIZ
]; /* if name, e.g. "en0" */
403 struct sockaddr ifru_addr
;
404 struct sockaddr ifru_dstaddr
;
405 struct sockaddr ifru_broadaddr
;
406 struct sockaddr ifru_netmask
;
407 struct sockaddr ifru_hwaddr
;
411 struct ifmap32 ifru_map
;
412 char ifru_slave
[IFNAMSIZ
]; /* Just fits the size */
413 __kernel_caddr_t32 ifru_data
;
418 int ifc_len
; /* size of buffer */
419 __kernel_caddr_t32 ifcbuf
;
422 static int dev_ifname32(unsigned int fd
, unsigned long arg
)
425 struct ifreq32 ifr32
;
428 if (copy_from_user(&ifr32
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
431 dev
= dev_get_by_index(ifr32
.ifr_ifindex
);
435 err
= copy_to_user((struct ifreq32
*)arg
, &ifr32
, sizeof(struct ifreq32
));
436 return (err
? -EFAULT
: 0);
439 static inline int dev_ifconf(unsigned int fd
, unsigned long arg
)
441 struct ifconf32 ifc32
;
443 struct ifreq32
*ifr32
;
449 if (copy_from_user(&ifc32
, (struct ifconf32
*)arg
, sizeof(struct ifconf32
)))
452 if(ifc32
.ifcbuf
== 0) {
457 ifc
.ifc_len
= ((ifc32
.ifc_len
/ sizeof (struct ifreq32
)) + 1) *
458 sizeof (struct ifreq
);
459 ifc
.ifc_buf
= kmalloc (ifc
.ifc_len
, GFP_KERNEL
);
464 ifr32
= (struct ifreq32
*)A(ifc32
.ifcbuf
);
465 for (i
= 0; i
< ifc32
.ifc_len
; i
+= sizeof (struct ifreq32
)) {
466 if (copy_from_user(ifr
++, ifr32
++, sizeof (struct ifreq32
))) {
471 old_fs
= get_fs(); set_fs (KERNEL_DS
);
472 err
= sys_ioctl (fd
, SIOCGIFCONF
, (unsigned long)&ifc
);
476 ifr32
= (struct ifreq32
*)A(ifc32
.ifcbuf
);
477 for (i
= 0, j
= 0; i
< ifc32
.ifc_len
&& j
< ifc
.ifc_len
;
478 i
+= sizeof (struct ifreq32
), j
+= sizeof (struct ifreq
)) {
479 if (copy_to_user(ifr32
++, ifr
++, sizeof (struct ifreq32
))) {
485 if (i
<= ifc32
.ifc_len
)
488 ifc32
.ifc_len
= i
- sizeof (struct ifreq32
);
489 if (copy_to_user((struct ifconf32
*)arg
, &ifc32
, sizeof(struct ifconf32
)))
493 if(ifc
.ifc_buf
!= NULL
)
498 static inline int dev_ifsioc(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
506 err
= copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(ifr
.ifr_name
));
507 err
|= __get_user(ifr
.ifr_map
.mem_start
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_start
));
508 err
|= __get_user(ifr
.ifr_map
.mem_end
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_end
));
509 err
|= __get_user(ifr
.ifr_map
.base_addr
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.base_addr
));
510 err
|= __get_user(ifr
.ifr_map
.irq
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.irq
));
511 err
|= __get_user(ifr
.ifr_map
.dma
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.dma
));
512 err
|= __get_user(ifr
.ifr_map
.port
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.port
));
520 if (copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
522 ifr
.ifr_data
= (__kernel_caddr_t
)get_free_page(GFP_KERNEL
);
525 if(cmd
== SIOCETHTOOL
) {
528 __get_user(data
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_data
));
529 if(copy_from_user(ifr
.ifr_data
,
531 sizeof(struct ethtool_cmd
))) {
532 free_page((unsigned long)ifr
.ifr_data
);
538 if (copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
544 err
= sys_ioctl (fd
, cmd
, (unsigned long)&ifr
);
559 if (copy_to_user((struct ifreq32
*)arg
, &ifr
, sizeof(struct ifreq32
)))
570 __get_user(data
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_data
));
571 if(cmd
== SIOCETHTOOL
)
572 len
= sizeof(struct ethtool_cmd
);
573 if(cmd
== SIOCGPPPVER
)
574 len
= strlen((char *)ifr
.ifr_data
) + 1;
575 else if(cmd
== SIOCGPPPCSTATS
)
576 len
= sizeof(struct ppp_comp_stats
);
578 len
= sizeof(struct ppp_stats
);
580 len
= copy_to_user((char *)A(data
), ifr
.ifr_data
, len
);
581 free_page((unsigned long)ifr
.ifr_data
);
587 err
= copy_to_user((struct ifreq32
*)arg
, &ifr
, sizeof(ifr
.ifr_name
));
588 err
|= __put_user(ifr
.ifr_map
.mem_start
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_start
));
589 err
|= __put_user(ifr
.ifr_map
.mem_end
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_end
));
590 err
|= __put_user(ifr
.ifr_map
.base_addr
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.base_addr
));
591 err
|= __put_user(ifr
.ifr_map
.irq
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.irq
));
592 err
|= __put_user(ifr
.ifr_map
.dma
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.dma
));
593 err
|= __put_user(ifr
.ifr_map
.port
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.port
));
602 struct sockaddr rt_dst
; /* target address */
603 struct sockaddr rt_gateway
; /* gateway addr (RTF_GATEWAY) */
604 struct sockaddr rt_genmask
; /* target network mask (IP) */
605 unsigned short rt_flags
;
608 unsigned char rt_tos
;
609 unsigned char rt_class
;
611 short rt_metric
; /* +1 for binary compatibility! */
612 /* char * */ u32 rt_dev
; /* forcing the device at add */
613 u32 rt_mtu
; /* per route MTU/Window */
614 u32 rt_window
; /* Window clamping */
615 unsigned short rt_irtt
; /* Initial RTT */
619 static inline int routing_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
625 mm_segment_t old_fs
= get_fs();
627 ret
= copy_from_user (&r
.rt_dst
, &(((struct rtentry32
*)arg
)->rt_dst
), 3 * sizeof(struct sockaddr
));
628 ret
|= __get_user (r
.rt_flags
, &(((struct rtentry32
*)arg
)->rt_flags
));
629 ret
|= __get_user (r
.rt_metric
, &(((struct rtentry32
*)arg
)->rt_metric
));
630 ret
|= __get_user (r
.rt_mtu
, &(((struct rtentry32
*)arg
)->rt_mtu
));
631 ret
|= __get_user (r
.rt_window
, &(((struct rtentry32
*)arg
)->rt_window
));
632 ret
|= __get_user (r
.rt_irtt
, &(((struct rtentry32
*)arg
)->rt_irtt
));
633 ret
|= __get_user (rtdev
, &(((struct rtentry32
*)arg
)->rt_dev
));
635 ret
|= copy_from_user (devname
, (char *)A(rtdev
), 15);
636 r
.rt_dev
= devname
; devname
[15] = 0;
642 ret
= sys_ioctl (fd
, cmd
, (long)&r
);
647 struct hd_geometry32
{
649 unsigned char sectors
;
650 unsigned short cylinders
;
654 static inline int hdio_getgeo(unsigned int fd
, unsigned long arg
)
656 mm_segment_t old_fs
= get_fs();
657 struct hd_geometry geo
;
661 err
= sys_ioctl(fd
, HDIO_GETGEO
, (unsigned long)&geo
);
664 err
= copy_to_user ((struct hd_geometry32
*)arg
, &geo
, 4);
665 err
|= __put_user (geo
.start
, &(((struct hd_geometry32
*)arg
)->start
));
671 int index
; /* first element (0 origin) */
678 #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32)
679 #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32)
681 static inline int fbiogetputcmap(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
685 char red
[256], green
[256], blue
[256];
687 mm_segment_t old_fs
= get_fs();
689 ret
= get_user(f
.index
, &(((struct fbcmap32
*)arg
)->index
));
690 ret
|= __get_user(f
.count
, &(((struct fbcmap32
*)arg
)->count
));
691 ret
|= __get_user(r
, &(((struct fbcmap32
*)arg
)->red
));
692 ret
|= __get_user(g
, &(((struct fbcmap32
*)arg
)->green
));
693 ret
|= __get_user(b
, &(((struct fbcmap32
*)arg
)->blue
));
696 if ((f
.index
< 0) || (f
.index
> 255)) return -EINVAL
;
697 if (f
.index
+ f
.count
> 256)
698 f
.count
= 256 - f
.index
;
699 if (cmd
== FBIOPUTCMAP32
) {
700 ret
= copy_from_user (red
, (char *)A(r
), f
.count
);
701 ret
|= copy_from_user (green
, (char *)A(g
), f
.count
);
702 ret
|= copy_from_user (blue
, (char *)A(b
), f
.count
);
706 f
.red
= red
; f
.green
= green
; f
.blue
= blue
;
708 ret
= sys_ioctl (fd
, (cmd
== FBIOPUTCMAP32
) ? FBIOPUTCMAP_SPARC
: FBIOGETCMAP_SPARC
, (long)&f
);
710 if (!ret
&& cmd
== FBIOGETCMAP32
) {
711 ret
= copy_to_user ((char *)A(r
), red
, f
.count
);
712 ret
|= copy_to_user ((char *)A(g
), green
, f
.count
);
713 ret
|= copy_to_user ((char *)A(b
), blue
, f
.count
);
719 short set
; /* what to set, choose from the list above */
720 short enable
; /* cursor on/off */
721 struct fbcurpos pos
; /* cursor position */
722 struct fbcurpos hot
; /* cursor hot spot */
723 struct fbcmap32 cmap
; /* color map info */
724 struct fbcurpos size
; /* cursor bit map size */
725 u32 image
; /* cursor image bits */
726 u32 mask
; /* cursor mask bits */
729 #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32)
730 #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32)
732 static inline int fbiogscursor(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
736 char red
[2], green
[2], blue
[2];
737 char image
[128], mask
[128];
740 mm_segment_t old_fs
= get_fs();
742 ret
= copy_from_user (&f
, (struct fbcursor32
*)arg
, 2 * sizeof (short) + 2 * sizeof(struct fbcurpos
));
743 ret
|= __get_user(f
.size
.fbx
, &(((struct fbcursor32
*)arg
)->size
.fbx
));
744 ret
|= __get_user(f
.size
.fby
, &(((struct fbcursor32
*)arg
)->size
.fby
));
745 ret
|= __get_user(f
.cmap
.index
, &(((struct fbcursor32
*)arg
)->cmap
.index
));
746 ret
|= __get_user(f
.cmap
.count
, &(((struct fbcursor32
*)arg
)->cmap
.count
));
747 ret
|= __get_user(r
, &(((struct fbcursor32
*)arg
)->cmap
.red
));
748 ret
|= __get_user(g
, &(((struct fbcursor32
*)arg
)->cmap
.green
));
749 ret
|= __get_user(b
, &(((struct fbcursor32
*)arg
)->cmap
.blue
));
750 ret
|= __get_user(m
, &(((struct fbcursor32
*)arg
)->mask
));
751 ret
|= __get_user(i
, &(((struct fbcursor32
*)arg
)->image
));
754 if (f
.set
& FB_CUR_SETCMAP
) {
755 if ((uint
) f
.size
.fby
> 32)
757 ret
= copy_from_user (mask
, (char *)A(m
), f
.size
.fby
* 4);
758 ret
|= copy_from_user (image
, (char *)A(i
), f
.size
.fby
* 4);
761 f
.image
= image
; f
.mask
= mask
;
763 if (f
.set
& FB_CUR_SETCMAP
) {
764 ret
= copy_from_user (red
, (char *)A(r
), 2);
765 ret
|= copy_from_user (green
, (char *)A(g
), 2);
766 ret
|= copy_from_user (blue
, (char *)A(b
), 2);
769 f
.cmap
.red
= red
; f
.cmap
.green
= green
; f
.cmap
.blue
= blue
;
772 ret
= sys_ioctl (fd
, FBIOSCURSOR
, (long)&f
);
777 struct fb_fix_screeninfo32
{
779 __kernel_caddr_t32 smem_start
;
788 __kernel_caddr_t32 mmio_start
;
797 __kernel_caddr_t32 red
;
798 __kernel_caddr_t32 green
;
799 __kernel_caddr_t32 blue
;
800 __kernel_caddr_t32 transp
;
803 static int fb_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
805 mm_segment_t old_fs
= get_fs();
806 u32 red
= 0, green
= 0, blue
= 0, transp
= 0;
807 struct fb_fix_screeninfo fix
;
812 memset(&cmap
, 0, sizeof(cmap
));
814 case FBIOGET_FSCREENINFO
:
820 err
= __get_user(cmap
.start
, &((struct fb_cmap32
*)arg
)->start
);
821 err
|= __get_user(cmap
.len
, &((struct fb_cmap32
*)arg
)->len
);
822 err
|= __get_user(red
, &((struct fb_cmap32
*)arg
)->red
);
823 err
|= __get_user(green
, &((struct fb_cmap32
*)arg
)->green
);
824 err
|= __get_user(blue
, &((struct fb_cmap32
*)arg
)->blue
);
825 err
|= __get_user(transp
, &((struct fb_cmap32
*)arg
)->transp
);
829 cmap
.red
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
832 cmap
.green
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
835 cmap
.blue
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
839 cmap
.transp
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
844 if (cmd
== FBIOGETCMAP
)
847 err
= __copy_from_user(cmap
.red
, (char *)A(red
), cmap
.len
* sizeof(__u16
));
848 err
|= __copy_from_user(cmap
.green
, (char *)A(green
), cmap
.len
* sizeof(__u16
));
849 err
|= __copy_from_user(cmap
.blue
, (char *)A(blue
), cmap
.len
* sizeof(__u16
));
850 if (cmap
.transp
) err
|= __copy_from_user(cmap
.transp
, (char *)A(transp
), cmap
.len
* sizeof(__u16
));
856 static int count
= 0;
858 printk("%s: Unknown fb ioctl cmd fd(%d) "
859 "cmd(%08x) arg(%08lx)\n",
860 __FUNCTION__
, fd
, cmd
, arg
);
865 err
= sys_ioctl(fd
, cmd
, (unsigned long)karg
);
870 case FBIOGET_FSCREENINFO
:
871 err
= __copy_to_user((char *)((struct fb_fix_screeninfo32
*)arg
)->id
, (char *)fix
.id
, sizeof(fix
.id
));
872 err
|= __put_user((__u32
)(unsigned long)fix
.smem_start
, &((struct fb_fix_screeninfo32
*)arg
)->smem_start
);
873 err
|= __put_user(fix
.smem_len
, &((struct fb_fix_screeninfo32
*)arg
)->smem_len
);
874 err
|= __put_user(fix
.type
, &((struct fb_fix_screeninfo32
*)arg
)->type
);
875 err
|= __put_user(fix
.type_aux
, &((struct fb_fix_screeninfo32
*)arg
)->type_aux
);
876 err
|= __put_user(fix
.visual
, &((struct fb_fix_screeninfo32
*)arg
)->visual
);
877 err
|= __put_user(fix
.xpanstep
, &((struct fb_fix_screeninfo32
*)arg
)->xpanstep
);
878 err
|= __put_user(fix
.ypanstep
, &((struct fb_fix_screeninfo32
*)arg
)->ypanstep
);
879 err
|= __put_user(fix
.ywrapstep
, &((struct fb_fix_screeninfo32
*)arg
)->ywrapstep
);
880 err
|= __put_user(fix
.line_length
, &((struct fb_fix_screeninfo32
*)arg
)->line_length
);
881 err
|= __put_user((__u32
)(unsigned long)fix
.mmio_start
, &((struct fb_fix_screeninfo32
*)arg
)->mmio_start
);
882 err
|= __put_user(fix
.mmio_len
, &((struct fb_fix_screeninfo32
*)arg
)->mmio_len
);
883 err
|= __put_user(fix
.accel
, &((struct fb_fix_screeninfo32
*)arg
)->accel
);
884 err
|= __copy_to_user((char *)((struct fb_fix_screeninfo32
*)arg
)->reserved
, (char *)fix
.reserved
, sizeof(fix
.reserved
));
887 err
= __copy_to_user((char *)A(red
), cmap
.red
, cmap
.len
* sizeof(__u16
));
888 err
|= __copy_to_user((char *)A(green
), cmap
.blue
, cmap
.len
* sizeof(__u16
));
889 err
|= __copy_to_user((char *)A(blue
), cmap
.blue
, cmap
.len
* sizeof(__u16
));
891 err
|= __copy_to_user((char *)A(transp
), cmap
.transp
, cmap
.len
* sizeof(__u16
));
896 out
: if (cmap
.red
) kfree(cmap
.red
);
897 if (cmap
.green
) kfree(cmap
.green
);
898 if (cmap
.blue
) kfree(cmap
.blue
);
899 if (cmap
.transp
) kfree(cmap
.transp
);
903 static int hdio_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
905 mm_segment_t old_fs
= get_fs();
911 error
= sys_ioctl(fd
, cmd
, (long)&kval
);
915 uvp
= (unsigned int *)arg
;
916 if(put_user(kval
, uvp
))
922 struct floppy_struct32
{
927 unsigned int stretch
;
931 unsigned char fmt_gap
;
932 const __kernel_caddr_t32 name
;
935 struct floppy_drive_params32
{
943 unsigned char spindown_offset
;
944 unsigned char select_delay
;
946 unsigned char tracks
;
948 unsigned char interleave_sect
;
949 struct floppy_max_errors max_errors
;
957 struct floppy_drive_struct32
{
971 __kernel_caddr_t32 dmabuf
;
975 struct floppy_fdc_state32
{
979 unsigned char version
;
982 unsigned int rawcmd
:2;
983 unsigned int reset
:1;
984 unsigned int need_configure
:1;
985 unsigned int perp_mode
:2;
986 unsigned int has_fifo
:1;
987 unsigned int driver_version
;
988 unsigned char track
[4];
991 struct floppy_write_errors32
{
992 unsigned int write_errors
;
993 u32 first_error_sector
;
994 int first_error_generation
;
995 u32 last_error_sector
;
996 int last_error_generation
;
997 unsigned int badness
;
1000 #define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32)
1001 #define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32)
1002 #define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32)
1003 #define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32)
1004 #define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32)
1005 #define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32)
1006 #define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32)
1007 #define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32)
1008 #define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32)
1013 } fd_ioctl_trans_table
[] = {
1014 { FDSETPRM32
, FDSETPRM
},
1015 { FDDEFPRM32
, FDDEFPRM
},
1016 { FDGETPRM32
, FDGETPRM
},
1017 { FDSETDRVPRM32
, FDSETDRVPRM
},
1018 { FDGETDRVPRM32
, FDGETDRVPRM
},
1019 { FDGETDRVSTAT32
, FDGETDRVSTAT
},
1020 { FDPOLLDRVSTAT32
, FDPOLLDRVSTAT
},
1021 { FDGETFDCSTAT32
, FDGETFDCSTAT
},
1022 { FDWERRORGET32
, FDWERRORGET
}
1025 #define NR_FD_IOCTL_TRANS (sizeof(fd_ioctl_trans_table)/sizeof(fd_ioctl_trans_table[0]))
1027 static int fd_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1029 mm_segment_t old_fs
= get_fs();
1031 unsigned int kcmd
= 0;
1034 for (i
= 0; i
< NR_FD_IOCTL_TRANS
; i
++)
1035 if (cmd
== fd_ioctl_trans_table
[i
].cmd32
) {
1036 kcmd
= fd_ioctl_trans_table
[i
].cmd
;
1047 struct floppy_struct
*f
;
1049 f
= karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_struct
));
1052 if (cmd
== FDGETPRM32
)
1054 err
= __get_user(f
->size
, &((struct floppy_struct32
*)arg
)->size
);
1055 err
|= __get_user(f
->sect
, &((struct floppy_struct32
*)arg
)->sect
);
1056 err
|= __get_user(f
->head
, &((struct floppy_struct32
*)arg
)->head
);
1057 err
|= __get_user(f
->track
, &((struct floppy_struct32
*)arg
)->track
);
1058 err
|= __get_user(f
->stretch
, &((struct floppy_struct32
*)arg
)->stretch
);
1059 err
|= __get_user(f
->gap
, &((struct floppy_struct32
*)arg
)->gap
);
1060 err
|= __get_user(f
->rate
, &((struct floppy_struct32
*)arg
)->rate
);
1061 err
|= __get_user(f
->spec1
, &((struct floppy_struct32
*)arg
)->spec1
);
1062 err
|= __get_user(f
->fmt_gap
, &((struct floppy_struct32
*)arg
)->fmt_gap
);
1063 err
|= __get_user((u64
)f
->name
, &((struct floppy_struct32
*)arg
)->name
);
1071 struct floppy_drive_params
*f
;
1073 f
= karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_drive_params
));
1076 if (cmd
== FDGETDRVPRM32
)
1078 err
= __get_user(f
->cmos
, &((struct floppy_drive_params32
*)arg
)->cmos
);
1079 err
|= __get_user(f
->max_dtr
, &((struct floppy_drive_params32
*)arg
)->max_dtr
);
1080 err
|= __get_user(f
->hlt
, &((struct floppy_drive_params32
*)arg
)->hlt
);
1081 err
|= __get_user(f
->hut
, &((struct floppy_drive_params32
*)arg
)->hut
);
1082 err
|= __get_user(f
->srt
, &((struct floppy_drive_params32
*)arg
)->srt
);
1083 err
|= __get_user(f
->spinup
, &((struct floppy_drive_params32
*)arg
)->spinup
);
1084 err
|= __get_user(f
->spindown
, &((struct floppy_drive_params32
*)arg
)->spindown
);
1085 err
|= __get_user(f
->spindown_offset
, &((struct floppy_drive_params32
*)arg
)->spindown_offset
);
1086 err
|= __get_user(f
->select_delay
, &((struct floppy_drive_params32
*)arg
)->select_delay
);
1087 err
|= __get_user(f
->rps
, &((struct floppy_drive_params32
*)arg
)->rps
);
1088 err
|= __get_user(f
->tracks
, &((struct floppy_drive_params32
*)arg
)->tracks
);
1089 err
|= __get_user(f
->timeout
, &((struct floppy_drive_params32
*)arg
)->timeout
);
1090 err
|= __get_user(f
->interleave_sect
, &((struct floppy_drive_params32
*)arg
)->interleave_sect
);
1091 err
|= __copy_from_user(&f
->max_errors
, &((struct floppy_drive_params32
*)arg
)->max_errors
, sizeof(f
->max_errors
));
1092 err
|= __get_user(f
->flags
, &((struct floppy_drive_params32
*)arg
)->flags
);
1093 err
|= __get_user(f
->read_track
, &((struct floppy_drive_params32
*)arg
)->read_track
);
1094 err
|= __copy_from_user(f
->autodetect
, ((struct floppy_drive_params32
*)arg
)->autodetect
, sizeof(f
->autodetect
));
1095 err
|= __get_user(f
->checkfreq
, &((struct floppy_drive_params32
*)arg
)->checkfreq
);
1096 err
|= __get_user(f
->native_format
, &((struct floppy_drive_params32
*)arg
)->native_format
);
1101 case FDGETDRVSTAT32
:
1102 case FDPOLLDRVSTAT32
:
1103 karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_drive_struct
));
1107 case FDGETFDCSTAT32
:
1108 karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_fdc_state
));
1113 karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_write_errors
));
1121 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1128 struct floppy_struct
*f
= karg
;
1130 err
= __put_user(f
->size
, &((struct floppy_struct32
*)arg
)->size
);
1131 err
|= __put_user(f
->sect
, &((struct floppy_struct32
*)arg
)->sect
);
1132 err
|= __put_user(f
->head
, &((struct floppy_struct32
*)arg
)->head
);
1133 err
|= __put_user(f
->track
, &((struct floppy_struct32
*)arg
)->track
);
1134 err
|= __put_user(f
->stretch
, &((struct floppy_struct32
*)arg
)->stretch
);
1135 err
|= __put_user(f
->gap
, &((struct floppy_struct32
*)arg
)->gap
);
1136 err
|= __put_user(f
->rate
, &((struct floppy_struct32
*)arg
)->rate
);
1137 err
|= __put_user(f
->spec1
, &((struct floppy_struct32
*)arg
)->spec1
);
1138 err
|= __put_user(f
->fmt_gap
, &((struct floppy_struct32
*)arg
)->fmt_gap
);
1139 err
|= __put_user((u64
)f
->name
, &((struct floppy_struct32
*)arg
)->name
);
1144 struct floppy_drive_params
*f
= karg
;
1146 err
= __put_user(f
->cmos
, &((struct floppy_drive_params32
*)arg
)->cmos
);
1147 err
|= __put_user(f
->max_dtr
, &((struct floppy_drive_params32
*)arg
)->max_dtr
);
1148 err
|= __put_user(f
->hlt
, &((struct floppy_drive_params32
*)arg
)->hlt
);
1149 err
|= __put_user(f
->hut
, &((struct floppy_drive_params32
*)arg
)->hut
);
1150 err
|= __put_user(f
->srt
, &((struct floppy_drive_params32
*)arg
)->srt
);
1151 err
|= __put_user(f
->spinup
, &((struct floppy_drive_params32
*)arg
)->spinup
);
1152 err
|= __put_user(f
->spindown
, &((struct floppy_drive_params32
*)arg
)->spindown
);
1153 err
|= __put_user(f
->spindown_offset
, &((struct floppy_drive_params32
*)arg
)->spindown_offset
);
1154 err
|= __put_user(f
->select_delay
, &((struct floppy_drive_params32
*)arg
)->select_delay
);
1155 err
|= __put_user(f
->rps
, &((struct floppy_drive_params32
*)arg
)->rps
);
1156 err
|= __put_user(f
->tracks
, &((struct floppy_drive_params32
*)arg
)->tracks
);
1157 err
|= __put_user(f
->timeout
, &((struct floppy_drive_params32
*)arg
)->timeout
);
1158 err
|= __put_user(f
->interleave_sect
, &((struct floppy_drive_params32
*)arg
)->interleave_sect
);
1159 err
|= __copy_to_user(&((struct floppy_drive_params32
*)arg
)->max_errors
, &f
->max_errors
, sizeof(f
->max_errors
));
1160 err
|= __put_user(f
->flags
, &((struct floppy_drive_params32
*)arg
)->flags
);
1161 err
|= __put_user(f
->read_track
, &((struct floppy_drive_params32
*)arg
)->read_track
);
1162 err
|= __copy_to_user(((struct floppy_drive_params32
*)arg
)->autodetect
, f
->autodetect
, sizeof(f
->autodetect
));
1163 err
|= __put_user(f
->checkfreq
, &((struct floppy_drive_params32
*)arg
)->checkfreq
);
1164 err
|= __put_user(f
->native_format
, &((struct floppy_drive_params32
*)arg
)->native_format
);
1167 case FDGETDRVSTAT32
:
1168 case FDPOLLDRVSTAT32
:
1170 struct floppy_drive_struct
*f
= karg
;
1172 err
= __put_user(f
->flags
, &((struct floppy_drive_struct32
*)arg
)->flags
);
1173 err
|= __put_user(f
->spinup_date
, &((struct floppy_drive_struct32
*)arg
)->spinup_date
);
1174 err
|= __put_user(f
->select_date
, &((struct floppy_drive_struct32
*)arg
)->select_date
);
1175 err
|= __put_user(f
->first_read_date
, &((struct floppy_drive_struct32
*)arg
)->first_read_date
);
1176 err
|= __put_user(f
->probed_format
, &((struct floppy_drive_struct32
*)arg
)->probed_format
);
1177 err
|= __put_user(f
->track
, &((struct floppy_drive_struct32
*)arg
)->track
);
1178 err
|= __put_user(f
->maxblock
, &((struct floppy_drive_struct32
*)arg
)->maxblock
);
1179 err
|= __put_user(f
->maxtrack
, &((struct floppy_drive_struct32
*)arg
)->maxtrack
);
1180 err
|= __put_user(f
->generation
, &((struct floppy_drive_struct32
*)arg
)->generation
);
1181 err
|= __put_user(f
->keep_data
, &((struct floppy_drive_struct32
*)arg
)->keep_data
);
1182 err
|= __put_user(f
->fd_ref
, &((struct floppy_drive_struct32
*)arg
)->fd_ref
);
1183 err
|= __put_user(f
->fd_device
, &((struct floppy_drive_struct32
*)arg
)->fd_device
);
1184 err
|= __put_user(f
->last_checked
, &((struct floppy_drive_struct32
*)arg
)->last_checked
);
1185 err
|= __put_user((u64
)f
->dmabuf
, &((struct floppy_drive_struct32
*)arg
)->dmabuf
);
1186 err
|= __put_user((u64
)f
->bufblocks
, &((struct floppy_drive_struct32
*)arg
)->bufblocks
);
1189 case FDGETFDCSTAT32
:
1191 struct floppy_fdc_state
*f
= karg
;
1193 err
= __put_user(f
->spec1
, &((struct floppy_fdc_state32
*)arg
)->spec1
);
1194 err
|= __put_user(f
->spec2
, &((struct floppy_fdc_state32
*)arg
)->spec2
);
1195 err
|= __put_user(f
->dtr
, &((struct floppy_fdc_state32
*)arg
)->dtr
);
1196 err
|= __put_user(f
->version
, &((struct floppy_fdc_state32
*)arg
)->version
);
1197 err
|= __put_user(f
->dor
, &((struct floppy_fdc_state32
*)arg
)->dor
);
1198 err
|= __put_user(f
->address
, &((struct floppy_fdc_state32
*)arg
)->address
);
1199 err
|= __copy_to_user((char *)&((struct floppy_fdc_state32
*)arg
)->address
1200 + sizeof(((struct floppy_fdc_state32
*)arg
)->address
),
1201 (char *)&f
->address
+ sizeof(f
->address
), sizeof(int));
1202 err
|= __put_user(f
->driver_version
, &((struct floppy_fdc_state32
*)arg
)->driver_version
);
1203 err
|= __copy_to_user(((struct floppy_fdc_state32
*)arg
)->track
, f
->track
, sizeof(f
->track
));
1208 struct floppy_write_errors
*f
= karg
;
1210 err
= __put_user(f
->write_errors
, &((struct floppy_write_errors32
*)arg
)->write_errors
);
1211 err
|= __put_user(f
->first_error_sector
, &((struct floppy_write_errors32
*)arg
)->first_error_sector
);
1212 err
|= __put_user(f
->first_error_generation
, &((struct floppy_write_errors32
*)arg
)->first_error_generation
);
1213 err
|= __put_user(f
->last_error_sector
, &((struct floppy_write_errors32
*)arg
)->last_error_sector
);
1214 err
|= __put_user(f
->last_error_generation
, &((struct floppy_write_errors32
*)arg
)->last_error_generation
);
1215 err
|= __put_user(f
->badness
, &((struct floppy_write_errors32
*)arg
)->badness
);
1221 out
: if (karg
) kfree(karg
);
1225 struct ppp_option_data32
{
1226 __kernel_caddr_t32 ptr
;
1230 #define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
1233 __kernel_time_t32 xmit_idle
;
1234 __kernel_time_t32 recv_idle
;
1236 #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
1238 static int ppp_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1240 mm_segment_t old_fs
= get_fs();
1241 struct ppp_option_data32 data32
;
1242 struct ppp_option_data data
;
1243 struct ppp_idle32 idle32
;
1244 struct ppp_idle idle
;
1254 case PPPIOCSCOMPRESS32
:
1255 if (copy_from_user(&data32
, (struct ppp_option_data32
*)arg
, sizeof(struct ppp_option_data32
)))
1257 data
.ptr
= kmalloc (data32
.length
, GFP_KERNEL
);
1260 if (copy_from_user(data
.ptr
, (__u8
*)A(data32
.ptr
), data32
.length
)) {
1264 data
.length
= data32
.length
;
1265 data
.transmit
= data32
.transmit
;
1266 kcmd
= PPPIOCSCOMPRESS
;
1271 static int count
= 0;
1273 printk("ppp_ioctl: Unknown cmd fd(%d) "
1274 "cmd(%08x) arg(%08x)\n",
1275 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1280 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1286 idle32
.xmit_idle
= idle
.xmit_idle
;
1287 idle32
.recv_idle
= idle
.recv_idle
;
1288 if (copy_to_user((struct ppp_idle32
*)arg
, &idle32
, sizeof(struct ppp_idle32
)))
1291 case PPPIOCSCOMPRESS32
:
1307 __kernel_daddr_t32 mt_fileno
;
1308 __kernel_daddr_t32 mt_blkno
;
1310 #define MTIOCGET32 _IOR('m', 2, struct mtget32)
1315 #define MTIOCPOS32 _IOR('m', 3, struct mtpos32)
1317 struct mtconfiginfo32
{
1338 #define MTIOCGETCONFIG32 _IOR('m', 4, struct mtconfiginfo32)
1339 #define MTIOCSETCONFIG32 _IOW('m', 5, struct mtconfiginfo32)
1341 static int mt_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1343 mm_segment_t old_fs
= get_fs();
1344 struct mtconfiginfo info
;
1360 case MTIOCGETCONFIG32
:
1361 kcmd
= MTIOCGETCONFIG
;
1364 case MTIOCSETCONFIG32
:
1365 kcmd
= MTIOCSETCONFIG
;
1367 err
= __get_user(info
.mt_type
, &((struct mtconfiginfo32
*)arg
)->mt_type
);
1368 err
|= __get_user(info
.ifc_type
, &((struct mtconfiginfo32
*)arg
)->ifc_type
);
1369 err
|= __get_user(info
.irqnr
, &((struct mtconfiginfo32
*)arg
)->irqnr
);
1370 err
|= __get_user(info
.dmanr
, &((struct mtconfiginfo32
*)arg
)->dmanr
);
1371 err
|= __get_user(info
.port
, &((struct mtconfiginfo32
*)arg
)->port
);
1372 err
|= __get_user(info
.debug
, &((struct mtconfiginfo32
*)arg
)->debug
);
1373 err
|= __copy_from_user((char *)&info
.debug
+ sizeof(info
.debug
),
1374 (char *)&((struct mtconfiginfo32
*)arg
)->debug
1375 + sizeof(((struct mtconfiginfo32
*)arg
)->debug
), sizeof(__u32
));
1381 static int count
= 0;
1383 printk("mt_ioctl: Unknown cmd fd(%d) "
1384 "cmd(%08x) arg(%08x)\n",
1385 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1390 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1396 if (__put_user(pos
.mt_blkno
, &((struct mtpos32
*)arg
)->mt_blkno
))
1400 err
= __put_user(get
.mt_type
, &((struct mtget32
*)arg
)->mt_type
);
1401 err
|= __put_user(get
.mt_resid
, &((struct mtget32
*)arg
)->mt_resid
);
1402 err
|= __put_user(get
.mt_dsreg
, &((struct mtget32
*)arg
)->mt_dsreg
);
1403 err
|= __put_user(get
.mt_gstat
, &((struct mtget32
*)arg
)->mt_gstat
);
1404 err
|= __put_user(get
.mt_erreg
, &((struct mtget32
*)arg
)->mt_erreg
);
1405 err
|= __put_user(get
.mt_fileno
, &((struct mtget32
*)arg
)->mt_fileno
);
1406 err
|= __put_user(get
.mt_blkno
, &((struct mtget32
*)arg
)->mt_blkno
);
1408 case MTIOCGETCONFIG32
:
1409 err
= __put_user(info
.mt_type
, &((struct mtconfiginfo32
*)arg
)->mt_type
);
1410 err
|= __put_user(info
.ifc_type
, &((struct mtconfiginfo32
*)arg
)->ifc_type
);
1411 err
|= __put_user(info
.irqnr
, &((struct mtconfiginfo32
*)arg
)->irqnr
);
1412 err
|= __put_user(info
.dmanr
, &((struct mtconfiginfo32
*)arg
)->dmanr
);
1413 err
|= __put_user(info
.port
, &((struct mtconfiginfo32
*)arg
)->port
);
1414 err
|= __put_user(info
.debug
, &((struct mtconfiginfo32
*)arg
)->debug
);
1415 err
|= __copy_to_user((char *)&((struct mtconfiginfo32
*)arg
)->debug
1416 + sizeof(((struct mtconfiginfo32
*)arg
)->debug
),
1417 (char *)&info
.debug
+ sizeof(info
.debug
), sizeof(__u32
));
1419 case MTIOCSETCONFIG32
:
1425 struct cdrom_read32
{
1427 __kernel_caddr_t32 cdread_bufaddr
;
1431 struct cdrom_read_audio32
{
1432 union cdrom_addr addr
;
1435 __kernel_caddr_t32 buf
;
1438 static int cdrom_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1440 mm_segment_t old_fs
= get_fs();
1441 struct cdrom_read cdread
;
1442 struct cdrom_read_audio cdreadaudio
;
1443 __kernel_caddr_t32 addr
;
1449 case CDROMREADMODE2
:
1450 case CDROMREADMODE1
:
1452 case CDROMREADCOOKED
:
1454 err
= __get_user(cdread
.cdread_lba
, &((struct cdrom_read32
*)arg
)->cdread_lba
);
1455 err
|= __get_user(addr
, &((struct cdrom_read32
*)arg
)->cdread_bufaddr
);
1456 err
|= __get_user(cdread
.cdread_buflen
, &((struct cdrom_read32
*)arg
)->cdread_buflen
);
1459 data
= kmalloc(cdread
.cdread_buflen
, GFP_KERNEL
);
1462 cdread
.cdread_bufaddr
= data
;
1464 case CDROMREADAUDIO
:
1465 karg
= &cdreadaudio
;
1466 err
= copy_from_user(&cdreadaudio
.addr
, &((struct cdrom_read_audio32
*)arg
)->addr
, sizeof(cdreadaudio
.addr
));
1467 err
|= __get_user(cdreadaudio
.addr_format
, &((struct cdrom_read_audio32
*)arg
)->addr_format
);
1468 err
|= __get_user(cdreadaudio
.nframes
, &((struct cdrom_read_audio32
*)arg
)->nframes
);
1469 err
|= __get_user(addr
, &((struct cdrom_read_audio32
*)arg
)->buf
);
1472 data
= kmalloc(cdreadaudio
.nframes
* 2352, GFP_KERNEL
);
1475 cdreadaudio
.buf
= data
;
1479 static int count
= 0;
1481 printk("cdrom_ioctl: Unknown cmd fd(%d) "
1482 "cmd(%08x) arg(%08x)\n",
1483 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1488 err
= sys_ioctl (fd
, cmd
, (unsigned long)karg
);
1493 case CDROMREADMODE2
:
1494 case CDROMREADMODE1
:
1496 case CDROMREADCOOKED
:
1497 err
= copy_to_user((char *)A(addr
), data
, cdread
.cdread_buflen
);
1499 case CDROMREADAUDIO
:
1500 err
= copy_to_user((char *)A(addr
), data
, cdreadaudio
.nframes
* 2352);
1505 out
: if (data
) kfree(data
);
1509 struct loop_info32
{
1510 int lo_number
; /* ioctl r/o */
1511 __kernel_dev_t32 lo_device
; /* ioctl r/o */
1512 unsigned int lo_inode
; /* ioctl r/o */
1513 __kernel_dev_t32 lo_rdevice
; /* ioctl r/o */
1515 int lo_encrypt_type
;
1516 int lo_encrypt_key_size
; /* ioctl w/o */
1517 int lo_flags
; /* ioctl r/o */
1518 char lo_name
[LO_NAME_SIZE
];
1519 unsigned char lo_encrypt_key
[LO_KEY_SIZE
]; /* ioctl w/o */
1520 unsigned int lo_init
[2];
1524 static int loop_status(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1526 mm_segment_t old_fs
= get_fs();
1531 case LOOP_SET_STATUS
:
1532 err
= get_user(l
.lo_number
, &((struct loop_info32
*)arg
)->lo_number
);
1533 err
|= __get_user(l
.lo_device
, &((struct loop_info32
*)arg
)->lo_device
);
1534 err
|= __get_user(l
.lo_inode
, &((struct loop_info32
*)arg
)->lo_inode
);
1535 err
|= __get_user(l
.lo_rdevice
, &((struct loop_info32
*)arg
)->lo_rdevice
);
1536 err
|= __copy_from_user((char *)&l
.lo_offset
, (char *)&((struct loop_info32
*)arg
)->lo_offset
,
1537 8 + (unsigned long)l
.lo_init
- (unsigned long)&l
.lo_offset
);
1541 err
= sys_ioctl (fd
, cmd
, (unsigned long)&l
);
1544 case LOOP_GET_STATUS
:
1546 err
= sys_ioctl (fd
, cmd
, (unsigned long)&l
);
1549 err
= put_user(l
.lo_number
, &((struct loop_info32
*)arg
)->lo_number
);
1550 err
|= __put_user(l
.lo_device
, &((struct loop_info32
*)arg
)->lo_device
);
1551 err
|= __put_user(l
.lo_inode
, &((struct loop_info32
*)arg
)->lo_inode
);
1552 err
|= __put_user(l
.lo_rdevice
, &((struct loop_info32
*)arg
)->lo_rdevice
);
1553 err
|= __copy_to_user((char *)&((struct loop_info32
*)arg
)->lo_offset
,
1554 (char *)&l
.lo_offset
, (unsigned long)l
.lo_init
- (unsigned long)&l
.lo_offset
);
1561 extern int tty_ioctl(struct inode
* inode
, struct file
* file
, unsigned int cmd
, unsigned long arg
);
1563 static int vt_check(struct file
*file
)
1565 struct tty_struct
*tty
;
1566 struct inode
*inode
= file
->f_dentry
->d_inode
;
1568 if (file
->f_op
->ioctl
!= tty_ioctl
)
1571 tty
= (struct tty_struct
*)file
->private_data
;
1572 if (tty_paranoia_check(tty
, inode
->i_rdev
, "tty_ioctl"))
1575 if (tty
->driver
.ioctl
!= vt_ioctl
)
1579 * To have permissions to do most of the vt ioctls, we either have
1580 * to be the owner of the tty, or super-user.
1582 if (current
->tty
== tty
|| suser())
1587 struct consolefontdesc32
{
1588 unsigned short charcount
; /* characters in font (256 or 512) */
1589 unsigned short charheight
; /* scan lines per character (1-32) */
1590 u32 chardata
; /* font data in expanded form */
1593 static int do_fontx_ioctl(struct file
*file
, int cmd
, struct consolefontdesc32
*user_cfd
)
1595 struct consolefontdesc cfdarg
;
1596 struct console_font_op op
;
1599 perm
= vt_check(file
);
1600 if (perm
< 0) return perm
;
1602 if (copy_from_user(&cfdarg
, user_cfd
, sizeof(struct consolefontdesc32
)))
1605 cfdarg
.chardata
= (unsigned char *)A(((struct consolefontdesc32
*)&cfdarg
)->chardata
);
1611 op
.op
= KD_FONT_OP_SET
;
1614 op
.height
= cfdarg
.charheight
;
1615 op
.charcount
= cfdarg
.charcount
;
1616 op
.data
= cfdarg
.chardata
;
1617 return con_font_op(fg_console
, &op
);
1619 if (!cfdarg
.chardata
)
1621 op
.op
= KD_FONT_OP_GET
;
1624 op
.height
= cfdarg
.charheight
;
1625 op
.charcount
= cfdarg
.charcount
;
1626 op
.data
= cfdarg
.chardata
;
1627 i
= con_font_op(fg_console
, &op
);
1630 cfdarg
.charheight
= op
.height
;
1631 cfdarg
.charcount
= op
.charcount
;
1632 ((struct consolefontdesc32
*)&cfdarg
)->chardata
= (unsigned long)cfdarg
.chardata
;
1633 if (copy_to_user(user_cfd
, &cfdarg
, sizeof(struct consolefontdesc32
)))
1640 struct console_font_op32
{
1641 unsigned int op
; /* operation code KD_FONT_OP_* */
1642 unsigned int flags
; /* KD_FONT_FLAG_* */
1643 unsigned int width
, height
; /* font size */
1644 unsigned int charcount
;
1645 u32 data
; /* font data with height fixed to 32 */
1648 static int do_kdfontop_ioctl(struct file
*file
, struct console_font_op32
*fontop
)
1650 struct console_font_op op
;
1651 int perm
= vt_check(file
), i
;
1652 struct vt_struct
*vt
;
1654 if (perm
< 0) return perm
;
1656 if (copy_from_user(&op
, (void *) fontop
, sizeof(struct console_font_op32
)))
1658 if (!perm
&& op
.op
!= KD_FONT_OP_GET
)
1660 op
.data
= (unsigned char *)A(((struct console_font_op32
*)&op
)->data
);
1661 op
.flags
|= KD_FONT_FLAG_OLD
;
1662 vt
= (struct vt_struct
*)((struct tty_struct
*)file
->private_data
)->driver_data
;
1663 i
= con_font_op(vt
->vc_num
, &op
);
1665 ((struct console_font_op32
*)&op
)->data
= (unsigned long)op
.data
;
1666 if (copy_to_user((void *) fontop
, &op
, sizeof(struct console_font_op32
)))
1671 struct unimapdesc32
{
1672 unsigned short entry_ct
;
1676 static int do_unimap_ioctl(struct file
*file
, int cmd
, struct unimapdesc32
*user_ud
)
1678 struct unimapdesc32 tmp
;
1679 int perm
= vt_check(file
);
1681 if (perm
< 0) return perm
;
1682 if (copy_from_user(&tmp
, user_ud
, sizeof tmp
))
1686 if (!perm
) return -EPERM
;
1687 return con_set_unimap(fg_console
, tmp
.entry_ct
, (struct unipair
*)A(tmp
.entries
));
1689 return con_get_unimap(fg_console
, tmp
.entry_ct
, &(user_ud
->entry_ct
), (struct unipair
*)A(tmp
.entries
));
1694 asmlinkage
int sys32_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1704 if (!filp
->f_op
|| !filp
->f_op
->ioctl
) {
1705 error
= sys_ioctl (fd
, cmd
, arg
);
1710 error
= dev_ifname32(fd
, arg
);
1714 error
= dev_ifconf(fd
, arg
);
1734 case SIOCGIFBRDADDR
:
1735 case SIOCSIFBRDADDR
:
1736 case SIOCGIFDSTADDR
:
1737 case SIOCSIFDSTADDR
:
1738 case SIOCGIFNETMASK
:
1739 case SIOCSIFNETMASK
:
1743 case SIOCGPPPCSTATS
:
1748 error
= dev_ifsioc(fd
, cmd
, arg
);
1753 error
= routing_ioctl(fd
, cmd
, arg
);
1756 case SIOCRTMSG
: /* Note SIOCRTMSG is no longer, so this is safe and
1757 * the user would have seen just an -EINVAL anyways.
1763 /* Sorry, timeval in the kernel is different now. */
1764 error
= do_siocgstamp(fd
, cmd
, arg
);
1768 error
= hdio_getgeo(fd
, arg
);
1774 /* The mkswap binary hard codes it to Intel value :-((( */
1777 error
= w_long(fd
, cmd
, arg
);
1782 error
= fbiogetputcmap(fd
, cmd
, arg
);
1786 error
= fbiogscursor(fd
, cmd
, arg
);
1789 case FBIOGET_FSCREENINFO
:
1792 error
= fb_ioctl_trans(fd
, cmd
, arg
);
1795 case HDIO_GET_KEEPSETTINGS
:
1796 case HDIO_GET_UNMASKINTR
:
1798 case HDIO_GET_32BIT
:
1799 case HDIO_GET_MULTCOUNT
:
1800 case HDIO_GET_NOWERR
:
1802 error
= hdio_ioctl_trans(fd
, cmd
, arg
);
1810 case FDGETDRVSTAT32
:
1811 case FDPOLLDRVSTAT32
:
1812 case FDGETFDCSTAT32
:
1814 error
= fd_ioctl_trans(fd
, cmd
, arg
);
1818 case PPPIOCSCOMPRESS32
:
1819 error
= ppp_ioctl_trans(fd
, cmd
, arg
);
1824 case MTIOCGETCONFIG32
:
1825 case MTIOCSETCONFIG32
:
1826 error
= mt_ioctl_trans(fd
, cmd
, arg
);
1829 case CDROMREADMODE2
:
1830 case CDROMREADMODE1
:
1832 case CDROMREADCOOKED
:
1833 case CDROMREADAUDIO
:
1835 error
= cdrom_ioctl_trans(fd
, cmd
, arg
);
1838 case LOOP_SET_STATUS
:
1839 case LOOP_GET_STATUS
:
1840 error
= loop_status(fd
, cmd
, arg
);
1843 #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
1844 case AUTOFS_IOC_SETTIMEOUT32
:
1845 error
= rw_long(fd
, AUTOFS_IOC_SETTIMEOUT
, arg
);
1850 error
= do_fontx_ioctl(filp
, cmd
, (struct consolefontdesc32
*)arg
);
1855 error
= do_unimap_ioctl(filp
, cmd
, (struct unimapdesc32
*)arg
);
1859 error
= do_kdfontop_ioctl(filp
, (struct console_font_op32
*)arg
);
1862 case EXT2_IOC32_GETFLAGS
:
1863 case EXT2_IOC32_SETFLAGS
:
1864 case EXT2_IOC32_GETVERSION
:
1865 case EXT2_IOC32_SETVERSION
:
1866 error
= do_ext2_ioctl(fd
, cmd
, arg
);
1869 case VIDIOCGTUNER32
:
1870 case VIDIOCSTUNER32
:
1877 error
= do_video_ioctl(fd
, cmd
, arg
);
1880 /* List here exlicitly which ioctl's are known to have
1881 * compatable types passed or none at all...
1928 case FBIOGCURSOR32
: /* This is not implemented yet. Later it should be converted... */
1933 case FBIOGET_VSCREENINFO
:
1934 case FBIOPUT_VSCREENINFO
:
1935 case FBIOPAN_DISPLAY
:
1936 case FBIOGET_FCURSORINFO
:
1937 case FBIOGET_VCURSORINFO
:
1938 case FBIOPUT_VCURSORINFO
:
1939 case FBIOGET_CURSORSTATE
:
1940 case FBIOPUT_CURSORSTATE
:
1941 case FBIOGET_CON2FBMAP
:
1942 case FBIOPUT_CON2FBMAP
:
1949 case FIONREAD
: /* This is also TIOCINQ */
1955 /* 0x03 -- HD/IDE ioctl's used by hdparm and friends.
1956 * Some need translations, these do not.
1958 case HDIO_GET_IDENTITY
:
1960 case HDIO_SET_KEEPSETTINGS
:
1961 case HDIO_SET_UNMASKINTR
:
1962 case HDIO_SET_NOWERR
:
1963 case HDIO_SET_32BIT
:
1964 case HDIO_SET_MULTCOUNT
:
1965 case HDIO_DRIVE_CMD
:
1966 case HDIO_SET_PIO_MODE
:
1967 case HDIO_SCAN_HWIF
:
1972 /* 0x02 -- Floppy ioctls */
1975 case FDSETEMSGTRESH
:
1997 case REGISTER_DEV_NEW
:
2028 case GIO_UNISCRNMAP
:
2029 case PIO_UNISCRNMAP
:
2046 case SCSI_IOCTL_GET_IDLUN
:
2047 case SCSI_IOCTL_DOORLOCK
:
2048 case SCSI_IOCTL_DOORUNLOCK
:
2049 case SCSI_IOCTL_TEST_UNIT_READY
:
2050 case SCSI_IOCTL_TAGGED_ENABLE
:
2051 case SCSI_IOCTL_TAGGED_DISABLE
:
2052 case SCSI_IOCTL_GET_BUS_NUMBER
:
2053 case SCSI_IOCTL_SEND_COMMAND
:
2063 case VT_DISALLOCATE
:
2067 case VT_UNLOCKSWITCH
:
2073 /* Little v, the video4linux ioctls */
2084 case VIDIOCMCAPTURE
:
2087 case VIDIOCGCAPTURE
:
2088 case VIDIOCSCAPTURE
:
2090 /* BTTV specific... */
2091 case _IOW('v', BASE_VIDIOCPRIVATE
+0, char [256]):
2092 case _IOR('v', BASE_VIDIOCPRIVATE
+1, char [256]):
2093 case _IOR('v' , BASE_VIDIOCPRIVATE
+2, unsigned int):
2094 case _IOW('v' , BASE_VIDIOCPRIVATE
+3, char [16]): /* struct bttv_pll_info */
2095 case _IOR('v' , BASE_VIDIOCPRIVATE
+4, int):
2096 case _IOR('v' , BASE_VIDIOCPRIVATE
+5, int):
2097 case _IOR('v' , BASE_VIDIOCPRIVATE
+6, int):
2098 case _IOR('v' , BASE_VIDIOCPRIVATE
+7, int):
2100 /* Little p (/dev/rtc, /dev/envctrl, etc.) */
2109 /* OPENPROMIO, SunOS/Solaris only, the NetBSD one's have
2110 * embedded pointers in the arg which we'd need to clean up...
2122 case OPROMGETFBNAME
:
2123 case OPROMGETBOOTARGS
:
2125 /* Socket level stuff */
2139 #if 0 /* XXX No longer exist in new routing code. XXX */
2151 case SG_SET_TIMEOUT
:
2152 case SG_GET_TIMEOUT
:
2153 case SG_EMULATED_HOST
:
2154 case SG_SET_TRANSFORM
:
2155 case SG_GET_TRANSFORM
:
2160 case PPPIOCGASYNCMAP
:
2161 case PPPIOCSASYNCMAP
:
2163 case PPPIOCGRASYNCMAP
:
2164 case PPPIOCSRASYNCMAP
:
2168 case PPPIOCGXASYNCMAP
:
2169 case PPPIOCSXASYNCMAP
:
2170 case PPPIOCXFERUNIT
:
2180 case CDROMPLAYTRKIND
:
2181 case CDROMREADTOCHDR
:
2182 case CDROMREADTOCENTRY
:
2189 case CDROMMULTISESSION
:
2195 case CDROMCLOSETRAY
:
2196 case CDROM_SET_OPTIONS
:
2197 case CDROM_CLEAR_OPTIONS
:
2198 case CDROM_SELECT_SPEED
:
2199 case CDROM_SELECT_DISC
:
2200 case CDROM_MEDIA_CHANGED
:
2201 case CDROM_DRIVE_STATUS
:
2202 case CDROM_DISC_STATUS
:
2203 case CDROM_CHANGER_NSLOTS
:
2214 case AUDIO_GETDEV_SUNOS
:
2217 /* Big Q for sound/OSS */
2218 case SNDCTL_SEQ_RESET
:
2219 case SNDCTL_SEQ_SYNC
:
2220 case SNDCTL_SYNTH_INFO
:
2221 case SNDCTL_SEQ_CTRLRATE
:
2222 case SNDCTL_SEQ_GETOUTCOUNT
:
2223 case SNDCTL_SEQ_GETINCOUNT
:
2224 case SNDCTL_SEQ_PERCMODE
:
2225 case SNDCTL_FM_LOAD_INSTR
:
2226 case SNDCTL_SEQ_TESTMIDI
:
2227 case SNDCTL_SEQ_RESETSAMPLES
:
2228 case SNDCTL_SEQ_NRSYNTHS
:
2229 case SNDCTL_SEQ_NRMIDIS
:
2230 case SNDCTL_MIDI_INFO
:
2231 case SNDCTL_SEQ_THRESHOLD
:
2232 case SNDCTL_SYNTH_MEMAVL
:
2233 case SNDCTL_FM_4OP_ENABLE
:
2234 case SNDCTL_SEQ_PANIC
:
2235 case SNDCTL_SEQ_OUTOFBAND
:
2236 case SNDCTL_SEQ_GETTIME
:
2237 case SNDCTL_SYNTH_ID
:
2238 case SNDCTL_SYNTH_CONTROL
:
2239 case SNDCTL_SYNTH_REMOVESAMPLE
:
2241 /* Big T for sound/OSS */
2242 case SNDCTL_TMR_TIMEBASE
:
2243 case SNDCTL_TMR_START
:
2244 case SNDCTL_TMR_STOP
:
2245 case SNDCTL_TMR_CONTINUE
:
2246 case SNDCTL_TMR_TEMPO
:
2247 case SNDCTL_TMR_SOURCE
:
2248 case SNDCTL_TMR_METRONOME
:
2249 case SNDCTL_TMR_SELECT
:
2251 /* Little m for sound/OSS */
2252 case SNDCTL_MIDI_PRETIME
:
2253 case SNDCTL_MIDI_MPUMODE
:
2254 case SNDCTL_MIDI_MPUCMD
:
2256 /* Big P for sound/OSS */
2257 case SNDCTL_DSP_RESET
:
2258 case SNDCTL_DSP_SYNC
:
2259 case SNDCTL_DSP_SPEED
:
2260 case SNDCTL_DSP_STEREO
:
2261 case SNDCTL_DSP_GETBLKSIZE
:
2262 case SNDCTL_DSP_CHANNELS
:
2263 case SOUND_PCM_WRITE_FILTER
:
2264 case SNDCTL_DSP_POST
:
2265 case SNDCTL_DSP_SUBDIVIDE
:
2266 case SNDCTL_DSP_SETFRAGMENT
:
2267 case SNDCTL_DSP_GETFMTS
:
2268 case SNDCTL_DSP_SETFMT
:
2269 case SNDCTL_DSP_GETOSPACE
:
2270 case SNDCTL_DSP_GETISPACE
:
2271 case SNDCTL_DSP_NONBLOCK
:
2272 case SNDCTL_DSP_GETCAPS
:
2273 case SNDCTL_DSP_GETTRIGGER
:
2274 case SNDCTL_DSP_SETTRIGGER
:
2275 case SNDCTL_DSP_GETIPTR
:
2276 case SNDCTL_DSP_GETOPTR
:
2277 /* case SNDCTL_DSP_MAPINBUF: XXX needs translation */
2278 /* case SNDCTL_DSP_MAPOUTBUF: XXX needs translation */
2279 case SNDCTL_DSP_SETSYNCRO
:
2280 case SNDCTL_DSP_SETDUPLEX
:
2281 case SNDCTL_DSP_GETODELAY
:
2282 case SNDCTL_DSP_PROFILE
:
2284 case SOUND_PCM_READ_RATE
:
2285 case SOUND_PCM_READ_CHANNELS
:
2286 case SOUND_PCM_READ_BITS
:
2287 case SOUND_PCM_READ_FILTER
:
2289 /* Big C for sound/OSS */
2290 case SNDCTL_COPR_RESET
:
2291 case SNDCTL_COPR_LOAD
:
2292 case SNDCTL_COPR_RDATA
:
2293 case SNDCTL_COPR_RCODE
:
2294 case SNDCTL_COPR_WDATA
:
2295 case SNDCTL_COPR_WCODE
:
2296 case SNDCTL_COPR_RUN
:
2297 case SNDCTL_COPR_HALT
:
2298 case SNDCTL_COPR_SENDMSG
:
2299 case SNDCTL_COPR_RCVMSG
:
2301 /* Big M for sound/OSS */
2302 case SOUND_MIXER_READ_VOLUME
:
2303 case SOUND_MIXER_READ_BASS
:
2304 case SOUND_MIXER_READ_TREBLE
:
2305 case SOUND_MIXER_READ_SYNTH
:
2306 case SOUND_MIXER_READ_PCM
:
2307 case SOUND_MIXER_READ_SPEAKER
:
2308 case SOUND_MIXER_READ_LINE
:
2309 case SOUND_MIXER_READ_MIC
:
2310 case SOUND_MIXER_READ_CD
:
2311 case SOUND_MIXER_READ_IMIX
:
2312 case SOUND_MIXER_READ_ALTPCM
:
2313 case SOUND_MIXER_READ_RECLEV
:
2314 case SOUND_MIXER_READ_IGAIN
:
2315 case SOUND_MIXER_READ_OGAIN
:
2316 case SOUND_MIXER_READ_LINE1
:
2317 case SOUND_MIXER_READ_LINE2
:
2318 case SOUND_MIXER_READ_LINE3
:
2319 case SOUND_MIXER_READ_MUTE
:
2320 /* case SOUND_MIXER_READ_ENHANCE: same value as READ_MUTE */
2321 /* case SOUND_MIXER_READ_LOUD: same value as READ_MUTE */
2322 case SOUND_MIXER_READ_RECSRC
:
2323 case SOUND_MIXER_READ_DEVMASK
:
2324 case SOUND_MIXER_READ_RECMASK
:
2325 case SOUND_MIXER_READ_STEREODEVS
:
2326 case SOUND_MIXER_READ_CAPS
:
2328 case SOUND_MIXER_WRITE_VOLUME
:
2329 case SOUND_MIXER_WRITE_BASS
:
2330 case SOUND_MIXER_WRITE_TREBLE
:
2331 case SOUND_MIXER_WRITE_SYNTH
:
2332 case SOUND_MIXER_WRITE_PCM
:
2333 case SOUND_MIXER_WRITE_SPEAKER
:
2334 case SOUND_MIXER_WRITE_LINE
:
2335 case SOUND_MIXER_WRITE_MIC
:
2336 case SOUND_MIXER_WRITE_CD
:
2337 case SOUND_MIXER_WRITE_IMIX
:
2338 case SOUND_MIXER_WRITE_ALTPCM
:
2339 case SOUND_MIXER_WRITE_RECLEV
:
2340 case SOUND_MIXER_WRITE_IGAIN
:
2341 case SOUND_MIXER_WRITE_OGAIN
:
2342 case SOUND_MIXER_WRITE_LINE1
:
2343 case SOUND_MIXER_WRITE_LINE2
:
2344 case SOUND_MIXER_WRITE_LINE3
:
2345 case SOUND_MIXER_WRITE_MUTE
:
2346 /* case SOUND_MIXER_WRITE_ENHANCE: same value as WRITE_MUTE */
2347 /* case SOUND_MIXER_WRITE_LOUD: same value as WRITE_MUTE */
2348 case SOUND_MIXER_WRITE_RECSRC
:
2350 case SOUND_MIXER_INFO
:
2351 case SOUND_OLD_MIXER_INFO
:
2352 case SOUND_MIXER_ACCESS
:
2353 case SOUND_MIXER_PRIVATE1
:
2354 case SOUND_MIXER_PRIVATE2
:
2355 case SOUND_MIXER_PRIVATE3
:
2356 case SOUND_MIXER_PRIVATE4
:
2357 case SOUND_MIXER_PRIVATE5
:
2358 case SOUND_MIXER_GETLEVELS
:
2359 case SOUND_MIXER_SETLEVELS
:
2361 case OSS_GETVERSION
:
2364 case AUTOFS_IOC_READY
:
2365 case AUTOFS_IOC_FAIL
:
2366 case AUTOFS_IOC_CATATONIC
:
2367 case AUTOFS_IOC_PROTOVER
:
2368 case AUTOFS_IOC_EXPIRE
:
2374 error
= sys_ioctl (fd
, cmd
, arg
);
2379 static int count
= 0;
2381 printk("sys32_ioctl: Unknown cmd fd(%d) "
2382 "cmd(%08x) arg(%08x)\n",
2383 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);