1 /* $Id: ioctl32.c,v 1.68 1999/09/10 05:59:25 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 char ifru_newname
[IFNAMSIZ
];
414 __kernel_caddr_t32 ifru_data
;
419 int ifc_len
; /* size of buffer */
420 __kernel_caddr_t32 ifcbuf
;
423 static int dev_ifname32(unsigned int fd
, unsigned long arg
)
425 struct net_device
*dev
;
426 struct ifreq32 ifr32
;
429 if (copy_from_user(&ifr32
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
432 dev
= dev_get_by_index(ifr32
.ifr_ifindex
);
436 strcpy(ifr32
.ifr_name
, dev
->name
);
438 err
= copy_to_user((struct ifreq32
*)arg
, &ifr32
, sizeof(struct ifreq32
));
439 return (err
? -EFAULT
: 0);
442 static inline int dev_ifconf(unsigned int fd
, unsigned long arg
)
444 struct ifconf32 ifc32
;
446 struct ifreq32
*ifr32
;
452 if (copy_from_user(&ifc32
, (struct ifconf32
*)arg
, sizeof(struct ifconf32
)))
455 if(ifc32
.ifcbuf
== 0) {
460 ifc
.ifc_len
= ((ifc32
.ifc_len
/ sizeof (struct ifreq32
)) + 1) *
461 sizeof (struct ifreq
);
462 ifc
.ifc_buf
= kmalloc (ifc
.ifc_len
, GFP_KERNEL
);
467 ifr32
= (struct ifreq32
*)A(ifc32
.ifcbuf
);
468 for (i
= 0; i
< ifc32
.ifc_len
; i
+= sizeof (struct ifreq32
)) {
469 if (copy_from_user(ifr
++, ifr32
++, sizeof (struct ifreq32
))) {
474 old_fs
= get_fs(); set_fs (KERNEL_DS
);
475 err
= sys_ioctl (fd
, SIOCGIFCONF
, (unsigned long)&ifc
);
479 ifr32
= (struct ifreq32
*)A(ifc32
.ifcbuf
);
480 for (i
= 0, j
= 0; i
< ifc32
.ifc_len
&& j
< ifc
.ifc_len
;
481 i
+= sizeof (struct ifreq32
), j
+= sizeof (struct ifreq
)) {
482 if (copy_to_user(ifr32
++, ifr
++, sizeof (struct ifreq32
))) {
488 if (i
<= ifc32
.ifc_len
)
491 ifc32
.ifc_len
= i
- sizeof (struct ifreq32
);
492 if (copy_to_user((struct ifconf32
*)arg
, &ifc32
, sizeof(struct ifconf32
)))
496 if(ifc
.ifc_buf
!= NULL
)
501 static inline int dev_ifsioc(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
509 err
= copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(ifr
.ifr_name
));
510 err
|= __get_user(ifr
.ifr_map
.mem_start
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_start
));
511 err
|= __get_user(ifr
.ifr_map
.mem_end
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_end
));
512 err
|= __get_user(ifr
.ifr_map
.base_addr
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.base_addr
));
513 err
|= __get_user(ifr
.ifr_map
.irq
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.irq
));
514 err
|= __get_user(ifr
.ifr_map
.dma
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.dma
));
515 err
|= __get_user(ifr
.ifr_map
.port
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.port
));
523 if (copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
525 ifr
.ifr_data
= (__kernel_caddr_t
)get_free_page(GFP_KERNEL
);
528 if(cmd
== SIOCETHTOOL
) {
531 __get_user(data
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_data
));
532 if(copy_from_user(ifr
.ifr_data
,
534 sizeof(struct ethtool_cmd
))) {
535 free_page((unsigned long)ifr
.ifr_data
);
541 if (copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
547 err
= sys_ioctl (fd
, cmd
, (unsigned long)&ifr
);
562 if (copy_to_user((struct ifreq32
*)arg
, &ifr
, sizeof(struct ifreq32
)))
573 __get_user(data
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_data
));
574 if(cmd
== SIOCETHTOOL
)
575 len
= sizeof(struct ethtool_cmd
);
576 if(cmd
== SIOCGPPPVER
)
577 len
= strlen((char *)ifr
.ifr_data
) + 1;
578 else if(cmd
== SIOCGPPPCSTATS
)
579 len
= sizeof(struct ppp_comp_stats
);
581 len
= sizeof(struct ppp_stats
);
583 len
= copy_to_user((char *)A(data
), ifr
.ifr_data
, len
);
584 free_page((unsigned long)ifr
.ifr_data
);
590 err
= copy_to_user((struct ifreq32
*)arg
, &ifr
, sizeof(ifr
.ifr_name
));
591 err
|= __put_user(ifr
.ifr_map
.mem_start
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_start
));
592 err
|= __put_user(ifr
.ifr_map
.mem_end
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_end
));
593 err
|= __put_user(ifr
.ifr_map
.base_addr
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.base_addr
));
594 err
|= __put_user(ifr
.ifr_map
.irq
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.irq
));
595 err
|= __put_user(ifr
.ifr_map
.dma
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.dma
));
596 err
|= __put_user(ifr
.ifr_map
.port
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.port
));
605 struct sockaddr rt_dst
; /* target address */
606 struct sockaddr rt_gateway
; /* gateway addr (RTF_GATEWAY) */
607 struct sockaddr rt_genmask
; /* target network mask (IP) */
608 unsigned short rt_flags
;
611 unsigned char rt_tos
;
612 unsigned char rt_class
;
614 short rt_metric
; /* +1 for binary compatibility! */
615 /* char * */ u32 rt_dev
; /* forcing the device at add */
616 u32 rt_mtu
; /* per route MTU/Window */
617 u32 rt_window
; /* Window clamping */
618 unsigned short rt_irtt
; /* Initial RTT */
622 static inline int routing_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
628 mm_segment_t old_fs
= get_fs();
630 ret
= copy_from_user (&r
.rt_dst
, &(((struct rtentry32
*)arg
)->rt_dst
), 3 * sizeof(struct sockaddr
));
631 ret
|= __get_user (r
.rt_flags
, &(((struct rtentry32
*)arg
)->rt_flags
));
632 ret
|= __get_user (r
.rt_metric
, &(((struct rtentry32
*)arg
)->rt_metric
));
633 ret
|= __get_user (r
.rt_mtu
, &(((struct rtentry32
*)arg
)->rt_mtu
));
634 ret
|= __get_user (r
.rt_window
, &(((struct rtentry32
*)arg
)->rt_window
));
635 ret
|= __get_user (r
.rt_irtt
, &(((struct rtentry32
*)arg
)->rt_irtt
));
636 ret
|= __get_user (rtdev
, &(((struct rtentry32
*)arg
)->rt_dev
));
638 ret
|= copy_from_user (devname
, (char *)A(rtdev
), 15);
639 r
.rt_dev
= devname
; devname
[15] = 0;
645 ret
= sys_ioctl (fd
, cmd
, (long)&r
);
650 struct hd_geometry32
{
652 unsigned char sectors
;
653 unsigned short cylinders
;
657 static inline int hdio_getgeo(unsigned int fd
, unsigned long arg
)
659 mm_segment_t old_fs
= get_fs();
660 struct hd_geometry geo
;
664 err
= sys_ioctl(fd
, HDIO_GETGEO
, (unsigned long)&geo
);
667 err
= copy_to_user ((struct hd_geometry32
*)arg
, &geo
, 4);
668 err
|= __put_user (geo
.start
, &(((struct hd_geometry32
*)arg
)->start
));
674 int index
; /* first element (0 origin) */
681 #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32)
682 #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32)
684 static inline int fbiogetputcmap(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
688 char red
[256], green
[256], blue
[256];
690 mm_segment_t old_fs
= get_fs();
692 ret
= get_user(f
.index
, &(((struct fbcmap32
*)arg
)->index
));
693 ret
|= __get_user(f
.count
, &(((struct fbcmap32
*)arg
)->count
));
694 ret
|= __get_user(r
, &(((struct fbcmap32
*)arg
)->red
));
695 ret
|= __get_user(g
, &(((struct fbcmap32
*)arg
)->green
));
696 ret
|= __get_user(b
, &(((struct fbcmap32
*)arg
)->blue
));
699 if ((f
.index
< 0) || (f
.index
> 255)) return -EINVAL
;
700 if (f
.index
+ f
.count
> 256)
701 f
.count
= 256 - f
.index
;
702 if (cmd
== FBIOPUTCMAP32
) {
703 ret
= copy_from_user (red
, (char *)A(r
), f
.count
);
704 ret
|= copy_from_user (green
, (char *)A(g
), f
.count
);
705 ret
|= copy_from_user (blue
, (char *)A(b
), f
.count
);
709 f
.red
= red
; f
.green
= green
; f
.blue
= blue
;
711 ret
= sys_ioctl (fd
, (cmd
== FBIOPUTCMAP32
) ? FBIOPUTCMAP_SPARC
: FBIOGETCMAP_SPARC
, (long)&f
);
713 if (!ret
&& cmd
== FBIOGETCMAP32
) {
714 ret
= copy_to_user ((char *)A(r
), red
, f
.count
);
715 ret
|= copy_to_user ((char *)A(g
), green
, f
.count
);
716 ret
|= copy_to_user ((char *)A(b
), blue
, f
.count
);
722 short set
; /* what to set, choose from the list above */
723 short enable
; /* cursor on/off */
724 struct fbcurpos pos
; /* cursor position */
725 struct fbcurpos hot
; /* cursor hot spot */
726 struct fbcmap32 cmap
; /* color map info */
727 struct fbcurpos size
; /* cursor bit map size */
728 u32 image
; /* cursor image bits */
729 u32 mask
; /* cursor mask bits */
732 #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32)
733 #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32)
735 static inline int fbiogscursor(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
739 char red
[2], green
[2], blue
[2];
740 char image
[128], mask
[128];
743 mm_segment_t old_fs
= get_fs();
745 ret
= copy_from_user (&f
, (struct fbcursor32
*)arg
, 2 * sizeof (short) + 2 * sizeof(struct fbcurpos
));
746 ret
|= __get_user(f
.size
.fbx
, &(((struct fbcursor32
*)arg
)->size
.fbx
));
747 ret
|= __get_user(f
.size
.fby
, &(((struct fbcursor32
*)arg
)->size
.fby
));
748 ret
|= __get_user(f
.cmap
.index
, &(((struct fbcursor32
*)arg
)->cmap
.index
));
749 ret
|= __get_user(f
.cmap
.count
, &(((struct fbcursor32
*)arg
)->cmap
.count
));
750 ret
|= __get_user(r
, &(((struct fbcursor32
*)arg
)->cmap
.red
));
751 ret
|= __get_user(g
, &(((struct fbcursor32
*)arg
)->cmap
.green
));
752 ret
|= __get_user(b
, &(((struct fbcursor32
*)arg
)->cmap
.blue
));
753 ret
|= __get_user(m
, &(((struct fbcursor32
*)arg
)->mask
));
754 ret
|= __get_user(i
, &(((struct fbcursor32
*)arg
)->image
));
757 if (f
.set
& FB_CUR_SETCMAP
) {
758 if ((uint
) f
.size
.fby
> 32)
760 ret
= copy_from_user (mask
, (char *)A(m
), f
.size
.fby
* 4);
761 ret
|= copy_from_user (image
, (char *)A(i
), f
.size
.fby
* 4);
764 f
.image
= image
; f
.mask
= mask
;
766 if (f
.set
& FB_CUR_SETCMAP
) {
767 ret
= copy_from_user (red
, (char *)A(r
), 2);
768 ret
|= copy_from_user (green
, (char *)A(g
), 2);
769 ret
|= copy_from_user (blue
, (char *)A(b
), 2);
772 f
.cmap
.red
= red
; f
.cmap
.green
= green
; f
.cmap
.blue
= blue
;
775 ret
= sys_ioctl (fd
, FBIOSCURSOR
, (long)&f
);
780 struct fb_fix_screeninfo32
{
782 __kernel_caddr_t32 smem_start
;
791 __kernel_caddr_t32 mmio_start
;
800 __kernel_caddr_t32 red
;
801 __kernel_caddr_t32 green
;
802 __kernel_caddr_t32 blue
;
803 __kernel_caddr_t32 transp
;
806 static int fb_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
808 mm_segment_t old_fs
= get_fs();
809 u32 red
= 0, green
= 0, blue
= 0, transp
= 0;
810 struct fb_fix_screeninfo fix
;
815 memset(&cmap
, 0, sizeof(cmap
));
817 case FBIOGET_FSCREENINFO
:
823 err
= __get_user(cmap
.start
, &((struct fb_cmap32
*)arg
)->start
);
824 err
|= __get_user(cmap
.len
, &((struct fb_cmap32
*)arg
)->len
);
825 err
|= __get_user(red
, &((struct fb_cmap32
*)arg
)->red
);
826 err
|= __get_user(green
, &((struct fb_cmap32
*)arg
)->green
);
827 err
|= __get_user(blue
, &((struct fb_cmap32
*)arg
)->blue
);
828 err
|= __get_user(transp
, &((struct fb_cmap32
*)arg
)->transp
);
832 cmap
.red
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
835 cmap
.green
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
838 cmap
.blue
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
842 cmap
.transp
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
847 if (cmd
== FBIOGETCMAP
)
850 err
= __copy_from_user(cmap
.red
, (char *)A(red
), cmap
.len
* sizeof(__u16
));
851 err
|= __copy_from_user(cmap
.green
, (char *)A(green
), cmap
.len
* sizeof(__u16
));
852 err
|= __copy_from_user(cmap
.blue
, (char *)A(blue
), cmap
.len
* sizeof(__u16
));
853 if (cmap
.transp
) err
|= __copy_from_user(cmap
.transp
, (char *)A(transp
), cmap
.len
* sizeof(__u16
));
859 static int count
= 0;
861 printk("%s: Unknown fb ioctl cmd fd(%d) "
862 "cmd(%08x) arg(%08lx)\n",
863 __FUNCTION__
, fd
, cmd
, arg
);
868 err
= sys_ioctl(fd
, cmd
, (unsigned long)karg
);
873 case FBIOGET_FSCREENINFO
:
874 err
= __copy_to_user((char *)((struct fb_fix_screeninfo32
*)arg
)->id
, (char *)fix
.id
, sizeof(fix
.id
));
875 err
|= __put_user((__u32
)(unsigned long)fix
.smem_start
, &((struct fb_fix_screeninfo32
*)arg
)->smem_start
);
876 err
|= __put_user(fix
.smem_len
, &((struct fb_fix_screeninfo32
*)arg
)->smem_len
);
877 err
|= __put_user(fix
.type
, &((struct fb_fix_screeninfo32
*)arg
)->type
);
878 err
|= __put_user(fix
.type_aux
, &((struct fb_fix_screeninfo32
*)arg
)->type_aux
);
879 err
|= __put_user(fix
.visual
, &((struct fb_fix_screeninfo32
*)arg
)->visual
);
880 err
|= __put_user(fix
.xpanstep
, &((struct fb_fix_screeninfo32
*)arg
)->xpanstep
);
881 err
|= __put_user(fix
.ypanstep
, &((struct fb_fix_screeninfo32
*)arg
)->ypanstep
);
882 err
|= __put_user(fix
.ywrapstep
, &((struct fb_fix_screeninfo32
*)arg
)->ywrapstep
);
883 err
|= __put_user(fix
.line_length
, &((struct fb_fix_screeninfo32
*)arg
)->line_length
);
884 err
|= __put_user((__u32
)(unsigned long)fix
.mmio_start
, &((struct fb_fix_screeninfo32
*)arg
)->mmio_start
);
885 err
|= __put_user(fix
.mmio_len
, &((struct fb_fix_screeninfo32
*)arg
)->mmio_len
);
886 err
|= __put_user(fix
.accel
, &((struct fb_fix_screeninfo32
*)arg
)->accel
);
887 err
|= __copy_to_user((char *)((struct fb_fix_screeninfo32
*)arg
)->reserved
, (char *)fix
.reserved
, sizeof(fix
.reserved
));
890 err
= __copy_to_user((char *)A(red
), cmap
.red
, cmap
.len
* sizeof(__u16
));
891 err
|= __copy_to_user((char *)A(green
), cmap
.blue
, cmap
.len
* sizeof(__u16
));
892 err
|= __copy_to_user((char *)A(blue
), cmap
.blue
, cmap
.len
* sizeof(__u16
));
894 err
|= __copy_to_user((char *)A(transp
), cmap
.transp
, cmap
.len
* sizeof(__u16
));
899 out
: if (cmap
.red
) kfree(cmap
.red
);
900 if (cmap
.green
) kfree(cmap
.green
);
901 if (cmap
.blue
) kfree(cmap
.blue
);
902 if (cmap
.transp
) kfree(cmap
.transp
);
906 static int hdio_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
908 mm_segment_t old_fs
= get_fs();
914 error
= sys_ioctl(fd
, cmd
, (long)&kval
);
918 uvp
= (unsigned int *)arg
;
919 if(put_user(kval
, uvp
))
925 struct floppy_struct32
{
930 unsigned int stretch
;
934 unsigned char fmt_gap
;
935 const __kernel_caddr_t32 name
;
938 struct floppy_drive_params32
{
946 unsigned char spindown_offset
;
947 unsigned char select_delay
;
949 unsigned char tracks
;
951 unsigned char interleave_sect
;
952 struct floppy_max_errors max_errors
;
960 struct floppy_drive_struct32
{
974 __kernel_caddr_t32 dmabuf
;
978 struct floppy_fdc_state32
{
982 unsigned char version
;
985 unsigned int rawcmd
:2;
986 unsigned int reset
:1;
987 unsigned int need_configure
:1;
988 unsigned int perp_mode
:2;
989 unsigned int has_fifo
:1;
990 unsigned int driver_version
;
991 unsigned char track
[4];
994 struct floppy_write_errors32
{
995 unsigned int write_errors
;
996 u32 first_error_sector
;
997 int first_error_generation
;
998 u32 last_error_sector
;
999 int last_error_generation
;
1000 unsigned int badness
;
1003 #define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32)
1004 #define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32)
1005 #define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32)
1006 #define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32)
1007 #define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32)
1008 #define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32)
1009 #define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32)
1010 #define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32)
1011 #define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32)
1016 } fd_ioctl_trans_table
[] = {
1017 { FDSETPRM32
, FDSETPRM
},
1018 { FDDEFPRM32
, FDDEFPRM
},
1019 { FDGETPRM32
, FDGETPRM
},
1020 { FDSETDRVPRM32
, FDSETDRVPRM
},
1021 { FDGETDRVPRM32
, FDGETDRVPRM
},
1022 { FDGETDRVSTAT32
, FDGETDRVSTAT
},
1023 { FDPOLLDRVSTAT32
, FDPOLLDRVSTAT
},
1024 { FDGETFDCSTAT32
, FDGETFDCSTAT
},
1025 { FDWERRORGET32
, FDWERRORGET
}
1028 #define NR_FD_IOCTL_TRANS (sizeof(fd_ioctl_trans_table)/sizeof(fd_ioctl_trans_table[0]))
1030 static int fd_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1032 mm_segment_t old_fs
= get_fs();
1034 unsigned int kcmd
= 0;
1037 for (i
= 0; i
< NR_FD_IOCTL_TRANS
; i
++)
1038 if (cmd
== fd_ioctl_trans_table
[i
].cmd32
) {
1039 kcmd
= fd_ioctl_trans_table
[i
].cmd
;
1050 struct floppy_struct
*f
;
1052 f
= karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_struct
));
1055 if (cmd
== FDGETPRM32
)
1057 err
= __get_user(f
->size
, &((struct floppy_struct32
*)arg
)->size
);
1058 err
|= __get_user(f
->sect
, &((struct floppy_struct32
*)arg
)->sect
);
1059 err
|= __get_user(f
->head
, &((struct floppy_struct32
*)arg
)->head
);
1060 err
|= __get_user(f
->track
, &((struct floppy_struct32
*)arg
)->track
);
1061 err
|= __get_user(f
->stretch
, &((struct floppy_struct32
*)arg
)->stretch
);
1062 err
|= __get_user(f
->gap
, &((struct floppy_struct32
*)arg
)->gap
);
1063 err
|= __get_user(f
->rate
, &((struct floppy_struct32
*)arg
)->rate
);
1064 err
|= __get_user(f
->spec1
, &((struct floppy_struct32
*)arg
)->spec1
);
1065 err
|= __get_user(f
->fmt_gap
, &((struct floppy_struct32
*)arg
)->fmt_gap
);
1066 err
|= __get_user((u64
)f
->name
, &((struct floppy_struct32
*)arg
)->name
);
1074 struct floppy_drive_params
*f
;
1076 f
= karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_drive_params
));
1079 if (cmd
== FDGETDRVPRM32
)
1081 err
= __get_user(f
->cmos
, &((struct floppy_drive_params32
*)arg
)->cmos
);
1082 err
|= __get_user(f
->max_dtr
, &((struct floppy_drive_params32
*)arg
)->max_dtr
);
1083 err
|= __get_user(f
->hlt
, &((struct floppy_drive_params32
*)arg
)->hlt
);
1084 err
|= __get_user(f
->hut
, &((struct floppy_drive_params32
*)arg
)->hut
);
1085 err
|= __get_user(f
->srt
, &((struct floppy_drive_params32
*)arg
)->srt
);
1086 err
|= __get_user(f
->spinup
, &((struct floppy_drive_params32
*)arg
)->spinup
);
1087 err
|= __get_user(f
->spindown
, &((struct floppy_drive_params32
*)arg
)->spindown
);
1088 err
|= __get_user(f
->spindown_offset
, &((struct floppy_drive_params32
*)arg
)->spindown_offset
);
1089 err
|= __get_user(f
->select_delay
, &((struct floppy_drive_params32
*)arg
)->select_delay
);
1090 err
|= __get_user(f
->rps
, &((struct floppy_drive_params32
*)arg
)->rps
);
1091 err
|= __get_user(f
->tracks
, &((struct floppy_drive_params32
*)arg
)->tracks
);
1092 err
|= __get_user(f
->timeout
, &((struct floppy_drive_params32
*)arg
)->timeout
);
1093 err
|= __get_user(f
->interleave_sect
, &((struct floppy_drive_params32
*)arg
)->interleave_sect
);
1094 err
|= __copy_from_user(&f
->max_errors
, &((struct floppy_drive_params32
*)arg
)->max_errors
, sizeof(f
->max_errors
));
1095 err
|= __get_user(f
->flags
, &((struct floppy_drive_params32
*)arg
)->flags
);
1096 err
|= __get_user(f
->read_track
, &((struct floppy_drive_params32
*)arg
)->read_track
);
1097 err
|= __copy_from_user(f
->autodetect
, ((struct floppy_drive_params32
*)arg
)->autodetect
, sizeof(f
->autodetect
));
1098 err
|= __get_user(f
->checkfreq
, &((struct floppy_drive_params32
*)arg
)->checkfreq
);
1099 err
|= __get_user(f
->native_format
, &((struct floppy_drive_params32
*)arg
)->native_format
);
1104 case FDGETDRVSTAT32
:
1105 case FDPOLLDRVSTAT32
:
1106 karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_drive_struct
));
1110 case FDGETFDCSTAT32
:
1111 karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_fdc_state
));
1116 karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_write_errors
));
1124 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1131 struct floppy_struct
*f
= karg
;
1133 err
= __put_user(f
->size
, &((struct floppy_struct32
*)arg
)->size
);
1134 err
|= __put_user(f
->sect
, &((struct floppy_struct32
*)arg
)->sect
);
1135 err
|= __put_user(f
->head
, &((struct floppy_struct32
*)arg
)->head
);
1136 err
|= __put_user(f
->track
, &((struct floppy_struct32
*)arg
)->track
);
1137 err
|= __put_user(f
->stretch
, &((struct floppy_struct32
*)arg
)->stretch
);
1138 err
|= __put_user(f
->gap
, &((struct floppy_struct32
*)arg
)->gap
);
1139 err
|= __put_user(f
->rate
, &((struct floppy_struct32
*)arg
)->rate
);
1140 err
|= __put_user(f
->spec1
, &((struct floppy_struct32
*)arg
)->spec1
);
1141 err
|= __put_user(f
->fmt_gap
, &((struct floppy_struct32
*)arg
)->fmt_gap
);
1142 err
|= __put_user((u64
)f
->name
, &((struct floppy_struct32
*)arg
)->name
);
1147 struct floppy_drive_params
*f
= karg
;
1149 err
= __put_user(f
->cmos
, &((struct floppy_drive_params32
*)arg
)->cmos
);
1150 err
|= __put_user(f
->max_dtr
, &((struct floppy_drive_params32
*)arg
)->max_dtr
);
1151 err
|= __put_user(f
->hlt
, &((struct floppy_drive_params32
*)arg
)->hlt
);
1152 err
|= __put_user(f
->hut
, &((struct floppy_drive_params32
*)arg
)->hut
);
1153 err
|= __put_user(f
->srt
, &((struct floppy_drive_params32
*)arg
)->srt
);
1154 err
|= __put_user(f
->spinup
, &((struct floppy_drive_params32
*)arg
)->spinup
);
1155 err
|= __put_user(f
->spindown
, &((struct floppy_drive_params32
*)arg
)->spindown
);
1156 err
|= __put_user(f
->spindown_offset
, &((struct floppy_drive_params32
*)arg
)->spindown_offset
);
1157 err
|= __put_user(f
->select_delay
, &((struct floppy_drive_params32
*)arg
)->select_delay
);
1158 err
|= __put_user(f
->rps
, &((struct floppy_drive_params32
*)arg
)->rps
);
1159 err
|= __put_user(f
->tracks
, &((struct floppy_drive_params32
*)arg
)->tracks
);
1160 err
|= __put_user(f
->timeout
, &((struct floppy_drive_params32
*)arg
)->timeout
);
1161 err
|= __put_user(f
->interleave_sect
, &((struct floppy_drive_params32
*)arg
)->interleave_sect
);
1162 err
|= __copy_to_user(&((struct floppy_drive_params32
*)arg
)->max_errors
, &f
->max_errors
, sizeof(f
->max_errors
));
1163 err
|= __put_user(f
->flags
, &((struct floppy_drive_params32
*)arg
)->flags
);
1164 err
|= __put_user(f
->read_track
, &((struct floppy_drive_params32
*)arg
)->read_track
);
1165 err
|= __copy_to_user(((struct floppy_drive_params32
*)arg
)->autodetect
, f
->autodetect
, sizeof(f
->autodetect
));
1166 err
|= __put_user(f
->checkfreq
, &((struct floppy_drive_params32
*)arg
)->checkfreq
);
1167 err
|= __put_user(f
->native_format
, &((struct floppy_drive_params32
*)arg
)->native_format
);
1170 case FDGETDRVSTAT32
:
1171 case FDPOLLDRVSTAT32
:
1173 struct floppy_drive_struct
*f
= karg
;
1175 err
= __put_user(f
->flags
, &((struct floppy_drive_struct32
*)arg
)->flags
);
1176 err
|= __put_user(f
->spinup_date
, &((struct floppy_drive_struct32
*)arg
)->spinup_date
);
1177 err
|= __put_user(f
->select_date
, &((struct floppy_drive_struct32
*)arg
)->select_date
);
1178 err
|= __put_user(f
->first_read_date
, &((struct floppy_drive_struct32
*)arg
)->first_read_date
);
1179 err
|= __put_user(f
->probed_format
, &((struct floppy_drive_struct32
*)arg
)->probed_format
);
1180 err
|= __put_user(f
->track
, &((struct floppy_drive_struct32
*)arg
)->track
);
1181 err
|= __put_user(f
->maxblock
, &((struct floppy_drive_struct32
*)arg
)->maxblock
);
1182 err
|= __put_user(f
->maxtrack
, &((struct floppy_drive_struct32
*)arg
)->maxtrack
);
1183 err
|= __put_user(f
->generation
, &((struct floppy_drive_struct32
*)arg
)->generation
);
1184 err
|= __put_user(f
->keep_data
, &((struct floppy_drive_struct32
*)arg
)->keep_data
);
1185 err
|= __put_user(f
->fd_ref
, &((struct floppy_drive_struct32
*)arg
)->fd_ref
);
1186 err
|= __put_user(f
->fd_device
, &((struct floppy_drive_struct32
*)arg
)->fd_device
);
1187 err
|= __put_user(f
->last_checked
, &((struct floppy_drive_struct32
*)arg
)->last_checked
);
1188 err
|= __put_user((u64
)f
->dmabuf
, &((struct floppy_drive_struct32
*)arg
)->dmabuf
);
1189 err
|= __put_user((u64
)f
->bufblocks
, &((struct floppy_drive_struct32
*)arg
)->bufblocks
);
1192 case FDGETFDCSTAT32
:
1194 struct floppy_fdc_state
*f
= karg
;
1196 err
= __put_user(f
->spec1
, &((struct floppy_fdc_state32
*)arg
)->spec1
);
1197 err
|= __put_user(f
->spec2
, &((struct floppy_fdc_state32
*)arg
)->spec2
);
1198 err
|= __put_user(f
->dtr
, &((struct floppy_fdc_state32
*)arg
)->dtr
);
1199 err
|= __put_user(f
->version
, &((struct floppy_fdc_state32
*)arg
)->version
);
1200 err
|= __put_user(f
->dor
, &((struct floppy_fdc_state32
*)arg
)->dor
);
1201 err
|= __put_user(f
->address
, &((struct floppy_fdc_state32
*)arg
)->address
);
1202 err
|= __copy_to_user((char *)&((struct floppy_fdc_state32
*)arg
)->address
1203 + sizeof(((struct floppy_fdc_state32
*)arg
)->address
),
1204 (char *)&f
->address
+ sizeof(f
->address
), sizeof(int));
1205 err
|= __put_user(f
->driver_version
, &((struct floppy_fdc_state32
*)arg
)->driver_version
);
1206 err
|= __copy_to_user(((struct floppy_fdc_state32
*)arg
)->track
, f
->track
, sizeof(f
->track
));
1211 struct floppy_write_errors
*f
= karg
;
1213 err
= __put_user(f
->write_errors
, &((struct floppy_write_errors32
*)arg
)->write_errors
);
1214 err
|= __put_user(f
->first_error_sector
, &((struct floppy_write_errors32
*)arg
)->first_error_sector
);
1215 err
|= __put_user(f
->first_error_generation
, &((struct floppy_write_errors32
*)arg
)->first_error_generation
);
1216 err
|= __put_user(f
->last_error_sector
, &((struct floppy_write_errors32
*)arg
)->last_error_sector
);
1217 err
|= __put_user(f
->last_error_generation
, &((struct floppy_write_errors32
*)arg
)->last_error_generation
);
1218 err
|= __put_user(f
->badness
, &((struct floppy_write_errors32
*)arg
)->badness
);
1224 out
: if (karg
) kfree(karg
);
1228 struct ppp_option_data32
{
1229 __kernel_caddr_t32 ptr
;
1233 #define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
1236 __kernel_time_t32 xmit_idle
;
1237 __kernel_time_t32 recv_idle
;
1239 #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
1241 static int ppp_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1243 mm_segment_t old_fs
= get_fs();
1244 struct ppp_option_data32 data32
;
1245 struct ppp_option_data data
;
1246 struct ppp_idle32 idle32
;
1247 struct ppp_idle idle
;
1257 case PPPIOCSCOMPRESS32
:
1258 if (copy_from_user(&data32
, (struct ppp_option_data32
*)arg
, sizeof(struct ppp_option_data32
)))
1260 data
.ptr
= kmalloc (data32
.length
, GFP_KERNEL
);
1263 if (copy_from_user(data
.ptr
, (__u8
*)A(data32
.ptr
), data32
.length
)) {
1267 data
.length
= data32
.length
;
1268 data
.transmit
= data32
.transmit
;
1269 kcmd
= PPPIOCSCOMPRESS
;
1274 static int count
= 0;
1276 printk("ppp_ioctl: Unknown cmd fd(%d) "
1277 "cmd(%08x) arg(%08x)\n",
1278 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1283 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1289 idle32
.xmit_idle
= idle
.xmit_idle
;
1290 idle32
.recv_idle
= idle
.recv_idle
;
1291 if (copy_to_user((struct ppp_idle32
*)arg
, &idle32
, sizeof(struct ppp_idle32
)))
1294 case PPPIOCSCOMPRESS32
:
1310 __kernel_daddr_t32 mt_fileno
;
1311 __kernel_daddr_t32 mt_blkno
;
1313 #define MTIOCGET32 _IOR('m', 2, struct mtget32)
1318 #define MTIOCPOS32 _IOR('m', 3, struct mtpos32)
1320 struct mtconfiginfo32
{
1341 #define MTIOCGETCONFIG32 _IOR('m', 4, struct mtconfiginfo32)
1342 #define MTIOCSETCONFIG32 _IOW('m', 5, struct mtconfiginfo32)
1344 static int mt_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1346 mm_segment_t old_fs
= get_fs();
1347 struct mtconfiginfo info
;
1363 case MTIOCGETCONFIG32
:
1364 kcmd
= MTIOCGETCONFIG
;
1367 case MTIOCSETCONFIG32
:
1368 kcmd
= MTIOCSETCONFIG
;
1370 err
= __get_user(info
.mt_type
, &((struct mtconfiginfo32
*)arg
)->mt_type
);
1371 err
|= __get_user(info
.ifc_type
, &((struct mtconfiginfo32
*)arg
)->ifc_type
);
1372 err
|= __get_user(info
.irqnr
, &((struct mtconfiginfo32
*)arg
)->irqnr
);
1373 err
|= __get_user(info
.dmanr
, &((struct mtconfiginfo32
*)arg
)->dmanr
);
1374 err
|= __get_user(info
.port
, &((struct mtconfiginfo32
*)arg
)->port
);
1375 err
|= __get_user(info
.debug
, &((struct mtconfiginfo32
*)arg
)->debug
);
1376 err
|= __copy_from_user((char *)&info
.debug
+ sizeof(info
.debug
),
1377 (char *)&((struct mtconfiginfo32
*)arg
)->debug
1378 + sizeof(((struct mtconfiginfo32
*)arg
)->debug
), sizeof(__u32
));
1384 static int count
= 0;
1386 printk("mt_ioctl: Unknown cmd fd(%d) "
1387 "cmd(%08x) arg(%08x)\n",
1388 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1393 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1399 if (__put_user(pos
.mt_blkno
, &((struct mtpos32
*)arg
)->mt_blkno
))
1403 err
= __put_user(get
.mt_type
, &((struct mtget32
*)arg
)->mt_type
);
1404 err
|= __put_user(get
.mt_resid
, &((struct mtget32
*)arg
)->mt_resid
);
1405 err
|= __put_user(get
.mt_dsreg
, &((struct mtget32
*)arg
)->mt_dsreg
);
1406 err
|= __put_user(get
.mt_gstat
, &((struct mtget32
*)arg
)->mt_gstat
);
1407 err
|= __put_user(get
.mt_erreg
, &((struct mtget32
*)arg
)->mt_erreg
);
1408 err
|= __put_user(get
.mt_fileno
, &((struct mtget32
*)arg
)->mt_fileno
);
1409 err
|= __put_user(get
.mt_blkno
, &((struct mtget32
*)arg
)->mt_blkno
);
1411 case MTIOCGETCONFIG32
:
1412 err
= __put_user(info
.mt_type
, &((struct mtconfiginfo32
*)arg
)->mt_type
);
1413 err
|= __put_user(info
.ifc_type
, &((struct mtconfiginfo32
*)arg
)->ifc_type
);
1414 err
|= __put_user(info
.irqnr
, &((struct mtconfiginfo32
*)arg
)->irqnr
);
1415 err
|= __put_user(info
.dmanr
, &((struct mtconfiginfo32
*)arg
)->dmanr
);
1416 err
|= __put_user(info
.port
, &((struct mtconfiginfo32
*)arg
)->port
);
1417 err
|= __put_user(info
.debug
, &((struct mtconfiginfo32
*)arg
)->debug
);
1418 err
|= __copy_to_user((char *)&((struct mtconfiginfo32
*)arg
)->debug
1419 + sizeof(((struct mtconfiginfo32
*)arg
)->debug
),
1420 (char *)&info
.debug
+ sizeof(info
.debug
), sizeof(__u32
));
1422 case MTIOCSETCONFIG32
:
1428 struct cdrom_read32
{
1430 __kernel_caddr_t32 cdread_bufaddr
;
1434 struct cdrom_read_audio32
{
1435 union cdrom_addr addr
;
1438 __kernel_caddr_t32 buf
;
1441 static int cdrom_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1443 mm_segment_t old_fs
= get_fs();
1444 struct cdrom_read cdread
;
1445 struct cdrom_read_audio cdreadaudio
;
1446 __kernel_caddr_t32 addr
;
1452 case CDROMREADMODE2
:
1453 case CDROMREADMODE1
:
1455 case CDROMREADCOOKED
:
1457 err
= __get_user(cdread
.cdread_lba
, &((struct cdrom_read32
*)arg
)->cdread_lba
);
1458 err
|= __get_user(addr
, &((struct cdrom_read32
*)arg
)->cdread_bufaddr
);
1459 err
|= __get_user(cdread
.cdread_buflen
, &((struct cdrom_read32
*)arg
)->cdread_buflen
);
1462 data
= kmalloc(cdread
.cdread_buflen
, GFP_KERNEL
);
1465 cdread
.cdread_bufaddr
= data
;
1467 case CDROMREADAUDIO
:
1468 karg
= &cdreadaudio
;
1469 err
= copy_from_user(&cdreadaudio
.addr
, &((struct cdrom_read_audio32
*)arg
)->addr
, sizeof(cdreadaudio
.addr
));
1470 err
|= __get_user(cdreadaudio
.addr_format
, &((struct cdrom_read_audio32
*)arg
)->addr_format
);
1471 err
|= __get_user(cdreadaudio
.nframes
, &((struct cdrom_read_audio32
*)arg
)->nframes
);
1472 err
|= __get_user(addr
, &((struct cdrom_read_audio32
*)arg
)->buf
);
1475 data
= kmalloc(cdreadaudio
.nframes
* 2352, GFP_KERNEL
);
1478 cdreadaudio
.buf
= data
;
1482 static int count
= 0;
1484 printk("cdrom_ioctl: Unknown cmd fd(%d) "
1485 "cmd(%08x) arg(%08x)\n",
1486 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1491 err
= sys_ioctl (fd
, cmd
, (unsigned long)karg
);
1496 case CDROMREADMODE2
:
1497 case CDROMREADMODE1
:
1499 case CDROMREADCOOKED
:
1500 err
= copy_to_user((char *)A(addr
), data
, cdread
.cdread_buflen
);
1502 case CDROMREADAUDIO
:
1503 err
= copy_to_user((char *)A(addr
), data
, cdreadaudio
.nframes
* 2352);
1508 out
: if (data
) kfree(data
);
1512 struct loop_info32
{
1513 int lo_number
; /* ioctl r/o */
1514 __kernel_dev_t32 lo_device
; /* ioctl r/o */
1515 unsigned int lo_inode
; /* ioctl r/o */
1516 __kernel_dev_t32 lo_rdevice
; /* ioctl r/o */
1518 int lo_encrypt_type
;
1519 int lo_encrypt_key_size
; /* ioctl w/o */
1520 int lo_flags
; /* ioctl r/o */
1521 char lo_name
[LO_NAME_SIZE
];
1522 unsigned char lo_encrypt_key
[LO_KEY_SIZE
]; /* ioctl w/o */
1523 unsigned int lo_init
[2];
1527 static int loop_status(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1529 mm_segment_t old_fs
= get_fs();
1534 case LOOP_SET_STATUS
:
1535 err
= get_user(l
.lo_number
, &((struct loop_info32
*)arg
)->lo_number
);
1536 err
|= __get_user(l
.lo_device
, &((struct loop_info32
*)arg
)->lo_device
);
1537 err
|= __get_user(l
.lo_inode
, &((struct loop_info32
*)arg
)->lo_inode
);
1538 err
|= __get_user(l
.lo_rdevice
, &((struct loop_info32
*)arg
)->lo_rdevice
);
1539 err
|= __copy_from_user((char *)&l
.lo_offset
, (char *)&((struct loop_info32
*)arg
)->lo_offset
,
1540 8 + (unsigned long)l
.lo_init
- (unsigned long)&l
.lo_offset
);
1544 err
= sys_ioctl (fd
, cmd
, (unsigned long)&l
);
1547 case LOOP_GET_STATUS
:
1549 err
= sys_ioctl (fd
, cmd
, (unsigned long)&l
);
1552 err
= put_user(l
.lo_number
, &((struct loop_info32
*)arg
)->lo_number
);
1553 err
|= __put_user(l
.lo_device
, &((struct loop_info32
*)arg
)->lo_device
);
1554 err
|= __put_user(l
.lo_inode
, &((struct loop_info32
*)arg
)->lo_inode
);
1555 err
|= __put_user(l
.lo_rdevice
, &((struct loop_info32
*)arg
)->lo_rdevice
);
1556 err
|= __copy_to_user((char *)&((struct loop_info32
*)arg
)->lo_offset
,
1557 (char *)&l
.lo_offset
, (unsigned long)l
.lo_init
- (unsigned long)&l
.lo_offset
);
1564 extern int tty_ioctl(struct inode
* inode
, struct file
* file
, unsigned int cmd
, unsigned long arg
);
1566 static int vt_check(struct file
*file
)
1568 struct tty_struct
*tty
;
1569 struct inode
*inode
= file
->f_dentry
->d_inode
;
1571 if (file
->f_op
->ioctl
!= tty_ioctl
)
1574 tty
= (struct tty_struct
*)file
->private_data
;
1575 if (tty_paranoia_check(tty
, inode
->i_rdev
, "tty_ioctl"))
1578 if (tty
->driver
.ioctl
!= vt_ioctl
)
1582 * To have permissions to do most of the vt ioctls, we either have
1583 * to be the owner of the tty, or super-user.
1585 if (current
->tty
== tty
|| suser())
1590 struct consolefontdesc32
{
1591 unsigned short charcount
; /* characters in font (256 or 512) */
1592 unsigned short charheight
; /* scan lines per character (1-32) */
1593 u32 chardata
; /* font data in expanded form */
1596 static int do_fontx_ioctl(struct file
*file
, int cmd
, struct consolefontdesc32
*user_cfd
)
1598 struct consolefontdesc cfdarg
;
1599 struct console_font_op op
;
1602 perm
= vt_check(file
);
1603 if (perm
< 0) return perm
;
1605 if (copy_from_user(&cfdarg
, user_cfd
, sizeof(struct consolefontdesc32
)))
1608 cfdarg
.chardata
= (unsigned char *)A(((struct consolefontdesc32
*)&cfdarg
)->chardata
);
1614 op
.op
= KD_FONT_OP_SET
;
1617 op
.height
= cfdarg
.charheight
;
1618 op
.charcount
= cfdarg
.charcount
;
1619 op
.data
= cfdarg
.chardata
;
1620 return con_font_op(fg_console
, &op
);
1622 if (!cfdarg
.chardata
)
1624 op
.op
= KD_FONT_OP_GET
;
1627 op
.height
= cfdarg
.charheight
;
1628 op
.charcount
= cfdarg
.charcount
;
1629 op
.data
= cfdarg
.chardata
;
1630 i
= con_font_op(fg_console
, &op
);
1633 cfdarg
.charheight
= op
.height
;
1634 cfdarg
.charcount
= op
.charcount
;
1635 ((struct consolefontdesc32
*)&cfdarg
)->chardata
= (unsigned long)cfdarg
.chardata
;
1636 if (copy_to_user(user_cfd
, &cfdarg
, sizeof(struct consolefontdesc32
)))
1643 struct console_font_op32
{
1644 unsigned int op
; /* operation code KD_FONT_OP_* */
1645 unsigned int flags
; /* KD_FONT_FLAG_* */
1646 unsigned int width
, height
; /* font size */
1647 unsigned int charcount
;
1648 u32 data
; /* font data with height fixed to 32 */
1651 static int do_kdfontop_ioctl(struct file
*file
, struct console_font_op32
*fontop
)
1653 struct console_font_op op
;
1654 int perm
= vt_check(file
), i
;
1655 struct vt_struct
*vt
;
1657 if (perm
< 0) return perm
;
1659 if (copy_from_user(&op
, (void *) fontop
, sizeof(struct console_font_op32
)))
1661 if (!perm
&& op
.op
!= KD_FONT_OP_GET
)
1663 op
.data
= (unsigned char *)A(((struct console_font_op32
*)&op
)->data
);
1664 op
.flags
|= KD_FONT_FLAG_OLD
;
1665 vt
= (struct vt_struct
*)((struct tty_struct
*)file
->private_data
)->driver_data
;
1666 i
= con_font_op(vt
->vc_num
, &op
);
1668 ((struct console_font_op32
*)&op
)->data
= (unsigned long)op
.data
;
1669 if (copy_to_user((void *) fontop
, &op
, sizeof(struct console_font_op32
)))
1674 struct unimapdesc32
{
1675 unsigned short entry_ct
;
1679 static int do_unimap_ioctl(struct file
*file
, int cmd
, struct unimapdesc32
*user_ud
)
1681 struct unimapdesc32 tmp
;
1682 int perm
= vt_check(file
);
1684 if (perm
< 0) return perm
;
1685 if (copy_from_user(&tmp
, user_ud
, sizeof tmp
))
1689 if (!perm
) return -EPERM
;
1690 return con_set_unimap(fg_console
, tmp
.entry_ct
, (struct unipair
*)A(tmp
.entries
));
1692 return con_get_unimap(fg_console
, tmp
.entry_ct
, &(user_ud
->entry_ct
), (struct unipair
*)A(tmp
.entries
));
1697 asmlinkage
int sys32_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1707 if (!filp
->f_op
|| !filp
->f_op
->ioctl
) {
1708 error
= sys_ioctl (fd
, cmd
, arg
);
1713 error
= dev_ifname32(fd
, arg
);
1717 error
= dev_ifconf(fd
, arg
);
1737 case SIOCGIFBRDADDR
:
1738 case SIOCSIFBRDADDR
:
1739 case SIOCGIFDSTADDR
:
1740 case SIOCSIFDSTADDR
:
1741 case SIOCGIFNETMASK
:
1742 case SIOCSIFNETMASK
:
1746 case SIOCGPPPCSTATS
:
1751 error
= dev_ifsioc(fd
, cmd
, arg
);
1756 error
= routing_ioctl(fd
, cmd
, arg
);
1759 case SIOCRTMSG
: /* Note SIOCRTMSG is no longer, so this is safe and
1760 * the user would have seen just an -EINVAL anyways.
1766 /* Sorry, timeval in the kernel is different now. */
1767 error
= do_siocgstamp(fd
, cmd
, arg
);
1771 error
= hdio_getgeo(fd
, arg
);
1777 /* The mkswap binary hard codes it to Intel value :-((( */
1780 error
= w_long(fd
, cmd
, arg
);
1785 error
= fbiogetputcmap(fd
, cmd
, arg
);
1789 error
= fbiogscursor(fd
, cmd
, arg
);
1792 case FBIOGET_FSCREENINFO
:
1795 error
= fb_ioctl_trans(fd
, cmd
, arg
);
1798 case HDIO_GET_KEEPSETTINGS
:
1799 case HDIO_GET_UNMASKINTR
:
1801 case HDIO_GET_32BIT
:
1802 case HDIO_GET_MULTCOUNT
:
1803 case HDIO_GET_NOWERR
:
1805 error
= hdio_ioctl_trans(fd
, cmd
, arg
);
1813 case FDGETDRVSTAT32
:
1814 case FDPOLLDRVSTAT32
:
1815 case FDGETFDCSTAT32
:
1817 error
= fd_ioctl_trans(fd
, cmd
, arg
);
1821 case PPPIOCSCOMPRESS32
:
1822 error
= ppp_ioctl_trans(fd
, cmd
, arg
);
1827 case MTIOCGETCONFIG32
:
1828 case MTIOCSETCONFIG32
:
1829 error
= mt_ioctl_trans(fd
, cmd
, arg
);
1832 case CDROMREADMODE2
:
1833 case CDROMREADMODE1
:
1835 case CDROMREADCOOKED
:
1836 case CDROMREADAUDIO
:
1838 error
= cdrom_ioctl_trans(fd
, cmd
, arg
);
1841 case LOOP_SET_STATUS
:
1842 case LOOP_GET_STATUS
:
1843 error
= loop_status(fd
, cmd
, arg
);
1846 #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
1847 case AUTOFS_IOC_SETTIMEOUT32
:
1848 error
= rw_long(fd
, AUTOFS_IOC_SETTIMEOUT
, arg
);
1853 error
= do_fontx_ioctl(filp
, cmd
, (struct consolefontdesc32
*)arg
);
1858 error
= do_unimap_ioctl(filp
, cmd
, (struct unimapdesc32
*)arg
);
1862 error
= do_kdfontop_ioctl(filp
, (struct console_font_op32
*)arg
);
1865 case EXT2_IOC32_GETFLAGS
:
1866 case EXT2_IOC32_SETFLAGS
:
1867 case EXT2_IOC32_GETVERSION
:
1868 case EXT2_IOC32_SETVERSION
:
1869 error
= do_ext2_ioctl(fd
, cmd
, arg
);
1872 case VIDIOCGTUNER32
:
1873 case VIDIOCSTUNER32
:
1880 error
= do_video_ioctl(fd
, cmd
, arg
);
1883 /* List here exlicitly which ioctl's are known to have
1884 * compatable types passed or none at all...
1931 case FBIOGCURSOR32
: /* This is not implemented yet. Later it should be converted... */
1936 case FBIOGET_VSCREENINFO
:
1937 case FBIOPUT_VSCREENINFO
:
1938 case FBIOPAN_DISPLAY
:
1939 case FBIOGET_FCURSORINFO
:
1940 case FBIOGET_VCURSORINFO
:
1941 case FBIOPUT_VCURSORINFO
:
1942 case FBIOGET_CURSORSTATE
:
1943 case FBIOPUT_CURSORSTATE
:
1944 case FBIOGET_CON2FBMAP
:
1945 case FBIOPUT_CON2FBMAP
:
1952 case FIONREAD
: /* This is also TIOCINQ */
1958 /* 0x03 -- HD/IDE ioctl's used by hdparm and friends.
1959 * Some need translations, these do not.
1961 case HDIO_GET_IDENTITY
:
1963 case HDIO_SET_KEEPSETTINGS
:
1964 case HDIO_SET_UNMASKINTR
:
1965 case HDIO_SET_NOWERR
:
1966 case HDIO_SET_32BIT
:
1967 case HDIO_SET_MULTCOUNT
:
1968 case HDIO_DRIVE_CMD
:
1969 case HDIO_SET_PIO_MODE
:
1970 case HDIO_SCAN_HWIF
:
1975 /* 0x02 -- Floppy ioctls */
1978 case FDSETEMSGTRESH
:
2000 case REGISTER_DEV_NEW
:
2031 case GIO_UNISCRNMAP
:
2032 case PIO_UNISCRNMAP
:
2049 case SCSI_IOCTL_GET_IDLUN
:
2050 case SCSI_IOCTL_DOORLOCK
:
2051 case SCSI_IOCTL_DOORUNLOCK
:
2052 case SCSI_IOCTL_TEST_UNIT_READY
:
2053 case SCSI_IOCTL_TAGGED_ENABLE
:
2054 case SCSI_IOCTL_TAGGED_DISABLE
:
2055 case SCSI_IOCTL_GET_BUS_NUMBER
:
2056 case SCSI_IOCTL_SEND_COMMAND
:
2066 case VT_DISALLOCATE
:
2070 case VT_UNLOCKSWITCH
:
2076 /* Little v, the video4linux ioctls */
2087 case VIDIOCMCAPTURE
:
2090 case VIDIOCGCAPTURE
:
2091 case VIDIOCSCAPTURE
:
2093 /* BTTV specific... */
2094 case _IOW('v', BASE_VIDIOCPRIVATE
+0, char [256]):
2095 case _IOR('v', BASE_VIDIOCPRIVATE
+1, char [256]):
2096 case _IOR('v' , BASE_VIDIOCPRIVATE
+2, unsigned int):
2097 case _IOW('v' , BASE_VIDIOCPRIVATE
+3, char [16]): /* struct bttv_pll_info */
2098 case _IOR('v' , BASE_VIDIOCPRIVATE
+4, int):
2099 case _IOR('v' , BASE_VIDIOCPRIVATE
+5, int):
2100 case _IOR('v' , BASE_VIDIOCPRIVATE
+6, int):
2101 case _IOR('v' , BASE_VIDIOCPRIVATE
+7, int):
2103 /* Little p (/dev/rtc, /dev/envctrl, etc.) */
2112 /* OPENPROMIO, SunOS/Solaris only, the NetBSD one's have
2113 * embedded pointers in the arg which we'd need to clean up...
2125 case OPROMGETFBNAME
:
2126 case OPROMGETBOOTARGS
:
2128 /* Socket level stuff */
2142 #if 0 /* XXX No longer exist in new routing code. XXX */
2154 case SG_SET_TIMEOUT
:
2155 case SG_GET_TIMEOUT
:
2156 case SG_EMULATED_HOST
:
2157 case SG_SET_TRANSFORM
:
2158 case SG_GET_TRANSFORM
:
2163 case PPPIOCGASYNCMAP
:
2164 case PPPIOCSASYNCMAP
:
2166 case PPPIOCGRASYNCMAP
:
2167 case PPPIOCSRASYNCMAP
:
2171 case PPPIOCGXASYNCMAP
:
2172 case PPPIOCSXASYNCMAP
:
2173 case PPPIOCXFERUNIT
:
2183 case CDROMPLAYTRKIND
:
2184 case CDROMREADTOCHDR
:
2185 case CDROMREADTOCENTRY
:
2192 case CDROMMULTISESSION
:
2198 case CDROMCLOSETRAY
:
2199 case CDROM_SET_OPTIONS
:
2200 case CDROM_CLEAR_OPTIONS
:
2201 case CDROM_SELECT_SPEED
:
2202 case CDROM_SELECT_DISC
:
2203 case CDROM_MEDIA_CHANGED
:
2204 case CDROM_DRIVE_STATUS
:
2205 case CDROM_DISC_STATUS
:
2206 case CDROM_CHANGER_NSLOTS
:
2217 case AUDIO_GETDEV_SUNOS
:
2220 /* Big Q for sound/OSS */
2221 case SNDCTL_SEQ_RESET
:
2222 case SNDCTL_SEQ_SYNC
:
2223 case SNDCTL_SYNTH_INFO
:
2224 case SNDCTL_SEQ_CTRLRATE
:
2225 case SNDCTL_SEQ_GETOUTCOUNT
:
2226 case SNDCTL_SEQ_GETINCOUNT
:
2227 case SNDCTL_SEQ_PERCMODE
:
2228 case SNDCTL_FM_LOAD_INSTR
:
2229 case SNDCTL_SEQ_TESTMIDI
:
2230 case SNDCTL_SEQ_RESETSAMPLES
:
2231 case SNDCTL_SEQ_NRSYNTHS
:
2232 case SNDCTL_SEQ_NRMIDIS
:
2233 case SNDCTL_MIDI_INFO
:
2234 case SNDCTL_SEQ_THRESHOLD
:
2235 case SNDCTL_SYNTH_MEMAVL
:
2236 case SNDCTL_FM_4OP_ENABLE
:
2237 case SNDCTL_SEQ_PANIC
:
2238 case SNDCTL_SEQ_OUTOFBAND
:
2239 case SNDCTL_SEQ_GETTIME
:
2240 case SNDCTL_SYNTH_ID
:
2241 case SNDCTL_SYNTH_CONTROL
:
2242 case SNDCTL_SYNTH_REMOVESAMPLE
:
2244 /* Big T for sound/OSS */
2245 case SNDCTL_TMR_TIMEBASE
:
2246 case SNDCTL_TMR_START
:
2247 case SNDCTL_TMR_STOP
:
2248 case SNDCTL_TMR_CONTINUE
:
2249 case SNDCTL_TMR_TEMPO
:
2250 case SNDCTL_TMR_SOURCE
:
2251 case SNDCTL_TMR_METRONOME
:
2252 case SNDCTL_TMR_SELECT
:
2254 /* Little m for sound/OSS */
2255 case SNDCTL_MIDI_PRETIME
:
2256 case SNDCTL_MIDI_MPUMODE
:
2257 case SNDCTL_MIDI_MPUCMD
:
2259 /* Big P for sound/OSS */
2260 case SNDCTL_DSP_RESET
:
2261 case SNDCTL_DSP_SYNC
:
2262 case SNDCTL_DSP_SPEED
:
2263 case SNDCTL_DSP_STEREO
:
2264 case SNDCTL_DSP_GETBLKSIZE
:
2265 case SNDCTL_DSP_CHANNELS
:
2266 case SOUND_PCM_WRITE_FILTER
:
2267 case SNDCTL_DSP_POST
:
2268 case SNDCTL_DSP_SUBDIVIDE
:
2269 case SNDCTL_DSP_SETFRAGMENT
:
2270 case SNDCTL_DSP_GETFMTS
:
2271 case SNDCTL_DSP_SETFMT
:
2272 case SNDCTL_DSP_GETOSPACE
:
2273 case SNDCTL_DSP_GETISPACE
:
2274 case SNDCTL_DSP_NONBLOCK
:
2275 case SNDCTL_DSP_GETCAPS
:
2276 case SNDCTL_DSP_GETTRIGGER
:
2277 case SNDCTL_DSP_SETTRIGGER
:
2278 case SNDCTL_DSP_GETIPTR
:
2279 case SNDCTL_DSP_GETOPTR
:
2280 /* case SNDCTL_DSP_MAPINBUF: XXX needs translation */
2281 /* case SNDCTL_DSP_MAPOUTBUF: XXX needs translation */
2282 case SNDCTL_DSP_SETSYNCRO
:
2283 case SNDCTL_DSP_SETDUPLEX
:
2284 case SNDCTL_DSP_GETODELAY
:
2285 case SNDCTL_DSP_PROFILE
:
2287 case SOUND_PCM_READ_RATE
:
2288 case SOUND_PCM_READ_CHANNELS
:
2289 case SOUND_PCM_READ_BITS
:
2290 case SOUND_PCM_READ_FILTER
:
2292 /* Big C for sound/OSS */
2293 case SNDCTL_COPR_RESET
:
2294 case SNDCTL_COPR_LOAD
:
2295 case SNDCTL_COPR_RDATA
:
2296 case SNDCTL_COPR_RCODE
:
2297 case SNDCTL_COPR_WDATA
:
2298 case SNDCTL_COPR_WCODE
:
2299 case SNDCTL_COPR_RUN
:
2300 case SNDCTL_COPR_HALT
:
2301 case SNDCTL_COPR_SENDMSG
:
2302 case SNDCTL_COPR_RCVMSG
:
2304 /* Big M for sound/OSS */
2305 case SOUND_MIXER_READ_VOLUME
:
2306 case SOUND_MIXER_READ_BASS
:
2307 case SOUND_MIXER_READ_TREBLE
:
2308 case SOUND_MIXER_READ_SYNTH
:
2309 case SOUND_MIXER_READ_PCM
:
2310 case SOUND_MIXER_READ_SPEAKER
:
2311 case SOUND_MIXER_READ_LINE
:
2312 case SOUND_MIXER_READ_MIC
:
2313 case SOUND_MIXER_READ_CD
:
2314 case SOUND_MIXER_READ_IMIX
:
2315 case SOUND_MIXER_READ_ALTPCM
:
2316 case SOUND_MIXER_READ_RECLEV
:
2317 case SOUND_MIXER_READ_IGAIN
:
2318 case SOUND_MIXER_READ_OGAIN
:
2319 case SOUND_MIXER_READ_LINE1
:
2320 case SOUND_MIXER_READ_LINE2
:
2321 case SOUND_MIXER_READ_LINE3
:
2322 case SOUND_MIXER_READ_MUTE
:
2323 /* case SOUND_MIXER_READ_ENHANCE: same value as READ_MUTE */
2324 /* case SOUND_MIXER_READ_LOUD: same value as READ_MUTE */
2325 case SOUND_MIXER_READ_RECSRC
:
2326 case SOUND_MIXER_READ_DEVMASK
:
2327 case SOUND_MIXER_READ_RECMASK
:
2328 case SOUND_MIXER_READ_STEREODEVS
:
2329 case SOUND_MIXER_READ_CAPS
:
2331 case SOUND_MIXER_WRITE_VOLUME
:
2332 case SOUND_MIXER_WRITE_BASS
:
2333 case SOUND_MIXER_WRITE_TREBLE
:
2334 case SOUND_MIXER_WRITE_SYNTH
:
2335 case SOUND_MIXER_WRITE_PCM
:
2336 case SOUND_MIXER_WRITE_SPEAKER
:
2337 case SOUND_MIXER_WRITE_LINE
:
2338 case SOUND_MIXER_WRITE_MIC
:
2339 case SOUND_MIXER_WRITE_CD
:
2340 case SOUND_MIXER_WRITE_IMIX
:
2341 case SOUND_MIXER_WRITE_ALTPCM
:
2342 case SOUND_MIXER_WRITE_RECLEV
:
2343 case SOUND_MIXER_WRITE_IGAIN
:
2344 case SOUND_MIXER_WRITE_OGAIN
:
2345 case SOUND_MIXER_WRITE_LINE1
:
2346 case SOUND_MIXER_WRITE_LINE2
:
2347 case SOUND_MIXER_WRITE_LINE3
:
2348 case SOUND_MIXER_WRITE_MUTE
:
2349 /* case SOUND_MIXER_WRITE_ENHANCE: same value as WRITE_MUTE */
2350 /* case SOUND_MIXER_WRITE_LOUD: same value as WRITE_MUTE */
2351 case SOUND_MIXER_WRITE_RECSRC
:
2353 case SOUND_MIXER_INFO
:
2354 case SOUND_OLD_MIXER_INFO
:
2355 case SOUND_MIXER_ACCESS
:
2356 case SOUND_MIXER_PRIVATE1
:
2357 case SOUND_MIXER_PRIVATE2
:
2358 case SOUND_MIXER_PRIVATE3
:
2359 case SOUND_MIXER_PRIVATE4
:
2360 case SOUND_MIXER_PRIVATE5
:
2361 case SOUND_MIXER_GETLEVELS
:
2362 case SOUND_MIXER_SETLEVELS
:
2364 case OSS_GETVERSION
:
2367 case AUTOFS_IOC_READY
:
2368 case AUTOFS_IOC_FAIL
:
2369 case AUTOFS_IOC_CATATONIC
:
2370 case AUTOFS_IOC_PROTOVER
:
2371 case AUTOFS_IOC_EXPIRE
:
2377 error
= sys_ioctl (fd
, cmd
, arg
);
2382 static int count
= 0;
2384 printk("sys32_ioctl: Unknown cmd fd(%d) "
2385 "cmd(%08x) arg(%08x)\n",
2386 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);