1 /* $Id: ioctl32.c,v 1.87 2000/03/30 02:09:07 davem Exp $
2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
4 * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com)
5 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
7 * These routines maintain argument size conversion between 32bit and 64bit
11 #include <linux/config.h>
12 #include <linux/types.h>
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
15 #include <linux/smp.h>
16 #include <linux/smp_lock.h>
17 #include <linux/ioctl.h>
19 #include <linux/malloc.h>
20 #include <linux/hdreg.h>
21 #if 0 /* New RAID code is half-merged... -DaveM */
25 #include <linux/route.h>
26 #include <linux/skbuff.h>
27 #include <linux/netlink.h>
30 #include <linux/file.h>
32 #include <linux/ppp_defs.h>
33 #include <linux/if_ppp.h>
34 #include <linux/mtio.h>
35 #include <linux/cdrom.h>
36 #include <linux/loop.h>
37 #include <linux/auto_fs.h>
38 #include <linux/devfs_fs.h>
39 #include <linux/tty.h>
40 #include <linux/vt_kern.h>
42 #include <linux/ext2_fs.h>
43 #include <linux/videodev.h>
44 #include <linux/netdevice.h>
45 #include <linux/raw.h>
46 #include <linux/smb_fs.h>
47 #include <linux/blkpg.h>
48 #include <linux/blk.h>
49 #include <linux/elevator.h>
50 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
51 /* Ugh. This header really is not clean */
54 #include <linux/lvm.h>
57 #include <scsi/scsi.h>
60 #include <scsi/scsi_ioctl.h>
64 #include <asm/types.h>
65 #include <asm/uaccess.h>
68 #include <asm/vuid_event.h>
70 #include <asm/openpromio.h>
71 #include <asm/envctrl.h>
72 #include <asm/audioio.h>
73 #include <asm/ethtool.h>
75 #include <linux/soundcard.h>
77 #include <linux/atm.h>
78 #include <linux/atmarp.h>
79 #include <linux/atmclip.h>
80 #include <linux/atmdev.h>
81 #include <linux/atmioc.h>
82 #include <linux/atmlec.h>
83 #include <linux/atmmpc.h>
84 #include <linux/atmsvc.h>
85 #include <linux/atm_tcp.h>
86 #include <linux/sonet.h>
87 #include <linux/atm_suni.h>
89 /* Use this to get at 32-bit user passed pointers.
90 See sys_sparc32.c for description about these. */
91 #define A(__x) ((unsigned long)(__x))
93 ({ unsigned long __ret; \
94 __asm__ ("srl %0, 0, %0" \
100 /* Aiee. Someone does not find a difference between int and long */
101 #define EXT2_IOC32_GETFLAGS _IOR('f', 1, int)
102 #define EXT2_IOC32_SETFLAGS _IOW('f', 2, int)
103 #define EXT2_IOC32_GETVERSION _IOR('v', 1, int)
104 #define EXT2_IOC32_SETVERSION _IOW('v', 2, int)
106 extern asmlinkage
int sys_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
);
108 static int w_long(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
110 mm_segment_t old_fs
= get_fs();
115 err
= sys_ioctl(fd
, cmd
, (unsigned long)&val
);
117 if (!err
&& put_user(val
, (u32
*)arg
))
122 static int rw_long(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
124 mm_segment_t old_fs
= get_fs();
128 if(get_user(val
, (u32
*)arg
))
131 err
= sys_ioctl(fd
, cmd
, (unsigned long)&val
);
133 if (!err
&& put_user(val
, (u32
*)arg
))
138 static int do_ext2_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
140 /* These are just misnamed, they actually get/put from/to user an int */
142 case EXT2_IOC32_GETFLAGS
: cmd
= EXT2_IOC_GETFLAGS
; break;
143 case EXT2_IOC32_SETFLAGS
: cmd
= EXT2_IOC_SETFLAGS
; break;
144 case EXT2_IOC32_GETVERSION
: cmd
= EXT2_IOC_GETVERSION
; break;
145 case EXT2_IOC32_SETVERSION
: cmd
= EXT2_IOC_SETVERSION
; break;
147 return sys_ioctl(fd
, cmd
, arg
);
150 struct video_tuner32
{
153 u32 rangelow
, rangehigh
;
158 static int get_video_tuner32(struct video_tuner
*kp
, struct video_tuner32
*up
)
162 if(get_user(kp
->tuner
, &up
->tuner
))
164 for(i
= 0; i
< 32; i
++)
165 __get_user(kp
->name
[i
], &up
->name
[i
]);
166 __get_user(kp
->rangelow
, &up
->rangelow
);
167 __get_user(kp
->rangehigh
, &up
->rangehigh
);
168 __get_user(kp
->flags
, &up
->flags
);
169 __get_user(kp
->mode
, &up
->mode
);
170 __get_user(kp
->signal
, &up
->signal
);
174 static int put_video_tuner32(struct video_tuner
*kp
, struct video_tuner32
*up
)
178 if(put_user(kp
->tuner
, &up
->tuner
))
180 for(i
= 0; i
< 32; i
++)
181 __put_user(kp
->name
[i
], &up
->name
[i
]);
182 __put_user(kp
->rangelow
, &up
->rangelow
);
183 __put_user(kp
->rangehigh
, &up
->rangehigh
);
184 __put_user(kp
->flags
, &up
->flags
);
185 __put_user(kp
->mode
, &up
->mode
);
186 __put_user(kp
->signal
, &up
->signal
);
190 struct video_buffer32
{
191 /* void * */ u32 base
;
192 s32 height
, width
, depth
, bytesperline
;
195 static int get_video_buffer32(struct video_buffer
*kp
, struct video_buffer32
*up
)
199 if(get_user(tmp
, &up
->base
))
201 kp
->base
= (void *) ((unsigned long)tmp
);
202 __get_user(kp
->height
, &up
->height
);
203 __get_user(kp
->width
, &up
->width
);
204 __get_user(kp
->depth
, &up
->depth
);
205 __get_user(kp
->bytesperline
, &up
->bytesperline
);
209 static int put_video_buffer32(struct video_buffer
*kp
, struct video_buffer32
*up
)
211 u32 tmp
= (u32
)((unsigned long)kp
->base
);
213 if(put_user(tmp
, &up
->base
))
215 __put_user(kp
->height
, &up
->height
);
216 __put_user(kp
->width
, &up
->width
);
217 __put_user(kp
->depth
, &up
->depth
);
218 __put_user(kp
->bytesperline
, &up
->bytesperline
);
222 struct video_clip32
{
223 s32 x
, y
, width
, height
;
224 /* struct video_clip32 * */ u32 next
;
227 struct video_window32
{
228 u32 x
, y
, width
, height
, chromakey
, flags
;
229 /* struct video_clip32 * */ u32 clips
;
233 static void free_kvideo_clips(struct video_window
*kp
)
235 struct video_clip
*cp
;
242 static int get_video_window32(struct video_window
*kp
, struct video_window32
*up
)
244 struct video_clip32
*ucp
;
245 struct video_clip
*kcp
;
249 if(get_user(kp
->x
, &up
->x
))
251 __get_user(kp
->y
, &up
->y
);
252 __get_user(kp
->width
, &up
->width
);
253 __get_user(kp
->height
, &up
->height
);
254 __get_user(kp
->chromakey
, &up
->chromakey
);
255 __get_user(kp
->flags
, &up
->flags
);
256 __get_user(kp
->clipcount
, &up
->clipcount
);
257 __get_user(tmp
, &up
->clips
);
258 ucp
= (struct video_clip32
*)A(tmp
);
261 nclips
= kp
->clipcount
;
268 /* Peculiar interface... */
270 nclips
= VIDEO_CLIPMAP_SIZE
;
272 kcp
= kmalloc(nclips
* sizeof(struct video_clip
), GFP_KERNEL
);
275 goto cleanup_and_err
;
278 for(i
= 0; i
< nclips
; i
++) {
279 __get_user(kcp
[i
].x
, &ucp
[i
].x
);
280 __get_user(kcp
[i
].y
, &ucp
[i
].y
);
281 __get_user(kcp
[i
].width
, &ucp
[i
].width
);
282 __get_user(kcp
[i
].height
, &ucp
[i
].height
);
283 kcp
[nclips
].next
= NULL
;
289 free_kvideo_clips(kp
);
293 /* You get back everything except the clips... */
294 static int put_video_window32(struct video_window
*kp
, struct video_window32
*up
)
296 if(put_user(kp
->x
, &up
->x
))
298 __put_user(kp
->y
, &up
->y
);
299 __put_user(kp
->width
, &up
->width
);
300 __put_user(kp
->height
, &up
->height
);
301 __put_user(kp
->chromakey
, &up
->chromakey
);
302 __put_user(kp
->flags
, &up
->flags
);
303 __put_user(kp
->clipcount
, &up
->clipcount
);
307 #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32)
308 #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32)
309 #define VIDIOCGWIN32 _IOR('v',9, struct video_window32)
310 #define VIDIOCSWIN32 _IOW('v',10, struct video_window32)
311 #define VIDIOCGFBUF32 _IOR('v',11, struct video_buffer32)
312 #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32)
313 #define VIDIOCGFREQ32 _IOR('v',14, u32)
314 #define VIDIOCSFREQ32 _IOW('v',15, u32)
316 static int do_video_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
319 struct video_tuner vt
;
320 struct video_buffer vb
;
321 struct video_window vw
;
324 mm_segment_t old_fs
= get_fs();
325 void *up
= (void *)arg
;
328 /* First, convert the command. */
330 case VIDIOCGTUNER32
: cmd
= VIDIOCGTUNER
; break;
331 case VIDIOCSTUNER32
: cmd
= VIDIOCSTUNER
; break;
332 case VIDIOCGWIN32
: cmd
= VIDIOCGWIN
; break;
333 case VIDIOCSWIN32
: cmd
= VIDIOCSWIN
; break;
334 case VIDIOCGFBUF32
: cmd
= VIDIOCGFBUF
; break;
335 case VIDIOCSFBUF32
: cmd
= VIDIOCSFBUF
; break;
336 case VIDIOCGFREQ32
: cmd
= VIDIOCGFREQ
; break;
337 case VIDIOCSFREQ32
: cmd
= VIDIOCSFREQ
; break;
343 err
= get_video_tuner32(&karg
.vt
, up
);
347 err
= get_video_window32(&karg
.vw
, up
);
351 err
= get_video_buffer32(&karg
.vb
, up
);
355 err
= get_user(karg
.vx
, (u32
*)up
);
362 err
= sys_ioctl(fd
, cmd
, (unsigned long)&karg
);
365 if(cmd
== VIDIOCSWIN
)
366 free_kvideo_clips(&karg
.vw
);
371 err
= put_video_tuner32(&karg
.vt
, up
);
375 err
= put_video_window32(&karg
.vw
, up
);
379 err
= put_video_buffer32(&karg
.vb
, up
);
383 err
= put_user(((u32
)karg
.vx
), (u32
*)up
);
396 static int do_siocgstamp(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
398 struct timeval32
*up
= (struct timeval32
*)arg
;
400 mm_segment_t old_fs
= get_fs();
404 err
= sys_ioctl(fd
, cmd
, (unsigned long)&ktv
);
407 err
= put_user(ktv
.tv_sec
, &up
->tv_sec
);
408 err
|= __put_user(ktv
.tv_usec
, &up
->tv_usec
);
416 unsigned short base_addr
;
423 #define IFHWADDRLEN 6
426 char ifrn_name
[IFNAMSIZ
]; /* if name, e.g. "en0" */
429 struct sockaddr ifru_addr
;
430 struct sockaddr ifru_dstaddr
;
431 struct sockaddr ifru_broadaddr
;
432 struct sockaddr ifru_netmask
;
433 struct sockaddr ifru_hwaddr
;
437 struct ifmap32 ifru_map
;
438 char ifru_slave
[IFNAMSIZ
]; /* Just fits the size */
439 char ifru_newname
[IFNAMSIZ
];
440 __kernel_caddr_t32 ifru_data
;
445 int ifc_len
; /* size of buffer */
446 __kernel_caddr_t32 ifcbuf
;
449 static int dev_ifname32(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
451 struct net_device
*dev
;
452 struct ifreq32 ifr32
;
455 if (copy_from_user(&ifr32
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
458 dev
= dev_get_by_index(ifr32
.ifr_ifindex
);
462 strcpy(ifr32
.ifr_name
, dev
->name
);
464 err
= copy_to_user((struct ifreq32
*)arg
, &ifr32
, sizeof(struct ifreq32
));
465 return (err
? -EFAULT
: 0);
468 static inline int dev_ifconf(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
470 struct ifconf32 ifc32
;
472 struct ifreq32
*ifr32
;
478 if (copy_from_user(&ifc32
, (struct ifconf32
*)arg
, sizeof(struct ifconf32
)))
481 if(ifc32
.ifcbuf
== 0) {
486 ifc
.ifc_len
= ((ifc32
.ifc_len
/ sizeof (struct ifreq32
)) + 1) *
487 sizeof (struct ifreq
);
488 ifc
.ifc_buf
= kmalloc (ifc
.ifc_len
, GFP_KERNEL
);
493 ifr32
= (struct ifreq32
*)A(ifc32
.ifcbuf
);
494 for (i
= 0; i
< ifc32
.ifc_len
; i
+= sizeof (struct ifreq32
)) {
495 if (copy_from_user(ifr
++, ifr32
++, sizeof (struct ifreq32
))) {
500 old_fs
= get_fs(); set_fs (KERNEL_DS
);
501 err
= sys_ioctl (fd
, SIOCGIFCONF
, (unsigned long)&ifc
);
505 ifr32
= (struct ifreq32
*)A(ifc32
.ifcbuf
);
506 for (i
= 0, j
= 0; i
< ifc32
.ifc_len
&& j
< ifc
.ifc_len
;
507 i
+= sizeof (struct ifreq32
), j
+= sizeof (struct ifreq
)) {
508 if (copy_to_user(ifr32
++, ifr
++, sizeof (struct ifreq32
))) {
514 if (i
<= ifc32
.ifc_len
)
517 ifc32
.ifc_len
= i
- sizeof (struct ifreq32
);
518 if (copy_to_user((struct ifconf32
*)arg
, &ifc32
, sizeof(struct ifconf32
)))
522 if(ifc
.ifc_buf
!= NULL
)
527 static inline int dev_ifsioc(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
535 err
= copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(ifr
.ifr_name
));
536 err
|= __get_user(ifr
.ifr_map
.mem_start
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_start
));
537 err
|= __get_user(ifr
.ifr_map
.mem_end
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_end
));
538 err
|= __get_user(ifr
.ifr_map
.base_addr
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.base_addr
));
539 err
|= __get_user(ifr
.ifr_map
.irq
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.irq
));
540 err
|= __get_user(ifr
.ifr_map
.dma
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.dma
));
541 err
|= __get_user(ifr
.ifr_map
.port
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.port
));
549 if (copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
551 ifr
.ifr_data
= (__kernel_caddr_t
)get_free_page(GFP_KERNEL
);
554 if(cmd
== SIOCETHTOOL
) {
557 __get_user(data
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_data
));
558 if(copy_from_user(ifr
.ifr_data
,
560 sizeof(struct ethtool_cmd
))) {
561 free_page((unsigned long)ifr
.ifr_data
);
567 if (copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
573 err
= sys_ioctl (fd
, cmd
, (unsigned long)&ifr
);
588 if (copy_to_user((struct ifreq32
*)arg
, &ifr
, sizeof(struct ifreq32
)))
599 __get_user(data
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_data
));
600 if(cmd
== SIOCETHTOOL
)
601 len
= sizeof(struct ethtool_cmd
);
602 if(cmd
== SIOCGPPPVER
)
603 len
= strlen((char *)ifr
.ifr_data
) + 1;
604 else if(cmd
== SIOCGPPPCSTATS
)
605 len
= sizeof(struct ppp_comp_stats
);
607 len
= sizeof(struct ppp_stats
);
609 len
= copy_to_user((char *)A(data
), ifr
.ifr_data
, len
);
610 free_page((unsigned long)ifr
.ifr_data
);
616 err
= copy_to_user((struct ifreq32
*)arg
, &ifr
, sizeof(ifr
.ifr_name
));
617 err
|= __put_user(ifr
.ifr_map
.mem_start
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_start
));
618 err
|= __put_user(ifr
.ifr_map
.mem_end
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_end
));
619 err
|= __put_user(ifr
.ifr_map
.base_addr
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.base_addr
));
620 err
|= __put_user(ifr
.ifr_map
.irq
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.irq
));
621 err
|= __put_user(ifr
.ifr_map
.dma
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.dma
));
622 err
|= __put_user(ifr
.ifr_map
.port
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.port
));
633 struct sockaddr rt_dst
; /* target address */
634 struct sockaddr rt_gateway
; /* gateway addr (RTF_GATEWAY) */
635 struct sockaddr rt_genmask
; /* target network mask (IP) */
636 unsigned short rt_flags
;
639 unsigned char rt_tos
;
640 unsigned char rt_class
;
642 short rt_metric
; /* +1 for binary compatibility! */
643 /* char * */ u32 rt_dev
; /* forcing the device at add */
644 u32 rt_mtu
; /* per route MTU/Window */
645 u32 rt_window
; /* Window clamping */
646 unsigned short rt_irtt
; /* Initial RTT */
650 static inline int routing_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
656 mm_segment_t old_fs
= get_fs();
658 ret
= copy_from_user (&r
.rt_dst
, &(((struct rtentry32
*)arg
)->rt_dst
), 3 * sizeof(struct sockaddr
));
659 ret
|= __get_user (r
.rt_flags
, &(((struct rtentry32
*)arg
)->rt_flags
));
660 ret
|= __get_user (r
.rt_metric
, &(((struct rtentry32
*)arg
)->rt_metric
));
661 ret
|= __get_user (r
.rt_mtu
, &(((struct rtentry32
*)arg
)->rt_mtu
));
662 ret
|= __get_user (r
.rt_window
, &(((struct rtentry32
*)arg
)->rt_window
));
663 ret
|= __get_user (r
.rt_irtt
, &(((struct rtentry32
*)arg
)->rt_irtt
));
664 ret
|= __get_user (rtdev
, &(((struct rtentry32
*)arg
)->rt_dev
));
666 ret
|= copy_from_user (devname
, (char *)A(rtdev
), 15);
667 r
.rt_dev
= devname
; devname
[15] = 0;
673 ret
= sys_ioctl (fd
, cmd
, (long)&r
);
678 struct hd_geometry32
{
680 unsigned char sectors
;
681 unsigned short cylinders
;
685 static inline int hdio_getgeo(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
687 mm_segment_t old_fs
= get_fs();
688 struct hd_geometry geo
;
692 err
= sys_ioctl(fd
, HDIO_GETGEO
, (unsigned long)&geo
);
695 err
= copy_to_user ((struct hd_geometry32
*)arg
, &geo
, 4);
696 err
|= __put_user (geo
.start
, &(((struct hd_geometry32
*)arg
)->start
));
698 return err
? -EFAULT
: 0;
702 int index
; /* first element (0 origin) */
709 #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32)
710 #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32)
712 static inline int fbiogetputcmap(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
716 char red
[256], green
[256], blue
[256];
718 mm_segment_t old_fs
= get_fs();
720 ret
= get_user(f
.index
, &(((struct fbcmap32
*)arg
)->index
));
721 ret
|= __get_user(f
.count
, &(((struct fbcmap32
*)arg
)->count
));
722 ret
|= __get_user(r
, &(((struct fbcmap32
*)arg
)->red
));
723 ret
|= __get_user(g
, &(((struct fbcmap32
*)arg
)->green
));
724 ret
|= __get_user(b
, &(((struct fbcmap32
*)arg
)->blue
));
727 if ((f
.index
< 0) || (f
.index
> 255)) return -EINVAL
;
728 if (f
.index
+ f
.count
> 256)
729 f
.count
= 256 - f
.index
;
730 if (cmd
== FBIOPUTCMAP32
) {
731 ret
= copy_from_user (red
, (char *)A(r
), f
.count
);
732 ret
|= copy_from_user (green
, (char *)A(g
), f
.count
);
733 ret
|= copy_from_user (blue
, (char *)A(b
), f
.count
);
737 f
.red
= red
; f
.green
= green
; f
.blue
= blue
;
739 ret
= sys_ioctl (fd
, (cmd
== FBIOPUTCMAP32
) ? FBIOPUTCMAP_SPARC
: FBIOGETCMAP_SPARC
, (long)&f
);
741 if (!ret
&& cmd
== FBIOGETCMAP32
) {
742 ret
= copy_to_user ((char *)A(r
), red
, f
.count
);
743 ret
|= copy_to_user ((char *)A(g
), green
, f
.count
);
744 ret
|= copy_to_user ((char *)A(b
), blue
, f
.count
);
746 return ret
? -EFAULT
: 0;
750 short set
; /* what to set, choose from the list above */
751 short enable
; /* cursor on/off */
752 struct fbcurpos pos
; /* cursor position */
753 struct fbcurpos hot
; /* cursor hot spot */
754 struct fbcmap32 cmap
; /* color map info */
755 struct fbcurpos size
; /* cursor bit map size */
756 u32 image
; /* cursor image bits */
757 u32 mask
; /* cursor mask bits */
760 #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32)
761 #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32)
763 static inline int fbiogscursor(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
767 char red
[2], green
[2], blue
[2];
768 char image
[128], mask
[128];
771 mm_segment_t old_fs
= get_fs();
773 ret
= copy_from_user (&f
, (struct fbcursor32
*)arg
, 2 * sizeof (short) + 2 * sizeof(struct fbcurpos
));
774 ret
|= __get_user(f
.size
.fbx
, &(((struct fbcursor32
*)arg
)->size
.fbx
));
775 ret
|= __get_user(f
.size
.fby
, &(((struct fbcursor32
*)arg
)->size
.fby
));
776 ret
|= __get_user(f
.cmap
.index
, &(((struct fbcursor32
*)arg
)->cmap
.index
));
777 ret
|= __get_user(f
.cmap
.count
, &(((struct fbcursor32
*)arg
)->cmap
.count
));
778 ret
|= __get_user(r
, &(((struct fbcursor32
*)arg
)->cmap
.red
));
779 ret
|= __get_user(g
, &(((struct fbcursor32
*)arg
)->cmap
.green
));
780 ret
|= __get_user(b
, &(((struct fbcursor32
*)arg
)->cmap
.blue
));
781 ret
|= __get_user(m
, &(((struct fbcursor32
*)arg
)->mask
));
782 ret
|= __get_user(i
, &(((struct fbcursor32
*)arg
)->image
));
785 if (f
.set
& FB_CUR_SETCMAP
) {
786 if ((uint
) f
.size
.fby
> 32)
788 ret
= copy_from_user (mask
, (char *)A(m
), f
.size
.fby
* 4);
789 ret
|= copy_from_user (image
, (char *)A(i
), f
.size
.fby
* 4);
792 f
.image
= image
; f
.mask
= mask
;
794 if (f
.set
& FB_CUR_SETCMAP
) {
795 ret
= copy_from_user (red
, (char *)A(r
), 2);
796 ret
|= copy_from_user (green
, (char *)A(g
), 2);
797 ret
|= copy_from_user (blue
, (char *)A(b
), 2);
800 f
.cmap
.red
= red
; f
.cmap
.green
= green
; f
.cmap
.blue
= blue
;
803 ret
= sys_ioctl (fd
, FBIOSCURSOR
, (long)&f
);
808 struct fb_fix_screeninfo32
{
810 __kernel_caddr_t32 smem_start
;
819 __kernel_caddr_t32 mmio_start
;
828 __kernel_caddr_t32 red
;
829 __kernel_caddr_t32 green
;
830 __kernel_caddr_t32 blue
;
831 __kernel_caddr_t32 transp
;
834 static int fb_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
836 mm_segment_t old_fs
= get_fs();
837 u32 red
= 0, green
= 0, blue
= 0, transp
= 0;
838 struct fb_fix_screeninfo fix
;
843 memset(&cmap
, 0, sizeof(cmap
));
845 case FBIOGET_FSCREENINFO
:
851 err
= __get_user(cmap
.start
, &((struct fb_cmap32
*)arg
)->start
);
852 err
|= __get_user(cmap
.len
, &((struct fb_cmap32
*)arg
)->len
);
853 err
|= __get_user(red
, &((struct fb_cmap32
*)arg
)->red
);
854 err
|= __get_user(green
, &((struct fb_cmap32
*)arg
)->green
);
855 err
|= __get_user(blue
, &((struct fb_cmap32
*)arg
)->blue
);
856 err
|= __get_user(transp
, &((struct fb_cmap32
*)arg
)->transp
);
862 cmap
.red
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
865 cmap
.green
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
868 cmap
.blue
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
872 cmap
.transp
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
877 if (cmd
== FBIOGETCMAP
)
880 err
= __copy_from_user(cmap
.red
, (char *)A(red
), cmap
.len
* sizeof(__u16
));
881 err
|= __copy_from_user(cmap
.green
, (char *)A(green
), cmap
.len
* sizeof(__u16
));
882 err
|= __copy_from_user(cmap
.blue
, (char *)A(blue
), cmap
.len
* sizeof(__u16
));
883 if (cmap
.transp
) err
|= __copy_from_user(cmap
.transp
, (char *)A(transp
), cmap
.len
* sizeof(__u16
));
891 static int count
= 0;
893 printk("%s: Unknown fb ioctl cmd fd(%d) "
894 "cmd(%08x) arg(%08lx)\n",
895 __FUNCTION__
, fd
, cmd
, arg
);
900 err
= sys_ioctl(fd
, cmd
, (unsigned long)karg
);
905 case FBIOGET_FSCREENINFO
:
906 err
= __copy_to_user((char *)((struct fb_fix_screeninfo32
*)arg
)->id
, (char *)fix
.id
, sizeof(fix
.id
));
907 err
|= __put_user((__u32
)(unsigned long)fix
.smem_start
, &((struct fb_fix_screeninfo32
*)arg
)->smem_start
);
908 err
|= __put_user(fix
.smem_len
, &((struct fb_fix_screeninfo32
*)arg
)->smem_len
);
909 err
|= __put_user(fix
.type
, &((struct fb_fix_screeninfo32
*)arg
)->type
);
910 err
|= __put_user(fix
.type_aux
, &((struct fb_fix_screeninfo32
*)arg
)->type_aux
);
911 err
|= __put_user(fix
.visual
, &((struct fb_fix_screeninfo32
*)arg
)->visual
);
912 err
|= __put_user(fix
.xpanstep
, &((struct fb_fix_screeninfo32
*)arg
)->xpanstep
);
913 err
|= __put_user(fix
.ypanstep
, &((struct fb_fix_screeninfo32
*)arg
)->ypanstep
);
914 err
|= __put_user(fix
.ywrapstep
, &((struct fb_fix_screeninfo32
*)arg
)->ywrapstep
);
915 err
|= __put_user(fix
.line_length
, &((struct fb_fix_screeninfo32
*)arg
)->line_length
);
916 err
|= __put_user((__u32
)(unsigned long)fix
.mmio_start
, &((struct fb_fix_screeninfo32
*)arg
)->mmio_start
);
917 err
|= __put_user(fix
.mmio_len
, &((struct fb_fix_screeninfo32
*)arg
)->mmio_len
);
918 err
|= __put_user(fix
.accel
, &((struct fb_fix_screeninfo32
*)arg
)->accel
);
919 err
|= __copy_to_user((char *)((struct fb_fix_screeninfo32
*)arg
)->reserved
, (char *)fix
.reserved
, sizeof(fix
.reserved
));
922 err
= __copy_to_user((char *)A(red
), cmap
.red
, cmap
.len
* sizeof(__u16
));
923 err
|= __copy_to_user((char *)A(green
), cmap
.blue
, cmap
.len
* sizeof(__u16
));
924 err
|= __copy_to_user((char *)A(blue
), cmap
.blue
, cmap
.len
* sizeof(__u16
));
926 err
|= __copy_to_user((char *)A(transp
), cmap
.transp
, cmap
.len
* sizeof(__u16
));
934 out
: if (cmap
.red
) kfree(cmap
.red
);
935 if (cmap
.green
) kfree(cmap
.green
);
936 if (cmap
.blue
) kfree(cmap
.blue
);
937 if (cmap
.transp
) kfree(cmap
.transp
);
941 static int hdio_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
943 mm_segment_t old_fs
= get_fs();
949 error
= sys_ioctl(fd
, cmd
, (long)&kval
);
953 uvp
= (unsigned int *)arg
;
954 if(put_user(kval
, uvp
))
960 struct floppy_struct32
{
965 unsigned int stretch
;
969 unsigned char fmt_gap
;
970 const __kernel_caddr_t32 name
;
973 struct floppy_drive_params32
{
981 unsigned char spindown_offset
;
982 unsigned char select_delay
;
984 unsigned char tracks
;
986 unsigned char interleave_sect
;
987 struct floppy_max_errors max_errors
;
995 struct floppy_drive_struct32
{
1000 short probed_format
;
1009 __kernel_caddr_t32 dmabuf
;
1013 struct floppy_fdc_state32
{
1017 unsigned char version
;
1020 unsigned int rawcmd
:2;
1021 unsigned int reset
:1;
1022 unsigned int need_configure
:1;
1023 unsigned int perp_mode
:2;
1024 unsigned int has_fifo
:1;
1025 unsigned int driver_version
;
1026 unsigned char track
[4];
1029 struct floppy_write_errors32
{
1030 unsigned int write_errors
;
1031 u32 first_error_sector
;
1032 int first_error_generation
;
1033 u32 last_error_sector
;
1034 int last_error_generation
;
1035 unsigned int badness
;
1038 #define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32)
1039 #define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32)
1040 #define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32)
1041 #define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32)
1042 #define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32)
1043 #define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32)
1044 #define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32)
1045 #define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32)
1046 #define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32)
1051 } fd_ioctl_trans_table
[] = {
1052 { FDSETPRM32
, FDSETPRM
},
1053 { FDDEFPRM32
, FDDEFPRM
},
1054 { FDGETPRM32
, FDGETPRM
},
1055 { FDSETDRVPRM32
, FDSETDRVPRM
},
1056 { FDGETDRVPRM32
, FDGETDRVPRM
},
1057 { FDGETDRVSTAT32
, FDGETDRVSTAT
},
1058 { FDPOLLDRVSTAT32
, FDPOLLDRVSTAT
},
1059 { FDGETFDCSTAT32
, FDGETFDCSTAT
},
1060 { FDWERRORGET32
, FDWERRORGET
}
1063 #define NR_FD_IOCTL_TRANS (sizeof(fd_ioctl_trans_table)/sizeof(fd_ioctl_trans_table[0]))
1065 static int fd_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1067 mm_segment_t old_fs
= get_fs();
1069 unsigned int kcmd
= 0;
1072 for (i
= 0; i
< NR_FD_IOCTL_TRANS
; i
++)
1073 if (cmd
== fd_ioctl_trans_table
[i
].cmd32
) {
1074 kcmd
= fd_ioctl_trans_table
[i
].cmd
;
1085 struct floppy_struct
*f
;
1087 f
= karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_struct
));
1090 if (cmd
== FDGETPRM32
)
1092 err
= __get_user(f
->size
, &((struct floppy_struct32
*)arg
)->size
);
1093 err
|= __get_user(f
->sect
, &((struct floppy_struct32
*)arg
)->sect
);
1094 err
|= __get_user(f
->head
, &((struct floppy_struct32
*)arg
)->head
);
1095 err
|= __get_user(f
->track
, &((struct floppy_struct32
*)arg
)->track
);
1096 err
|= __get_user(f
->stretch
, &((struct floppy_struct32
*)arg
)->stretch
);
1097 err
|= __get_user(f
->gap
, &((struct floppy_struct32
*)arg
)->gap
);
1098 err
|= __get_user(f
->rate
, &((struct floppy_struct32
*)arg
)->rate
);
1099 err
|= __get_user(f
->spec1
, &((struct floppy_struct32
*)arg
)->spec1
);
1100 err
|= __get_user(f
->fmt_gap
, &((struct floppy_struct32
*)arg
)->fmt_gap
);
1101 err
|= __get_user((u64
)f
->name
, &((struct floppy_struct32
*)arg
)->name
);
1111 struct floppy_drive_params
*f
;
1113 f
= karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_drive_params
));
1116 if (cmd
== FDGETDRVPRM32
)
1118 err
= __get_user(f
->cmos
, &((struct floppy_drive_params32
*)arg
)->cmos
);
1119 err
|= __get_user(f
->max_dtr
, &((struct floppy_drive_params32
*)arg
)->max_dtr
);
1120 err
|= __get_user(f
->hlt
, &((struct floppy_drive_params32
*)arg
)->hlt
);
1121 err
|= __get_user(f
->hut
, &((struct floppy_drive_params32
*)arg
)->hut
);
1122 err
|= __get_user(f
->srt
, &((struct floppy_drive_params32
*)arg
)->srt
);
1123 err
|= __get_user(f
->spinup
, &((struct floppy_drive_params32
*)arg
)->spinup
);
1124 err
|= __get_user(f
->spindown
, &((struct floppy_drive_params32
*)arg
)->spindown
);
1125 err
|= __get_user(f
->spindown_offset
, &((struct floppy_drive_params32
*)arg
)->spindown_offset
);
1126 err
|= __get_user(f
->select_delay
, &((struct floppy_drive_params32
*)arg
)->select_delay
);
1127 err
|= __get_user(f
->rps
, &((struct floppy_drive_params32
*)arg
)->rps
);
1128 err
|= __get_user(f
->tracks
, &((struct floppy_drive_params32
*)arg
)->tracks
);
1129 err
|= __get_user(f
->timeout
, &((struct floppy_drive_params32
*)arg
)->timeout
);
1130 err
|= __get_user(f
->interleave_sect
, &((struct floppy_drive_params32
*)arg
)->interleave_sect
);
1131 err
|= __copy_from_user(&f
->max_errors
, &((struct floppy_drive_params32
*)arg
)->max_errors
, sizeof(f
->max_errors
));
1132 err
|= __get_user(f
->flags
, &((struct floppy_drive_params32
*)arg
)->flags
);
1133 err
|= __get_user(f
->read_track
, &((struct floppy_drive_params32
*)arg
)->read_track
);
1134 err
|= __copy_from_user(f
->autodetect
, ((struct floppy_drive_params32
*)arg
)->autodetect
, sizeof(f
->autodetect
));
1135 err
|= __get_user(f
->checkfreq
, &((struct floppy_drive_params32
*)arg
)->checkfreq
);
1136 err
|= __get_user(f
->native_format
, &((struct floppy_drive_params32
*)arg
)->native_format
);
1143 case FDGETDRVSTAT32
:
1144 case FDPOLLDRVSTAT32
:
1145 karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_drive_struct
));
1149 case FDGETFDCSTAT32
:
1150 karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_fdc_state
));
1155 karg
= kmalloc(GFP_KERNEL
, sizeof(struct floppy_write_errors
));
1163 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1170 struct floppy_struct
*f
= karg
;
1172 err
= __put_user(f
->size
, &((struct floppy_struct32
*)arg
)->size
);
1173 err
|= __put_user(f
->sect
, &((struct floppy_struct32
*)arg
)->sect
);
1174 err
|= __put_user(f
->head
, &((struct floppy_struct32
*)arg
)->head
);
1175 err
|= __put_user(f
->track
, &((struct floppy_struct32
*)arg
)->track
);
1176 err
|= __put_user(f
->stretch
, &((struct floppy_struct32
*)arg
)->stretch
);
1177 err
|= __put_user(f
->gap
, &((struct floppy_struct32
*)arg
)->gap
);
1178 err
|= __put_user(f
->rate
, &((struct floppy_struct32
*)arg
)->rate
);
1179 err
|= __put_user(f
->spec1
, &((struct floppy_struct32
*)arg
)->spec1
);
1180 err
|= __put_user(f
->fmt_gap
, &((struct floppy_struct32
*)arg
)->fmt_gap
);
1181 err
|= __put_user((u64
)f
->name
, &((struct floppy_struct32
*)arg
)->name
);
1186 struct floppy_drive_params
*f
= karg
;
1188 err
= __put_user(f
->cmos
, &((struct floppy_drive_params32
*)arg
)->cmos
);
1189 err
|= __put_user(f
->max_dtr
, &((struct floppy_drive_params32
*)arg
)->max_dtr
);
1190 err
|= __put_user(f
->hlt
, &((struct floppy_drive_params32
*)arg
)->hlt
);
1191 err
|= __put_user(f
->hut
, &((struct floppy_drive_params32
*)arg
)->hut
);
1192 err
|= __put_user(f
->srt
, &((struct floppy_drive_params32
*)arg
)->srt
);
1193 err
|= __put_user(f
->spinup
, &((struct floppy_drive_params32
*)arg
)->spinup
);
1194 err
|= __put_user(f
->spindown
, &((struct floppy_drive_params32
*)arg
)->spindown
);
1195 err
|= __put_user(f
->spindown_offset
, &((struct floppy_drive_params32
*)arg
)->spindown_offset
);
1196 err
|= __put_user(f
->select_delay
, &((struct floppy_drive_params32
*)arg
)->select_delay
);
1197 err
|= __put_user(f
->rps
, &((struct floppy_drive_params32
*)arg
)->rps
);
1198 err
|= __put_user(f
->tracks
, &((struct floppy_drive_params32
*)arg
)->tracks
);
1199 err
|= __put_user(f
->timeout
, &((struct floppy_drive_params32
*)arg
)->timeout
);
1200 err
|= __put_user(f
->interleave_sect
, &((struct floppy_drive_params32
*)arg
)->interleave_sect
);
1201 err
|= __copy_to_user(&((struct floppy_drive_params32
*)arg
)->max_errors
, &f
->max_errors
, sizeof(f
->max_errors
));
1202 err
|= __put_user(f
->flags
, &((struct floppy_drive_params32
*)arg
)->flags
);
1203 err
|= __put_user(f
->read_track
, &((struct floppy_drive_params32
*)arg
)->read_track
);
1204 err
|= __copy_to_user(((struct floppy_drive_params32
*)arg
)->autodetect
, f
->autodetect
, sizeof(f
->autodetect
));
1205 err
|= __put_user(f
->checkfreq
, &((struct floppy_drive_params32
*)arg
)->checkfreq
);
1206 err
|= __put_user(f
->native_format
, &((struct floppy_drive_params32
*)arg
)->native_format
);
1209 case FDGETDRVSTAT32
:
1210 case FDPOLLDRVSTAT32
:
1212 struct floppy_drive_struct
*f
= karg
;
1214 err
= __put_user(f
->flags
, &((struct floppy_drive_struct32
*)arg
)->flags
);
1215 err
|= __put_user(f
->spinup_date
, &((struct floppy_drive_struct32
*)arg
)->spinup_date
);
1216 err
|= __put_user(f
->select_date
, &((struct floppy_drive_struct32
*)arg
)->select_date
);
1217 err
|= __put_user(f
->first_read_date
, &((struct floppy_drive_struct32
*)arg
)->first_read_date
);
1218 err
|= __put_user(f
->probed_format
, &((struct floppy_drive_struct32
*)arg
)->probed_format
);
1219 err
|= __put_user(f
->track
, &((struct floppy_drive_struct32
*)arg
)->track
);
1220 err
|= __put_user(f
->maxblock
, &((struct floppy_drive_struct32
*)arg
)->maxblock
);
1221 err
|= __put_user(f
->maxtrack
, &((struct floppy_drive_struct32
*)arg
)->maxtrack
);
1222 err
|= __put_user(f
->generation
, &((struct floppy_drive_struct32
*)arg
)->generation
);
1223 err
|= __put_user(f
->keep_data
, &((struct floppy_drive_struct32
*)arg
)->keep_data
);
1224 err
|= __put_user(f
->fd_ref
, &((struct floppy_drive_struct32
*)arg
)->fd_ref
);
1225 err
|= __put_user(f
->fd_device
, &((struct floppy_drive_struct32
*)arg
)->fd_device
);
1226 err
|= __put_user(f
->last_checked
, &((struct floppy_drive_struct32
*)arg
)->last_checked
);
1227 err
|= __put_user((u64
)f
->dmabuf
, &((struct floppy_drive_struct32
*)arg
)->dmabuf
);
1228 err
|= __put_user((u64
)f
->bufblocks
, &((struct floppy_drive_struct32
*)arg
)->bufblocks
);
1231 case FDGETFDCSTAT32
:
1233 struct floppy_fdc_state
*f
= karg
;
1235 err
= __put_user(f
->spec1
, &((struct floppy_fdc_state32
*)arg
)->spec1
);
1236 err
|= __put_user(f
->spec2
, &((struct floppy_fdc_state32
*)arg
)->spec2
);
1237 err
|= __put_user(f
->dtr
, &((struct floppy_fdc_state32
*)arg
)->dtr
);
1238 err
|= __put_user(f
->version
, &((struct floppy_fdc_state32
*)arg
)->version
);
1239 err
|= __put_user(f
->dor
, &((struct floppy_fdc_state32
*)arg
)->dor
);
1240 err
|= __put_user(f
->address
, &((struct floppy_fdc_state32
*)arg
)->address
);
1241 err
|= __copy_to_user((char *)&((struct floppy_fdc_state32
*)arg
)->address
1242 + sizeof(((struct floppy_fdc_state32
*)arg
)->address
),
1243 (char *)&f
->address
+ sizeof(f
->address
), sizeof(int));
1244 err
|= __put_user(f
->driver_version
, &((struct floppy_fdc_state32
*)arg
)->driver_version
);
1245 err
|= __copy_to_user(((struct floppy_fdc_state32
*)arg
)->track
, f
->track
, sizeof(f
->track
));
1250 struct floppy_write_errors
*f
= karg
;
1252 err
= __put_user(f
->write_errors
, &((struct floppy_write_errors32
*)arg
)->write_errors
);
1253 err
|= __put_user(f
->first_error_sector
, &((struct floppy_write_errors32
*)arg
)->first_error_sector
);
1254 err
|= __put_user(f
->first_error_generation
, &((struct floppy_write_errors32
*)arg
)->first_error_generation
);
1255 err
|= __put_user(f
->last_error_sector
, &((struct floppy_write_errors32
*)arg
)->last_error_sector
);
1256 err
|= __put_user(f
->last_error_generation
, &((struct floppy_write_errors32
*)arg
)->last_error_generation
);
1257 err
|= __put_user(f
->badness
, &((struct floppy_write_errors32
*)arg
)->badness
);
1266 out
: if (karg
) kfree(karg
);
1270 struct ppp_option_data32
{
1271 __kernel_caddr_t32 ptr
;
1275 #define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
1278 __kernel_time_t32 xmit_idle
;
1279 __kernel_time_t32 recv_idle
;
1281 #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
1283 static int ppp_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1285 mm_segment_t old_fs
= get_fs();
1286 struct ppp_option_data32 data32
;
1287 struct ppp_option_data data
;
1288 struct ppp_idle32 idle32
;
1289 struct ppp_idle idle
;
1299 case PPPIOCSCOMPRESS32
:
1300 if (copy_from_user(&data32
, (struct ppp_option_data32
*)arg
, sizeof(struct ppp_option_data32
)))
1302 data
.ptr
= kmalloc (data32
.length
, GFP_KERNEL
);
1305 if (copy_from_user(data
.ptr
, (__u8
*)A(data32
.ptr
), data32
.length
)) {
1309 data
.length
= data32
.length
;
1310 data
.transmit
= data32
.transmit
;
1311 kcmd
= PPPIOCSCOMPRESS
;
1316 static int count
= 0;
1318 printk("ppp_ioctl: Unknown cmd fd(%d) "
1319 "cmd(%08x) arg(%08x)\n",
1320 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1325 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1331 idle32
.xmit_idle
= idle
.xmit_idle
;
1332 idle32
.recv_idle
= idle
.recv_idle
;
1333 if (copy_to_user((struct ppp_idle32
*)arg
, &idle32
, sizeof(struct ppp_idle32
)))
1336 case PPPIOCSCOMPRESS32
:
1352 __kernel_daddr_t32 mt_fileno
;
1353 __kernel_daddr_t32 mt_blkno
;
1355 #define MTIOCGET32 _IOR('m', 2, struct mtget32)
1360 #define MTIOCPOS32 _IOR('m', 3, struct mtpos32)
1362 struct mtconfiginfo32
{
1383 #define MTIOCGETCONFIG32 _IOR('m', 4, struct mtconfiginfo32)
1384 #define MTIOCSETCONFIG32 _IOW('m', 5, struct mtconfiginfo32)
1386 static int mt_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1388 mm_segment_t old_fs
= get_fs();
1389 struct mtconfiginfo info
;
1405 case MTIOCGETCONFIG32
:
1406 kcmd
= MTIOCGETCONFIG
;
1409 case MTIOCSETCONFIG32
:
1410 kcmd
= MTIOCSETCONFIG
;
1412 err
= __get_user(info
.mt_type
, &((struct mtconfiginfo32
*)arg
)->mt_type
);
1413 err
|= __get_user(info
.ifc_type
, &((struct mtconfiginfo32
*)arg
)->ifc_type
);
1414 err
|= __get_user(info
.irqnr
, &((struct mtconfiginfo32
*)arg
)->irqnr
);
1415 err
|= __get_user(info
.dmanr
, &((struct mtconfiginfo32
*)arg
)->dmanr
);
1416 err
|= __get_user(info
.port
, &((struct mtconfiginfo32
*)arg
)->port
);
1417 err
|= __get_user(info
.debug
, &((struct mtconfiginfo32
*)arg
)->debug
);
1418 err
|= __copy_from_user((char *)&info
.debug
+ sizeof(info
.debug
),
1419 (char *)&((struct mtconfiginfo32
*)arg
)->debug
1420 + sizeof(((struct mtconfiginfo32
*)arg
)->debug
), sizeof(__u32
));
1426 static int count
= 0;
1428 printk("mt_ioctl: Unknown cmd fd(%d) "
1429 "cmd(%08x) arg(%08x)\n",
1430 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1435 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1441 err
= __put_user(pos
.mt_blkno
, &((struct mtpos32
*)arg
)->mt_blkno
);
1444 err
= __put_user(get
.mt_type
, &((struct mtget32
*)arg
)->mt_type
);
1445 err
|= __put_user(get
.mt_resid
, &((struct mtget32
*)arg
)->mt_resid
);
1446 err
|= __put_user(get
.mt_dsreg
, &((struct mtget32
*)arg
)->mt_dsreg
);
1447 err
|= __put_user(get
.mt_gstat
, &((struct mtget32
*)arg
)->mt_gstat
);
1448 err
|= __put_user(get
.mt_erreg
, &((struct mtget32
*)arg
)->mt_erreg
);
1449 err
|= __put_user(get
.mt_fileno
, &((struct mtget32
*)arg
)->mt_fileno
);
1450 err
|= __put_user(get
.mt_blkno
, &((struct mtget32
*)arg
)->mt_blkno
);
1452 case MTIOCGETCONFIG32
:
1453 err
= __put_user(info
.mt_type
, &((struct mtconfiginfo32
*)arg
)->mt_type
);
1454 err
|= __put_user(info
.ifc_type
, &((struct mtconfiginfo32
*)arg
)->ifc_type
);
1455 err
|= __put_user(info
.irqnr
, &((struct mtconfiginfo32
*)arg
)->irqnr
);
1456 err
|= __put_user(info
.dmanr
, &((struct mtconfiginfo32
*)arg
)->dmanr
);
1457 err
|= __put_user(info
.port
, &((struct mtconfiginfo32
*)arg
)->port
);
1458 err
|= __put_user(info
.debug
, &((struct mtconfiginfo32
*)arg
)->debug
);
1459 err
|= __copy_to_user((char *)&((struct mtconfiginfo32
*)arg
)->debug
1460 + sizeof(((struct mtconfiginfo32
*)arg
)->debug
),
1461 (char *)&info
.debug
+ sizeof(info
.debug
), sizeof(__u32
));
1463 case MTIOCSETCONFIG32
:
1466 return err
? -EFAULT
: 0;
1469 struct cdrom_read32
{
1471 __kernel_caddr_t32 cdread_bufaddr
;
1475 struct cdrom_read_audio32
{
1476 union cdrom_addr addr
;
1479 __kernel_caddr_t32 buf
;
1482 struct cdrom_generic_command32
{
1483 unsigned char cmd
[CDROM_PACKET_SIZE
];
1484 __kernel_caddr_t32 buffer
;
1485 unsigned int buflen
;
1487 __kernel_caddr_t32 sense
;
1488 __kernel_caddr_t32 reserved
[3];
1491 static int cdrom_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1493 mm_segment_t old_fs
= get_fs();
1494 struct cdrom_read cdread
;
1495 struct cdrom_read_audio cdreadaudio
;
1496 struct cdrom_generic_command cgc
;
1497 __kernel_caddr_t32 addr
;
1503 case CDROMREADMODE2
:
1504 case CDROMREADMODE1
:
1506 case CDROMREADCOOKED
:
1508 err
= __get_user(cdread
.cdread_lba
, &((struct cdrom_read32
*)arg
)->cdread_lba
);
1509 err
|= __get_user(addr
, &((struct cdrom_read32
*)arg
)->cdread_bufaddr
);
1510 err
|= __get_user(cdread
.cdread_buflen
, &((struct cdrom_read32
*)arg
)->cdread_buflen
);
1513 data
= kmalloc(cdread
.cdread_buflen
, GFP_KERNEL
);
1516 cdread
.cdread_bufaddr
= data
;
1518 case CDROMREADAUDIO
:
1519 karg
= &cdreadaudio
;
1520 err
= copy_from_user(&cdreadaudio
.addr
, &((struct cdrom_read_audio32
*)arg
)->addr
, sizeof(cdreadaudio
.addr
));
1521 err
|= __get_user(cdreadaudio
.addr_format
, &((struct cdrom_read_audio32
*)arg
)->addr_format
);
1522 err
|= __get_user(cdreadaudio
.nframes
, &((struct cdrom_read_audio32
*)arg
)->nframes
);
1523 err
|= __get_user(addr
, &((struct cdrom_read_audio32
*)arg
)->buf
);
1526 data
= kmalloc(cdreadaudio
.nframes
* 2352, GFP_KERNEL
);
1529 cdreadaudio
.buf
= data
;
1531 case CDROM_SEND_PACKET
:
1533 err
= copy_from_user(cgc
.cmd
, &((struct cdrom_generic_command32
*)arg
)->cmd
, sizeof(cgc
.cmd
));
1534 err
|= __get_user(addr
, &((struct cdrom_generic_command32
*)arg
)->buffer
);
1535 err
|= __get_user(cgc
.buflen
, &((struct cdrom_generic_command32
*)arg
)->buflen
);
1538 if ((data
= kmalloc(cgc
.buflen
, GFP_KERNEL
)) == NULL
)
1544 static int count
= 0;
1546 printk("cdrom_ioctl: Unknown cmd fd(%d) "
1547 "cmd(%08x) arg(%08x)\n",
1548 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1553 err
= sys_ioctl (fd
, cmd
, (unsigned long)karg
);
1558 case CDROMREADMODE2
:
1559 case CDROMREADMODE1
:
1561 case CDROMREADCOOKED
:
1562 err
= copy_to_user((char *)A(addr
), data
, cdread
.cdread_buflen
);
1564 case CDROMREADAUDIO
:
1565 err
= copy_to_user((char *)A(addr
), data
, cdreadaudio
.nframes
* 2352);
1567 case CDROM_SEND_PACKET
:
1568 err
= copy_to_user((char *)A(addr
), data
, cgc
.buflen
);
1575 return err
? -EFAULT
: 0;
1578 struct loop_info32
{
1579 int lo_number
; /* ioctl r/o */
1580 __kernel_dev_t32 lo_device
; /* ioctl r/o */
1581 unsigned int lo_inode
; /* ioctl r/o */
1582 __kernel_dev_t32 lo_rdevice
; /* ioctl r/o */
1584 int lo_encrypt_type
;
1585 int lo_encrypt_key_size
; /* ioctl w/o */
1586 int lo_flags
; /* ioctl r/o */
1587 char lo_name
[LO_NAME_SIZE
];
1588 unsigned char lo_encrypt_key
[LO_KEY_SIZE
]; /* ioctl w/o */
1589 unsigned int lo_init
[2];
1593 static int loop_status(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1595 mm_segment_t old_fs
= get_fs();
1600 case LOOP_SET_STATUS
:
1601 err
= get_user(l
.lo_number
, &((struct loop_info32
*)arg
)->lo_number
);
1602 err
|= __get_user(l
.lo_device
, &((struct loop_info32
*)arg
)->lo_device
);
1603 err
|= __get_user(l
.lo_inode
, &((struct loop_info32
*)arg
)->lo_inode
);
1604 err
|= __get_user(l
.lo_rdevice
, &((struct loop_info32
*)arg
)->lo_rdevice
);
1605 err
|= __copy_from_user((char *)&l
.lo_offset
, (char *)&((struct loop_info32
*)arg
)->lo_offset
,
1606 8 + (unsigned long)l
.lo_init
- (unsigned long)&l
.lo_offset
);
1611 err
= sys_ioctl (fd
, cmd
, (unsigned long)&l
);
1615 case LOOP_GET_STATUS
:
1617 err
= sys_ioctl (fd
, cmd
, (unsigned long)&l
);
1620 err
= put_user(l
.lo_number
, &((struct loop_info32
*)arg
)->lo_number
);
1621 err
|= __put_user(l
.lo_device
, &((struct loop_info32
*)arg
)->lo_device
);
1622 err
|= __put_user(l
.lo_inode
, &((struct loop_info32
*)arg
)->lo_inode
);
1623 err
|= __put_user(l
.lo_rdevice
, &((struct loop_info32
*)arg
)->lo_rdevice
);
1624 err
|= __copy_to_user((char *)&((struct loop_info32
*)arg
)->lo_offset
,
1625 (char *)&l
.lo_offset
, (unsigned long)l
.lo_init
- (unsigned long)&l
.lo_offset
);
1631 static int count
= 0;
1633 printk("%s: Unknown loop ioctl cmd, fd(%d) "
1634 "cmd(%08x) arg(%08lx)\n",
1635 __FUNCTION__
, fd
, cmd
, arg
);
1641 extern int tty_ioctl(struct inode
* inode
, struct file
* file
, unsigned int cmd
, unsigned long arg
);
1643 static int vt_check(struct file
*file
)
1645 struct tty_struct
*tty
;
1646 struct inode
*inode
= file
->f_dentry
->d_inode
;
1648 if (file
->f_op
->ioctl
!= tty_ioctl
)
1651 tty
= (struct tty_struct
*)file
->private_data
;
1652 if (tty_paranoia_check(tty
, inode
->i_rdev
, "tty_ioctl"))
1655 if (tty
->driver
.ioctl
!= vt_ioctl
)
1659 * To have permissions to do most of the vt ioctls, we either have
1660 * to be the owner of the tty, or super-user.
1662 if (current
->tty
== tty
|| suser())
1667 struct consolefontdesc32
{
1668 unsigned short charcount
; /* characters in font (256 or 512) */
1669 unsigned short charheight
; /* scan lines per character (1-32) */
1670 u32 chardata
; /* font data in expanded form */
1673 static int do_fontx_ioctl(unsigned int fd
, int cmd
, struct consolefontdesc32
*user_cfd
, struct file
*file
)
1675 struct consolefontdesc cfdarg
;
1676 struct console_font_op op
;
1679 perm
= vt_check(file
);
1680 if (perm
< 0) return perm
;
1682 if (copy_from_user(&cfdarg
, user_cfd
, sizeof(struct consolefontdesc32
)))
1685 cfdarg
.chardata
= (unsigned char *)A(((struct consolefontdesc32
*)&cfdarg
)->chardata
);
1691 op
.op
= KD_FONT_OP_SET
;
1694 op
.height
= cfdarg
.charheight
;
1695 op
.charcount
= cfdarg
.charcount
;
1696 op
.data
= cfdarg
.chardata
;
1697 return con_font_op(fg_console
, &op
);
1699 if (!cfdarg
.chardata
)
1701 op
.op
= KD_FONT_OP_GET
;
1704 op
.height
= cfdarg
.charheight
;
1705 op
.charcount
= cfdarg
.charcount
;
1706 op
.data
= cfdarg
.chardata
;
1707 i
= con_font_op(fg_console
, &op
);
1710 cfdarg
.charheight
= op
.height
;
1711 cfdarg
.charcount
= op
.charcount
;
1712 ((struct consolefontdesc32
*)&cfdarg
)->chardata
= (unsigned long)cfdarg
.chardata
;
1713 if (copy_to_user(user_cfd
, &cfdarg
, sizeof(struct consolefontdesc32
)))
1720 struct console_font_op32
{
1721 unsigned int op
; /* operation code KD_FONT_OP_* */
1722 unsigned int flags
; /* KD_FONT_FLAG_* */
1723 unsigned int width
, height
; /* font size */
1724 unsigned int charcount
;
1725 u32 data
; /* font data with height fixed to 32 */
1728 static int do_kdfontop_ioctl(unsigned int fd
, unsigned int cmd
, struct console_font_op32
*fontop
, struct file
*file
)
1730 struct console_font_op op
;
1731 int perm
= vt_check(file
), i
;
1732 struct vt_struct
*vt
;
1734 if (perm
< 0) return perm
;
1736 if (copy_from_user(&op
, (void *) fontop
, sizeof(struct console_font_op32
)))
1738 if (!perm
&& op
.op
!= KD_FONT_OP_GET
)
1740 op
.data
= (unsigned char *)A(((struct console_font_op32
*)&op
)->data
);
1741 op
.flags
|= KD_FONT_FLAG_OLD
;
1742 vt
= (struct vt_struct
*)((struct tty_struct
*)file
->private_data
)->driver_data
;
1743 i
= con_font_op(vt
->vc_num
, &op
);
1745 ((struct console_font_op32
*)&op
)->data
= (unsigned long)op
.data
;
1746 if (copy_to_user((void *) fontop
, &op
, sizeof(struct console_font_op32
)))
1751 struct unimapdesc32
{
1752 unsigned short entry_ct
;
1756 static int do_unimap_ioctl(unsigned int fd
, unsigned int cmd
, struct unimapdesc32
*user_ud
, struct file
*file
)
1758 struct unimapdesc32 tmp
;
1759 int perm
= vt_check(file
);
1761 if (perm
< 0) return perm
;
1762 if (copy_from_user(&tmp
, user_ud
, sizeof tmp
))
1766 if (!perm
) return -EPERM
;
1767 return con_set_unimap(fg_console
, tmp
.entry_ct
, (struct unipair
*)A(tmp
.entries
));
1769 return con_get_unimap(fg_console
, tmp
.entry_ct
, &(user_ud
->entry_ct
), (struct unipair
*)A(tmp
.entries
));
1774 static int do_smb_getmountuid(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1776 mm_segment_t old_fs
= get_fs();
1777 __kernel_uid_t kuid
;
1780 cmd
= SMB_IOC_GETMOUNTUID
;
1783 err
= sys_ioctl(fd
, cmd
, (unsigned long)&kuid
);
1787 err
= put_user(kuid
, (__kernel_uid_t32
*)arg
);
1792 struct atmif_sioc32
{
1795 __kernel_caddr_t32 arg
;
1798 struct atm_iobuf32
{
1800 __kernel_caddr_t32 buffer
;
1803 #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32)
1804 #define ATM_GETNAMES32 _IOW('a', ATMIOC_ITF+3, struct atm_iobuf32)
1805 #define ATM_GETTYPE32 _IOW('a', ATMIOC_ITF+4, struct atmif_sioc32)
1806 #define ATM_GETESI32 _IOW('a', ATMIOC_ITF+5, struct atmif_sioc32)
1807 #define ATM_GETADDR32 _IOW('a', ATMIOC_ITF+6, struct atmif_sioc32)
1808 #define ATM_RSTADDR32 _IOW('a', ATMIOC_ITF+7, struct atmif_sioc32)
1809 #define ATM_ADDADDR32 _IOW('a', ATMIOC_ITF+8, struct atmif_sioc32)
1810 #define ATM_DELADDR32 _IOW('a', ATMIOC_ITF+9, struct atmif_sioc32)
1811 #define ATM_GETCIRANGE32 _IOW('a', ATMIOC_ITF+10, struct atmif_sioc32)
1812 #define ATM_SETCIRANGE32 _IOW('a', ATMIOC_ITF+11, struct atmif_sioc32)
1813 #define ATM_SETESI32 _IOW('a', ATMIOC_ITF+12, struct atmif_sioc32)
1814 #define ATM_SETESIF32 _IOW('a', ATMIOC_ITF+13, struct atmif_sioc32)
1815 #define ATM_GETSTAT32 _IOW('a', ATMIOC_SARCOM+0, struct atmif_sioc32)
1816 #define ATM_GETSTATZ32 _IOW('a', ATMIOC_SARCOM+1, struct atmif_sioc32)
1817 #define ATM_GETLOOP32 _IOW('a', ATMIOC_SARCOM+2, struct atmif_sioc32)
1818 #define ATM_SETLOOP32 _IOW('a', ATMIOC_SARCOM+3, struct atmif_sioc32)
1823 } atm_ioctl_map
[] = {
1824 { ATM_GETLINKRATE32
, ATM_GETLINKRATE
},
1825 { ATM_GETNAMES32
, ATM_GETNAMES
},
1826 { ATM_GETTYPE32
, ATM_GETTYPE
},
1827 { ATM_GETESI32
, ATM_GETESI
},
1828 { ATM_GETADDR32
, ATM_GETADDR
},
1829 { ATM_RSTADDR32
, ATM_RSTADDR
},
1830 { ATM_ADDADDR32
, ATM_ADDADDR
},
1831 { ATM_DELADDR32
, ATM_DELADDR
},
1832 { ATM_GETCIRANGE32
, ATM_GETCIRANGE
},
1833 { ATM_SETCIRANGE32
, ATM_SETCIRANGE
},
1834 { ATM_SETESI32
, ATM_SETESI
},
1835 { ATM_SETESIF32
, ATM_SETESIF
},
1836 { ATM_GETSTAT32
, ATM_GETSTAT
},
1837 { ATM_GETSTATZ32
, ATM_GETSTATZ
},
1838 { ATM_GETLOOP32
, ATM_GETLOOP
},
1839 { ATM_SETLOOP32
, ATM_SETLOOP
}
1842 #define NR_ATM_IOCTL (sizeof(atm_ioctl_map)/sizeof(atm_ioctl_map[0]))
1845 static int do_atm_iobuf(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1847 struct atm_iobuf32 iobuf32
;
1848 struct atm_iobuf iobuf
= { 0, NULL
};
1849 mm_segment_t old_fs
;
1852 err
= copy_from_user(&iobuf32
, (struct atm_iobuf32
*)arg
,
1853 sizeof(struct atm_iobuf32
));
1857 iobuf
.length
= iobuf32
.length
;
1859 if (iobuf32
.buffer
== (__kernel_caddr_t32
) NULL
|| iobuf32
.length
== 0) {
1860 iobuf
.buffer
= (void*)(unsigned long)iobuf32
.buffer
;
1862 iobuf
.buffer
= kmalloc(iobuf
.length
, GFP_KERNEL
);
1863 if (iobuf
.buffer
== NULL
) {
1868 err
= copy_from_user(iobuf
.buffer
, A(iobuf32
.buffer
), iobuf
.length
);
1875 old_fs
= get_fs(); set_fs (KERNEL_DS
);
1876 err
= sys_ioctl (fd
, cmd
, (unsigned long)&iobuf
);
1881 if(iobuf
.buffer
&& iobuf
.length
> 0) {
1882 err
= copy_to_user(A(iobuf32
.buffer
), iobuf
.buffer
, iobuf
.length
);
1888 err
= __put_user(iobuf
.length
, &(((struct atm_iobuf32
*)arg
)->length
));
1891 if(iobuf32
.buffer
&& iobuf32
.length
> 0)
1892 kfree(iobuf
.buffer
);
1898 static int do_atmif_sioc(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1900 struct atmif_sioc32 sioc32
;
1901 struct atmif_sioc sioc
= { 0, 0, NULL
};
1902 mm_segment_t old_fs
;
1905 err
= copy_from_user(&sioc32
, (struct atmif_sioc32
*)arg
,
1906 sizeof(struct atmif_sioc32
));
1910 sioc
.number
= sioc32
.number
;
1911 sioc
.length
= sioc32
.length
;
1913 if (sioc32
.arg
== (__kernel_caddr_t32
) NULL
|| sioc32
.length
== 0) {
1914 sioc
.arg
= (void*)(unsigned long)sioc32
.arg
;
1916 sioc
.arg
= kmalloc(sioc
.length
, GFP_KERNEL
);
1917 if (sioc
.arg
== NULL
) {
1922 err
= copy_from_user(sioc
.arg
, A(sioc32
.arg
), sioc32
.length
);
1929 old_fs
= get_fs(); set_fs (KERNEL_DS
);
1930 err
= sys_ioctl (fd
, cmd
, (unsigned long)&sioc
);
1936 if(sioc
.arg
&& sioc
.length
> 0) {
1937 err
= copy_to_user(A(sioc32
.arg
), sioc
.arg
, sioc
.length
);
1943 err
= __put_user(sioc
.length
, &(((struct atmif_sioc32
*)arg
)->length
));
1946 if(sioc32
.arg
&& sioc32
.length
> 0)
1953 static int do_atm_ioctl(unsigned int fd
, unsigned int cmd32
, unsigned long arg
)
1956 unsigned int cmd
= 0;
1960 case SONET_GETSTATZ
:
1964 case SONET_SETFRAMING
:
1965 case SONET_GETFRAMING
:
1966 case SONET_GETFRSENSE
:
1967 return do_atmif_sioc(fd
, cmd32
, arg
);
1970 for (i
= 0; i
< NR_ATM_IOCTL
; i
++) {
1971 if (cmd32
== atm_ioctl_map
[i
].cmd32
) {
1972 cmd
= atm_ioctl_map
[i
].cmd
;
1976 if (i
== NR_ATM_IOCTL
) {
1982 return do_atm_iobuf(fd
, cmd
, arg
);
1984 case ATM_GETLINKRATE
:
1991 case ATM_GETCIRANGE
:
1992 case ATM_SETCIRANGE
:
1999 return do_atmif_sioc(fd
, cmd
, arg
);
2005 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
2006 /* Ugh, LVM. Pitty it was not cleaned up before accepted :((. */
2008 uint8_t vg_name
[NAME_LEN
];
2022 uint32_t pe_allocated
;
2025 u32 pv
[ABS_MAX_PV
+ 1];
2026 u32 lv
[ABS_MAX_LV
+ 1];
2032 lvm_disk_data_t pv_on_disk
;
2033 lvm_disk_data_t vg_on_disk
;
2034 lvm_disk_data_t pv_namelist_on_disk
;
2035 lvm_disk_data_t lv_on_disk
;
2036 lvm_disk_data_t pe_on_disk
;
2037 uint8_t pv_name
[NAME_LEN
];
2038 uint8_t vg_name
[NAME_LEN
];
2039 uint8_t system_id
[NAME_LEN
];
2043 uint32_t pv_allocatable
;
2048 uint32_t pe_allocated
;
2055 char lv_name
[NAME_LEN
];
2062 } lv_status_byindex_req32_t
;
2065 uint8_t lv_name
[NAME_LEN
];
2073 char pv_name
[NAME_LEN
];
2075 } pv_status_req32_t
;
2078 uint8_t lv_name
[NAME_LEN
];
2079 uint8_t vg_name
[NAME_LEN
];
2085 uint32_t lv_mirror_copies
;
2086 uint32_t lv_recovery
;
2087 uint32_t lv_schedule
;
2090 uint32_t lv_current_le
;
2091 uint32_t lv_allocated_le
;
2092 uint32_t lv_stripes
;
2093 uint32_t lv_stripesize
;
2094 uint32_t lv_badblock
;
2095 uint32_t lv_allocation
;
2096 uint32_t lv_io_timeout
;
2097 uint32_t lv_read_ahead
;
2098 /* delta to version 1 starts here */
2099 u32 lv_snapshot_org
;
2100 u32 lv_snapshot_prev
;
2101 u32 lv_snapshot_next
;
2102 u32 lv_block_exception
;
2103 uint32_t lv_remap_ptr
;
2104 uint32_t lv_remap_end
;
2105 uint32_t lv_chunk_size
;
2106 uint32_t lv_snapshot_minor
;
2116 } lv_block_exception32_t
;
2118 static void put_lv_t(lv_t
*l
)
2120 if (l
->lv_current_pe
) vfree(l
->lv_current_pe
);
2121 if (l
->lv_block_exception
) vfree(l
->lv_block_exception
);
2125 static lv_t
*get_lv_t(u32 p
, int *errp
)
2130 lv_block_exception32_t
*lbe32
;
2131 lv_block_exception_t
*lbe
;
2132 lv32_t
*ul
= (lv32_t
*)A(p
);
2133 lv_t
*l
= (lv_t
*)kmalloc(sizeof(lv_t
), GFP_KERNEL
);
2138 memset(l
, 0, sizeof(lv_t
));
2139 err
= copy_from_user(l
, ul
, (long)&((lv32_t
*)0)->lv_current_pe
);
2140 err
|= __copy_from_user(&l
->lv_current_le
, &ul
->lv_current_le
,
2141 ((long)&ul
->lv_snapshot_org
) - ((long)&ul
->lv_current_le
));
2142 err
|= __copy_from_user(&l
->lv_remap_ptr
, &ul
->lv_remap_ptr
,
2143 ((long)&ul
->dummy
[0]) - ((long)&ul
->lv_remap_ptr
));
2144 err
|= __get_user(ptr1
, &ul
->lv_current_pe
);
2145 err
|= __get_user(ptr2
, &ul
->lv_block_exception
);
2152 size
= l
->lv_allocated_le
* sizeof(pe_t
);
2153 l
->lv_current_pe
= vmalloc(size
);
2154 if (l
->lv_current_pe
)
2155 err
= copy_from_user(l
->lv_current_pe
, (void *)A(ptr1
), size
);
2158 size
= l
->lv_remap_end
* sizeof(lv_block_exception_t
);
2159 l
->lv_block_exception
= lbe
= vmalloc(size
);
2160 if (l
->lv_block_exception
) {
2161 lbe32
= (lv_block_exception32_t
*)A(ptr2
);
2162 memset(lbe
, 0, size
);
2163 for (i
= 0; i
< l
->lv_remap_end
; i
++, lbe
++, lbe32
++) {
2164 err
|= get_user(lbe
->rsector_org
, &lbe32
->rsector_org
);
2165 err
|= __get_user(lbe
->rdev_org
, &lbe32
->rdev_org
);
2166 err
|= __get_user(lbe
->rsector_new
, &lbe32
->rsector_new
);
2167 err
|= __get_user(lbe
->rdev_new
, &lbe32
->rdev_new
);
2171 if (err
|| (ptr1
&& !l
->lv_current_pe
) || (ptr2
&& !l
->lv_block_exception
)) {
2182 static int copy_lv_t(u32 ptr
, lv_t
*l
)
2185 lv32_t
*ul
= (lv32_t
*)A(ptr
);
2189 err
= get_user(ptr1
, &ul
->lv_current_pe
);
2192 err
= copy_to_user(ul
, l
, (long)&((lv32_t
*)0)->lv_current_pe
);
2193 err
|= __copy_to_user(&ul
->lv_current_le
, &l
->lv_current_le
,
2194 ((long)&ul
->lv_snapshot_org
) - ((long)&ul
->lv_current_le
));
2195 err
|= __copy_to_user(&ul
->lv_remap_ptr
, &l
->lv_remap_ptr
,
2196 ((long)&ul
->dummy
[0]) - ((long)&ul
->lv_remap_ptr
));
2197 size
= l
->lv_allocated_le
* sizeof(pe_t
);
2198 err
|= __copy_to_user((void *)A(ptr1
), l
->lv_current_pe
, size
);
2202 static int do_lvm_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2207 le_remap_req_t le_remap
;
2208 lv_status_byindex_req_t lv_byindex
;
2209 pv_status_req32_t pv_status
;
2215 mm_segment_t old_fs
;
2220 v
= kmalloc(sizeof(vg_t
), GFP_KERNEL
);
2221 if (!v
) return -ENOMEM
;
2225 v
= kmalloc(sizeof(vg_t
), GFP_KERNEL
);
2226 if (!v
) return -ENOMEM
;
2227 if (copy_from_user(v
, (void *)arg
, (long)&((vg32_t
*)0)->proc
) ||
2228 __get_user(v
->proc
, &((vg32_t
*)arg
)->proc
)) {
2233 memset(v
->pv
, 0, sizeof(v
->pv
) + sizeof(v
->lv
));
2234 if (v
->pv_max
> ABS_MAX_PV
|| v
->lv_max
== ABS_MAX_LV
) return -EPERM
;
2235 for (i
= 0; i
< v
->pv_max
; i
++) {
2236 err
= __get_user(ptr
, &((vg32_t
*)arg
)->pv
[i
]);
2239 v
->pv
[i
] = kmalloc(sizeof(pv_t
), GFP_KERNEL
);
2244 err
= copy_from_user(v
->pv
[i
], (void *)A(ptr
), sizeof(pv32_t
) - 8);
2249 v
->pv
[i
]->pe
= NULL
; v
->pv
[i
]->inode
= NULL
;
2253 for (i
= 0; i
< v
->lv_max
; i
++) {
2254 err
= __get_user(ptr
, &((vg32_t
*)arg
)->lv
[i
]);
2257 v
->lv
[i
] = get_lv_t(ptr
, &err
);
2267 case LV_STATUS_BYNAME
:
2268 err
= copy_from_user(&u
.pv_status
, arg
, sizeof(u
.pv_status
.pv_name
));
2269 if (err
) return -EFAULT
;
2270 if (cmd
!= LV_REMOVE
) {
2271 err
= __get_user(ptr
, &((lv_req32_t
*)arg
)->lv
);
2272 if (err
) return err
;
2273 u
.lv_req
.lv
= get_lv_t(ptr
, &err
);
2277 case LV_STATUS_BYINDEX
:
2278 err
= get_user(u
.lv_byindex
.lv_index
, &((lv_status_byindex_req32_t
*)arg
)->lv_index
);
2279 err
|= __get_user(ptr
, &((lv_status_byindex_req32_t
*)arg
)->lv
);
2280 if (err
) return err
;
2281 u
.lv_byindex
.lv
= get_lv_t(ptr
, &err
);
2284 err
= copy_from_user(&p
, (void *)arg
, sizeof(pv32_t
) - 8);
2285 if (err
) return -EFAULT
;
2286 p
.pe
= NULL
; p
.inode
= NULL
;
2290 err
= copy_from_user(&u
.le_remap
, (void *)arg
, sizeof(le_remap_req32_t
));
2291 if (err
) return -EFAULT
;
2292 u
.le_remap
.new_pe
= ((le_remap_req32_t
*)&u
.le_remap
)->new_pe
;
2293 u
.le_remap
.old_pe
= ((le_remap_req32_t
*)&u
.le_remap
)->old_pe
;
2297 err
= copy_from_user(&u
.pv_status
, arg
, sizeof(u
.lv_req
.lv_name
));
2298 if (err
) return -EFAULT
;
2299 err
= __get_user(ptr
, &((pv_status_req32_t
*)arg
)->pv
);
2300 if (err
) return err
;
2301 u
.pv_status
.pv
= &p
;
2302 if (cmd
== PV_CHANGE
) {
2303 err
= copy_from_user(&p
, (void *)A(ptr
), sizeof(pv32_t
) - 8);
2304 if (err
) return -EFAULT
;
2305 p
.pe
= NULL
; p
.inode
= NULL
;
2309 old_fs
= get_fs(); set_fs (KERNEL_DS
);
2310 err
= sys_ioctl (fd
, cmd
, (unsigned long)karg
);
2315 if (copy_to_user((void *)arg
, v
, (long)&((vg32_t
*)0)->proc
) ||
2316 clear_user(&((vg32_t
*)arg
)->proc
, sizeof(vg32_t
) - (long)&((vg32_t
*)0)->proc
))
2322 for (i
= 0; i
< v
->pv_max
; i
++)
2323 if (v
->pv
[i
]) kfree(v
->pv
[i
]);
2324 for (i
= 0; i
< v
->lv_max
; i
++)
2325 if (v
->lv
[i
]) put_lv_t(v
->lv
[i
]);
2328 case LV_STATUS_BYNAME
:
2329 if (!err
&& u
.lv_req
.lv
) err
= copy_lv_t(ptr
, u
.lv_req
.lv
);
2334 if (u
.lv_req
.lv
) put_lv_t(u
.lv_req
.lv
);
2336 case LV_STATUS_BYINDEX
:
2337 if (u
.lv_byindex
.lv
) {
2338 if (!err
) err
= copy_lv_t(ptr
, u
.lv_byindex
.lv
);
2339 put_lv_t(u
.lv_byindex
.lv
);
2343 err
= copy_to_user((void *)A(ptr
), &p
, sizeof(pv32_t
) - 8);
2344 if (err
) return -EFAULT
;
2352 static int ret_einval(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2357 static int broken_blkgetsize(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2359 /* The mkswap binary hard codes it to Intel value :-((( */
2360 return w_long(fd
, BLKGETSIZE
, arg
);
2363 struct blkpg_ioctl_arg32
{
2370 static int blkpg_ioctl_trans(unsigned int fd
, unsigned int cmd
, struct blkpg_ioctl_arg32
*arg
)
2372 struct blkpg_ioctl_arg a
;
2373 struct blkpg_partition p
;
2375 mm_segment_t old_fs
= get_fs();
2377 err
= get_user(a
.op
, &arg
->op
);
2378 err
|= __get_user(a
.flags
, &arg
->flags
);
2379 err
|= __get_user(a
.datalen
, &arg
->datalen
);
2380 err
|= __get_user((long)a
.data
, &arg
->data
);
2381 if (err
) return err
;
2383 case BLKPG_ADD_PARTITION
:
2384 case BLKPG_DEL_PARTITION
:
2385 if (a
.datalen
< sizeof(struct blkpg_partition
))
2387 if (copy_from_user(&p
, a
.data
, sizeof(struct blkpg_partition
)))
2391 err
= sys_ioctl(fd
, cmd
, (unsigned long)&a
);
2399 typedef struct blkelv_ioctl32_arg_s
{
2403 int max_bomb_segments
;
2404 } blkelv_ioctl32_arg_t
;
2406 static int do_blkelv_ioctl(unsigned int fd
, unsigned int cmd
, blkelv_ioctl32_arg_t
*arg
)
2408 blkelv_ioctl_arg_t b
;
2410 mm_segment_t old_fs
= get_fs();
2412 if (cmd
== BLKELVSET
) {
2413 err
= get_user((long)b
.queue_ID
, &arg
->queue_ID
);
2414 err
|= __get_user(b
.read_latency
, &arg
->read_latency
);
2415 err
|= __get_user(b
.write_latency
, &arg
->write_latency
);
2416 err
|= __get_user(b
.max_bomb_segments
, &arg
->max_bomb_segments
);
2417 if (err
) return err
;
2420 err
= sys_ioctl(fd
, cmd
, (unsigned long)&b
);
2422 if (cmd
== BLKELVGET
&& !err
) {
2423 err
= put_user((long)b
.queue_ID
, &arg
->queue_ID
);
2424 err
|= __put_user(b
.read_latency
, &arg
->read_latency
);
2425 err
|= __put_user(b
.write_latency
, &arg
->write_latency
);
2426 err
|= __put_user(b
.max_bomb_segments
, &arg
->max_bomb_segments
);
2427 if (err
) return err
;
2432 static int ioc_settimeout(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2434 return rw_long(fd
, AUTOFS_IOC_SETTIMEOUT
, arg
);
2437 struct ioctl_trans
{
2439 unsigned int handler
;
2443 #define COMPATIBLE_IOCTL(cmd) asm volatile(".word %0, sys_ioctl, 0" : : "i" (cmd));
2444 #define HANDLE_IOCTL(cmd,handler) asm volatile(".word %0, %1, 0" : : "i" (cmd), "i" (handler));
2445 #define IOCTL_TABLE_START void ioctl32_foo(void) { asm volatile(".data\nioctl_translations:");
2446 #define IOCTL_TABLE_END asm volatile("\nioctl_translations_end:\n\t.previous"); }
2449 /* List here exlicitly which ioctl's are known to have
2450 * compatable types passed or none at all...
2453 COMPATIBLE_IOCTL(TCGETA
)
2454 COMPATIBLE_IOCTL(TCSETA
)
2455 COMPATIBLE_IOCTL(TCSETAW
)
2456 COMPATIBLE_IOCTL(TCSETAF
)
2457 COMPATIBLE_IOCTL(TCSBRK
)
2458 COMPATIBLE_IOCTL(TCXONC
)
2459 COMPATIBLE_IOCTL(TCFLSH
)
2460 COMPATIBLE_IOCTL(TCGETS
)
2461 COMPATIBLE_IOCTL(TCSETS
)
2462 COMPATIBLE_IOCTL(TCSETSW
)
2463 COMPATIBLE_IOCTL(TCSETSF
)
2464 COMPATIBLE_IOCTL(TIOCLINUX
)
2466 COMPATIBLE_IOCTL(TIOCGETD
)
2467 COMPATIBLE_IOCTL(TIOCSETD
)
2468 COMPATIBLE_IOCTL(TIOCEXCL
)
2469 COMPATIBLE_IOCTL(TIOCNXCL
)
2470 COMPATIBLE_IOCTL(TIOCCONS
)
2471 COMPATIBLE_IOCTL(TIOCGSOFTCAR
)
2472 COMPATIBLE_IOCTL(TIOCSSOFTCAR
)
2473 COMPATIBLE_IOCTL(TIOCSWINSZ
)
2474 COMPATIBLE_IOCTL(TIOCGWINSZ
)
2475 COMPATIBLE_IOCTL(TIOCMGET
)
2476 COMPATIBLE_IOCTL(TIOCMBIC
)
2477 COMPATIBLE_IOCTL(TIOCMBIS
)
2478 COMPATIBLE_IOCTL(TIOCMSET
)
2479 COMPATIBLE_IOCTL(TIOCPKT
)
2480 COMPATIBLE_IOCTL(TIOCNOTTY
)
2481 COMPATIBLE_IOCTL(TIOCSTI
)
2482 COMPATIBLE_IOCTL(TIOCOUTQ
)
2483 COMPATIBLE_IOCTL(TIOCSPGRP
)
2484 COMPATIBLE_IOCTL(TIOCGPGRP
)
2485 COMPATIBLE_IOCTL(TIOCSCTTY
)
2486 COMPATIBLE_IOCTL(TIOCGPTN
)
2487 COMPATIBLE_IOCTL(TIOCSPTLCK
)
2488 COMPATIBLE_IOCTL(TIOCGSERIAL
)
2489 COMPATIBLE_IOCTL(TIOCSSERIAL
)
2490 COMPATIBLE_IOCTL(TIOCSERGETLSR
)
2492 COMPATIBLE_IOCTL(FBIOGTYPE
)
2493 COMPATIBLE_IOCTL(FBIOSATTR
)
2494 COMPATIBLE_IOCTL(FBIOGATTR
)
2495 COMPATIBLE_IOCTL(FBIOSVIDEO
)
2496 COMPATIBLE_IOCTL(FBIOGVIDEO
)
2497 COMPATIBLE_IOCTL(FBIOGCURSOR32
) /* This is not implemented yet. Later it should be converted... */
2498 COMPATIBLE_IOCTL(FBIOSCURPOS
)
2499 COMPATIBLE_IOCTL(FBIOGCURPOS
)
2500 COMPATIBLE_IOCTL(FBIOGCURMAX
)
2501 COMPATIBLE_IOCTL(FBIOGET_VSCREENINFO
)
2502 COMPATIBLE_IOCTL(FBIOPUT_VSCREENINFO
)
2503 COMPATIBLE_IOCTL(FBIOPAN_DISPLAY
)
2504 COMPATIBLE_IOCTL(FBIOGET_FCURSORINFO
)
2505 COMPATIBLE_IOCTL(FBIOGET_VCURSORINFO
)
2506 COMPATIBLE_IOCTL(FBIOPUT_VCURSORINFO
)
2507 COMPATIBLE_IOCTL(FBIOGET_CURSORSTATE
)
2508 COMPATIBLE_IOCTL(FBIOPUT_CURSORSTATE
)
2509 COMPATIBLE_IOCTL(FBIOGET_CON2FBMAP
)
2510 COMPATIBLE_IOCTL(FBIOPUT_CON2FBMAP
)
2512 COMPATIBLE_IOCTL(FIOCLEX
)
2513 COMPATIBLE_IOCTL(FIONCLEX
)
2514 COMPATIBLE_IOCTL(FIOASYNC
)
2515 COMPATIBLE_IOCTL(FIONBIO
)
2516 COMPATIBLE_IOCTL(FIONREAD
) /* This is also TIOCINQ */
2518 COMPATIBLE_IOCTL(FIBMAP
)
2519 COMPATIBLE_IOCTL(FIGETBSZ
)
2520 /* 0x03 -- HD/IDE ioctl's used by hdparm and friends.
2521 * Some need translations, these do not.
2523 COMPATIBLE_IOCTL(HDIO_GET_IDENTITY
)
2524 COMPATIBLE_IOCTL(HDIO_SET_DMA
)
2525 COMPATIBLE_IOCTL(HDIO_SET_KEEPSETTINGS
)
2526 COMPATIBLE_IOCTL(HDIO_SET_UNMASKINTR
)
2527 COMPATIBLE_IOCTL(HDIO_SET_NOWERR
)
2528 COMPATIBLE_IOCTL(HDIO_SET_32BIT
)
2529 COMPATIBLE_IOCTL(HDIO_SET_MULTCOUNT
)
2530 COMPATIBLE_IOCTL(HDIO_DRIVE_CMD
)
2531 COMPATIBLE_IOCTL(HDIO_SET_PIO_MODE
)
2532 COMPATIBLE_IOCTL(HDIO_SCAN_HWIF
)
2533 COMPATIBLE_IOCTL(HDIO_SET_NICE
)
2534 /* 0x02 -- Floppy ioctls */
2535 COMPATIBLE_IOCTL(FDMSGON
)
2536 COMPATIBLE_IOCTL(FDMSGOFF
)
2537 COMPATIBLE_IOCTL(FDSETEMSGTRESH
)
2538 COMPATIBLE_IOCTL(FDFLUSH
)
2539 COMPATIBLE_IOCTL(FDWERRORCLR
)
2540 COMPATIBLE_IOCTL(FDSETMAXERRS
)
2541 COMPATIBLE_IOCTL(FDGETMAXERRS
)
2542 COMPATIBLE_IOCTL(FDGETDRVTYP
)
2543 COMPATIBLE_IOCTL(FDEJECT
)
2544 COMPATIBLE_IOCTL(FDCLRPRM
)
2545 COMPATIBLE_IOCTL(FDFMTBEG
)
2546 COMPATIBLE_IOCTL(FDFMTEND
)
2547 COMPATIBLE_IOCTL(FDRESET
)
2548 COMPATIBLE_IOCTL(FDTWADDLE
)
2549 COMPATIBLE_IOCTL(FDFMTTRK
)
2550 COMPATIBLE_IOCTL(FDRAWCMD
)
2552 COMPATIBLE_IOCTL(BLKROSET
)
2553 COMPATIBLE_IOCTL(BLKROGET
)
2554 COMPATIBLE_IOCTL(BLKRRPART
)
2555 COMPATIBLE_IOCTL(BLKFLSBUF
)
2556 COMPATIBLE_IOCTL(BLKRASET
)
2557 COMPATIBLE_IOCTL(BLKFRASET
)
2558 COMPATIBLE_IOCTL(BLKSECTSET
)
2559 COMPATIBLE_IOCTL(BLKSSZGET
)
2562 #if 0 /* New RAID code is being merged, fix up to handle
2563 * new RAID ioctls when fully merged in 2.3.x -DaveM
2566 COMPATIBLE_IOCTL(REGISTER_DEV
)
2567 COMPATIBLE_IOCTL(REGISTER_DEV_NEW
)
2568 COMPATIBLE_IOCTL(START_MD
)
2569 COMPATIBLE_IOCTL(STOP_MD
)
2573 COMPATIBLE_IOCTL(PIO_FONT
)
2574 COMPATIBLE_IOCTL(GIO_FONT
)
2575 COMPATIBLE_IOCTL(KDSIGACCEPT
)
2576 COMPATIBLE_IOCTL(KDGETKEYCODE
)
2577 COMPATIBLE_IOCTL(KDSETKEYCODE
)
2578 COMPATIBLE_IOCTL(KIOCSOUND
)
2579 COMPATIBLE_IOCTL(KDMKTONE
)
2580 COMPATIBLE_IOCTL(KDGKBTYPE
)
2581 COMPATIBLE_IOCTL(KDSETMODE
)
2582 COMPATIBLE_IOCTL(KDGETMODE
)
2583 COMPATIBLE_IOCTL(KDSKBMODE
)
2584 COMPATIBLE_IOCTL(KDGKBMODE
)
2585 COMPATIBLE_IOCTL(KDSKBMETA
)
2586 COMPATIBLE_IOCTL(KDGKBMETA
)
2587 COMPATIBLE_IOCTL(KDGKBENT
)
2588 COMPATIBLE_IOCTL(KDSKBENT
)
2589 COMPATIBLE_IOCTL(KDGKBSENT
)
2590 COMPATIBLE_IOCTL(KDSKBSENT
)
2591 COMPATIBLE_IOCTL(KDGKBDIACR
)
2592 COMPATIBLE_IOCTL(KDSKBDIACR
)
2593 COMPATIBLE_IOCTL(KDGKBLED
)
2594 COMPATIBLE_IOCTL(KDSKBLED
)
2595 COMPATIBLE_IOCTL(KDGETLED
)
2596 COMPATIBLE_IOCTL(KDSETLED
)
2597 COMPATIBLE_IOCTL(GIO_SCRNMAP
)
2598 COMPATIBLE_IOCTL(PIO_SCRNMAP
)
2599 COMPATIBLE_IOCTL(GIO_UNISCRNMAP
)
2600 COMPATIBLE_IOCTL(PIO_UNISCRNMAP
)
2601 COMPATIBLE_IOCTL(PIO_FONTRESET
)
2602 COMPATIBLE_IOCTL(PIO_UNIMAPCLR
)
2604 COMPATIBLE_IOCTL(KIOCTYPE
)
2605 COMPATIBLE_IOCTL(KIOCLAYOUT
)
2606 COMPATIBLE_IOCTL(KIOCGTRANS
)
2607 COMPATIBLE_IOCTL(KIOCTRANS
)
2608 COMPATIBLE_IOCTL(KIOCCMD
)
2609 COMPATIBLE_IOCTL(KIOCSDIRECT
)
2610 COMPATIBLE_IOCTL(KIOCSLED
)
2611 COMPATIBLE_IOCTL(KIOCGLED
)
2612 COMPATIBLE_IOCTL(KIOCSRATE
)
2613 COMPATIBLE_IOCTL(KIOCGRATE
)
2615 COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN
)
2616 COMPATIBLE_IOCTL(SCSI_IOCTL_DOORLOCK
)
2617 COMPATIBLE_IOCTL(SCSI_IOCTL_DOORUNLOCK
)
2618 COMPATIBLE_IOCTL(SCSI_IOCTL_TEST_UNIT_READY
)
2619 COMPATIBLE_IOCTL(SCSI_IOCTL_TAGGED_ENABLE
)
2620 COMPATIBLE_IOCTL(SCSI_IOCTL_TAGGED_DISABLE
)
2621 COMPATIBLE_IOCTL(SCSI_IOCTL_GET_BUS_NUMBER
)
2622 COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND
)
2624 COMPATIBLE_IOCTL(VT_SETMODE
)
2625 COMPATIBLE_IOCTL(VT_GETMODE
)
2626 COMPATIBLE_IOCTL(VT_GETSTATE
)
2627 COMPATIBLE_IOCTL(VT_OPENQRY
)
2628 COMPATIBLE_IOCTL(VT_ACTIVATE
)
2629 COMPATIBLE_IOCTL(VT_WAITACTIVE
)
2630 COMPATIBLE_IOCTL(VT_RELDISP
)
2631 COMPATIBLE_IOCTL(VT_DISALLOCATE
)
2632 COMPATIBLE_IOCTL(VT_RESIZE
)
2633 COMPATIBLE_IOCTL(VT_RESIZEX
)
2634 COMPATIBLE_IOCTL(VT_LOCKSWITCH
)
2635 COMPATIBLE_IOCTL(VT_UNLOCKSWITCH
)
2637 COMPATIBLE_IOCTL(VUIDSFORMAT
)
2638 COMPATIBLE_IOCTL(VUIDGFORMAT
)
2639 /* Little v, the video4linux ioctls */
2640 COMPATIBLE_IOCTL(VIDIOCGCAP
)
2641 COMPATIBLE_IOCTL(VIDIOCGCHAN
)
2642 COMPATIBLE_IOCTL(VIDIOCSCHAN
)
2643 COMPATIBLE_IOCTL(VIDIOCGPICT
)
2644 COMPATIBLE_IOCTL(VIDIOCSPICT
)
2645 COMPATIBLE_IOCTL(VIDIOCCAPTURE
)
2646 COMPATIBLE_IOCTL(VIDIOCKEY
)
2647 COMPATIBLE_IOCTL(VIDIOCGAUDIO
)
2648 COMPATIBLE_IOCTL(VIDIOCSAUDIO
)
2649 COMPATIBLE_IOCTL(VIDIOCSYNC
)
2650 COMPATIBLE_IOCTL(VIDIOCMCAPTURE
)
2651 COMPATIBLE_IOCTL(VIDIOCGMBUF
)
2652 COMPATIBLE_IOCTL(VIDIOCGUNIT
)
2653 COMPATIBLE_IOCTL(VIDIOCGCAPTURE
)
2654 COMPATIBLE_IOCTL(VIDIOCSCAPTURE
)
2655 /* BTTV specific... */
2656 COMPATIBLE_IOCTL(_IOW('v', BASE_VIDIOCPRIVATE
+0, char [256]))
2657 COMPATIBLE_IOCTL(_IOR('v', BASE_VIDIOCPRIVATE
+1, char [256]))
2658 COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE
+2, unsigned int))
2659 COMPATIBLE_IOCTL(_IOW('v' , BASE_VIDIOCPRIVATE
+3, char [16])) /* struct bttv_pll_info */
2660 COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE
+4, int))
2661 COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE
+5, int))
2662 COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE
+6, int))
2663 COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE
+7, int))
2664 /* Little p (/dev/rtc, /dev/envctrl, etc.) */
2665 COMPATIBLE_IOCTL(RTCGET
)
2666 COMPATIBLE_IOCTL(RTCSET
)
2667 COMPATIBLE_IOCTL(I2CIOCSADR
)
2668 COMPATIBLE_IOCTL(I2CIOCGADR
)
2670 COMPATIBLE_IOCTL(MTIOCTOP
)
2671 /* OPENPROMIO, SunOS/Solaris only, the NetBSD one's have
2672 * embedded pointers in the arg which we'd need to clean up...
2674 COMPATIBLE_IOCTL(OPROMGETOPT
)
2675 COMPATIBLE_IOCTL(OPROMSETOPT
)
2676 COMPATIBLE_IOCTL(OPROMNXTOPT
)
2677 COMPATIBLE_IOCTL(OPROMSETOPT2
)
2678 COMPATIBLE_IOCTL(OPROMNEXT
)
2679 COMPATIBLE_IOCTL(OPROMCHILD
)
2680 COMPATIBLE_IOCTL(OPROMGETPROP
)
2681 COMPATIBLE_IOCTL(OPROMNXTPROP
)
2682 COMPATIBLE_IOCTL(OPROMU2P
)
2683 COMPATIBLE_IOCTL(OPROMGETCONS
)
2684 COMPATIBLE_IOCTL(OPROMGETFBNAME
)
2685 COMPATIBLE_IOCTL(OPROMGETBOOTARGS
)
2686 COMPATIBLE_IOCTL(OPROMSETCUR
)
2687 COMPATIBLE_IOCTL(OPROMPCI2NODE
)
2688 COMPATIBLE_IOCTL(OPROMPATH2NODE
)
2689 /* Socket level stuff */
2690 COMPATIBLE_IOCTL(FIOSETOWN
)
2691 COMPATIBLE_IOCTL(SIOCSPGRP
)
2692 COMPATIBLE_IOCTL(FIOGETOWN
)
2693 COMPATIBLE_IOCTL(SIOCGPGRP
)
2694 COMPATIBLE_IOCTL(SIOCATMARK
)
2695 COMPATIBLE_IOCTL(SIOCSIFLINK
)
2696 COMPATIBLE_IOCTL(SIOCSIFENCAP
)
2697 COMPATIBLE_IOCTL(SIOCGIFENCAP
)
2698 COMPATIBLE_IOCTL(SIOCSIFBR
)
2699 COMPATIBLE_IOCTL(SIOCGIFBR
)
2700 COMPATIBLE_IOCTL(SIOCSARP
)
2701 COMPATIBLE_IOCTL(SIOCGARP
)
2702 COMPATIBLE_IOCTL(SIOCDARP
)
2703 #if 0 /* XXX No longer exist in new routing code. XXX */
2704 COMPATIBLE_IOCTL(OLD_SIOCSARP
)
2705 COMPATIBLE_IOCTL(OLD_SIOCGARP
)
2706 COMPATIBLE_IOCTL(OLD_SIOCDARP
)
2708 COMPATIBLE_IOCTL(SIOCSRARP
)
2709 COMPATIBLE_IOCTL(SIOCGRARP
)
2710 COMPATIBLE_IOCTL(SIOCDRARP
)
2711 COMPATIBLE_IOCTL(SIOCADDDLCI
)
2712 COMPATIBLE_IOCTL(SIOCDELDLCI
)
2714 COMPATIBLE_IOCTL(SG_SET_TIMEOUT
)
2715 COMPATIBLE_IOCTL(SG_GET_TIMEOUT
)
2716 COMPATIBLE_IOCTL(SG_EMULATED_HOST
)
2717 COMPATIBLE_IOCTL(SG_SET_TRANSFORM
)
2718 COMPATIBLE_IOCTL(SG_GET_TRANSFORM
)
2719 COMPATIBLE_IOCTL(SG_SET_RESERVED_SIZE
)
2720 COMPATIBLE_IOCTL(SG_GET_RESERVED_SIZE
)
2721 COMPATIBLE_IOCTL(SG_GET_SCSI_ID
)
2722 COMPATIBLE_IOCTL(SG_SET_FORCE_LOW_DMA
)
2723 COMPATIBLE_IOCTL(SG_GET_LOW_DMA
)
2724 COMPATIBLE_IOCTL(SG_SET_FORCE_PACK_ID
)
2725 COMPATIBLE_IOCTL(SG_GET_PACK_ID
)
2726 COMPATIBLE_IOCTL(SG_GET_NUM_WAITING
)
2727 COMPATIBLE_IOCTL(SG_SET_DEBUG
)
2728 COMPATIBLE_IOCTL(SG_GET_SG_TABLESIZE
)
2729 COMPATIBLE_IOCTL(SG_GET_COMMAND_Q
)
2730 COMPATIBLE_IOCTL(SG_SET_COMMAND_Q
)
2731 COMPATIBLE_IOCTL(SG_GET_VERSION_NUM
)
2732 COMPATIBLE_IOCTL(SG_NEXT_CMD_LEN
)
2733 COMPATIBLE_IOCTL(SG_SCSI_RESET
)
2734 COMPATIBLE_IOCTL(SG_IO
)
2735 COMPATIBLE_IOCTL(SG_GET_REQUEST_TABLE
)
2736 COMPATIBLE_IOCTL(SG_SET_KEEP_ORPHAN
)
2737 COMPATIBLE_IOCTL(SG_GET_KEEP_ORPHAN
)
2739 COMPATIBLE_IOCTL(PPPIOCGFLAGS
)
2740 COMPATIBLE_IOCTL(PPPIOCSFLAGS
)
2741 COMPATIBLE_IOCTL(PPPIOCGASYNCMAP
)
2742 COMPATIBLE_IOCTL(PPPIOCSASYNCMAP
)
2743 COMPATIBLE_IOCTL(PPPIOCGUNIT
)
2744 COMPATIBLE_IOCTL(PPPIOCGRASYNCMAP
)
2745 COMPATIBLE_IOCTL(PPPIOCSRASYNCMAP
)
2746 COMPATIBLE_IOCTL(PPPIOCGMRU
)
2747 COMPATIBLE_IOCTL(PPPIOCSMRU
)
2748 COMPATIBLE_IOCTL(PPPIOCSMAXCID
)
2749 COMPATIBLE_IOCTL(PPPIOCGXASYNCMAP
)
2750 COMPATIBLE_IOCTL(PPPIOCSXASYNCMAP
)
2751 COMPATIBLE_IOCTL(PPPIOCXFERUNIT
)
2752 COMPATIBLE_IOCTL(PPPIOCGNPMODE
)
2753 COMPATIBLE_IOCTL(PPPIOCSNPMODE
)
2754 COMPATIBLE_IOCTL(PPPIOCGDEBUG
)
2755 COMPATIBLE_IOCTL(PPPIOCSDEBUG
)
2756 COMPATIBLE_IOCTL(PPPIOCNEWUNIT
)
2757 COMPATIBLE_IOCTL(PPPIOCATTACH
)
2758 COMPATIBLE_IOCTL(PPPIOCDETACH
)
2759 COMPATIBLE_IOCTL(PPPIOCSMRRU
)
2760 COMPATIBLE_IOCTL(PPPIOCCONNECT
)
2761 COMPATIBLE_IOCTL(PPPIOCDISCONN
)
2762 COMPATIBLE_IOCTL(PPPIOCATTCHAN
)
2764 COMPATIBLE_IOCTL(CDROMPAUSE
)
2765 COMPATIBLE_IOCTL(CDROMRESUME
)
2766 COMPATIBLE_IOCTL(CDROMPLAYMSF
)
2767 COMPATIBLE_IOCTL(CDROMPLAYTRKIND
)
2768 COMPATIBLE_IOCTL(CDROMREADTOCHDR
)
2769 COMPATIBLE_IOCTL(CDROMREADTOCENTRY
)
2770 COMPATIBLE_IOCTL(CDROMSTOP
)
2771 COMPATIBLE_IOCTL(CDROMSTART
)
2772 COMPATIBLE_IOCTL(CDROMEJECT
)
2773 COMPATIBLE_IOCTL(CDROMVOLCTRL
)
2774 COMPATIBLE_IOCTL(CDROMSUBCHNL
)
2775 COMPATIBLE_IOCTL(CDROMEJECT_SW
)
2776 COMPATIBLE_IOCTL(CDROMMULTISESSION
)
2777 COMPATIBLE_IOCTL(CDROM_GET_MCN
)
2778 COMPATIBLE_IOCTL(CDROMRESET
)
2779 COMPATIBLE_IOCTL(CDROMVOLREAD
)
2780 COMPATIBLE_IOCTL(CDROMSEEK
)
2781 COMPATIBLE_IOCTL(CDROMPLAYBLK
)
2782 COMPATIBLE_IOCTL(CDROMCLOSETRAY
)
2783 COMPATIBLE_IOCTL(CDROM_SET_OPTIONS
)
2784 COMPATIBLE_IOCTL(CDROM_CLEAR_OPTIONS
)
2785 COMPATIBLE_IOCTL(CDROM_SELECT_SPEED
)
2786 COMPATIBLE_IOCTL(CDROM_SELECT_DISC
)
2787 COMPATIBLE_IOCTL(CDROM_MEDIA_CHANGED
)
2788 COMPATIBLE_IOCTL(CDROM_DRIVE_STATUS
)
2789 COMPATIBLE_IOCTL(CDROM_DISC_STATUS
)
2790 COMPATIBLE_IOCTL(CDROM_CHANGER_NSLOTS
)
2791 COMPATIBLE_IOCTL(CDROM_LOCKDOOR
)
2792 COMPATIBLE_IOCTL(CDROM_DEBUG
)
2793 COMPATIBLE_IOCTL(CDROM_GET_CAPABILITY
)
2795 COMPATIBLE_IOCTL(LOOP_SET_FD
)
2796 COMPATIBLE_IOCTL(LOOP_CLR_FD
)
2798 COMPATIBLE_IOCTL(AUDIO_GETINFO
)
2799 COMPATIBLE_IOCTL(AUDIO_SETINFO
)
2800 COMPATIBLE_IOCTL(AUDIO_DRAIN
)
2801 COMPATIBLE_IOCTL(AUDIO_GETDEV
)
2802 COMPATIBLE_IOCTL(AUDIO_GETDEV_SUNOS
)
2803 COMPATIBLE_IOCTL(AUDIO_FLUSH
)
2804 /* Big Q for sound/OSS */
2805 COMPATIBLE_IOCTL(SNDCTL_SEQ_RESET
)
2806 COMPATIBLE_IOCTL(SNDCTL_SEQ_SYNC
)
2807 COMPATIBLE_IOCTL(SNDCTL_SYNTH_INFO
)
2808 COMPATIBLE_IOCTL(SNDCTL_SEQ_CTRLRATE
)
2809 COMPATIBLE_IOCTL(SNDCTL_SEQ_GETOUTCOUNT
)
2810 COMPATIBLE_IOCTL(SNDCTL_SEQ_GETINCOUNT
)
2811 COMPATIBLE_IOCTL(SNDCTL_SEQ_PERCMODE
)
2812 COMPATIBLE_IOCTL(SNDCTL_FM_LOAD_INSTR
)
2813 COMPATIBLE_IOCTL(SNDCTL_SEQ_TESTMIDI
)
2814 COMPATIBLE_IOCTL(SNDCTL_SEQ_RESETSAMPLES
)
2815 COMPATIBLE_IOCTL(SNDCTL_SEQ_NRSYNTHS
)
2816 COMPATIBLE_IOCTL(SNDCTL_SEQ_NRMIDIS
)
2817 COMPATIBLE_IOCTL(SNDCTL_MIDI_INFO
)
2818 COMPATIBLE_IOCTL(SNDCTL_SEQ_THRESHOLD
)
2819 COMPATIBLE_IOCTL(SNDCTL_SYNTH_MEMAVL
)
2820 COMPATIBLE_IOCTL(SNDCTL_FM_4OP_ENABLE
)
2821 COMPATIBLE_IOCTL(SNDCTL_SEQ_PANIC
)
2822 COMPATIBLE_IOCTL(SNDCTL_SEQ_OUTOFBAND
)
2823 COMPATIBLE_IOCTL(SNDCTL_SEQ_GETTIME
)
2824 COMPATIBLE_IOCTL(SNDCTL_SYNTH_ID
)
2825 COMPATIBLE_IOCTL(SNDCTL_SYNTH_CONTROL
)
2826 COMPATIBLE_IOCTL(SNDCTL_SYNTH_REMOVESAMPLE
)
2827 /* Big T for sound/OSS */
2828 COMPATIBLE_IOCTL(SNDCTL_TMR_TIMEBASE
)
2829 COMPATIBLE_IOCTL(SNDCTL_TMR_START
)
2830 COMPATIBLE_IOCTL(SNDCTL_TMR_STOP
)
2831 COMPATIBLE_IOCTL(SNDCTL_TMR_CONTINUE
)
2832 COMPATIBLE_IOCTL(SNDCTL_TMR_TEMPO
)
2833 COMPATIBLE_IOCTL(SNDCTL_TMR_SOURCE
)
2834 COMPATIBLE_IOCTL(SNDCTL_TMR_METRONOME
)
2835 COMPATIBLE_IOCTL(SNDCTL_TMR_SELECT
)
2836 /* Little m for sound/OSS */
2837 COMPATIBLE_IOCTL(SNDCTL_MIDI_PRETIME
)
2838 COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUMODE
)
2839 COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUCMD
)
2840 /* Big P for sound/OSS */
2841 COMPATIBLE_IOCTL(SNDCTL_DSP_RESET
)
2842 COMPATIBLE_IOCTL(SNDCTL_DSP_SYNC
)
2843 COMPATIBLE_IOCTL(SNDCTL_DSP_SPEED
)
2844 COMPATIBLE_IOCTL(SNDCTL_DSP_STEREO
)
2845 COMPATIBLE_IOCTL(SNDCTL_DSP_GETBLKSIZE
)
2846 COMPATIBLE_IOCTL(SNDCTL_DSP_CHANNELS
)
2847 COMPATIBLE_IOCTL(SOUND_PCM_WRITE_FILTER
)
2848 COMPATIBLE_IOCTL(SNDCTL_DSP_POST
)
2849 COMPATIBLE_IOCTL(SNDCTL_DSP_SUBDIVIDE
)
2850 COMPATIBLE_IOCTL(SNDCTL_DSP_SETFRAGMENT
)
2851 COMPATIBLE_IOCTL(SNDCTL_DSP_GETFMTS
)
2852 COMPATIBLE_IOCTL(SNDCTL_DSP_SETFMT
)
2853 COMPATIBLE_IOCTL(SNDCTL_DSP_GETOSPACE
)
2854 COMPATIBLE_IOCTL(SNDCTL_DSP_GETISPACE
)
2855 COMPATIBLE_IOCTL(SNDCTL_DSP_NONBLOCK
)
2856 COMPATIBLE_IOCTL(SNDCTL_DSP_GETCAPS
)
2857 COMPATIBLE_IOCTL(SNDCTL_DSP_GETTRIGGER
)
2858 COMPATIBLE_IOCTL(SNDCTL_DSP_SETTRIGGER
)
2859 COMPATIBLE_IOCTL(SNDCTL_DSP_GETIPTR
)
2860 COMPATIBLE_IOCTL(SNDCTL_DSP_GETOPTR
)
2861 /* SNDCTL_DSP_MAPINBUF, XXX needs translation */
2862 /* SNDCTL_DSP_MAPOUTBUF, XXX needs translation */
2863 COMPATIBLE_IOCTL(SNDCTL_DSP_SETSYNCRO
)
2864 COMPATIBLE_IOCTL(SNDCTL_DSP_SETDUPLEX
)
2865 COMPATIBLE_IOCTL(SNDCTL_DSP_GETODELAY
)
2866 COMPATIBLE_IOCTL(SNDCTL_DSP_PROFILE
)
2867 COMPATIBLE_IOCTL(SOUND_PCM_READ_RATE
)
2868 COMPATIBLE_IOCTL(SOUND_PCM_READ_CHANNELS
)
2869 COMPATIBLE_IOCTL(SOUND_PCM_READ_BITS
)
2870 COMPATIBLE_IOCTL(SOUND_PCM_READ_FILTER
)
2871 /* Big C for sound/OSS */
2872 COMPATIBLE_IOCTL(SNDCTL_COPR_RESET
)
2873 COMPATIBLE_IOCTL(SNDCTL_COPR_LOAD
)
2874 COMPATIBLE_IOCTL(SNDCTL_COPR_RDATA
)
2875 COMPATIBLE_IOCTL(SNDCTL_COPR_RCODE
)
2876 COMPATIBLE_IOCTL(SNDCTL_COPR_WDATA
)
2877 COMPATIBLE_IOCTL(SNDCTL_COPR_WCODE
)
2878 COMPATIBLE_IOCTL(SNDCTL_COPR_RUN
)
2879 COMPATIBLE_IOCTL(SNDCTL_COPR_HALT
)
2880 COMPATIBLE_IOCTL(SNDCTL_COPR_SENDMSG
)
2881 COMPATIBLE_IOCTL(SNDCTL_COPR_RCVMSG
)
2882 /* Big M for sound/OSS */
2883 COMPATIBLE_IOCTL(SOUND_MIXER_READ_VOLUME
)
2884 COMPATIBLE_IOCTL(SOUND_MIXER_READ_BASS
)
2885 COMPATIBLE_IOCTL(SOUND_MIXER_READ_TREBLE
)
2886 COMPATIBLE_IOCTL(SOUND_MIXER_READ_SYNTH
)
2887 COMPATIBLE_IOCTL(SOUND_MIXER_READ_PCM
)
2888 COMPATIBLE_IOCTL(SOUND_MIXER_READ_SPEAKER
)
2889 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE
)
2890 COMPATIBLE_IOCTL(SOUND_MIXER_READ_MIC
)
2891 COMPATIBLE_IOCTL(SOUND_MIXER_READ_CD
)
2892 COMPATIBLE_IOCTL(SOUND_MIXER_READ_IMIX
)
2893 COMPATIBLE_IOCTL(SOUND_MIXER_READ_ALTPCM
)
2894 COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECLEV
)
2895 COMPATIBLE_IOCTL(SOUND_MIXER_READ_IGAIN
)
2896 COMPATIBLE_IOCTL(SOUND_MIXER_READ_OGAIN
)
2897 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE1
)
2898 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE2
)
2899 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE3
)
2900 COMPATIBLE_IOCTL(SOUND_MIXER_READ_MUTE
)
2901 /* SOUND_MIXER_READ_ENHANCE, same value as READ_MUTE */
2902 /* SOUND_MIXER_READ_LOUD, same value as READ_MUTE */
2903 COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECSRC
)
2904 COMPATIBLE_IOCTL(SOUND_MIXER_READ_DEVMASK
)
2905 COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECMASK
)
2906 COMPATIBLE_IOCTL(SOUND_MIXER_READ_STEREODEVS
)
2907 COMPATIBLE_IOCTL(SOUND_MIXER_READ_CAPS
)
2908 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_VOLUME
)
2909 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_BASS
)
2910 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_TREBLE
)
2911 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SYNTH
)
2912 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_PCM
)
2913 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SPEAKER
)
2914 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE
)
2915 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MIC
)
2916 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_CD
)
2917 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IMIX
)
2918 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_ALTPCM
)
2919 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECLEV
)
2920 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IGAIN
)
2921 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_OGAIN
)
2922 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE1
)
2923 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE2
)
2924 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE3
)
2925 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MUTE
)
2926 /* SOUND_MIXER_WRITE_ENHANCE, same value as WRITE_MUTE */
2927 /* SOUND_MIXER_WRITE_LOUD, same value as WRITE_MUTE */
2928 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECSRC
)
2929 COMPATIBLE_IOCTL(SOUND_MIXER_INFO
)
2930 COMPATIBLE_IOCTL(SOUND_OLD_MIXER_INFO
)
2931 COMPATIBLE_IOCTL(SOUND_MIXER_ACCESS
)
2932 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE1
)
2933 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE2
)
2934 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE3
)
2935 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE4
)
2936 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE5
)
2937 COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS
)
2938 COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS
)
2939 COMPATIBLE_IOCTL(OSS_GETVERSION
)
2941 COMPATIBLE_IOCTL(AUTOFS_IOC_READY
)
2942 COMPATIBLE_IOCTL(AUTOFS_IOC_FAIL
)
2943 COMPATIBLE_IOCTL(AUTOFS_IOC_CATATONIC
)
2944 COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOVER
)
2945 COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE
)
2947 COMPATIBLE_IOCTL(DEVFSDIOC_GET_PROTO_REV
)
2948 COMPATIBLE_IOCTL(DEVFSDIOC_SET_EVENT_MASK
)
2949 COMPATIBLE_IOCTL(DEVFSDIOC_RELEASE_EVENT_QUEUE
)
2950 COMPATIBLE_IOCTL(DEVFSDIOC_SET_DEBUG_MASK
)
2952 COMPATIBLE_IOCTL(RAW_SETBIND
)
2953 COMPATIBLE_IOCTL(RAW_GETBIND
)
2954 /* SMB ioctls which do not need any translations */
2955 COMPATIBLE_IOCTL(SMB_IOC_NEWCONN
)
2957 COMPATIBLE_IOCTL(ATMSIGD_CTRL
)
2958 COMPATIBLE_IOCTL(ATMARPD_CTRL
)
2959 COMPATIBLE_IOCTL(ATMLEC_CTRL
)
2960 COMPATIBLE_IOCTL(ATMLEC_MCAST
)
2961 COMPATIBLE_IOCTL(ATMLEC_DATA
)
2962 COMPATIBLE_IOCTL(ATM_SETSC
)
2963 COMPATIBLE_IOCTL(SIOCSIFATMTCP
)
2964 COMPATIBLE_IOCTL(SIOCMKCLIP
)
2965 COMPATIBLE_IOCTL(ATMARP_MKIP
)
2966 COMPATIBLE_IOCTL(ATMARP_SETENTRY
)
2967 COMPATIBLE_IOCTL(ATMARP_ENCAP
)
2968 COMPATIBLE_IOCTL(ATMTCP_CREATE
)
2969 COMPATIBLE_IOCTL(ATMTCP_REMOVE
)
2970 COMPATIBLE_IOCTL(ATMMPC_CTRL
)
2971 COMPATIBLE_IOCTL(ATMMPC_DATA
)
2972 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
2974 COMPATIBLE_IOCTL(VG_SET_EXTENDABLE
)
2975 COMPATIBLE_IOCTL(VG_STATUS_GET_COUNT
)
2976 COMPATIBLE_IOCTL(VG_STATUS_GET_NAMELIST
)
2977 COMPATIBLE_IOCTL(VG_REMOVE
)
2978 COMPATIBLE_IOCTL(VG_REDUCE
)
2979 COMPATIBLE_IOCTL(PE_LOCK_UNLOCK
)
2980 COMPATIBLE_IOCTL(PV_FLUSH
)
2981 COMPATIBLE_IOCTL(LVM_LOCK_LVM
)
2982 COMPATIBLE_IOCTL(LVM_GET_IOP_VERSION
)
2983 #ifdef LVM_TOTAL_RESET
2984 COMPATIBLE_IOCTL(LVM_RESET
)
2986 COMPATIBLE_IOCTL(LV_SET_ACCESS
)
2987 COMPATIBLE_IOCTL(LV_SET_STATUS
)
2988 COMPATIBLE_IOCTL(LV_SET_ALLOCATION
)
2990 /* And these ioctls need translation */
2991 HANDLE_IOCTL(SIOCGIFNAME
, dev_ifname32
)
2992 HANDLE_IOCTL(SIOCGIFCONF
, dev_ifconf
)
2993 HANDLE_IOCTL(SIOCGIFFLAGS
, dev_ifsioc
)
2994 HANDLE_IOCTL(SIOCSIFFLAGS
, dev_ifsioc
)
2995 HANDLE_IOCTL(SIOCGIFMETRIC
, dev_ifsioc
)
2996 HANDLE_IOCTL(SIOCSIFMETRIC
, dev_ifsioc
)
2997 HANDLE_IOCTL(SIOCGIFMTU
, dev_ifsioc
)
2998 HANDLE_IOCTL(SIOCSIFMTU
, dev_ifsioc
)
2999 HANDLE_IOCTL(SIOCGIFMEM
, dev_ifsioc
)
3000 HANDLE_IOCTL(SIOCSIFMEM
, dev_ifsioc
)
3001 HANDLE_IOCTL(SIOCGIFHWADDR
, dev_ifsioc
)
3002 HANDLE_IOCTL(SIOCSIFHWADDR
, dev_ifsioc
)
3003 HANDLE_IOCTL(SIOCADDMULTI
, dev_ifsioc
)
3004 HANDLE_IOCTL(SIOCDELMULTI
, dev_ifsioc
)
3005 HANDLE_IOCTL(SIOCGIFINDEX
, dev_ifsioc
)
3006 HANDLE_IOCTL(SIOCGIFMAP
, dev_ifsioc
)
3007 HANDLE_IOCTL(SIOCSIFMAP
, dev_ifsioc
)
3008 HANDLE_IOCTL(SIOCGIFADDR
, dev_ifsioc
)
3009 HANDLE_IOCTL(SIOCSIFADDR
, dev_ifsioc
)
3010 HANDLE_IOCTL(SIOCGIFBRDADDR
, dev_ifsioc
)
3011 HANDLE_IOCTL(SIOCSIFBRDADDR
, dev_ifsioc
)
3012 HANDLE_IOCTL(SIOCGIFDSTADDR
, dev_ifsioc
)
3013 HANDLE_IOCTL(SIOCSIFDSTADDR
, dev_ifsioc
)
3014 HANDLE_IOCTL(SIOCGIFNETMASK
, dev_ifsioc
)
3015 HANDLE_IOCTL(SIOCSIFNETMASK
, dev_ifsioc
)
3016 HANDLE_IOCTL(SIOCSIFPFLAGS
, dev_ifsioc
)
3017 HANDLE_IOCTL(SIOCGIFPFLAGS
, dev_ifsioc
)
3018 HANDLE_IOCTL(SIOCGPPPSTATS
, dev_ifsioc
)
3019 HANDLE_IOCTL(SIOCGPPPCSTATS
, dev_ifsioc
)
3020 HANDLE_IOCTL(SIOCGPPPVER
, dev_ifsioc
)
3021 HANDLE_IOCTL(SIOCGIFTXQLEN
, dev_ifsioc
)
3022 HANDLE_IOCTL(SIOCSIFTXQLEN
, dev_ifsioc
)
3023 HANDLE_IOCTL(SIOCETHTOOL
, dev_ifsioc
)
3024 HANDLE_IOCTL(SIOCADDRT
, routing_ioctl
)
3025 HANDLE_IOCTL(SIOCDELRT
, routing_ioctl
)
3026 /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
3027 HANDLE_IOCTL(SIOCRTMSG
, ret_einval
)
3028 HANDLE_IOCTL(SIOCGSTAMP
, do_siocgstamp
)
3029 HANDLE_IOCTL(HDIO_GETGEO
, hdio_getgeo
)
3030 HANDLE_IOCTL(BLKRAGET
, w_long
)
3031 HANDLE_IOCTL(BLKGETSIZE
, w_long
)
3032 HANDLE_IOCTL(0x1260, broken_blkgetsize
)
3033 HANDLE_IOCTL(BLKFRAGET
, w_long
)
3034 HANDLE_IOCTL(BLKSECTGET
, w_long
)
3035 HANDLE_IOCTL(BLKPG
, blkpg_ioctl_trans
)
3036 HANDLE_IOCTL(BLKELVGET
, do_blkelv_ioctl
)
3037 HANDLE_IOCTL(BLKELVSET
, do_blkelv_ioctl
)
3038 HANDLE_IOCTL(FBIOPUTCMAP32
, fbiogetputcmap
)
3039 HANDLE_IOCTL(FBIOGETCMAP32
, fbiogetputcmap
)
3040 HANDLE_IOCTL(FBIOSCURSOR32
, fbiogscursor
)
3041 HANDLE_IOCTL(FBIOGET_FSCREENINFO
, fb_ioctl_trans
)
3042 HANDLE_IOCTL(FBIOGETCMAP
, fb_ioctl_trans
)
3043 HANDLE_IOCTL(FBIOPUTCMAP
, fb_ioctl_trans
)
3044 HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS
, hdio_ioctl_trans
)
3045 HANDLE_IOCTL(HDIO_GET_UNMASKINTR
, hdio_ioctl_trans
)
3046 HANDLE_IOCTL(HDIO_GET_DMA
, hdio_ioctl_trans
)
3047 HANDLE_IOCTL(HDIO_GET_32BIT
, hdio_ioctl_trans
)
3048 HANDLE_IOCTL(HDIO_GET_MULTCOUNT
, hdio_ioctl_trans
)
3049 HANDLE_IOCTL(HDIO_GET_NOWERR
, hdio_ioctl_trans
)
3050 HANDLE_IOCTL(HDIO_GET_NICE
, hdio_ioctl_trans
)
3051 HANDLE_IOCTL(FDSETPRM32
, fd_ioctl_trans
)
3052 HANDLE_IOCTL(FDDEFPRM32
, fd_ioctl_trans
)
3053 HANDLE_IOCTL(FDGETPRM32
, fd_ioctl_trans
)
3054 HANDLE_IOCTL(FDSETDRVPRM32
, fd_ioctl_trans
)
3055 HANDLE_IOCTL(FDGETDRVPRM32
, fd_ioctl_trans
)
3056 HANDLE_IOCTL(FDGETDRVSTAT32
, fd_ioctl_trans
)
3057 HANDLE_IOCTL(FDPOLLDRVSTAT32
, fd_ioctl_trans
)
3058 HANDLE_IOCTL(FDGETFDCSTAT32
, fd_ioctl_trans
)
3059 HANDLE_IOCTL(FDWERRORGET32
, fd_ioctl_trans
)
3060 HANDLE_IOCTL(PPPIOCGIDLE32
, ppp_ioctl_trans
)
3061 HANDLE_IOCTL(PPPIOCSCOMPRESS32
, ppp_ioctl_trans
)
3062 HANDLE_IOCTL(MTIOCGET32
, mt_ioctl_trans
)
3063 HANDLE_IOCTL(MTIOCPOS32
, mt_ioctl_trans
)
3064 HANDLE_IOCTL(MTIOCGETCONFIG32
, mt_ioctl_trans
)
3065 HANDLE_IOCTL(MTIOCSETCONFIG32
, mt_ioctl_trans
)
3066 HANDLE_IOCTL(CDROMREADMODE2
, cdrom_ioctl_trans
)
3067 HANDLE_IOCTL(CDROMREADMODE1
, cdrom_ioctl_trans
)
3068 HANDLE_IOCTL(CDROMREADRAW
, cdrom_ioctl_trans
)
3069 HANDLE_IOCTL(CDROMREADCOOKED
, cdrom_ioctl_trans
)
3070 HANDLE_IOCTL(CDROMREADAUDIO
, cdrom_ioctl_trans
)
3071 HANDLE_IOCTL(CDROMREADALL
, cdrom_ioctl_trans
)
3072 HANDLE_IOCTL(CDROM_SEND_PACKET
, cdrom_ioctl_trans
)
3073 HANDLE_IOCTL(LOOP_SET_STATUS
, loop_status
)
3074 HANDLE_IOCTL(LOOP_GET_STATUS
, loop_status
)
3075 #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
3076 HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32
, ioc_settimeout
)
3077 HANDLE_IOCTL(PIO_FONTX
, do_fontx_ioctl
)
3078 HANDLE_IOCTL(GIO_FONTX
, do_fontx_ioctl
)
3079 HANDLE_IOCTL(PIO_UNIMAP
, do_unimap_ioctl
)
3080 HANDLE_IOCTL(GIO_UNIMAP
, do_unimap_ioctl
)
3081 HANDLE_IOCTL(KDFONTOP
, do_kdfontop_ioctl
)
3082 HANDLE_IOCTL(EXT2_IOC32_GETFLAGS
, do_ext2_ioctl
)
3083 HANDLE_IOCTL(EXT2_IOC32_SETFLAGS
, do_ext2_ioctl
)
3084 HANDLE_IOCTL(EXT2_IOC32_GETVERSION
, do_ext2_ioctl
)
3085 HANDLE_IOCTL(EXT2_IOC32_SETVERSION
, do_ext2_ioctl
)
3086 HANDLE_IOCTL(VIDIOCGTUNER32
, do_video_ioctl
)
3087 HANDLE_IOCTL(VIDIOCSTUNER32
, do_video_ioctl
)
3088 HANDLE_IOCTL(VIDIOCGWIN32
, do_video_ioctl
)
3089 HANDLE_IOCTL(VIDIOCSWIN32
, do_video_ioctl
)
3090 HANDLE_IOCTL(VIDIOCGFBUF32
, do_video_ioctl
)
3091 HANDLE_IOCTL(VIDIOCSFBUF32
, do_video_ioctl
)
3092 HANDLE_IOCTL(VIDIOCGFREQ32
, do_video_ioctl
)
3093 HANDLE_IOCTL(VIDIOCSFREQ32
, do_video_ioctl
)
3094 /* One SMB ioctl needs translations. */
3095 #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
3096 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32
, do_smb_getmountuid
)
3097 HANDLE_IOCTL(ATM_GETLINKRATE32
, do_atm_ioctl
)
3098 HANDLE_IOCTL(ATM_GETNAMES32
, do_atm_ioctl
)
3099 HANDLE_IOCTL(ATM_GETTYPE32
, do_atm_ioctl
)
3100 HANDLE_IOCTL(ATM_GETESI32
, do_atm_ioctl
)
3101 HANDLE_IOCTL(ATM_GETADDR32
, do_atm_ioctl
)
3102 HANDLE_IOCTL(ATM_RSTADDR32
, do_atm_ioctl
)
3103 HANDLE_IOCTL(ATM_ADDADDR32
, do_atm_ioctl
)
3104 HANDLE_IOCTL(ATM_DELADDR32
, do_atm_ioctl
)
3105 HANDLE_IOCTL(ATM_GETCIRANGE32
, do_atm_ioctl
)
3106 HANDLE_IOCTL(ATM_SETCIRANGE32
, do_atm_ioctl
)
3107 HANDLE_IOCTL(ATM_SETESI32
, do_atm_ioctl
)
3108 HANDLE_IOCTL(ATM_SETESIF32
, do_atm_ioctl
)
3109 HANDLE_IOCTL(ATM_GETSTAT32
, do_atm_ioctl
)
3110 HANDLE_IOCTL(ATM_GETSTATZ32
, do_atm_ioctl
)
3111 HANDLE_IOCTL(ATM_GETLOOP32
, do_atm_ioctl
)
3112 HANDLE_IOCTL(ATM_SETLOOP32
, do_atm_ioctl
)
3113 HANDLE_IOCTL(SONET_GETSTAT
, do_atm_ioctl
)
3114 HANDLE_IOCTL(SONET_GETSTATZ
, do_atm_ioctl
)
3115 HANDLE_IOCTL(SONET_GETDIAG
, do_atm_ioctl
)
3116 HANDLE_IOCTL(SONET_SETDIAG
, do_atm_ioctl
)
3117 HANDLE_IOCTL(SONET_CLRDIAG
, do_atm_ioctl
)
3118 HANDLE_IOCTL(SONET_SETFRAMING
, do_atm_ioctl
)
3119 HANDLE_IOCTL(SONET_GETFRAMING
, do_atm_ioctl
)
3120 HANDLE_IOCTL(SONET_GETFRSENSE
, do_atm_ioctl
)
3121 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
3122 HANDLE_IOCTL(VG_STATUS
, do_lvm_ioctl
)
3123 HANDLE_IOCTL(VG_CREATE
, do_lvm_ioctl
)
3124 HANDLE_IOCTL(VG_EXTEND
, do_lvm_ioctl
)
3125 HANDLE_IOCTL(LV_CREATE
, do_lvm_ioctl
)
3126 HANDLE_IOCTL(LV_REMOVE
, do_lvm_ioctl
)
3127 HANDLE_IOCTL(LV_EXTEND
, do_lvm_ioctl
)
3128 HANDLE_IOCTL(LV_REDUCE
, do_lvm_ioctl
)
3129 HANDLE_IOCTL(LV_STATUS_BYNAME
, do_lvm_ioctl
)
3130 HANDLE_IOCTL(LV_STATUS_BYINDEX
, do_lvm_ioctl
)
3131 HANDLE_IOCTL(LE_REMAP
, do_lvm_ioctl
)
3132 HANDLE_IOCTL(PV_CHANGE
, do_lvm_ioctl
)
3133 HANDLE_IOCTL(PV_STATUS
, do_lvm_ioctl
)
3137 unsigned int ioctl32_hash_table
[1024];
3139 extern inline unsigned long ioctl32_hash(unsigned long cmd
)
3141 return ((cmd
>> 6) ^ (cmd
>> 4) ^ cmd
) & 0x3ff;
3144 static void ioctl32_insert_translation(struct ioctl_trans
*trans
)
3147 struct ioctl_trans
*t
;
3149 hash
= ioctl32_hash (trans
->cmd
);
3150 if (!ioctl32_hash_table
[hash
])
3151 ioctl32_hash_table
[hash
] = (u32
)(long)trans
;
3153 t
= (struct ioctl_trans
*)(long)ioctl32_hash_table
[hash
];
3155 t
= (struct ioctl_trans
*)(long)t
->next
;
3157 t
->next
= (u32
)(long)trans
;
3161 static int __init
init_sys32_ioctl(void)
3164 extern struct ioctl_trans ioctl_translations
[], ioctl_translations_end
[];
3166 for (i
= 0; &ioctl_translations
[i
] < &ioctl_translations_end
[0]; i
++)
3167 ioctl32_insert_translation(&ioctl_translations
[i
]);
3171 __initcall(init_sys32_ioctl
);
3173 static struct ioctl_trans
*additional_ioctls
;
3175 /* Always call these with kernel lock held! */
3177 int register_ioctl32_conversion(unsigned int cmd
, int (*handler
)(unsigned int, unsigned int, unsigned long, struct file
*))
3180 if (!additional_ioctls
) {
3181 additional_ioctls
= module_map(PAGE_SIZE
);
3182 if (!additional_ioctls
) return -ENOMEM
;
3184 for (i
= 0; i
< PAGE_SIZE
/sizeof(struct ioctl_trans
); i
++)
3185 if (!additional_ioctls
[i
].cmd
)
3187 if (i
== PAGE_SIZE
/sizeof(struct ioctl_trans
))
3189 additional_ioctls
[i
].cmd
= cmd
;
3191 additional_ioctls
[i
].handler
= (u32
)(long)sys_ioctl
;
3193 additional_ioctls
[i
].handler
= (u32
)(long)handler
;
3194 ioctl32_insert_translation(&additional_ioctls
[i
]);
3198 int unregister_ioctl32_conversion(unsigned int cmd
)
3200 unsigned long hash
= ioctl32_hash(cmd
);
3201 struct ioctl_trans
*t
, *t1
;
3203 t
= (struct ioctl_trans
*)(long)ioctl32_hash_table
[hash
];
3204 if (!t
) return -EINVAL
;
3205 if (t
->cmd
== cmd
&& t
>= additional_ioctls
&&
3206 (unsigned long)t
< ((unsigned long)additional_ioctls
) + PAGE_SIZE
) {
3207 ioctl32_hash_table
[hash
] = t
->next
;
3210 } else while (t
->next
) {
3211 t1
= (struct ioctl_trans
*)(long)t
->next
;
3212 if (t1
->cmd
== cmd
&& t1
>= additional_ioctls
&&
3213 (unsigned long)t1
< ((unsigned long)additional_ioctls
) + PAGE_SIZE
) {
3223 asmlinkage
int sys32_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
3227 int (*handler
)(unsigned int, unsigned int, unsigned long, struct file
* filp
);
3228 struct ioctl_trans
*t
;
3235 if (!filp
->f_op
|| !filp
->f_op
->ioctl
) {
3236 error
= sys_ioctl (fd
, cmd
, arg
);
3240 t
= (struct ioctl_trans
*)(long)ioctl32_hash_table
[ioctl32_hash (cmd
)];
3242 while (t
&& t
->cmd
!= cmd
)
3243 t
= (struct ioctl_trans
*)(long)t
->next
;
3245 handler
= (void *)(long)t
->handler
;
3246 error
= handler(fd
, cmd
, arg
, filp
);
3248 static int count
= 0;
3250 printk("sys32_ioctl: Unknown cmd fd(%d) "
3251 "cmd(%08x) arg(%08x)\n",
3252 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);