1 /* $Id: ioctl32.c,v 1.103 2000/11/10 05:44:33 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 #include <linux/raid/md.h>
23 #include <linux/route.h>
24 #include <linux/in6.h>
25 #include <linux/ipv6_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/if_pppox.h>
35 #include <linux/mtio.h>
36 #include <linux/cdrom.h>
37 #include <linux/loop.h>
38 #include <linux/auto_fs.h>
39 #include <linux/devfs_fs.h>
40 #include <linux/tty.h>
41 #include <linux/vt_kern.h>
43 #include <linux/ext2_fs.h>
44 #include <linux/videodev.h>
45 #include <linux/netdevice.h>
46 #include <linux/raw.h>
47 #include <linux/smb_fs.h>
48 #include <linux/blkpg.h>
49 #include <linux/blk.h>
50 #include <linux/elevator.h>
51 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
52 /* Ugh. This header really is not clean */
55 #include <linux/lvm.h>
58 #include <scsi/scsi.h>
61 #include <scsi/scsi_ioctl.h>
65 #include <asm/types.h>
66 #include <asm/uaccess.h>
69 #include <asm/vuid_event.h>
71 #include <asm/openpromio.h>
72 #include <asm/envctrl.h>
73 #include <asm/audioio.h>
74 #include <linux/ethtool.h>
75 #include <asm/display7seg.h>
76 #include <asm/module.h>
77 #include <linux/soundcard.h>
79 #include <linux/atm.h>
80 #include <linux/atmarp.h>
81 #include <linux/atmclip.h>
82 #include <linux/atmdev.h>
83 #include <linux/atmioc.h>
84 #include <linux/atmlec.h>
85 #include <linux/atmmpc.h>
86 #include <linux/atmsvc.h>
87 #include <linux/atm_tcp.h>
88 #include <linux/sonet.h>
89 #include <linux/atm_suni.h>
91 /* Use this to get at 32-bit user passed pointers.
92 See sys_sparc32.c for description about these. */
93 #define A(__x) ((unsigned long)(__x))
95 ({ unsigned long __ret; \
96 __asm__ ("srl %0, 0, %0" \
102 /* Aiee. Someone does not find a difference between int and long */
103 #define EXT2_IOC32_GETFLAGS _IOR('f', 1, int)
104 #define EXT2_IOC32_SETFLAGS _IOW('f', 2, int)
105 #define EXT2_IOC32_GETVERSION _IOR('v', 1, int)
106 #define EXT2_IOC32_SETVERSION _IOW('v', 2, int)
108 extern asmlinkage
int sys_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
);
110 static int w_long(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
112 mm_segment_t old_fs
= get_fs();
117 err
= sys_ioctl(fd
, cmd
, (unsigned long)&val
);
119 if (!err
&& put_user(val
, (u32
*)arg
))
124 static int rw_long(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
126 mm_segment_t old_fs
= get_fs();
130 if(get_user(val
, (u32
*)arg
))
133 err
= sys_ioctl(fd
, cmd
, (unsigned long)&val
);
135 if (!err
&& put_user(val
, (u32
*)arg
))
140 static int do_ext2_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
142 /* These are just misnamed, they actually get/put from/to user an int */
144 case EXT2_IOC32_GETFLAGS
: cmd
= EXT2_IOC_GETFLAGS
; break;
145 case EXT2_IOC32_SETFLAGS
: cmd
= EXT2_IOC_SETFLAGS
; break;
146 case EXT2_IOC32_GETVERSION
: cmd
= EXT2_IOC_GETVERSION
; break;
147 case EXT2_IOC32_SETVERSION
: cmd
= EXT2_IOC_SETVERSION
; break;
149 return sys_ioctl(fd
, cmd
, arg
);
152 struct video_tuner32
{
155 u32 rangelow
, rangehigh
;
160 static int get_video_tuner32(struct video_tuner
*kp
, struct video_tuner32
*up
)
164 if(get_user(kp
->tuner
, &up
->tuner
))
166 for(i
= 0; i
< 32; i
++)
167 __get_user(kp
->name
[i
], &up
->name
[i
]);
168 __get_user(kp
->rangelow
, &up
->rangelow
);
169 __get_user(kp
->rangehigh
, &up
->rangehigh
);
170 __get_user(kp
->flags
, &up
->flags
);
171 __get_user(kp
->mode
, &up
->mode
);
172 __get_user(kp
->signal
, &up
->signal
);
176 static int put_video_tuner32(struct video_tuner
*kp
, struct video_tuner32
*up
)
180 if(put_user(kp
->tuner
, &up
->tuner
))
182 for(i
= 0; i
< 32; i
++)
183 __put_user(kp
->name
[i
], &up
->name
[i
]);
184 __put_user(kp
->rangelow
, &up
->rangelow
);
185 __put_user(kp
->rangehigh
, &up
->rangehigh
);
186 __put_user(kp
->flags
, &up
->flags
);
187 __put_user(kp
->mode
, &up
->mode
);
188 __put_user(kp
->signal
, &up
->signal
);
192 struct video_buffer32
{
193 /* void * */ u32 base
;
194 s32 height
, width
, depth
, bytesperline
;
197 static int get_video_buffer32(struct video_buffer
*kp
, struct video_buffer32
*up
)
201 if(get_user(tmp
, &up
->base
))
203 kp
->base
= (void *) ((unsigned long)tmp
);
204 __get_user(kp
->height
, &up
->height
);
205 __get_user(kp
->width
, &up
->width
);
206 __get_user(kp
->depth
, &up
->depth
);
207 __get_user(kp
->bytesperline
, &up
->bytesperline
);
211 static int put_video_buffer32(struct video_buffer
*kp
, struct video_buffer32
*up
)
213 u32 tmp
= (u32
)((unsigned long)kp
->base
);
215 if(put_user(tmp
, &up
->base
))
217 __put_user(kp
->height
, &up
->height
);
218 __put_user(kp
->width
, &up
->width
);
219 __put_user(kp
->depth
, &up
->depth
);
220 __put_user(kp
->bytesperline
, &up
->bytesperline
);
224 struct video_clip32
{
225 s32 x
, y
, width
, height
;
226 /* struct video_clip32 * */ u32 next
;
229 struct video_window32
{
230 u32 x
, y
, width
, height
, chromakey
, flags
;
231 /* struct video_clip32 * */ u32 clips
;
235 static void free_kvideo_clips(struct video_window
*kp
)
237 struct video_clip
*cp
;
244 static int get_video_window32(struct video_window
*kp
, struct video_window32
*up
)
246 struct video_clip32
*ucp
;
247 struct video_clip
*kcp
;
251 if(get_user(kp
->x
, &up
->x
))
253 __get_user(kp
->y
, &up
->y
);
254 __get_user(kp
->width
, &up
->width
);
255 __get_user(kp
->height
, &up
->height
);
256 __get_user(kp
->chromakey
, &up
->chromakey
);
257 __get_user(kp
->flags
, &up
->flags
);
258 __get_user(kp
->clipcount
, &up
->clipcount
);
259 __get_user(tmp
, &up
->clips
);
260 ucp
= (struct video_clip32
*)A(tmp
);
263 nclips
= kp
->clipcount
;
270 /* Peculiar interface... */
272 nclips
= VIDEO_CLIPMAP_SIZE
;
274 kcp
= kmalloc(nclips
* sizeof(struct video_clip
), GFP_KERNEL
);
277 goto cleanup_and_err
;
280 for(i
= 0; i
< nclips
; i
++) {
281 __get_user(kcp
[i
].x
, &ucp
[i
].x
);
282 __get_user(kcp
[i
].y
, &ucp
[i
].y
);
283 __get_user(kcp
[i
].width
, &ucp
[i
].width
);
284 __get_user(kcp
[i
].height
, &ucp
[i
].height
);
285 kcp
[nclips
].next
= NULL
;
291 free_kvideo_clips(kp
);
295 /* You get back everything except the clips... */
296 static int put_video_window32(struct video_window
*kp
, struct video_window32
*up
)
298 if(put_user(kp
->x
, &up
->x
))
300 __put_user(kp
->y
, &up
->y
);
301 __put_user(kp
->width
, &up
->width
);
302 __put_user(kp
->height
, &up
->height
);
303 __put_user(kp
->chromakey
, &up
->chromakey
);
304 __put_user(kp
->flags
, &up
->flags
);
305 __put_user(kp
->clipcount
, &up
->clipcount
);
309 #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32)
310 #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32)
311 #define VIDIOCGWIN32 _IOR('v',9, struct video_window32)
312 #define VIDIOCSWIN32 _IOW('v',10, struct video_window32)
313 #define VIDIOCGFBUF32 _IOR('v',11, struct video_buffer32)
314 #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32)
315 #define VIDIOCGFREQ32 _IOR('v',14, u32)
316 #define VIDIOCSFREQ32 _IOW('v',15, u32)
318 static int do_video_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
321 struct video_tuner vt
;
322 struct video_buffer vb
;
323 struct video_window vw
;
326 mm_segment_t old_fs
= get_fs();
327 void *up
= (void *)arg
;
330 /* First, convert the command. */
332 case VIDIOCGTUNER32
: cmd
= VIDIOCGTUNER
; break;
333 case VIDIOCSTUNER32
: cmd
= VIDIOCSTUNER
; break;
334 case VIDIOCGWIN32
: cmd
= VIDIOCGWIN
; break;
335 case VIDIOCSWIN32
: cmd
= VIDIOCSWIN
; break;
336 case VIDIOCGFBUF32
: cmd
= VIDIOCGFBUF
; break;
337 case VIDIOCSFBUF32
: cmd
= VIDIOCSFBUF
; break;
338 case VIDIOCGFREQ32
: cmd
= VIDIOCGFREQ
; break;
339 case VIDIOCSFREQ32
: cmd
= VIDIOCSFREQ
; break;
345 err
= get_video_tuner32(&karg
.vt
, up
);
349 err
= get_video_window32(&karg
.vw
, up
);
353 err
= get_video_buffer32(&karg
.vb
, up
);
357 err
= get_user(karg
.vx
, (u32
*)up
);
364 err
= sys_ioctl(fd
, cmd
, (unsigned long)&karg
);
367 if(cmd
== VIDIOCSWIN
)
368 free_kvideo_clips(&karg
.vw
);
373 err
= put_video_tuner32(&karg
.vt
, up
);
377 err
= put_video_window32(&karg
.vw
, up
);
381 err
= put_video_buffer32(&karg
.vb
, up
);
385 err
= put_user(((u32
)karg
.vx
), (u32
*)up
);
398 static int do_siocgstamp(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
400 struct timeval32
*up
= (struct timeval32
*)arg
;
402 mm_segment_t old_fs
= get_fs();
406 err
= sys_ioctl(fd
, cmd
, (unsigned long)&ktv
);
409 err
= put_user(ktv
.tv_sec
, &up
->tv_sec
);
410 err
|= __put_user(ktv
.tv_usec
, &up
->tv_usec
);
418 unsigned short base_addr
;
425 #define IFHWADDRLEN 6
428 char ifrn_name
[IFNAMSIZ
]; /* if name, e.g. "en0" */
431 struct sockaddr ifru_addr
;
432 struct sockaddr ifru_dstaddr
;
433 struct sockaddr ifru_broadaddr
;
434 struct sockaddr ifru_netmask
;
435 struct sockaddr ifru_hwaddr
;
439 struct ifmap32 ifru_map
;
440 char ifru_slave
[IFNAMSIZ
]; /* Just fits the size */
441 char ifru_newname
[IFNAMSIZ
];
442 __kernel_caddr_t32 ifru_data
;
447 int ifc_len
; /* size of buffer */
448 __kernel_caddr_t32 ifcbuf
;
451 static int dev_ifname32(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
453 struct net_device
*dev
;
454 struct ifreq32 ifr32
;
457 if (copy_from_user(&ifr32
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
460 dev
= dev_get_by_index(ifr32
.ifr_ifindex
);
464 strcpy(ifr32
.ifr_name
, dev
->name
);
466 err
= copy_to_user((struct ifreq32
*)arg
, &ifr32
, sizeof(struct ifreq32
));
467 return (err
? -EFAULT
: 0);
470 static inline int dev_ifconf(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
472 struct ifconf32 ifc32
;
474 struct ifreq32
*ifr32
;
480 if (copy_from_user(&ifc32
, (struct ifconf32
*)arg
, sizeof(struct ifconf32
)))
483 if(ifc32
.ifcbuf
== 0) {
488 ifc
.ifc_len
= ((ifc32
.ifc_len
/ sizeof (struct ifreq32
)) + 1) *
489 sizeof (struct ifreq
);
490 ifc
.ifc_buf
= kmalloc (ifc
.ifc_len
, GFP_KERNEL
);
495 ifr32
= (struct ifreq32
*)A(ifc32
.ifcbuf
);
496 for (i
= 0; i
< ifc32
.ifc_len
; i
+= sizeof (struct ifreq32
)) {
497 if (copy_from_user(ifr
++, ifr32
++, sizeof (struct ifreq32
))) {
502 old_fs
= get_fs(); set_fs (KERNEL_DS
);
503 err
= sys_ioctl (fd
, SIOCGIFCONF
, (unsigned long)&ifc
);
507 ifr32
= (struct ifreq32
*)A(ifc32
.ifcbuf
);
508 for (i
= 0, j
= 0; i
< ifc32
.ifc_len
&& j
< ifc
.ifc_len
;
509 i
+= sizeof (struct ifreq32
), j
+= sizeof (struct ifreq
)) {
510 if (copy_to_user(ifr32
++, ifr
++, sizeof (struct ifreq32
))) {
516 if (i
<= ifc32
.ifc_len
)
519 ifc32
.ifc_len
= i
- sizeof (struct ifreq32
);
520 if (copy_to_user((struct ifconf32
*)arg
, &ifc32
, sizeof(struct ifconf32
)))
524 if(ifc
.ifc_buf
!= NULL
)
529 static inline int dev_ifsioc(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
537 err
= copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(ifr
.ifr_name
));
538 err
|= __get_user(ifr
.ifr_map
.mem_start
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_start
));
539 err
|= __get_user(ifr
.ifr_map
.mem_end
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_end
));
540 err
|= __get_user(ifr
.ifr_map
.base_addr
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.base_addr
));
541 err
|= __get_user(ifr
.ifr_map
.irq
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.irq
));
542 err
|= __get_user(ifr
.ifr_map
.dma
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.dma
));
543 err
|= __get_user(ifr
.ifr_map
.port
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.port
));
551 if (copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
553 ifr
.ifr_data
= (__kernel_caddr_t
)get_free_page(GFP_KERNEL
);
556 if(cmd
== SIOCETHTOOL
) {
559 __get_user(data
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_data
));
560 if(copy_from_user(ifr
.ifr_data
,
562 sizeof(struct ethtool_cmd
))) {
563 free_page((unsigned long)ifr
.ifr_data
);
569 if (copy_from_user(&ifr
, (struct ifreq32
*)arg
, sizeof(struct ifreq32
)))
575 err
= sys_ioctl (fd
, cmd
, (unsigned long)&ifr
);
590 if (copy_to_user((struct ifreq32
*)arg
, &ifr
, sizeof(struct ifreq32
)))
601 __get_user(data
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_data
));
602 if(cmd
== SIOCETHTOOL
)
603 len
= sizeof(struct ethtool_cmd
);
604 if(cmd
== SIOCGPPPVER
)
605 len
= strlen((char *)ifr
.ifr_data
) + 1;
606 else if(cmd
== SIOCGPPPCSTATS
)
607 len
= sizeof(struct ppp_comp_stats
);
609 len
= sizeof(struct ppp_stats
);
611 len
= copy_to_user((char *)A(data
), ifr
.ifr_data
, len
);
612 free_page((unsigned long)ifr
.ifr_data
);
618 err
= copy_to_user((struct ifreq32
*)arg
, &ifr
, sizeof(ifr
.ifr_name
));
619 err
|= __put_user(ifr
.ifr_map
.mem_start
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_start
));
620 err
|= __put_user(ifr
.ifr_map
.mem_end
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.mem_end
));
621 err
|= __put_user(ifr
.ifr_map
.base_addr
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.base_addr
));
622 err
|= __put_user(ifr
.ifr_map
.irq
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.irq
));
623 err
|= __put_user(ifr
.ifr_map
.dma
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.dma
));
624 err
|= __put_user(ifr
.ifr_map
.port
, &(((struct ifreq32
*)arg
)->ifr_ifru
.ifru_map
.port
));
635 struct sockaddr rt_dst
; /* target address */
636 struct sockaddr rt_gateway
; /* gateway addr (RTF_GATEWAY) */
637 struct sockaddr rt_genmask
; /* target network mask (IP) */
638 unsigned short rt_flags
;
641 unsigned char rt_tos
;
642 unsigned char rt_class
;
644 short rt_metric
; /* +1 for binary compatibility! */
645 /* char * */ u32 rt_dev
; /* forcing the device at add */
646 u32 rt_mtu
; /* per route MTU/Window */
647 u32 rt_window
; /* Window clamping */
648 unsigned short rt_irtt
; /* Initial RTT */
653 struct in6_addr rtmsg_dst
;
654 struct in6_addr rtmsg_src
;
655 struct in6_addr rtmsg_gateway
;
665 extern struct socket
*sockfd_lookup(int fd
, int *err
);
667 static inline int routing_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
675 mm_segment_t old_fs
= get_fs();
677 struct socket
*mysock
= sockfd_lookup(fd
, &ret
);
679 if (mysock
&& mysock
->sk
&& mysock
->sk
->family
== AF_INET6
) { /* ipv6 */
680 ret
= copy_from_user (&r6
.rtmsg_dst
, &(((struct in6_rtmsg32
*)arg
)->rtmsg_dst
),
681 3 * sizeof(struct in6_addr
));
682 ret
|= __get_user (r6
.rtmsg_type
, &(((struct in6_rtmsg32
*)arg
)->rtmsg_type
));
683 ret
|= __get_user (r6
.rtmsg_dst_len
, &(((struct in6_rtmsg32
*)arg
)->rtmsg_dst_len
));
684 ret
|= __get_user (r6
.rtmsg_src_len
, &(((struct in6_rtmsg32
*)arg
)->rtmsg_src_len
));
685 ret
|= __get_user (r6
.rtmsg_metric
, &(((struct in6_rtmsg32
*)arg
)->rtmsg_metric
));
686 ret
|= __get_user (r6
.rtmsg_info
, &(((struct in6_rtmsg32
*)arg
)->rtmsg_info
));
687 ret
|= __get_user (r6
.rtmsg_flags
, &(((struct in6_rtmsg32
*)arg
)->rtmsg_flags
));
688 ret
|= __get_user (r6
.rtmsg_ifindex
, &(((struct in6_rtmsg32
*)arg
)->rtmsg_ifindex
));
692 ret
= copy_from_user (&r4
.rt_dst
, &(((struct rtentry32
*)arg
)->rt_dst
), 3 * sizeof(struct sockaddr
));
693 ret
|= __get_user (r4
.rt_flags
, &(((struct rtentry32
*)arg
)->rt_flags
));
694 ret
|= __get_user (r4
.rt_metric
, &(((struct rtentry32
*)arg
)->rt_metric
));
695 ret
|= __get_user (r4
.rt_mtu
, &(((struct rtentry32
*)arg
)->rt_mtu
));
696 ret
|= __get_user (r4
.rt_window
, &(((struct rtentry32
*)arg
)->rt_window
));
697 ret
|= __get_user (r4
.rt_irtt
, &(((struct rtentry32
*)arg
)->rt_irtt
));
698 ret
|= __get_user (rtdev
, &(((struct rtentry32
*)arg
)->rt_dev
));
700 ret
|= copy_from_user (devname
, (char *)A(rtdev
), 15);
701 r4
.rt_dev
= devname
; devname
[15] = 0;
712 ret
= sys_ioctl (fd
, cmd
, (long) r
);
718 struct hd_geometry32
{
720 unsigned char sectors
;
721 unsigned short cylinders
;
725 static inline int hdio_getgeo(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
727 mm_segment_t old_fs
= get_fs();
728 struct hd_geometry geo
;
732 err
= sys_ioctl(fd
, HDIO_GETGEO
, (unsigned long)&geo
);
735 err
= copy_to_user ((struct hd_geometry32
*)arg
, &geo
, 4);
736 err
|= __put_user (geo
.start
, &(((struct hd_geometry32
*)arg
)->start
));
738 return err
? -EFAULT
: 0;
742 int index
; /* first element (0 origin) */
749 #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32)
750 #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32)
752 static inline int fbiogetputcmap(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
756 char red
[256], green
[256], blue
[256];
758 mm_segment_t old_fs
= get_fs();
760 ret
= get_user(f
.index
, &(((struct fbcmap32
*)arg
)->index
));
761 ret
|= __get_user(f
.count
, &(((struct fbcmap32
*)arg
)->count
));
762 ret
|= __get_user(r
, &(((struct fbcmap32
*)arg
)->red
));
763 ret
|= __get_user(g
, &(((struct fbcmap32
*)arg
)->green
));
764 ret
|= __get_user(b
, &(((struct fbcmap32
*)arg
)->blue
));
767 if ((f
.index
< 0) || (f
.index
> 255)) return -EINVAL
;
768 if (f
.index
+ f
.count
> 256)
769 f
.count
= 256 - f
.index
;
770 if (cmd
== FBIOPUTCMAP32
) {
771 ret
= copy_from_user (red
, (char *)A(r
), f
.count
);
772 ret
|= copy_from_user (green
, (char *)A(g
), f
.count
);
773 ret
|= copy_from_user (blue
, (char *)A(b
), f
.count
);
777 f
.red
= red
; f
.green
= green
; f
.blue
= blue
;
779 ret
= sys_ioctl (fd
, (cmd
== FBIOPUTCMAP32
) ? FBIOPUTCMAP_SPARC
: FBIOGETCMAP_SPARC
, (long)&f
);
781 if (!ret
&& cmd
== FBIOGETCMAP32
) {
782 ret
= copy_to_user ((char *)A(r
), red
, f
.count
);
783 ret
|= copy_to_user ((char *)A(g
), green
, f
.count
);
784 ret
|= copy_to_user ((char *)A(b
), blue
, f
.count
);
786 return ret
? -EFAULT
: 0;
790 short set
; /* what to set, choose from the list above */
791 short enable
; /* cursor on/off */
792 struct fbcurpos pos
; /* cursor position */
793 struct fbcurpos hot
; /* cursor hot spot */
794 struct fbcmap32 cmap
; /* color map info */
795 struct fbcurpos size
; /* cursor bit map size */
796 u32 image
; /* cursor image bits */
797 u32 mask
; /* cursor mask bits */
800 #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32)
801 #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32)
803 static inline int fbiogscursor(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
807 char red
[2], green
[2], blue
[2];
808 char image
[128], mask
[128];
811 mm_segment_t old_fs
= get_fs();
813 ret
= copy_from_user (&f
, (struct fbcursor32
*)arg
, 2 * sizeof (short) + 2 * sizeof(struct fbcurpos
));
814 ret
|= __get_user(f
.size
.fbx
, &(((struct fbcursor32
*)arg
)->size
.fbx
));
815 ret
|= __get_user(f
.size
.fby
, &(((struct fbcursor32
*)arg
)->size
.fby
));
816 ret
|= __get_user(f
.cmap
.index
, &(((struct fbcursor32
*)arg
)->cmap
.index
));
817 ret
|= __get_user(f
.cmap
.count
, &(((struct fbcursor32
*)arg
)->cmap
.count
));
818 ret
|= __get_user(r
, &(((struct fbcursor32
*)arg
)->cmap
.red
));
819 ret
|= __get_user(g
, &(((struct fbcursor32
*)arg
)->cmap
.green
));
820 ret
|= __get_user(b
, &(((struct fbcursor32
*)arg
)->cmap
.blue
));
821 ret
|= __get_user(m
, &(((struct fbcursor32
*)arg
)->mask
));
822 ret
|= __get_user(i
, &(((struct fbcursor32
*)arg
)->image
));
825 if (f
.set
& FB_CUR_SETCMAP
) {
826 if ((uint
) f
.size
.fby
> 32)
828 ret
= copy_from_user (mask
, (char *)A(m
), f
.size
.fby
* 4);
829 ret
|= copy_from_user (image
, (char *)A(i
), f
.size
.fby
* 4);
832 f
.image
= image
; f
.mask
= mask
;
834 if (f
.set
& FB_CUR_SETCMAP
) {
835 ret
= copy_from_user (red
, (char *)A(r
), 2);
836 ret
|= copy_from_user (green
, (char *)A(g
), 2);
837 ret
|= copy_from_user (blue
, (char *)A(b
), 2);
840 f
.cmap
.red
= red
; f
.cmap
.green
= green
; f
.cmap
.blue
= blue
;
843 ret
= sys_ioctl (fd
, FBIOSCURSOR
, (long)&f
);
848 struct fb_fix_screeninfo32
{
850 __kernel_caddr_t32 smem_start
;
859 __kernel_caddr_t32 mmio_start
;
868 __kernel_caddr_t32 red
;
869 __kernel_caddr_t32 green
;
870 __kernel_caddr_t32 blue
;
871 __kernel_caddr_t32 transp
;
874 static int fb_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
876 mm_segment_t old_fs
= get_fs();
877 u32 red
= 0, green
= 0, blue
= 0, transp
= 0;
878 struct fb_fix_screeninfo fix
;
883 memset(&cmap
, 0, sizeof(cmap
));
885 case FBIOGET_FSCREENINFO
:
891 err
= __get_user(cmap
.start
, &((struct fb_cmap32
*)arg
)->start
);
892 err
|= __get_user(cmap
.len
, &((struct fb_cmap32
*)arg
)->len
);
893 err
|= __get_user(red
, &((struct fb_cmap32
*)arg
)->red
);
894 err
|= __get_user(green
, &((struct fb_cmap32
*)arg
)->green
);
895 err
|= __get_user(blue
, &((struct fb_cmap32
*)arg
)->blue
);
896 err
|= __get_user(transp
, &((struct fb_cmap32
*)arg
)->transp
);
902 cmap
.red
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
905 cmap
.green
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
908 cmap
.blue
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
912 cmap
.transp
= kmalloc(cmap
.len
* sizeof(__u16
), GFP_KERNEL
);
917 if (cmd
== FBIOGETCMAP
)
920 err
= __copy_from_user(cmap
.red
, (char *)A(red
), cmap
.len
* sizeof(__u16
));
921 err
|= __copy_from_user(cmap
.green
, (char *)A(green
), cmap
.len
* sizeof(__u16
));
922 err
|= __copy_from_user(cmap
.blue
, (char *)A(blue
), cmap
.len
* sizeof(__u16
));
923 if (cmap
.transp
) err
|= __copy_from_user(cmap
.transp
, (char *)A(transp
), cmap
.len
* sizeof(__u16
));
931 static int count
= 0;
933 printk("%s: Unknown fb ioctl cmd fd(%d) "
934 "cmd(%08x) arg(%08lx)\n",
935 __FUNCTION__
, fd
, cmd
, arg
);
940 err
= sys_ioctl(fd
, cmd
, (unsigned long)karg
);
945 case FBIOGET_FSCREENINFO
:
946 err
= __copy_to_user((char *)((struct fb_fix_screeninfo32
*)arg
)->id
, (char *)fix
.id
, sizeof(fix
.id
));
947 err
|= __put_user((__u32
)(unsigned long)fix
.smem_start
, &((struct fb_fix_screeninfo32
*)arg
)->smem_start
);
948 err
|= __put_user(fix
.smem_len
, &((struct fb_fix_screeninfo32
*)arg
)->smem_len
);
949 err
|= __put_user(fix
.type
, &((struct fb_fix_screeninfo32
*)arg
)->type
);
950 err
|= __put_user(fix
.type_aux
, &((struct fb_fix_screeninfo32
*)arg
)->type_aux
);
951 err
|= __put_user(fix
.visual
, &((struct fb_fix_screeninfo32
*)arg
)->visual
);
952 err
|= __put_user(fix
.xpanstep
, &((struct fb_fix_screeninfo32
*)arg
)->xpanstep
);
953 err
|= __put_user(fix
.ypanstep
, &((struct fb_fix_screeninfo32
*)arg
)->ypanstep
);
954 err
|= __put_user(fix
.ywrapstep
, &((struct fb_fix_screeninfo32
*)arg
)->ywrapstep
);
955 err
|= __put_user(fix
.line_length
, &((struct fb_fix_screeninfo32
*)arg
)->line_length
);
956 err
|= __put_user((__u32
)(unsigned long)fix
.mmio_start
, &((struct fb_fix_screeninfo32
*)arg
)->mmio_start
);
957 err
|= __put_user(fix
.mmio_len
, &((struct fb_fix_screeninfo32
*)arg
)->mmio_len
);
958 err
|= __put_user(fix
.accel
, &((struct fb_fix_screeninfo32
*)arg
)->accel
);
959 err
|= __copy_to_user((char *)((struct fb_fix_screeninfo32
*)arg
)->reserved
, (char *)fix
.reserved
, sizeof(fix
.reserved
));
962 err
= __copy_to_user((char *)A(red
), cmap
.red
, cmap
.len
* sizeof(__u16
));
963 err
|= __copy_to_user((char *)A(green
), cmap
.blue
, cmap
.len
* sizeof(__u16
));
964 err
|= __copy_to_user((char *)A(blue
), cmap
.blue
, cmap
.len
* sizeof(__u16
));
966 err
|= __copy_to_user((char *)A(transp
), cmap
.transp
, cmap
.len
* sizeof(__u16
));
974 out
: if (cmap
.red
) kfree(cmap
.red
);
975 if (cmap
.green
) kfree(cmap
.green
);
976 if (cmap
.blue
) kfree(cmap
.blue
);
977 if (cmap
.transp
) kfree(cmap
.transp
);
981 static int hdio_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
983 mm_segment_t old_fs
= get_fs();
989 error
= sys_ioctl(fd
, cmd
, (long)&kval
);
993 uvp
= (unsigned int *)arg
;
994 if(put_user(kval
, uvp
))
1000 struct floppy_struct32
{
1005 unsigned int stretch
;
1008 unsigned char spec1
;
1009 unsigned char fmt_gap
;
1010 const __kernel_caddr_t32 name
;
1013 struct floppy_drive_params32
{
1021 unsigned char spindown_offset
;
1022 unsigned char select_delay
;
1024 unsigned char tracks
;
1026 unsigned char interleave_sect
;
1027 struct floppy_max_errors max_errors
;
1030 short autodetect
[8];
1035 struct floppy_drive_struct32
{
1039 u32 first_read_date
;
1040 short probed_format
;
1049 __kernel_caddr_t32 dmabuf
;
1053 struct floppy_fdc_state32
{
1057 unsigned char version
;
1060 unsigned int rawcmd
:2;
1061 unsigned int reset
:1;
1062 unsigned int need_configure
:1;
1063 unsigned int perp_mode
:2;
1064 unsigned int has_fifo
:1;
1065 unsigned int driver_version
;
1066 unsigned char track
[4];
1069 struct floppy_write_errors32
{
1070 unsigned int write_errors
;
1071 u32 first_error_sector
;
1072 int first_error_generation
;
1073 u32 last_error_sector
;
1074 int last_error_generation
;
1075 unsigned int badness
;
1078 #define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32)
1079 #define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32)
1080 #define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32)
1081 #define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32)
1082 #define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32)
1083 #define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32)
1084 #define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32)
1085 #define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32)
1086 #define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32)
1091 } fd_ioctl_trans_table
[] = {
1092 { FDSETPRM32
, FDSETPRM
},
1093 { FDDEFPRM32
, FDDEFPRM
},
1094 { FDGETPRM32
, FDGETPRM
},
1095 { FDSETDRVPRM32
, FDSETDRVPRM
},
1096 { FDGETDRVPRM32
, FDGETDRVPRM
},
1097 { FDGETDRVSTAT32
, FDGETDRVSTAT
},
1098 { FDPOLLDRVSTAT32
, FDPOLLDRVSTAT
},
1099 { FDGETFDCSTAT32
, FDGETFDCSTAT
},
1100 { FDWERRORGET32
, FDWERRORGET
}
1103 #define NR_FD_IOCTL_TRANS (sizeof(fd_ioctl_trans_table)/sizeof(fd_ioctl_trans_table[0]))
1105 static int fd_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1107 mm_segment_t old_fs
= get_fs();
1109 unsigned int kcmd
= 0;
1112 for (i
= 0; i
< NR_FD_IOCTL_TRANS
; i
++)
1113 if (cmd
== fd_ioctl_trans_table
[i
].cmd32
) {
1114 kcmd
= fd_ioctl_trans_table
[i
].cmd
;
1125 struct floppy_struct
*f
;
1127 f
= karg
= kmalloc(sizeof(struct floppy_struct
), GFP_KERNEL
);
1130 if (cmd
== FDGETPRM32
)
1132 err
= __get_user(f
->size
, &((struct floppy_struct32
*)arg
)->size
);
1133 err
|= __get_user(f
->sect
, &((struct floppy_struct32
*)arg
)->sect
);
1134 err
|= __get_user(f
->head
, &((struct floppy_struct32
*)arg
)->head
);
1135 err
|= __get_user(f
->track
, &((struct floppy_struct32
*)arg
)->track
);
1136 err
|= __get_user(f
->stretch
, &((struct floppy_struct32
*)arg
)->stretch
);
1137 err
|= __get_user(f
->gap
, &((struct floppy_struct32
*)arg
)->gap
);
1138 err
|= __get_user(f
->rate
, &((struct floppy_struct32
*)arg
)->rate
);
1139 err
|= __get_user(f
->spec1
, &((struct floppy_struct32
*)arg
)->spec1
);
1140 err
|= __get_user(f
->fmt_gap
, &((struct floppy_struct32
*)arg
)->fmt_gap
);
1141 err
|= __get_user((u64
)f
->name
, &((struct floppy_struct32
*)arg
)->name
);
1151 struct floppy_drive_params
*f
;
1153 f
= karg
= kmalloc(sizeof(struct floppy_drive_params
), GFP_KERNEL
);
1156 if (cmd
== FDGETDRVPRM32
)
1158 err
= __get_user(f
->cmos
, &((struct floppy_drive_params32
*)arg
)->cmos
);
1159 err
|= __get_user(f
->max_dtr
, &((struct floppy_drive_params32
*)arg
)->max_dtr
);
1160 err
|= __get_user(f
->hlt
, &((struct floppy_drive_params32
*)arg
)->hlt
);
1161 err
|= __get_user(f
->hut
, &((struct floppy_drive_params32
*)arg
)->hut
);
1162 err
|= __get_user(f
->srt
, &((struct floppy_drive_params32
*)arg
)->srt
);
1163 err
|= __get_user(f
->spinup
, &((struct floppy_drive_params32
*)arg
)->spinup
);
1164 err
|= __get_user(f
->spindown
, &((struct floppy_drive_params32
*)arg
)->spindown
);
1165 err
|= __get_user(f
->spindown_offset
, &((struct floppy_drive_params32
*)arg
)->spindown_offset
);
1166 err
|= __get_user(f
->select_delay
, &((struct floppy_drive_params32
*)arg
)->select_delay
);
1167 err
|= __get_user(f
->rps
, &((struct floppy_drive_params32
*)arg
)->rps
);
1168 err
|= __get_user(f
->tracks
, &((struct floppy_drive_params32
*)arg
)->tracks
);
1169 err
|= __get_user(f
->timeout
, &((struct floppy_drive_params32
*)arg
)->timeout
);
1170 err
|= __get_user(f
->interleave_sect
, &((struct floppy_drive_params32
*)arg
)->interleave_sect
);
1171 err
|= __copy_from_user(&f
->max_errors
, &((struct floppy_drive_params32
*)arg
)->max_errors
, sizeof(f
->max_errors
));
1172 err
|= __get_user(f
->flags
, &((struct floppy_drive_params32
*)arg
)->flags
);
1173 err
|= __get_user(f
->read_track
, &((struct floppy_drive_params32
*)arg
)->read_track
);
1174 err
|= __copy_from_user(f
->autodetect
, ((struct floppy_drive_params32
*)arg
)->autodetect
, sizeof(f
->autodetect
));
1175 err
|= __get_user(f
->checkfreq
, &((struct floppy_drive_params32
*)arg
)->checkfreq
);
1176 err
|= __get_user(f
->native_format
, &((struct floppy_drive_params32
*)arg
)->native_format
);
1183 case FDGETDRVSTAT32
:
1184 case FDPOLLDRVSTAT32
:
1185 karg
= kmalloc(sizeof(struct floppy_drive_struct
), GFP_KERNEL
);
1189 case FDGETFDCSTAT32
:
1190 karg
= kmalloc(sizeof(struct floppy_fdc_state
), GFP_KERNEL
);
1195 karg
= kmalloc(sizeof(struct floppy_write_errors
), GFP_KERNEL
);
1203 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1210 struct floppy_struct
*f
= karg
;
1212 err
= __put_user(f
->size
, &((struct floppy_struct32
*)arg
)->size
);
1213 err
|= __put_user(f
->sect
, &((struct floppy_struct32
*)arg
)->sect
);
1214 err
|= __put_user(f
->head
, &((struct floppy_struct32
*)arg
)->head
);
1215 err
|= __put_user(f
->track
, &((struct floppy_struct32
*)arg
)->track
);
1216 err
|= __put_user(f
->stretch
, &((struct floppy_struct32
*)arg
)->stretch
);
1217 err
|= __put_user(f
->gap
, &((struct floppy_struct32
*)arg
)->gap
);
1218 err
|= __put_user(f
->rate
, &((struct floppy_struct32
*)arg
)->rate
);
1219 err
|= __put_user(f
->spec1
, &((struct floppy_struct32
*)arg
)->spec1
);
1220 err
|= __put_user(f
->fmt_gap
, &((struct floppy_struct32
*)arg
)->fmt_gap
);
1221 err
|= __put_user((u64
)f
->name
, &((struct floppy_struct32
*)arg
)->name
);
1226 struct floppy_drive_params
*f
= karg
;
1228 err
= __put_user(f
->cmos
, &((struct floppy_drive_params32
*)arg
)->cmos
);
1229 err
|= __put_user(f
->max_dtr
, &((struct floppy_drive_params32
*)arg
)->max_dtr
);
1230 err
|= __put_user(f
->hlt
, &((struct floppy_drive_params32
*)arg
)->hlt
);
1231 err
|= __put_user(f
->hut
, &((struct floppy_drive_params32
*)arg
)->hut
);
1232 err
|= __put_user(f
->srt
, &((struct floppy_drive_params32
*)arg
)->srt
);
1233 err
|= __put_user(f
->spinup
, &((struct floppy_drive_params32
*)arg
)->spinup
);
1234 err
|= __put_user(f
->spindown
, &((struct floppy_drive_params32
*)arg
)->spindown
);
1235 err
|= __put_user(f
->spindown_offset
, &((struct floppy_drive_params32
*)arg
)->spindown_offset
);
1236 err
|= __put_user(f
->select_delay
, &((struct floppy_drive_params32
*)arg
)->select_delay
);
1237 err
|= __put_user(f
->rps
, &((struct floppy_drive_params32
*)arg
)->rps
);
1238 err
|= __put_user(f
->tracks
, &((struct floppy_drive_params32
*)arg
)->tracks
);
1239 err
|= __put_user(f
->timeout
, &((struct floppy_drive_params32
*)arg
)->timeout
);
1240 err
|= __put_user(f
->interleave_sect
, &((struct floppy_drive_params32
*)arg
)->interleave_sect
);
1241 err
|= __copy_to_user(&((struct floppy_drive_params32
*)arg
)->max_errors
, &f
->max_errors
, sizeof(f
->max_errors
));
1242 err
|= __put_user(f
->flags
, &((struct floppy_drive_params32
*)arg
)->flags
);
1243 err
|= __put_user(f
->read_track
, &((struct floppy_drive_params32
*)arg
)->read_track
);
1244 err
|= __copy_to_user(((struct floppy_drive_params32
*)arg
)->autodetect
, f
->autodetect
, sizeof(f
->autodetect
));
1245 err
|= __put_user(f
->checkfreq
, &((struct floppy_drive_params32
*)arg
)->checkfreq
);
1246 err
|= __put_user(f
->native_format
, &((struct floppy_drive_params32
*)arg
)->native_format
);
1249 case FDGETDRVSTAT32
:
1250 case FDPOLLDRVSTAT32
:
1252 struct floppy_drive_struct
*f
= karg
;
1254 err
= __put_user(f
->flags
, &((struct floppy_drive_struct32
*)arg
)->flags
);
1255 err
|= __put_user(f
->spinup_date
, &((struct floppy_drive_struct32
*)arg
)->spinup_date
);
1256 err
|= __put_user(f
->select_date
, &((struct floppy_drive_struct32
*)arg
)->select_date
);
1257 err
|= __put_user(f
->first_read_date
, &((struct floppy_drive_struct32
*)arg
)->first_read_date
);
1258 err
|= __put_user(f
->probed_format
, &((struct floppy_drive_struct32
*)arg
)->probed_format
);
1259 err
|= __put_user(f
->track
, &((struct floppy_drive_struct32
*)arg
)->track
);
1260 err
|= __put_user(f
->maxblock
, &((struct floppy_drive_struct32
*)arg
)->maxblock
);
1261 err
|= __put_user(f
->maxtrack
, &((struct floppy_drive_struct32
*)arg
)->maxtrack
);
1262 err
|= __put_user(f
->generation
, &((struct floppy_drive_struct32
*)arg
)->generation
);
1263 err
|= __put_user(f
->keep_data
, &((struct floppy_drive_struct32
*)arg
)->keep_data
);
1264 err
|= __put_user(f
->fd_ref
, &((struct floppy_drive_struct32
*)arg
)->fd_ref
);
1265 err
|= __put_user(f
->fd_device
, &((struct floppy_drive_struct32
*)arg
)->fd_device
);
1266 err
|= __put_user(f
->last_checked
, &((struct floppy_drive_struct32
*)arg
)->last_checked
);
1267 err
|= __put_user((u64
)f
->dmabuf
, &((struct floppy_drive_struct32
*)arg
)->dmabuf
);
1268 err
|= __put_user((u64
)f
->bufblocks
, &((struct floppy_drive_struct32
*)arg
)->bufblocks
);
1271 case FDGETFDCSTAT32
:
1273 struct floppy_fdc_state
*f
= karg
;
1275 err
= __put_user(f
->spec1
, &((struct floppy_fdc_state32
*)arg
)->spec1
);
1276 err
|= __put_user(f
->spec2
, &((struct floppy_fdc_state32
*)arg
)->spec2
);
1277 err
|= __put_user(f
->dtr
, &((struct floppy_fdc_state32
*)arg
)->dtr
);
1278 err
|= __put_user(f
->version
, &((struct floppy_fdc_state32
*)arg
)->version
);
1279 err
|= __put_user(f
->dor
, &((struct floppy_fdc_state32
*)arg
)->dor
);
1280 err
|= __put_user(f
->address
, &((struct floppy_fdc_state32
*)arg
)->address
);
1281 err
|= __copy_to_user((char *)&((struct floppy_fdc_state32
*)arg
)->address
1282 + sizeof(((struct floppy_fdc_state32
*)arg
)->address
),
1283 (char *)&f
->address
+ sizeof(f
->address
), sizeof(int));
1284 err
|= __put_user(f
->driver_version
, &((struct floppy_fdc_state32
*)arg
)->driver_version
);
1285 err
|= __copy_to_user(((struct floppy_fdc_state32
*)arg
)->track
, f
->track
, sizeof(f
->track
));
1290 struct floppy_write_errors
*f
= karg
;
1292 err
= __put_user(f
->write_errors
, &((struct floppy_write_errors32
*)arg
)->write_errors
);
1293 err
|= __put_user(f
->first_error_sector
, &((struct floppy_write_errors32
*)arg
)->first_error_sector
);
1294 err
|= __put_user(f
->first_error_generation
, &((struct floppy_write_errors32
*)arg
)->first_error_generation
);
1295 err
|= __put_user(f
->last_error_sector
, &((struct floppy_write_errors32
*)arg
)->last_error_sector
);
1296 err
|= __put_user(f
->last_error_generation
, &((struct floppy_write_errors32
*)arg
)->last_error_generation
);
1297 err
|= __put_user(f
->badness
, &((struct floppy_write_errors32
*)arg
)->badness
);
1306 out
: if (karg
) kfree(karg
);
1310 struct ppp_option_data32
{
1311 __kernel_caddr_t32 ptr
;
1315 #define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
1318 __kernel_time_t32 xmit_idle
;
1319 __kernel_time_t32 recv_idle
;
1321 #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
1323 static int ppp_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1325 mm_segment_t old_fs
= get_fs();
1326 struct ppp_option_data32 data32
;
1327 struct ppp_option_data data
;
1328 struct ppp_idle32 idle32
;
1329 struct ppp_idle idle
;
1339 case PPPIOCSCOMPRESS32
:
1340 if (copy_from_user(&data32
, (struct ppp_option_data32
*)arg
, sizeof(struct ppp_option_data32
)))
1342 data
.ptr
= kmalloc (data32
.length
, GFP_KERNEL
);
1345 if (copy_from_user(data
.ptr
, (__u8
*)A(data32
.ptr
), data32
.length
)) {
1349 data
.length
= data32
.length
;
1350 data
.transmit
= data32
.transmit
;
1351 kcmd
= PPPIOCSCOMPRESS
;
1356 static int count
= 0;
1358 printk("ppp_ioctl: Unknown cmd fd(%d) "
1359 "cmd(%08x) arg(%08x)\n",
1360 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1365 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1371 idle32
.xmit_idle
= idle
.xmit_idle
;
1372 idle32
.recv_idle
= idle
.recv_idle
;
1373 if (copy_to_user((struct ppp_idle32
*)arg
, &idle32
, sizeof(struct ppp_idle32
)))
1376 case PPPIOCSCOMPRESS32
:
1392 __kernel_daddr_t32 mt_fileno
;
1393 __kernel_daddr_t32 mt_blkno
;
1395 #define MTIOCGET32 _IOR('m', 2, struct mtget32)
1400 #define MTIOCPOS32 _IOR('m', 3, struct mtpos32)
1402 struct mtconfiginfo32
{
1423 #define MTIOCGETCONFIG32 _IOR('m', 4, struct mtconfiginfo32)
1424 #define MTIOCSETCONFIG32 _IOW('m', 5, struct mtconfiginfo32)
1426 static int mt_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1428 mm_segment_t old_fs
= get_fs();
1429 struct mtconfiginfo info
;
1445 case MTIOCGETCONFIG32
:
1446 kcmd
= MTIOCGETCONFIG
;
1449 case MTIOCSETCONFIG32
:
1450 kcmd
= MTIOCSETCONFIG
;
1452 err
= __get_user(info
.mt_type
, &((struct mtconfiginfo32
*)arg
)->mt_type
);
1453 err
|= __get_user(info
.ifc_type
, &((struct mtconfiginfo32
*)arg
)->ifc_type
);
1454 err
|= __get_user(info
.irqnr
, &((struct mtconfiginfo32
*)arg
)->irqnr
);
1455 err
|= __get_user(info
.dmanr
, &((struct mtconfiginfo32
*)arg
)->dmanr
);
1456 err
|= __get_user(info
.port
, &((struct mtconfiginfo32
*)arg
)->port
);
1457 err
|= __get_user(info
.debug
, &((struct mtconfiginfo32
*)arg
)->debug
);
1458 err
|= __copy_from_user((char *)&info
.debug
+ sizeof(info
.debug
),
1459 (char *)&((struct mtconfiginfo32
*)arg
)->debug
1460 + sizeof(((struct mtconfiginfo32
*)arg
)->debug
), sizeof(__u32
));
1466 static int count
= 0;
1468 printk("mt_ioctl: Unknown cmd fd(%d) "
1469 "cmd(%08x) arg(%08x)\n",
1470 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1475 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1481 err
= __put_user(pos
.mt_blkno
, &((struct mtpos32
*)arg
)->mt_blkno
);
1484 err
= __put_user(get
.mt_type
, &((struct mtget32
*)arg
)->mt_type
);
1485 err
|= __put_user(get
.mt_resid
, &((struct mtget32
*)arg
)->mt_resid
);
1486 err
|= __put_user(get
.mt_dsreg
, &((struct mtget32
*)arg
)->mt_dsreg
);
1487 err
|= __put_user(get
.mt_gstat
, &((struct mtget32
*)arg
)->mt_gstat
);
1488 err
|= __put_user(get
.mt_erreg
, &((struct mtget32
*)arg
)->mt_erreg
);
1489 err
|= __put_user(get
.mt_fileno
, &((struct mtget32
*)arg
)->mt_fileno
);
1490 err
|= __put_user(get
.mt_blkno
, &((struct mtget32
*)arg
)->mt_blkno
);
1492 case MTIOCGETCONFIG32
:
1493 err
= __put_user(info
.mt_type
, &((struct mtconfiginfo32
*)arg
)->mt_type
);
1494 err
|= __put_user(info
.ifc_type
, &((struct mtconfiginfo32
*)arg
)->ifc_type
);
1495 err
|= __put_user(info
.irqnr
, &((struct mtconfiginfo32
*)arg
)->irqnr
);
1496 err
|= __put_user(info
.dmanr
, &((struct mtconfiginfo32
*)arg
)->dmanr
);
1497 err
|= __put_user(info
.port
, &((struct mtconfiginfo32
*)arg
)->port
);
1498 err
|= __put_user(info
.debug
, &((struct mtconfiginfo32
*)arg
)->debug
);
1499 err
|= __copy_to_user((char *)&((struct mtconfiginfo32
*)arg
)->debug
1500 + sizeof(((struct mtconfiginfo32
*)arg
)->debug
),
1501 (char *)&info
.debug
+ sizeof(info
.debug
), sizeof(__u32
));
1503 case MTIOCSETCONFIG32
:
1506 return err
? -EFAULT
: 0;
1509 struct cdrom_read32
{
1511 __kernel_caddr_t32 cdread_bufaddr
;
1515 struct cdrom_read_audio32
{
1516 union cdrom_addr addr
;
1519 __kernel_caddr_t32 buf
;
1522 struct cdrom_generic_command32
{
1523 unsigned char cmd
[CDROM_PACKET_SIZE
];
1524 __kernel_caddr_t32 buffer
;
1525 unsigned int buflen
;
1527 __kernel_caddr_t32 sense
;
1528 __kernel_caddr_t32 reserved
[3];
1531 static int cdrom_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1533 mm_segment_t old_fs
= get_fs();
1534 struct cdrom_read cdread
;
1535 struct cdrom_read_audio cdreadaudio
;
1536 struct cdrom_generic_command cgc
;
1537 __kernel_caddr_t32 addr
;
1543 case CDROMREADMODE2
:
1544 case CDROMREADMODE1
:
1546 case CDROMREADCOOKED
:
1548 err
= __get_user(cdread
.cdread_lba
, &((struct cdrom_read32
*)arg
)->cdread_lba
);
1549 err
|= __get_user(addr
, &((struct cdrom_read32
*)arg
)->cdread_bufaddr
);
1550 err
|= __get_user(cdread
.cdread_buflen
, &((struct cdrom_read32
*)arg
)->cdread_buflen
);
1553 data
= kmalloc(cdread
.cdread_buflen
, GFP_KERNEL
);
1556 cdread
.cdread_bufaddr
= data
;
1558 case CDROMREADAUDIO
:
1559 karg
= &cdreadaudio
;
1560 err
= copy_from_user(&cdreadaudio
.addr
, &((struct cdrom_read_audio32
*)arg
)->addr
, sizeof(cdreadaudio
.addr
));
1561 err
|= __get_user(cdreadaudio
.addr_format
, &((struct cdrom_read_audio32
*)arg
)->addr_format
);
1562 err
|= __get_user(cdreadaudio
.nframes
, &((struct cdrom_read_audio32
*)arg
)->nframes
);
1563 err
|= __get_user(addr
, &((struct cdrom_read_audio32
*)arg
)->buf
);
1566 data
= kmalloc(cdreadaudio
.nframes
* 2352, GFP_KERNEL
);
1569 cdreadaudio
.buf
= data
;
1571 case CDROM_SEND_PACKET
:
1573 err
= copy_from_user(cgc
.cmd
, &((struct cdrom_generic_command32
*)arg
)->cmd
, sizeof(cgc
.cmd
));
1574 err
|= __get_user(addr
, &((struct cdrom_generic_command32
*)arg
)->buffer
);
1575 err
|= __get_user(cgc
.buflen
, &((struct cdrom_generic_command32
*)arg
)->buflen
);
1578 if ((data
= kmalloc(cgc
.buflen
, GFP_KERNEL
)) == NULL
)
1584 static int count
= 0;
1586 printk("cdrom_ioctl: Unknown cmd fd(%d) "
1587 "cmd(%08x) arg(%08x)\n",
1588 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1593 err
= sys_ioctl (fd
, cmd
, (unsigned long)karg
);
1598 case CDROMREADMODE2
:
1599 case CDROMREADMODE1
:
1601 case CDROMREADCOOKED
:
1602 err
= copy_to_user((char *)A(addr
), data
, cdread
.cdread_buflen
);
1604 case CDROMREADAUDIO
:
1605 err
= copy_to_user((char *)A(addr
), data
, cdreadaudio
.nframes
* 2352);
1607 case CDROM_SEND_PACKET
:
1608 err
= copy_to_user((char *)A(addr
), data
, cgc
.buflen
);
1615 return err
? -EFAULT
: 0;
1618 struct loop_info32
{
1619 int lo_number
; /* ioctl r/o */
1620 __kernel_dev_t32 lo_device
; /* ioctl r/o */
1621 unsigned int lo_inode
; /* ioctl r/o */
1622 __kernel_dev_t32 lo_rdevice
; /* ioctl r/o */
1624 int lo_encrypt_type
;
1625 int lo_encrypt_key_size
; /* ioctl w/o */
1626 int lo_flags
; /* ioctl r/o */
1627 char lo_name
[LO_NAME_SIZE
];
1628 unsigned char lo_encrypt_key
[LO_KEY_SIZE
]; /* ioctl w/o */
1629 unsigned int lo_init
[2];
1633 static int loop_status(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1635 mm_segment_t old_fs
= get_fs();
1640 case LOOP_SET_STATUS
:
1641 err
= get_user(l
.lo_number
, &((struct loop_info32
*)arg
)->lo_number
);
1642 err
|= __get_user(l
.lo_device
, &((struct loop_info32
*)arg
)->lo_device
);
1643 err
|= __get_user(l
.lo_inode
, &((struct loop_info32
*)arg
)->lo_inode
);
1644 err
|= __get_user(l
.lo_rdevice
, &((struct loop_info32
*)arg
)->lo_rdevice
);
1645 err
|= __copy_from_user((char *)&l
.lo_offset
, (char *)&((struct loop_info32
*)arg
)->lo_offset
,
1646 8 + (unsigned long)l
.lo_init
- (unsigned long)&l
.lo_offset
);
1651 err
= sys_ioctl (fd
, cmd
, (unsigned long)&l
);
1655 case LOOP_GET_STATUS
:
1657 err
= sys_ioctl (fd
, cmd
, (unsigned long)&l
);
1660 err
= put_user(l
.lo_number
, &((struct loop_info32
*)arg
)->lo_number
);
1661 err
|= __put_user(l
.lo_device
, &((struct loop_info32
*)arg
)->lo_device
);
1662 err
|= __put_user(l
.lo_inode
, &((struct loop_info32
*)arg
)->lo_inode
);
1663 err
|= __put_user(l
.lo_rdevice
, &((struct loop_info32
*)arg
)->lo_rdevice
);
1664 err
|= __copy_to_user((char *)&((struct loop_info32
*)arg
)->lo_offset
,
1665 (char *)&l
.lo_offset
, (unsigned long)l
.lo_init
- (unsigned long)&l
.lo_offset
);
1671 static int count
= 0;
1673 printk("%s: Unknown loop ioctl cmd, fd(%d) "
1674 "cmd(%08x) arg(%08lx)\n",
1675 __FUNCTION__
, fd
, cmd
, arg
);
1681 extern int tty_ioctl(struct inode
* inode
, struct file
* file
, unsigned int cmd
, unsigned long arg
);
1683 static int vt_check(struct file
*file
)
1685 struct tty_struct
*tty
;
1686 struct inode
*inode
= file
->f_dentry
->d_inode
;
1688 if (file
->f_op
->ioctl
!= tty_ioctl
)
1691 tty
= (struct tty_struct
*)file
->private_data
;
1692 if (tty_paranoia_check(tty
, inode
->i_rdev
, "tty_ioctl"))
1695 if (tty
->driver
.ioctl
!= vt_ioctl
)
1699 * To have permissions to do most of the vt ioctls, we either have
1700 * to be the owner of the tty, or super-user.
1702 if (current
->tty
== tty
|| suser())
1707 struct consolefontdesc32
{
1708 unsigned short charcount
; /* characters in font (256 or 512) */
1709 unsigned short charheight
; /* scan lines per character (1-32) */
1710 u32 chardata
; /* font data in expanded form */
1713 static int do_fontx_ioctl(unsigned int fd
, int cmd
, struct consolefontdesc32
*user_cfd
, struct file
*file
)
1715 struct consolefontdesc cfdarg
;
1716 struct console_font_op op
;
1719 perm
= vt_check(file
);
1720 if (perm
< 0) return perm
;
1722 if (copy_from_user(&cfdarg
, user_cfd
, sizeof(struct consolefontdesc32
)))
1725 cfdarg
.chardata
= (unsigned char *)A(((struct consolefontdesc32
*)&cfdarg
)->chardata
);
1731 op
.op
= KD_FONT_OP_SET
;
1734 op
.height
= cfdarg
.charheight
;
1735 op
.charcount
= cfdarg
.charcount
;
1736 op
.data
= cfdarg
.chardata
;
1737 return con_font_op(fg_console
, &op
);
1739 if (!cfdarg
.chardata
)
1741 op
.op
= KD_FONT_OP_GET
;
1744 op
.height
= cfdarg
.charheight
;
1745 op
.charcount
= cfdarg
.charcount
;
1746 op
.data
= cfdarg
.chardata
;
1747 i
= con_font_op(fg_console
, &op
);
1750 cfdarg
.charheight
= op
.height
;
1751 cfdarg
.charcount
= op
.charcount
;
1752 ((struct consolefontdesc32
*)&cfdarg
)->chardata
= (unsigned long)cfdarg
.chardata
;
1753 if (copy_to_user(user_cfd
, &cfdarg
, sizeof(struct consolefontdesc32
)))
1760 struct console_font_op32
{
1761 unsigned int op
; /* operation code KD_FONT_OP_* */
1762 unsigned int flags
; /* KD_FONT_FLAG_* */
1763 unsigned int width
, height
; /* font size */
1764 unsigned int charcount
;
1765 u32 data
; /* font data with height fixed to 32 */
1768 static int do_kdfontop_ioctl(unsigned int fd
, unsigned int cmd
, struct console_font_op32
*fontop
, struct file
*file
)
1770 struct console_font_op op
;
1771 int perm
= vt_check(file
), i
;
1772 struct vt_struct
*vt
;
1774 if (perm
< 0) return perm
;
1776 if (copy_from_user(&op
, (void *) fontop
, sizeof(struct console_font_op32
)))
1778 if (!perm
&& op
.op
!= KD_FONT_OP_GET
)
1780 op
.data
= (unsigned char *)A(((struct console_font_op32
*)&op
)->data
);
1781 op
.flags
|= KD_FONT_FLAG_OLD
;
1782 vt
= (struct vt_struct
*)((struct tty_struct
*)file
->private_data
)->driver_data
;
1783 i
= con_font_op(vt
->vc_num
, &op
);
1785 ((struct console_font_op32
*)&op
)->data
= (unsigned long)op
.data
;
1786 if (copy_to_user((void *) fontop
, &op
, sizeof(struct console_font_op32
)))
1791 struct unimapdesc32
{
1792 unsigned short entry_ct
;
1796 static int do_unimap_ioctl(unsigned int fd
, unsigned int cmd
, struct unimapdesc32
*user_ud
, struct file
*file
)
1798 struct unimapdesc32 tmp
;
1799 int perm
= vt_check(file
);
1801 if (perm
< 0) return perm
;
1802 if (copy_from_user(&tmp
, user_ud
, sizeof tmp
))
1806 if (!perm
) return -EPERM
;
1807 return con_set_unimap(fg_console
, tmp
.entry_ct
, (struct unipair
*)A(tmp
.entries
));
1809 return con_get_unimap(fg_console
, tmp
.entry_ct
, &(user_ud
->entry_ct
), (struct unipair
*)A(tmp
.entries
));
1814 static int do_smb_getmountuid(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1816 mm_segment_t old_fs
= get_fs();
1817 __kernel_uid_t kuid
;
1820 cmd
= SMB_IOC_GETMOUNTUID
;
1823 err
= sys_ioctl(fd
, cmd
, (unsigned long)&kuid
);
1827 err
= put_user(kuid
, (__kernel_uid_t32
*)arg
);
1832 struct atmif_sioc32
{
1835 __kernel_caddr_t32 arg
;
1838 struct atm_iobuf32
{
1840 __kernel_caddr_t32 buffer
;
1843 #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32)
1844 #define ATM_GETNAMES32 _IOW('a', ATMIOC_ITF+3, struct atm_iobuf32)
1845 #define ATM_GETTYPE32 _IOW('a', ATMIOC_ITF+4, struct atmif_sioc32)
1846 #define ATM_GETESI32 _IOW('a', ATMIOC_ITF+5, struct atmif_sioc32)
1847 #define ATM_GETADDR32 _IOW('a', ATMIOC_ITF+6, struct atmif_sioc32)
1848 #define ATM_RSTADDR32 _IOW('a', ATMIOC_ITF+7, struct atmif_sioc32)
1849 #define ATM_ADDADDR32 _IOW('a', ATMIOC_ITF+8, struct atmif_sioc32)
1850 #define ATM_DELADDR32 _IOW('a', ATMIOC_ITF+9, struct atmif_sioc32)
1851 #define ATM_GETCIRANGE32 _IOW('a', ATMIOC_ITF+10, struct atmif_sioc32)
1852 #define ATM_SETCIRANGE32 _IOW('a', ATMIOC_ITF+11, struct atmif_sioc32)
1853 #define ATM_SETESI32 _IOW('a', ATMIOC_ITF+12, struct atmif_sioc32)
1854 #define ATM_SETESIF32 _IOW('a', ATMIOC_ITF+13, struct atmif_sioc32)
1855 #define ATM_GETSTAT32 _IOW('a', ATMIOC_SARCOM+0, struct atmif_sioc32)
1856 #define ATM_GETSTATZ32 _IOW('a', ATMIOC_SARCOM+1, struct atmif_sioc32)
1857 #define ATM_GETLOOP32 _IOW('a', ATMIOC_SARCOM+2, struct atmif_sioc32)
1858 #define ATM_SETLOOP32 _IOW('a', ATMIOC_SARCOM+3, struct atmif_sioc32)
1859 #define ATM_QUERYLOOP32 _IOW('a', ATMIOC_SARCOM+4, struct atmif_sioc32)
1864 } atm_ioctl_map
[] = {
1865 { ATM_GETLINKRATE32
, ATM_GETLINKRATE
},
1866 { ATM_GETNAMES32
, ATM_GETNAMES
},
1867 { ATM_GETTYPE32
, ATM_GETTYPE
},
1868 { ATM_GETESI32
, ATM_GETESI
},
1869 { ATM_GETADDR32
, ATM_GETADDR
},
1870 { ATM_RSTADDR32
, ATM_RSTADDR
},
1871 { ATM_ADDADDR32
, ATM_ADDADDR
},
1872 { ATM_DELADDR32
, ATM_DELADDR
},
1873 { ATM_GETCIRANGE32
, ATM_GETCIRANGE
},
1874 { ATM_SETCIRANGE32
, ATM_SETCIRANGE
},
1875 { ATM_SETESI32
, ATM_SETESI
},
1876 { ATM_SETESIF32
, ATM_SETESIF
},
1877 { ATM_GETSTAT32
, ATM_GETSTAT
},
1878 { ATM_GETSTATZ32
, ATM_GETSTATZ
},
1879 { ATM_GETLOOP32
, ATM_GETLOOP
},
1880 { ATM_SETLOOP32
, ATM_SETLOOP
},
1881 { ATM_QUERYLOOP32
, ATM_QUERYLOOP
}
1884 #define NR_ATM_IOCTL (sizeof(atm_ioctl_map)/sizeof(atm_ioctl_map[0]))
1887 static int do_atm_iobuf(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1889 struct atm_iobuf32 iobuf32
;
1890 struct atm_iobuf iobuf
= { 0, NULL
};
1891 mm_segment_t old_fs
;
1894 err
= copy_from_user(&iobuf32
, (struct atm_iobuf32
*)arg
,
1895 sizeof(struct atm_iobuf32
));
1899 iobuf
.length
= iobuf32
.length
;
1901 if (iobuf32
.buffer
== (__kernel_caddr_t32
) NULL
|| iobuf32
.length
== 0) {
1902 iobuf
.buffer
= (void*)(unsigned long)iobuf32
.buffer
;
1904 iobuf
.buffer
= kmalloc(iobuf
.length
, GFP_KERNEL
);
1905 if (iobuf
.buffer
== NULL
) {
1910 err
= copy_from_user(iobuf
.buffer
, A(iobuf32
.buffer
), iobuf
.length
);
1917 old_fs
= get_fs(); set_fs (KERNEL_DS
);
1918 err
= sys_ioctl (fd
, cmd
, (unsigned long)&iobuf
);
1923 if(iobuf
.buffer
&& iobuf
.length
> 0) {
1924 err
= copy_to_user(A(iobuf32
.buffer
), iobuf
.buffer
, iobuf
.length
);
1930 err
= __put_user(iobuf
.length
, &(((struct atm_iobuf32
*)arg
)->length
));
1933 if(iobuf32
.buffer
&& iobuf32
.length
> 0)
1934 kfree(iobuf
.buffer
);
1940 static int do_atmif_sioc(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1942 struct atmif_sioc32 sioc32
;
1943 struct atmif_sioc sioc
= { 0, 0, NULL
};
1944 mm_segment_t old_fs
;
1947 err
= copy_from_user(&sioc32
, (struct atmif_sioc32
*)arg
,
1948 sizeof(struct atmif_sioc32
));
1952 sioc
.number
= sioc32
.number
;
1953 sioc
.length
= sioc32
.length
;
1955 if (sioc32
.arg
== (__kernel_caddr_t32
) NULL
|| sioc32
.length
== 0) {
1956 sioc
.arg
= (void*)(unsigned long)sioc32
.arg
;
1958 sioc
.arg
= kmalloc(sioc
.length
, GFP_KERNEL
);
1959 if (sioc
.arg
== NULL
) {
1964 err
= copy_from_user(sioc
.arg
, A(sioc32
.arg
), sioc32
.length
);
1971 old_fs
= get_fs(); set_fs (KERNEL_DS
);
1972 err
= sys_ioctl (fd
, cmd
, (unsigned long)&sioc
);
1978 if(sioc
.arg
&& sioc
.length
> 0) {
1979 err
= copy_to_user(A(sioc32
.arg
), sioc
.arg
, sioc
.length
);
1985 err
= __put_user(sioc
.length
, &(((struct atmif_sioc32
*)arg
)->length
));
1988 if(sioc32
.arg
&& sioc32
.length
> 0)
1995 static int do_atm_ioctl(unsigned int fd
, unsigned int cmd32
, unsigned long arg
)
1998 unsigned int cmd
= 0;
2002 case SONET_GETSTATZ
:
2006 case SONET_SETFRAMING
:
2007 case SONET_GETFRAMING
:
2008 case SONET_GETFRSENSE
:
2009 return do_atmif_sioc(fd
, cmd32
, arg
);
2012 for (i
= 0; i
< NR_ATM_IOCTL
; i
++) {
2013 if (cmd32
== atm_ioctl_map
[i
].cmd32
) {
2014 cmd
= atm_ioctl_map
[i
].cmd
;
2018 if (i
== NR_ATM_IOCTL
) {
2024 return do_atm_iobuf(fd
, cmd
, arg
);
2026 case ATM_GETLINKRATE
:
2033 case ATM_GETCIRANGE
:
2034 case ATM_SETCIRANGE
:
2042 return do_atmif_sioc(fd
, cmd
, arg
);
2048 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
2049 /* Ugh, LVM. Pitty it was not cleaned up before accepted :((. */
2051 uint8_t vg_name
[NAME_LEN
];
2065 uint32_t pe_allocated
;
2068 u32 pv
[ABS_MAX_PV
+ 1];
2069 u32 lv
[ABS_MAX_LV
+ 1];
2075 lvm_disk_data_t pv_on_disk
;
2076 lvm_disk_data_t vg_on_disk
;
2077 lvm_disk_data_t pv_namelist_on_disk
;
2078 lvm_disk_data_t lv_on_disk
;
2079 lvm_disk_data_t pe_on_disk
;
2080 uint8_t pv_name
[NAME_LEN
];
2081 uint8_t vg_name
[NAME_LEN
];
2082 uint8_t system_id
[NAME_LEN
];
2086 uint32_t pv_allocatable
;
2091 uint32_t pe_allocated
;
2098 char lv_name
[NAME_LEN
];
2105 } lv_status_byindex_req32_t
;
2108 uint8_t lv_name
[NAME_LEN
];
2116 char pv_name
[NAME_LEN
];
2118 } pv_status_req32_t
;
2121 uint8_t lv_name
[NAME_LEN
];
2122 uint8_t vg_name
[NAME_LEN
];
2128 uint32_t lv_mirror_copies
;
2129 uint32_t lv_recovery
;
2130 uint32_t lv_schedule
;
2133 uint32_t lv_current_le
;
2134 uint32_t lv_allocated_le
;
2135 uint32_t lv_stripes
;
2136 uint32_t lv_stripesize
;
2137 uint32_t lv_badblock
;
2138 uint32_t lv_allocation
;
2139 uint32_t lv_io_timeout
;
2140 uint32_t lv_read_ahead
;
2141 /* delta to version 1 starts here */
2142 u32 lv_snapshot_org
;
2143 u32 lv_snapshot_prev
;
2144 u32 lv_snapshot_next
;
2145 u32 lv_block_exception
;
2146 uint32_t lv_remap_ptr
;
2147 uint32_t lv_remap_end
;
2148 uint32_t lv_chunk_size
;
2149 uint32_t lv_snapshot_minor
;
2159 } lv_block_exception32_t
;
2161 static void put_lv_t(lv_t
*l
)
2163 if (l
->lv_current_pe
) vfree(l
->lv_current_pe
);
2164 if (l
->lv_block_exception
) vfree(l
->lv_block_exception
);
2168 static lv_t
*get_lv_t(u32 p
, int *errp
)
2173 lv_block_exception32_t
*lbe32
;
2174 lv_block_exception_t
*lbe
;
2175 lv32_t
*ul
= (lv32_t
*)A(p
);
2176 lv_t
*l
= (lv_t
*)kmalloc(sizeof(lv_t
), GFP_KERNEL
);
2181 memset(l
, 0, sizeof(lv_t
));
2182 err
= copy_from_user(l
, ul
, (long)&((lv32_t
*)0)->lv_current_pe
);
2183 err
|= __copy_from_user(&l
->lv_current_le
, &ul
->lv_current_le
,
2184 ((long)&ul
->lv_snapshot_org
) - ((long)&ul
->lv_current_le
));
2185 err
|= __copy_from_user(&l
->lv_remap_ptr
, &ul
->lv_remap_ptr
,
2186 ((long)&ul
->dummy
[0]) - ((long)&ul
->lv_remap_ptr
));
2187 err
|= __get_user(ptr1
, &ul
->lv_current_pe
);
2188 err
|= __get_user(ptr2
, &ul
->lv_block_exception
);
2195 size
= l
->lv_allocated_le
* sizeof(pe_t
);
2196 l
->lv_current_pe
= vmalloc(size
);
2197 if (l
->lv_current_pe
)
2198 err
= copy_from_user(l
->lv_current_pe
, (void *)A(ptr1
), size
);
2201 size
= l
->lv_remap_end
* sizeof(lv_block_exception_t
);
2202 l
->lv_block_exception
= lbe
= vmalloc(size
);
2203 if (l
->lv_block_exception
) {
2204 lbe32
= (lv_block_exception32_t
*)A(ptr2
);
2205 memset(lbe
, 0, size
);
2206 for (i
= 0; i
< l
->lv_remap_end
; i
++, lbe
++, lbe32
++) {
2207 err
|= get_user(lbe
->rsector_org
, &lbe32
->rsector_org
);
2208 err
|= __get_user(lbe
->rdev_org
, &lbe32
->rdev_org
);
2209 err
|= __get_user(lbe
->rsector_new
, &lbe32
->rsector_new
);
2210 err
|= __get_user(lbe
->rdev_new
, &lbe32
->rdev_new
);
2214 if (err
|| (ptr1
&& !l
->lv_current_pe
) || (ptr2
&& !l
->lv_block_exception
)) {
2225 static int copy_lv_t(u32 ptr
, lv_t
*l
)
2228 lv32_t
*ul
= (lv32_t
*)A(ptr
);
2232 err
= get_user(ptr1
, &ul
->lv_current_pe
);
2235 err
= copy_to_user(ul
, l
, (long)&((lv32_t
*)0)->lv_current_pe
);
2236 err
|= __copy_to_user(&ul
->lv_current_le
, &l
->lv_current_le
,
2237 ((long)&ul
->lv_snapshot_org
) - ((long)&ul
->lv_current_le
));
2238 err
|= __copy_to_user(&ul
->lv_remap_ptr
, &l
->lv_remap_ptr
,
2239 ((long)&ul
->dummy
[0]) - ((long)&ul
->lv_remap_ptr
));
2240 size
= l
->lv_allocated_le
* sizeof(pe_t
);
2241 err
|= __copy_to_user((void *)A(ptr1
), l
->lv_current_pe
, size
);
2245 static int do_lvm_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2250 le_remap_req_t le_remap
;
2251 lv_status_byindex_req_t lv_byindex
;
2252 pv_status_req32_t pv_status
;
2258 mm_segment_t old_fs
;
2263 v
= kmalloc(sizeof(vg_t
), GFP_KERNEL
);
2264 if (!v
) return -ENOMEM
;
2268 v
= kmalloc(sizeof(vg_t
), GFP_KERNEL
);
2269 if (!v
) return -ENOMEM
;
2270 if (copy_from_user(v
, (void *)arg
, (long)&((vg32_t
*)0)->proc
) ||
2271 __get_user(v
->proc
, &((vg32_t
*)arg
)->proc
)) {
2276 memset(v
->pv
, 0, sizeof(v
->pv
) + sizeof(v
->lv
));
2277 if (v
->pv_max
> ABS_MAX_PV
|| v
->lv_max
== ABS_MAX_LV
) return -EPERM
;
2278 for (i
= 0; i
< v
->pv_max
; i
++) {
2279 err
= __get_user(ptr
, &((vg32_t
*)arg
)->pv
[i
]);
2282 v
->pv
[i
] = kmalloc(sizeof(pv_t
), GFP_KERNEL
);
2287 err
= copy_from_user(v
->pv
[i
], (void *)A(ptr
), sizeof(pv32_t
) - 8);
2292 v
->pv
[i
]->pe
= NULL
; v
->pv
[i
]->inode
= NULL
;
2296 for (i
= 0; i
< v
->lv_max
; i
++) {
2297 err
= __get_user(ptr
, &((vg32_t
*)arg
)->lv
[i
]);
2300 v
->lv
[i
] = get_lv_t(ptr
, &err
);
2310 case LV_STATUS_BYNAME
:
2311 err
= copy_from_user(&u
.pv_status
, arg
, sizeof(u
.pv_status
.pv_name
));
2312 if (err
) return -EFAULT
;
2313 if (cmd
!= LV_REMOVE
) {
2314 err
= __get_user(ptr
, &((lv_req32_t
*)arg
)->lv
);
2315 if (err
) return err
;
2316 u
.lv_req
.lv
= get_lv_t(ptr
, &err
);
2320 case LV_STATUS_BYINDEX
:
2321 err
= get_user(u
.lv_byindex
.lv_index
, &((lv_status_byindex_req32_t
*)arg
)->lv_index
);
2322 err
|= __get_user(ptr
, &((lv_status_byindex_req32_t
*)arg
)->lv
);
2323 if (err
) return err
;
2324 u
.lv_byindex
.lv
= get_lv_t(ptr
, &err
);
2327 err
= copy_from_user(&p
, (void *)arg
, sizeof(pv32_t
) - 8);
2328 if (err
) return -EFAULT
;
2329 p
.pe
= NULL
; p
.inode
= NULL
;
2333 err
= copy_from_user(&u
.le_remap
, (void *)arg
, sizeof(le_remap_req32_t
));
2334 if (err
) return -EFAULT
;
2335 u
.le_remap
.new_pe
= ((le_remap_req32_t
*)&u
.le_remap
)->new_pe
;
2336 u
.le_remap
.old_pe
= ((le_remap_req32_t
*)&u
.le_remap
)->old_pe
;
2340 err
= copy_from_user(&u
.pv_status
, arg
, sizeof(u
.lv_req
.lv_name
));
2341 if (err
) return -EFAULT
;
2342 err
= __get_user(ptr
, &((pv_status_req32_t
*)arg
)->pv
);
2343 if (err
) return err
;
2344 u
.pv_status
.pv
= &p
;
2345 if (cmd
== PV_CHANGE
) {
2346 err
= copy_from_user(&p
, (void *)A(ptr
), sizeof(pv32_t
) - 8);
2347 if (err
) return -EFAULT
;
2348 p
.pe
= NULL
; p
.inode
= NULL
;
2352 old_fs
= get_fs(); set_fs (KERNEL_DS
);
2353 err
= sys_ioctl (fd
, cmd
, (unsigned long)karg
);
2358 if (copy_to_user((void *)arg
, v
, (long)&((vg32_t
*)0)->proc
) ||
2359 clear_user(&((vg32_t
*)arg
)->proc
, sizeof(vg32_t
) - (long)&((vg32_t
*)0)->proc
))
2365 for (i
= 0; i
< v
->pv_max
; i
++)
2366 if (v
->pv
[i
]) kfree(v
->pv
[i
]);
2367 for (i
= 0; i
< v
->lv_max
; i
++)
2368 if (v
->lv
[i
]) put_lv_t(v
->lv
[i
]);
2371 case LV_STATUS_BYNAME
:
2372 if (!err
&& u
.lv_req
.lv
) err
= copy_lv_t(ptr
, u
.lv_req
.lv
);
2377 if (u
.lv_req
.lv
) put_lv_t(u
.lv_req
.lv
);
2379 case LV_STATUS_BYINDEX
:
2380 if (u
.lv_byindex
.lv
) {
2381 if (!err
) err
= copy_lv_t(ptr
, u
.lv_byindex
.lv
);
2382 put_lv_t(u
.lv_byindex
.lv
);
2386 err
= copy_to_user((void *)A(ptr
), &p
, sizeof(pv32_t
) - 8);
2387 if (err
) return -EFAULT
;
2395 #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
2396 /* This really belongs in include/linux/drm.h -DaveM */
2397 #include "../../../drivers/char/drm/drm.h"
2399 typedef struct drm32_version
{
2400 int version_major
; /* Major version */
2401 int version_minor
; /* Minor version */
2402 int version_patchlevel
;/* Patch level */
2403 int name_len
; /* Length of name buffer */
2404 u32 name
; /* Name of driver */
2405 int date_len
; /* Length of date buffer */
2406 u32 date
; /* User-space buffer to hold date */
2407 int desc_len
; /* Length of desc buffer */
2408 u32 desc
; /* User-space buffer to hold desc */
2410 #define DRM32_IOCTL_VERSION DRM_IOWR(0x00, drm32_version_t)
2412 static int drm32_version(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2414 drm32_version_t
*uversion
= (drm32_version_t
*)arg
;
2415 char *name_ptr
, *date_ptr
, *desc_ptr
;
2416 u32 tmp1
, tmp2
, tmp3
;
2417 drm_version_t kversion
;
2418 mm_segment_t old_fs
;
2421 memset(&kversion
, 0, sizeof(kversion
));
2422 if (get_user(kversion
.name_len
, &uversion
->name_len
) ||
2423 get_user(kversion
.date_len
, &uversion
->date_len
) ||
2424 get_user(kversion
.desc_len
, &uversion
->desc_len
) ||
2425 get_user(tmp1
, &uversion
->name
) ||
2426 get_user(tmp2
, &uversion
->date
) ||
2427 get_user(tmp3
, &uversion
->desc
))
2430 name_ptr
= (char *) A(tmp1
);
2431 date_ptr
= (char *) A(tmp2
);
2432 desc_ptr
= (char *) A(tmp3
);
2435 if (kversion
.name_len
&& name_ptr
) {
2436 kversion
.name
= kmalloc(kversion
.name_len
, GFP_KERNEL
);
2440 if (kversion
.date_len
&& date_ptr
) {
2441 kversion
.date
= kmalloc(kversion
.date_len
, GFP_KERNEL
);
2445 if (kversion
.desc_len
&& desc_ptr
) {
2446 kversion
.desc
= kmalloc(kversion
.desc_len
, GFP_KERNEL
);
2453 ret
= sys_ioctl (fd
, DRM_IOCTL_VERSION
, (unsigned long)&kversion
);
2457 if ((kversion
.name
&&
2458 copy_to_user(name_ptr
, kversion
.name
, kversion
.name_len
)) ||
2460 copy_to_user(date_ptr
, kversion
.date
, kversion
.date_len
)) ||
2462 copy_to_user(desc_ptr
, kversion
.desc
, kversion
.desc_len
)))
2464 if (put_user(kversion
.version_major
, &uversion
->version_major
) ||
2465 put_user(kversion
.version_minor
, &uversion
->version_minor
) ||
2466 put_user(kversion
.version_patchlevel
, &uversion
->version_patchlevel
) ||
2467 put_user(kversion
.name_len
, &uversion
->name_len
) ||
2468 put_user(kversion
.date_len
, &uversion
->date_len
) ||
2469 put_user(kversion
.desc_len
, &uversion
->desc_len
))
2475 kfree(kversion
.name
);
2477 kfree(kversion
.date
);
2479 kfree(kversion
.desc
);
2483 typedef struct drm32_unique
{
2484 int unique_len
; /* Length of unique */
2485 u32 unique
; /* Unique name for driver instantiation */
2487 #define DRM32_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm32_unique_t)
2488 #define DRM32_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm32_unique_t)
2490 static int drm32_getsetunique(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2492 drm32_unique_t
*uarg
= (drm32_unique_t
*)arg
;
2494 mm_segment_t old_fs
;
2499 if (get_user(karg
.unique_len
, &uarg
->unique_len
))
2503 if (get_user(tmp
, &uarg
->unique
))
2506 uptr
= (char *) A(tmp
);
2509 karg
.unique
= kmalloc(karg
.unique_len
, GFP_KERNEL
);
2512 if (cmd
== DRM32_IOCTL_SET_UNIQUE
&&
2513 copy_from_user(karg
.unique
, uptr
, karg
.unique_len
)) {
2521 if (cmd
== DRM32_IOCTL_GET_UNIQUE
)
2522 ret
= sys_ioctl (fd
, DRM_IOCTL_GET_UNIQUE
, (unsigned long)&karg
);
2524 ret
= sys_ioctl (fd
, DRM_IOCTL_SET_UNIQUE
, (unsigned long)&karg
);
2528 if (cmd
== DRM32_IOCTL_GET_UNIQUE
&&
2530 copy_to_user(uptr
, karg
.unique
, karg
.unique_len
))
2532 if (put_user(karg
.unique_len
, &uarg
->unique_len
))
2536 if (karg
.unique
!= NULL
)
2542 typedef struct drm32_map
{
2543 u32 offset
; /* Requested physical address (0 for SAREA)*/
2544 u32 size
; /* Requested physical size (bytes) */
2545 drm_map_type_t type
; /* Type of memory to map */
2546 drm_map_flags_t flags
; /* Flags */
2547 u32 handle
; /* User-space: "Handle" to pass to mmap */
2548 /* Kernel-space: kernel-virtual address */
2549 int mtrr
; /* MTRR slot used */
2552 #define DRM32_IOCTL_ADD_MAP DRM_IOWR(0x15, drm32_map_t)
2554 static int drm32_addmap(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2556 drm32_map_t
*uarg
= (drm32_map_t
*) arg
;
2558 mm_segment_t old_fs
;
2562 ret
= get_user(karg
.offset
, &uarg
->offset
);
2563 ret
|= get_user(karg
.size
, &uarg
->size
);
2564 ret
|= get_user(karg
.type
, &uarg
->type
);
2565 ret
|= get_user(karg
.flags
, &uarg
->flags
);
2566 ret
|= get_user(tmp
, &uarg
->handle
);
2567 ret
|= get_user(karg
.mtrr
, &uarg
->mtrr
);
2571 karg
.handle
= (void *) A(tmp
);
2575 ret
= sys_ioctl(fd
, DRM_IOCTL_ADD_MAP
, (unsigned long) &karg
);
2579 ret
= put_user(karg
.offset
, &uarg
->offset
);
2580 ret
|= put_user(karg
.size
, &uarg
->size
);
2581 ret
|= put_user(karg
.type
, &uarg
->type
);
2582 ret
|= put_user(karg
.flags
, &uarg
->flags
);
2583 tmp
= (u32
) (long)karg
.handle
;
2584 ret
|= put_user(tmp
, &uarg
->handle
);
2585 ret
|= put_user(karg
.mtrr
, &uarg
->mtrr
);
2593 typedef struct drm32_buf_info
{
2594 int count
; /* Entries in list */
2595 u32 list
; /* (drm_buf_desc_t *) */
2597 #define DRM32_IOCTL_INFO_BUFS DRM_IOWR(0x18, drm32_buf_info_t)
2599 static int drm32_info_bufs(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2601 drm32_buf_info_t
*uarg
= (drm32_buf_info_t
*)arg
;
2602 drm_buf_desc_t
*ulist
;
2603 drm_buf_info_t karg
;
2604 mm_segment_t old_fs
;
2605 int orig_count
, ret
;
2608 if (get_user(karg
.count
, &uarg
->count
) ||
2609 get_user(tmp
, &uarg
->list
))
2612 ulist
= (drm_buf_desc_t
*) A(tmp
);
2614 orig_count
= karg
.count
;
2616 karg
.list
= kmalloc(karg
.count
* sizeof(drm_buf_desc_t
), GFP_KERNEL
);
2622 ret
= sys_ioctl(fd
, DRM_IOCTL_INFO_BUFS
, (unsigned long) &karg
);
2626 if (karg
.count
<= orig_count
&&
2627 (copy_to_user(ulist
, karg
.list
,
2628 karg
.count
* sizeof(drm_buf_desc_t
))))
2630 if (put_user(karg
.count
, &uarg
->count
))
2639 typedef struct drm32_buf_free
{
2641 u32 list
; /* (int *) */
2643 #define DRM32_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm32_buf_free_t)
2645 static int drm32_free_bufs(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2647 drm32_buf_free_t
*uarg
= (drm32_buf_free_t
*)arg
;
2648 drm_buf_free_t karg
;
2649 mm_segment_t old_fs
;
2654 if (get_user(karg
.count
, &uarg
->count
) ||
2655 get_user(tmp
, &uarg
->list
))
2658 ulist
= (int *) A(tmp
);
2660 karg
.list
= kmalloc(karg
.count
* sizeof(int), GFP_KERNEL
);
2665 if (copy_from_user(karg
.list
, ulist
, (karg
.count
* sizeof(int))))
2670 ret
= sys_ioctl(fd
, DRM_IOCTL_FREE_BUFS
, (unsigned long) &karg
);
2679 typedef struct drm32_buf_pub
{
2680 int idx
; /* Index into master buflist */
2681 int total
; /* Buffer size */
2682 int used
; /* Amount of buffer in use (for DMA) */
2683 u32 address
; /* Address of buffer (void *) */
2686 typedef struct drm32_buf_map
{
2687 int count
; /* Length of buflist */
2688 u32
virtual; /* Mmaped area in user-virtual (void *) */
2689 u32 list
; /* Buffer information (drm_buf_pub_t *) */
2691 #define DRM32_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm32_buf_map_t)
2693 static int drm32_map_bufs(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2695 drm32_buf_map_t
*uarg
= (drm32_buf_map_t
*)arg
;
2696 drm32_buf_pub_t
*ulist
;
2698 mm_segment_t old_fs
;
2699 int orig_count
, ret
, i
;
2702 if (get_user(karg
.count
, &uarg
->count
) ||
2703 get_user(tmp1
, &uarg
->virtual) ||
2704 get_user(tmp2
, &uarg
->list
))
2707 karg
.virtual = (void *) A(tmp1
);
2708 ulist
= (drm32_buf_pub_t
*) A(tmp2
);
2710 orig_count
= karg
.count
;
2712 karg
.list
= kmalloc(karg
.count
* sizeof(drm_buf_pub_t
), GFP_KERNEL
);
2717 for (i
= 0; i
< karg
.count
; i
++) {
2718 if (get_user(karg
.list
[i
].idx
, &ulist
[i
].idx
) ||
2719 get_user(karg
.list
[i
].total
, &ulist
[i
].total
) ||
2720 get_user(karg
.list
[i
].used
, &ulist
[i
].used
) ||
2721 get_user(tmp1
, &ulist
[i
].address
))
2724 karg
.list
[i
].address
= (void *) A(tmp1
);
2729 ret
= sys_ioctl(fd
, DRM_IOCTL_MAP_BUFS
, (unsigned long) &karg
);
2733 for (i
= 0; i
< orig_count
; i
++) {
2734 tmp1
= (u32
) (long) karg
.list
[i
].address
;
2735 if (put_user(karg
.list
[i
].idx
, &ulist
[i
].idx
) ||
2736 put_user(karg
.list
[i
].total
, &ulist
[i
].total
) ||
2737 put_user(karg
.list
[i
].used
, &ulist
[i
].used
) ||
2738 put_user(tmp1
, &ulist
[i
].address
)) {
2743 if (put_user(karg
.count
, &uarg
->count
))
2752 typedef struct drm32_dma
{
2753 /* Indices here refer to the offset into
2754 buflist in drm_buf_get_t. */
2755 int context
; /* Context handle */
2756 int send_count
; /* Number of buffers to send */
2757 u32 send_indices
; /* List of handles to buffers (int *) */
2758 u32 send_sizes
; /* Lengths of data to send (int *) */
2759 drm_dma_flags_t flags
; /* Flags */
2760 int request_count
; /* Number of buffers requested */
2761 int request_size
; /* Desired size for buffers */
2762 u32 request_indices
; /* Buffer information (int *) */
2763 u32 request_sizes
; /* (int *) */
2764 int granted_count
; /* Number of buffers granted */
2766 #define DRM32_IOCTL_DMA DRM_IOWR(0x29, drm32_dma_t)
2768 /* RED PEN The DRM layer blindly dereferences the send/request
2769 * indice/size arrays even though they are userland
2772 static int drm32_dma(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2774 drm32_dma_t
*uarg
= (drm32_dma_t
*) arg
;
2775 int *u_si
, *u_ss
, *u_ri
, *u_rs
;
2777 mm_segment_t old_fs
;
2779 u32 tmp1
, tmp2
, tmp3
, tmp4
;
2781 karg
.send_indices
= karg
.send_sizes
= NULL
;
2782 karg
.request_indices
= karg
.request_sizes
= NULL
;
2784 if (get_user(karg
.context
, &uarg
->context
) ||
2785 get_user(karg
.send_count
, &uarg
->send_count
) ||
2786 get_user(tmp1
, &uarg
->send_indices
) ||
2787 get_user(tmp2
, &uarg
->send_sizes
) ||
2788 get_user(karg
.flags
, &uarg
->flags
) ||
2789 get_user(karg
.request_count
, &uarg
->request_count
) ||
2790 get_user(karg
.request_size
, &uarg
->request_size
) ||
2791 get_user(tmp3
, &uarg
->request_indices
) ||
2792 get_user(tmp4
, &uarg
->request_sizes
) ||
2793 get_user(karg
.granted_count
, &uarg
->granted_count
))
2796 u_si
= (int *) A(tmp1
);
2797 u_ss
= (int *) A(tmp2
);
2798 u_ri
= (int *) A(tmp3
);
2799 u_rs
= (int *) A(tmp4
);
2801 if (karg
.send_count
) {
2802 karg
.send_indices
= kmalloc(karg
.send_count
* sizeof(int), GFP_KERNEL
);
2803 karg
.send_sizes
= kmalloc(karg
.send_count
* sizeof(int), GFP_KERNEL
);
2806 if (!karg
.send_indices
|| !karg
.send_sizes
)
2810 if (copy_from_user(karg
.send_indices
, u_si
,
2811 (karg
.send_count
* sizeof(int))) ||
2812 copy_from_user(karg
.send_sizes
, u_ss
,
2813 (karg
.send_count
* sizeof(int))))
2817 if (karg
.request_count
) {
2818 karg
.request_indices
= kmalloc(karg
.request_count
* sizeof(int), GFP_KERNEL
);
2819 karg
.request_sizes
= kmalloc(karg
.request_count
* sizeof(int), GFP_KERNEL
);
2822 if (!karg
.request_indices
|| !karg
.request_sizes
)
2826 if (copy_from_user(karg
.request_indices
, u_ri
,
2827 (karg
.request_count
* sizeof(int))) ||
2828 copy_from_user(karg
.request_sizes
, u_rs
,
2829 (karg
.request_count
* sizeof(int))))
2835 ret
= sys_ioctl(fd
, DRM_IOCTL_DMA
, (unsigned long) &karg
);
2839 if (put_user(karg
.context
, &uarg
->context
) ||
2840 put_user(karg
.send_count
, &uarg
->send_count
) ||
2841 put_user(karg
.flags
, &uarg
->flags
) ||
2842 put_user(karg
.request_count
, &uarg
->request_count
) ||
2843 put_user(karg
.request_size
, &uarg
->request_size
) ||
2844 put_user(karg
.granted_count
, &uarg
->granted_count
))
2847 if (karg
.send_count
) {
2848 if (copy_to_user(u_si
, karg
.send_indices
,
2849 (karg
.send_count
* sizeof(int))) ||
2850 copy_to_user(u_ss
, karg
.send_sizes
,
2851 (karg
.send_count
* sizeof(int))))
2854 if (karg
.request_count
) {
2855 if (copy_to_user(u_ri
, karg
.request_indices
,
2856 (karg
.request_count
* sizeof(int))) ||
2857 copy_to_user(u_rs
, karg
.request_sizes
,
2858 (karg
.request_count
* sizeof(int))))
2864 if (karg
.send_indices
)
2865 kfree(karg
.send_indices
);
2866 if (karg
.send_sizes
)
2867 kfree(karg
.send_sizes
);
2868 if (karg
.request_indices
)
2869 kfree(karg
.request_indices
);
2870 if (karg
.request_sizes
)
2871 kfree(karg
.request_sizes
);
2876 typedef struct drm32_ctx_res
{
2878 u32 contexts
; /* (drm_ctx_t *) */
2880 #define DRM32_IOCTL_RES_CTX DRM_IOWR(0x26, drm32_ctx_res_t)
2882 static int drm32_res_ctx(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2884 drm32_ctx_res_t
*uarg
= (drm32_ctx_res_t
*) arg
;
2887 mm_segment_t old_fs
;
2888 int orig_count
, ret
;
2891 karg
.contexts
= NULL
;
2892 if (get_user(karg
.count
, &uarg
->count
) ||
2893 get_user(tmp
, &uarg
->contexts
))
2896 ulist
= (drm_ctx_t
*) A(tmp
);
2898 orig_count
= karg
.count
;
2899 if (karg
.count
&& ulist
) {
2900 karg
.contexts
= kmalloc((karg
.count
* sizeof(drm_ctx_t
)), GFP_KERNEL
);
2903 if (copy_from_user(karg
.contexts
, ulist
,
2904 (karg
.count
* sizeof(drm_ctx_t
)))) {
2905 kfree(karg
.contexts
);
2912 ret
= sys_ioctl(fd
, DRM_IOCTL_RES_CTX
, (unsigned long) &karg
);
2917 if (copy_to_user(ulist
, karg
.contexts
,
2918 (orig_count
* sizeof(drm_ctx_t
))))
2921 if (put_user(karg
.count
, &uarg
->count
))
2926 kfree(karg
.contexts
);
2933 static int ret_einval(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2938 static int broken_blkgetsize(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2940 /* The mkswap binary hard codes it to Intel value :-((( */
2941 return w_long(fd
, BLKGETSIZE
, arg
);
2944 struct blkpg_ioctl_arg32
{
2951 static int blkpg_ioctl_trans(unsigned int fd
, unsigned int cmd
, struct blkpg_ioctl_arg32
*arg
)
2953 struct blkpg_ioctl_arg a
;
2954 struct blkpg_partition p
;
2956 mm_segment_t old_fs
= get_fs();
2958 err
= get_user(a
.op
, &arg
->op
);
2959 err
|= __get_user(a
.flags
, &arg
->flags
);
2960 err
|= __get_user(a
.datalen
, &arg
->datalen
);
2961 err
|= __get_user((long)a
.data
, &arg
->data
);
2962 if (err
) return err
;
2964 case BLKPG_ADD_PARTITION
:
2965 case BLKPG_DEL_PARTITION
:
2966 if (a
.datalen
< sizeof(struct blkpg_partition
))
2968 if (copy_from_user(&p
, a
.data
, sizeof(struct blkpg_partition
)))
2972 err
= sys_ioctl(fd
, cmd
, (unsigned long)&a
);
2980 static int ioc_settimeout(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2982 return rw_long(fd
, AUTOFS_IOC_SETTIMEOUT
, arg
);
2985 struct ioctl_trans
{
2987 unsigned int handler
;
2991 #define COMPATIBLE_IOCTL(cmd) asm volatile(".word %0, sys_ioctl, 0" : : "i" (cmd));
2992 #define HANDLE_IOCTL(cmd,handler) asm volatile(".word %0, %1, 0" : : "i" (cmd), "i" (handler));
2993 #define IOCTL_TABLE_START void ioctl32_foo(void) { asm volatile(".data\nioctl_translations:");
2994 #define IOCTL_TABLE_END asm volatile("\nioctl_translations_end:\n\t.previous"); }
2997 /* List here exlicitly which ioctl's are known to have
2998 * compatable types passed or none at all...
3001 COMPATIBLE_IOCTL(TCGETA
)
3002 COMPATIBLE_IOCTL(TCSETA
)
3003 COMPATIBLE_IOCTL(TCSETAW
)
3004 COMPATIBLE_IOCTL(TCSETAF
)
3005 COMPATIBLE_IOCTL(TCSBRK
)
3006 COMPATIBLE_IOCTL(TCXONC
)
3007 COMPATIBLE_IOCTL(TCFLSH
)
3008 COMPATIBLE_IOCTL(TCGETS
)
3009 COMPATIBLE_IOCTL(TCSETS
)
3010 COMPATIBLE_IOCTL(TCSETSW
)
3011 COMPATIBLE_IOCTL(TCSETSF
)
3012 COMPATIBLE_IOCTL(TIOCLINUX
)
3014 COMPATIBLE_IOCTL(TIOCGETD
)
3015 COMPATIBLE_IOCTL(TIOCSETD
)
3016 COMPATIBLE_IOCTL(TIOCEXCL
)
3017 COMPATIBLE_IOCTL(TIOCNXCL
)
3018 COMPATIBLE_IOCTL(TIOCCONS
)
3019 COMPATIBLE_IOCTL(TIOCGSOFTCAR
)
3020 COMPATIBLE_IOCTL(TIOCSSOFTCAR
)
3021 COMPATIBLE_IOCTL(TIOCSWINSZ
)
3022 COMPATIBLE_IOCTL(TIOCGWINSZ
)
3023 COMPATIBLE_IOCTL(TIOCMGET
)
3024 COMPATIBLE_IOCTL(TIOCMBIC
)
3025 COMPATIBLE_IOCTL(TIOCMBIS
)
3026 COMPATIBLE_IOCTL(TIOCMSET
)
3027 COMPATIBLE_IOCTL(TIOCPKT
)
3028 COMPATIBLE_IOCTL(TIOCNOTTY
)
3029 COMPATIBLE_IOCTL(TIOCSTI
)
3030 COMPATIBLE_IOCTL(TIOCOUTQ
)
3031 COMPATIBLE_IOCTL(TIOCSPGRP
)
3032 COMPATIBLE_IOCTL(TIOCGPGRP
)
3033 COMPATIBLE_IOCTL(TIOCSCTTY
)
3034 COMPATIBLE_IOCTL(TIOCGPTN
)
3035 COMPATIBLE_IOCTL(TIOCSPTLCK
)
3036 COMPATIBLE_IOCTL(TIOCGSERIAL
)
3037 COMPATIBLE_IOCTL(TIOCSSERIAL
)
3038 COMPATIBLE_IOCTL(TIOCSERGETLSR
)
3040 COMPATIBLE_IOCTL(FBIOGTYPE
)
3041 COMPATIBLE_IOCTL(FBIOSATTR
)
3042 COMPATIBLE_IOCTL(FBIOGATTR
)
3043 COMPATIBLE_IOCTL(FBIOSVIDEO
)
3044 COMPATIBLE_IOCTL(FBIOGVIDEO
)
3045 COMPATIBLE_IOCTL(FBIOGCURSOR32
) /* This is not implemented yet. Later it should be converted... */
3046 COMPATIBLE_IOCTL(FBIOSCURPOS
)
3047 COMPATIBLE_IOCTL(FBIOGCURPOS
)
3048 COMPATIBLE_IOCTL(FBIOGCURMAX
)
3049 COMPATIBLE_IOCTL(FBIOGET_VSCREENINFO
)
3050 COMPATIBLE_IOCTL(FBIOPUT_VSCREENINFO
)
3051 COMPATIBLE_IOCTL(FBIOPAN_DISPLAY
)
3052 COMPATIBLE_IOCTL(FBIOGET_FCURSORINFO
)
3053 COMPATIBLE_IOCTL(FBIOGET_VCURSORINFO
)
3054 COMPATIBLE_IOCTL(FBIOPUT_VCURSORINFO
)
3055 COMPATIBLE_IOCTL(FBIOGET_CURSORSTATE
)
3056 COMPATIBLE_IOCTL(FBIOPUT_CURSORSTATE
)
3057 COMPATIBLE_IOCTL(FBIOGET_CON2FBMAP
)
3058 COMPATIBLE_IOCTL(FBIOPUT_CON2FBMAP
)
3060 COMPATIBLE_IOCTL(FIOCLEX
)
3061 COMPATIBLE_IOCTL(FIONCLEX
)
3062 COMPATIBLE_IOCTL(FIOASYNC
)
3063 COMPATIBLE_IOCTL(FIONBIO
)
3064 COMPATIBLE_IOCTL(FIONREAD
) /* This is also TIOCINQ */
3066 COMPATIBLE_IOCTL(FIBMAP
)
3067 COMPATIBLE_IOCTL(FIGETBSZ
)
3068 /* 0x03 -- HD/IDE ioctl's used by hdparm and friends.
3069 * Some need translations, these do not.
3071 COMPATIBLE_IOCTL(HDIO_GET_IDENTITY
)
3072 COMPATIBLE_IOCTL(HDIO_SET_DMA
)
3073 COMPATIBLE_IOCTL(HDIO_SET_KEEPSETTINGS
)
3074 COMPATIBLE_IOCTL(HDIO_SET_UNMASKINTR
)
3075 COMPATIBLE_IOCTL(HDIO_SET_NOWERR
)
3076 COMPATIBLE_IOCTL(HDIO_SET_32BIT
)
3077 COMPATIBLE_IOCTL(HDIO_SET_MULTCOUNT
)
3078 COMPATIBLE_IOCTL(HDIO_DRIVE_CMD
)
3079 COMPATIBLE_IOCTL(HDIO_SET_PIO_MODE
)
3080 COMPATIBLE_IOCTL(HDIO_SCAN_HWIF
)
3081 COMPATIBLE_IOCTL(HDIO_SET_NICE
)
3082 /* 0x02 -- Floppy ioctls */
3083 COMPATIBLE_IOCTL(FDMSGON
)
3084 COMPATIBLE_IOCTL(FDMSGOFF
)
3085 COMPATIBLE_IOCTL(FDSETEMSGTRESH
)
3086 COMPATIBLE_IOCTL(FDFLUSH
)
3087 COMPATIBLE_IOCTL(FDWERRORCLR
)
3088 COMPATIBLE_IOCTL(FDSETMAXERRS
)
3089 COMPATIBLE_IOCTL(FDGETMAXERRS
)
3090 COMPATIBLE_IOCTL(FDGETDRVTYP
)
3091 COMPATIBLE_IOCTL(FDEJECT
)
3092 COMPATIBLE_IOCTL(FDCLRPRM
)
3093 COMPATIBLE_IOCTL(FDFMTBEG
)
3094 COMPATIBLE_IOCTL(FDFMTEND
)
3095 COMPATIBLE_IOCTL(FDRESET
)
3096 COMPATIBLE_IOCTL(FDTWADDLE
)
3097 COMPATIBLE_IOCTL(FDFMTTRK
)
3098 COMPATIBLE_IOCTL(FDRAWCMD
)
3100 COMPATIBLE_IOCTL(BLKROSET
)
3101 COMPATIBLE_IOCTL(BLKROGET
)
3102 COMPATIBLE_IOCTL(BLKRRPART
)
3103 COMPATIBLE_IOCTL(BLKFLSBUF
)
3104 COMPATIBLE_IOCTL(BLKRASET
)
3105 COMPATIBLE_IOCTL(BLKFRASET
)
3106 COMPATIBLE_IOCTL(BLKSECTSET
)
3107 COMPATIBLE_IOCTL(BLKSSZGET
)
3110 COMPATIBLE_IOCTL(RAID_VERSION
)
3111 COMPATIBLE_IOCTL(GET_ARRAY_INFO
)
3112 COMPATIBLE_IOCTL(GET_DISK_INFO
)
3113 COMPATIBLE_IOCTL(PRINT_RAID_DEBUG
)
3114 COMPATIBLE_IOCTL(CLEAR_ARRAY
)
3115 COMPATIBLE_IOCTL(ADD_NEW_DISK
)
3116 COMPATIBLE_IOCTL(HOT_REMOVE_DISK
)
3117 COMPATIBLE_IOCTL(SET_ARRAY_INFO
)
3118 COMPATIBLE_IOCTL(SET_DISK_INFO
)
3119 COMPATIBLE_IOCTL(WRITE_RAID_INFO
)
3120 COMPATIBLE_IOCTL(UNPROTECT_ARRAY
)
3121 COMPATIBLE_IOCTL(PROTECT_ARRAY
)
3122 COMPATIBLE_IOCTL(HOT_ADD_DISK
)
3123 COMPATIBLE_IOCTL(SET_DISK_FAULTY
)
3124 COMPATIBLE_IOCTL(RUN_ARRAY
)
3125 COMPATIBLE_IOCTL(START_ARRAY
)
3126 COMPATIBLE_IOCTL(STOP_ARRAY
)
3127 COMPATIBLE_IOCTL(STOP_ARRAY_RO
)
3128 COMPATIBLE_IOCTL(RESTART_ARRAY_RW
)
3131 COMPATIBLE_IOCTL(PIO_FONT
)
3132 COMPATIBLE_IOCTL(GIO_FONT
)
3133 COMPATIBLE_IOCTL(KDSIGACCEPT
)
3134 COMPATIBLE_IOCTL(KDGETKEYCODE
)
3135 COMPATIBLE_IOCTL(KDSETKEYCODE
)
3136 COMPATIBLE_IOCTL(KIOCSOUND
)
3137 COMPATIBLE_IOCTL(KDMKTONE
)
3138 COMPATIBLE_IOCTL(KDGKBTYPE
)
3139 COMPATIBLE_IOCTL(KDSETMODE
)
3140 COMPATIBLE_IOCTL(KDGETMODE
)
3141 COMPATIBLE_IOCTL(KDSKBMODE
)
3142 COMPATIBLE_IOCTL(KDGKBMODE
)
3143 COMPATIBLE_IOCTL(KDSKBMETA
)
3144 COMPATIBLE_IOCTL(KDGKBMETA
)
3145 COMPATIBLE_IOCTL(KDGKBENT
)
3146 COMPATIBLE_IOCTL(KDSKBENT
)
3147 COMPATIBLE_IOCTL(KDGKBSENT
)
3148 COMPATIBLE_IOCTL(KDSKBSENT
)
3149 COMPATIBLE_IOCTL(KDGKBDIACR
)
3150 COMPATIBLE_IOCTL(KDSKBDIACR
)
3151 COMPATIBLE_IOCTL(KDGKBLED
)
3152 COMPATIBLE_IOCTL(KDSKBLED
)
3153 COMPATIBLE_IOCTL(KDGETLED
)
3154 COMPATIBLE_IOCTL(KDSETLED
)
3155 COMPATIBLE_IOCTL(GIO_SCRNMAP
)
3156 COMPATIBLE_IOCTL(PIO_SCRNMAP
)
3157 COMPATIBLE_IOCTL(GIO_UNISCRNMAP
)
3158 COMPATIBLE_IOCTL(PIO_UNISCRNMAP
)
3159 COMPATIBLE_IOCTL(PIO_FONTRESET
)
3160 COMPATIBLE_IOCTL(PIO_UNIMAPCLR
)
3162 COMPATIBLE_IOCTL(KIOCTYPE
)
3163 COMPATIBLE_IOCTL(KIOCLAYOUT
)
3164 COMPATIBLE_IOCTL(KIOCGTRANS
)
3165 COMPATIBLE_IOCTL(KIOCTRANS
)
3166 COMPATIBLE_IOCTL(KIOCCMD
)
3167 COMPATIBLE_IOCTL(KIOCSDIRECT
)
3168 COMPATIBLE_IOCTL(KIOCSLED
)
3169 COMPATIBLE_IOCTL(KIOCGLED
)
3170 COMPATIBLE_IOCTL(KIOCSRATE
)
3171 COMPATIBLE_IOCTL(KIOCGRATE
)
3173 COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN
)
3174 COMPATIBLE_IOCTL(SCSI_IOCTL_DOORLOCK
)
3175 COMPATIBLE_IOCTL(SCSI_IOCTL_DOORUNLOCK
)
3176 COMPATIBLE_IOCTL(SCSI_IOCTL_TEST_UNIT_READY
)
3177 COMPATIBLE_IOCTL(SCSI_IOCTL_TAGGED_ENABLE
)
3178 COMPATIBLE_IOCTL(SCSI_IOCTL_TAGGED_DISABLE
)
3179 COMPATIBLE_IOCTL(SCSI_IOCTL_GET_BUS_NUMBER
)
3180 COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND
)
3182 COMPATIBLE_IOCTL(VT_SETMODE
)
3183 COMPATIBLE_IOCTL(VT_GETMODE
)
3184 COMPATIBLE_IOCTL(VT_GETSTATE
)
3185 COMPATIBLE_IOCTL(VT_OPENQRY
)
3186 COMPATIBLE_IOCTL(VT_ACTIVATE
)
3187 COMPATIBLE_IOCTL(VT_WAITACTIVE
)
3188 COMPATIBLE_IOCTL(VT_RELDISP
)
3189 COMPATIBLE_IOCTL(VT_DISALLOCATE
)
3190 COMPATIBLE_IOCTL(VT_RESIZE
)
3191 COMPATIBLE_IOCTL(VT_RESIZEX
)
3192 COMPATIBLE_IOCTL(VT_LOCKSWITCH
)
3193 COMPATIBLE_IOCTL(VT_UNLOCKSWITCH
)
3195 COMPATIBLE_IOCTL(VUIDSFORMAT
)
3196 COMPATIBLE_IOCTL(VUIDGFORMAT
)
3197 /* Little v, the video4linux ioctls */
3198 COMPATIBLE_IOCTL(VIDIOCGCAP
)
3199 COMPATIBLE_IOCTL(VIDIOCGCHAN
)
3200 COMPATIBLE_IOCTL(VIDIOCSCHAN
)
3201 COMPATIBLE_IOCTL(VIDIOCGPICT
)
3202 COMPATIBLE_IOCTL(VIDIOCSPICT
)
3203 COMPATIBLE_IOCTL(VIDIOCCAPTURE
)
3204 COMPATIBLE_IOCTL(VIDIOCKEY
)
3205 COMPATIBLE_IOCTL(VIDIOCGAUDIO
)
3206 COMPATIBLE_IOCTL(VIDIOCSAUDIO
)
3207 COMPATIBLE_IOCTL(VIDIOCSYNC
)
3208 COMPATIBLE_IOCTL(VIDIOCMCAPTURE
)
3209 COMPATIBLE_IOCTL(VIDIOCGMBUF
)
3210 COMPATIBLE_IOCTL(VIDIOCGUNIT
)
3211 COMPATIBLE_IOCTL(VIDIOCGCAPTURE
)
3212 COMPATIBLE_IOCTL(VIDIOCSCAPTURE
)
3213 /* BTTV specific... */
3214 COMPATIBLE_IOCTL(_IOW('v', BASE_VIDIOCPRIVATE
+0, char [256]))
3215 COMPATIBLE_IOCTL(_IOR('v', BASE_VIDIOCPRIVATE
+1, char [256]))
3216 COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE
+2, unsigned int))
3217 COMPATIBLE_IOCTL(_IOW('v' , BASE_VIDIOCPRIVATE
+3, char [16])) /* struct bttv_pll_info */
3218 COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE
+4, int))
3219 COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE
+5, int))
3220 COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE
+6, int))
3221 COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE
+7, int))
3222 /* Little p (/dev/rtc, /dev/envctrl, etc.) */
3223 COMPATIBLE_IOCTL(RTCGET
)
3224 COMPATIBLE_IOCTL(RTCSET
)
3225 COMPATIBLE_IOCTL(ENVCTRL_RD_WARNING_TEMPERATURE
)
3226 COMPATIBLE_IOCTL(ENVCTRL_RD_SHUTDOWN_TEMPERATURE
)
3227 COMPATIBLE_IOCTL(ENVCTRL_RD_CPU_TEMPERATURE
)
3228 COMPATIBLE_IOCTL(ENVCTRL_RD_FAN_STATUS
)
3229 COMPATIBLE_IOCTL(ENVCTRL_RD_VOLTAGE_STATUS
)
3230 COMPATIBLE_IOCTL(ENVCTRL_RD_SCSI_TEMPERATURE
)
3231 COMPATIBLE_IOCTL(ENVCTRL_RD_ETHERNET_TEMPERATURE
)
3232 COMPATIBLE_IOCTL(ENVCTRL_RD_MTHRBD_TEMPERATURE
)
3233 COMPATIBLE_IOCTL(ENVCTRL_RD_CPU_VOLTAGE
)
3234 COMPATIBLE_IOCTL(ENVCTRL_RD_GLOBALADDRESS
)
3235 /* COMPATIBLE_IOCTL(D7SIOCRD) same value as ENVCTRL_RD_VOLTAGE_STATUS */
3236 COMPATIBLE_IOCTL(D7SIOCWR
)
3237 COMPATIBLE_IOCTL(D7SIOCTM
)
3239 COMPATIBLE_IOCTL(MTIOCTOP
)
3240 /* OPENPROMIO, SunOS/Solaris only, the NetBSD one's have
3241 * embedded pointers in the arg which we'd need to clean up...
3243 COMPATIBLE_IOCTL(OPROMGETOPT
)
3244 COMPATIBLE_IOCTL(OPROMSETOPT
)
3245 COMPATIBLE_IOCTL(OPROMNXTOPT
)
3246 COMPATIBLE_IOCTL(OPROMSETOPT2
)
3247 COMPATIBLE_IOCTL(OPROMNEXT
)
3248 COMPATIBLE_IOCTL(OPROMCHILD
)
3249 COMPATIBLE_IOCTL(OPROMGETPROP
)
3250 COMPATIBLE_IOCTL(OPROMNXTPROP
)
3251 COMPATIBLE_IOCTL(OPROMU2P
)
3252 COMPATIBLE_IOCTL(OPROMGETCONS
)
3253 COMPATIBLE_IOCTL(OPROMGETFBNAME
)
3254 COMPATIBLE_IOCTL(OPROMGETBOOTARGS
)
3255 COMPATIBLE_IOCTL(OPROMSETCUR
)
3256 COMPATIBLE_IOCTL(OPROMPCI2NODE
)
3257 COMPATIBLE_IOCTL(OPROMPATH2NODE
)
3258 /* Socket level stuff */
3259 COMPATIBLE_IOCTL(FIOSETOWN
)
3260 COMPATIBLE_IOCTL(SIOCSPGRP
)
3261 COMPATIBLE_IOCTL(FIOGETOWN
)
3262 COMPATIBLE_IOCTL(SIOCGPGRP
)
3263 COMPATIBLE_IOCTL(SIOCATMARK
)
3264 COMPATIBLE_IOCTL(SIOCSIFLINK
)
3265 COMPATIBLE_IOCTL(SIOCSIFENCAP
)
3266 COMPATIBLE_IOCTL(SIOCGIFENCAP
)
3267 COMPATIBLE_IOCTL(SIOCSIFBR
)
3268 COMPATIBLE_IOCTL(SIOCGIFBR
)
3269 COMPATIBLE_IOCTL(SIOCSARP
)
3270 COMPATIBLE_IOCTL(SIOCGARP
)
3271 COMPATIBLE_IOCTL(SIOCDARP
)
3272 #if 0 /* XXX No longer exist in new routing code. XXX */
3273 COMPATIBLE_IOCTL(OLD_SIOCSARP
)
3274 COMPATIBLE_IOCTL(OLD_SIOCGARP
)
3275 COMPATIBLE_IOCTL(OLD_SIOCDARP
)
3277 COMPATIBLE_IOCTL(SIOCSRARP
)
3278 COMPATIBLE_IOCTL(SIOCGRARP
)
3279 COMPATIBLE_IOCTL(SIOCDRARP
)
3280 COMPATIBLE_IOCTL(SIOCADDDLCI
)
3281 COMPATIBLE_IOCTL(SIOCDELDLCI
)
3283 COMPATIBLE_IOCTL(SG_SET_TIMEOUT
)
3284 COMPATIBLE_IOCTL(SG_GET_TIMEOUT
)
3285 COMPATIBLE_IOCTL(SG_EMULATED_HOST
)
3286 COMPATIBLE_IOCTL(SG_SET_TRANSFORM
)
3287 COMPATIBLE_IOCTL(SG_GET_TRANSFORM
)
3288 COMPATIBLE_IOCTL(SG_SET_RESERVED_SIZE
)
3289 COMPATIBLE_IOCTL(SG_GET_RESERVED_SIZE
)
3290 COMPATIBLE_IOCTL(SG_GET_SCSI_ID
)
3291 COMPATIBLE_IOCTL(SG_SET_FORCE_LOW_DMA
)
3292 COMPATIBLE_IOCTL(SG_GET_LOW_DMA
)
3293 COMPATIBLE_IOCTL(SG_SET_FORCE_PACK_ID
)
3294 COMPATIBLE_IOCTL(SG_GET_PACK_ID
)
3295 COMPATIBLE_IOCTL(SG_GET_NUM_WAITING
)
3296 COMPATIBLE_IOCTL(SG_SET_DEBUG
)
3297 COMPATIBLE_IOCTL(SG_GET_SG_TABLESIZE
)
3298 COMPATIBLE_IOCTL(SG_GET_COMMAND_Q
)
3299 COMPATIBLE_IOCTL(SG_SET_COMMAND_Q
)
3300 COMPATIBLE_IOCTL(SG_GET_VERSION_NUM
)
3301 COMPATIBLE_IOCTL(SG_NEXT_CMD_LEN
)
3302 COMPATIBLE_IOCTL(SG_SCSI_RESET
)
3303 COMPATIBLE_IOCTL(SG_IO
)
3304 COMPATIBLE_IOCTL(SG_GET_REQUEST_TABLE
)
3305 COMPATIBLE_IOCTL(SG_SET_KEEP_ORPHAN
)
3306 COMPATIBLE_IOCTL(SG_GET_KEEP_ORPHAN
)
3308 COMPATIBLE_IOCTL(PPPIOCGFLAGS
)
3309 COMPATIBLE_IOCTL(PPPIOCSFLAGS
)
3310 COMPATIBLE_IOCTL(PPPIOCGASYNCMAP
)
3311 COMPATIBLE_IOCTL(PPPIOCSASYNCMAP
)
3312 COMPATIBLE_IOCTL(PPPIOCGUNIT
)
3313 COMPATIBLE_IOCTL(PPPIOCGRASYNCMAP
)
3314 COMPATIBLE_IOCTL(PPPIOCSRASYNCMAP
)
3315 COMPATIBLE_IOCTL(PPPIOCGMRU
)
3316 COMPATIBLE_IOCTL(PPPIOCSMRU
)
3317 COMPATIBLE_IOCTL(PPPIOCSMAXCID
)
3318 COMPATIBLE_IOCTL(PPPIOCGXASYNCMAP
)
3319 COMPATIBLE_IOCTL(PPPIOCSXASYNCMAP
)
3320 COMPATIBLE_IOCTL(PPPIOCXFERUNIT
)
3321 COMPATIBLE_IOCTL(PPPIOCGNPMODE
)
3322 COMPATIBLE_IOCTL(PPPIOCSNPMODE
)
3323 COMPATIBLE_IOCTL(PPPIOCGDEBUG
)
3324 COMPATIBLE_IOCTL(PPPIOCSDEBUG
)
3325 COMPATIBLE_IOCTL(PPPIOCNEWUNIT
)
3326 COMPATIBLE_IOCTL(PPPIOCATTACH
)
3327 COMPATIBLE_IOCTL(PPPIOCDETACH
)
3328 COMPATIBLE_IOCTL(PPPIOCSMRRU
)
3329 COMPATIBLE_IOCTL(PPPIOCCONNECT
)
3330 COMPATIBLE_IOCTL(PPPIOCDISCONN
)
3331 COMPATIBLE_IOCTL(PPPIOCATTCHAN
)
3333 COMPATIBLE_IOCTL(PPPOEIOCSFWD
);
3334 COMPATIBLE_IOCTL(PPPOEIOCDFWD
);
3336 COMPATIBLE_IOCTL(CDROMPAUSE
)
3337 COMPATIBLE_IOCTL(CDROMRESUME
)
3338 COMPATIBLE_IOCTL(CDROMPLAYMSF
)
3339 COMPATIBLE_IOCTL(CDROMPLAYTRKIND
)
3340 COMPATIBLE_IOCTL(CDROMREADTOCHDR
)
3341 COMPATIBLE_IOCTL(CDROMREADTOCENTRY
)
3342 COMPATIBLE_IOCTL(CDROMSTOP
)
3343 COMPATIBLE_IOCTL(CDROMSTART
)
3344 COMPATIBLE_IOCTL(CDROMEJECT
)
3345 COMPATIBLE_IOCTL(CDROMVOLCTRL
)
3346 COMPATIBLE_IOCTL(CDROMSUBCHNL
)
3347 COMPATIBLE_IOCTL(CDROMEJECT_SW
)
3348 COMPATIBLE_IOCTL(CDROMMULTISESSION
)
3349 COMPATIBLE_IOCTL(CDROM_GET_MCN
)
3350 COMPATIBLE_IOCTL(CDROMRESET
)
3351 COMPATIBLE_IOCTL(CDROMVOLREAD
)
3352 COMPATIBLE_IOCTL(CDROMSEEK
)
3353 COMPATIBLE_IOCTL(CDROMPLAYBLK
)
3354 COMPATIBLE_IOCTL(CDROMCLOSETRAY
)
3355 COMPATIBLE_IOCTL(CDROM_SET_OPTIONS
)
3356 COMPATIBLE_IOCTL(CDROM_CLEAR_OPTIONS
)
3357 COMPATIBLE_IOCTL(CDROM_SELECT_SPEED
)
3358 COMPATIBLE_IOCTL(CDROM_SELECT_DISC
)
3359 COMPATIBLE_IOCTL(CDROM_MEDIA_CHANGED
)
3360 COMPATIBLE_IOCTL(CDROM_DRIVE_STATUS
)
3361 COMPATIBLE_IOCTL(CDROM_DISC_STATUS
)
3362 COMPATIBLE_IOCTL(CDROM_CHANGER_NSLOTS
)
3363 COMPATIBLE_IOCTL(CDROM_LOCKDOOR
)
3364 COMPATIBLE_IOCTL(CDROM_DEBUG
)
3365 COMPATIBLE_IOCTL(CDROM_GET_CAPABILITY
)
3367 COMPATIBLE_IOCTL(LOOP_SET_FD
)
3368 COMPATIBLE_IOCTL(LOOP_CLR_FD
)
3370 COMPATIBLE_IOCTL(AUDIO_GETINFO
)
3371 COMPATIBLE_IOCTL(AUDIO_SETINFO
)
3372 COMPATIBLE_IOCTL(AUDIO_DRAIN
)
3373 COMPATIBLE_IOCTL(AUDIO_GETDEV
)
3374 COMPATIBLE_IOCTL(AUDIO_GETDEV_SUNOS
)
3375 COMPATIBLE_IOCTL(AUDIO_FLUSH
)
3376 /* Big Q for sound/OSS */
3377 COMPATIBLE_IOCTL(SNDCTL_SEQ_RESET
)
3378 COMPATIBLE_IOCTL(SNDCTL_SEQ_SYNC
)
3379 COMPATIBLE_IOCTL(SNDCTL_SYNTH_INFO
)
3380 COMPATIBLE_IOCTL(SNDCTL_SEQ_CTRLRATE
)
3381 COMPATIBLE_IOCTL(SNDCTL_SEQ_GETOUTCOUNT
)
3382 COMPATIBLE_IOCTL(SNDCTL_SEQ_GETINCOUNT
)
3383 COMPATIBLE_IOCTL(SNDCTL_SEQ_PERCMODE
)
3384 COMPATIBLE_IOCTL(SNDCTL_FM_LOAD_INSTR
)
3385 COMPATIBLE_IOCTL(SNDCTL_SEQ_TESTMIDI
)
3386 COMPATIBLE_IOCTL(SNDCTL_SEQ_RESETSAMPLES
)
3387 COMPATIBLE_IOCTL(SNDCTL_SEQ_NRSYNTHS
)
3388 COMPATIBLE_IOCTL(SNDCTL_SEQ_NRMIDIS
)
3389 COMPATIBLE_IOCTL(SNDCTL_MIDI_INFO
)
3390 COMPATIBLE_IOCTL(SNDCTL_SEQ_THRESHOLD
)
3391 COMPATIBLE_IOCTL(SNDCTL_SYNTH_MEMAVL
)
3392 COMPATIBLE_IOCTL(SNDCTL_FM_4OP_ENABLE
)
3393 COMPATIBLE_IOCTL(SNDCTL_SEQ_PANIC
)
3394 COMPATIBLE_IOCTL(SNDCTL_SEQ_OUTOFBAND
)
3395 COMPATIBLE_IOCTL(SNDCTL_SEQ_GETTIME
)
3396 COMPATIBLE_IOCTL(SNDCTL_SYNTH_ID
)
3397 COMPATIBLE_IOCTL(SNDCTL_SYNTH_CONTROL
)
3398 COMPATIBLE_IOCTL(SNDCTL_SYNTH_REMOVESAMPLE
)
3399 /* Big T for sound/OSS */
3400 COMPATIBLE_IOCTL(SNDCTL_TMR_TIMEBASE
)
3401 COMPATIBLE_IOCTL(SNDCTL_TMR_START
)
3402 COMPATIBLE_IOCTL(SNDCTL_TMR_STOP
)
3403 COMPATIBLE_IOCTL(SNDCTL_TMR_CONTINUE
)
3404 COMPATIBLE_IOCTL(SNDCTL_TMR_TEMPO
)
3405 COMPATIBLE_IOCTL(SNDCTL_TMR_SOURCE
)
3406 COMPATIBLE_IOCTL(SNDCTL_TMR_METRONOME
)
3407 COMPATIBLE_IOCTL(SNDCTL_TMR_SELECT
)
3408 /* Little m for sound/OSS */
3409 COMPATIBLE_IOCTL(SNDCTL_MIDI_PRETIME
)
3410 COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUMODE
)
3411 COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUCMD
)
3412 /* Big P for sound/OSS */
3413 COMPATIBLE_IOCTL(SNDCTL_DSP_RESET
)
3414 COMPATIBLE_IOCTL(SNDCTL_DSP_SYNC
)
3415 COMPATIBLE_IOCTL(SNDCTL_DSP_SPEED
)
3416 COMPATIBLE_IOCTL(SNDCTL_DSP_STEREO
)
3417 COMPATIBLE_IOCTL(SNDCTL_DSP_GETBLKSIZE
)
3418 COMPATIBLE_IOCTL(SNDCTL_DSP_CHANNELS
)
3419 COMPATIBLE_IOCTL(SOUND_PCM_WRITE_FILTER
)
3420 COMPATIBLE_IOCTL(SNDCTL_DSP_POST
)
3421 COMPATIBLE_IOCTL(SNDCTL_DSP_SUBDIVIDE
)
3422 COMPATIBLE_IOCTL(SNDCTL_DSP_SETFRAGMENT
)
3423 COMPATIBLE_IOCTL(SNDCTL_DSP_GETFMTS
)
3424 COMPATIBLE_IOCTL(SNDCTL_DSP_SETFMT
)
3425 COMPATIBLE_IOCTL(SNDCTL_DSP_GETOSPACE
)
3426 COMPATIBLE_IOCTL(SNDCTL_DSP_GETISPACE
)
3427 COMPATIBLE_IOCTL(SNDCTL_DSP_NONBLOCK
)
3428 COMPATIBLE_IOCTL(SNDCTL_DSP_GETCAPS
)
3429 COMPATIBLE_IOCTL(SNDCTL_DSP_GETTRIGGER
)
3430 COMPATIBLE_IOCTL(SNDCTL_DSP_SETTRIGGER
)
3431 COMPATIBLE_IOCTL(SNDCTL_DSP_GETIPTR
)
3432 COMPATIBLE_IOCTL(SNDCTL_DSP_GETOPTR
)
3433 /* SNDCTL_DSP_MAPINBUF, XXX needs translation */
3434 /* SNDCTL_DSP_MAPOUTBUF, XXX needs translation */
3435 COMPATIBLE_IOCTL(SNDCTL_DSP_SETSYNCRO
)
3436 COMPATIBLE_IOCTL(SNDCTL_DSP_SETDUPLEX
)
3437 COMPATIBLE_IOCTL(SNDCTL_DSP_GETODELAY
)
3438 COMPATIBLE_IOCTL(SNDCTL_DSP_PROFILE
)
3439 COMPATIBLE_IOCTL(SOUND_PCM_READ_RATE
)
3440 COMPATIBLE_IOCTL(SOUND_PCM_READ_CHANNELS
)
3441 COMPATIBLE_IOCTL(SOUND_PCM_READ_BITS
)
3442 COMPATIBLE_IOCTL(SOUND_PCM_READ_FILTER
)
3443 /* Big C for sound/OSS */
3444 COMPATIBLE_IOCTL(SNDCTL_COPR_RESET
)
3445 COMPATIBLE_IOCTL(SNDCTL_COPR_LOAD
)
3446 COMPATIBLE_IOCTL(SNDCTL_COPR_RDATA
)
3447 COMPATIBLE_IOCTL(SNDCTL_COPR_RCODE
)
3448 COMPATIBLE_IOCTL(SNDCTL_COPR_WDATA
)
3449 COMPATIBLE_IOCTL(SNDCTL_COPR_WCODE
)
3450 COMPATIBLE_IOCTL(SNDCTL_COPR_RUN
)
3451 COMPATIBLE_IOCTL(SNDCTL_COPR_HALT
)
3452 COMPATIBLE_IOCTL(SNDCTL_COPR_SENDMSG
)
3453 COMPATIBLE_IOCTL(SNDCTL_COPR_RCVMSG
)
3454 /* Big M for sound/OSS */
3455 COMPATIBLE_IOCTL(SOUND_MIXER_READ_VOLUME
)
3456 COMPATIBLE_IOCTL(SOUND_MIXER_READ_BASS
)
3457 COMPATIBLE_IOCTL(SOUND_MIXER_READ_TREBLE
)
3458 COMPATIBLE_IOCTL(SOUND_MIXER_READ_SYNTH
)
3459 COMPATIBLE_IOCTL(SOUND_MIXER_READ_PCM
)
3460 COMPATIBLE_IOCTL(SOUND_MIXER_READ_SPEAKER
)
3461 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE
)
3462 COMPATIBLE_IOCTL(SOUND_MIXER_READ_MIC
)
3463 COMPATIBLE_IOCTL(SOUND_MIXER_READ_CD
)
3464 COMPATIBLE_IOCTL(SOUND_MIXER_READ_IMIX
)
3465 COMPATIBLE_IOCTL(SOUND_MIXER_READ_ALTPCM
)
3466 COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECLEV
)
3467 COMPATIBLE_IOCTL(SOUND_MIXER_READ_IGAIN
)
3468 COMPATIBLE_IOCTL(SOUND_MIXER_READ_OGAIN
)
3469 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE1
)
3470 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE2
)
3471 COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE3
)
3472 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL1
))
3473 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL2
))
3474 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL3
))
3475 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEIN
))
3476 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEOUT
))
3477 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_VIDEO
))
3478 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_RADIO
))
3479 COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_MONITOR
))
3480 COMPATIBLE_IOCTL(SOUND_MIXER_READ_MUTE
)
3481 /* SOUND_MIXER_READ_ENHANCE, same value as READ_MUTE */
3482 /* SOUND_MIXER_READ_LOUD, same value as READ_MUTE */
3483 COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECSRC
)
3484 COMPATIBLE_IOCTL(SOUND_MIXER_READ_DEVMASK
)
3485 COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECMASK
)
3486 COMPATIBLE_IOCTL(SOUND_MIXER_READ_STEREODEVS
)
3487 COMPATIBLE_IOCTL(SOUND_MIXER_READ_CAPS
)
3488 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_VOLUME
)
3489 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_BASS
)
3490 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_TREBLE
)
3491 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SYNTH
)
3492 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_PCM
)
3493 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SPEAKER
)
3494 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE
)
3495 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MIC
)
3496 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_CD
)
3497 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IMIX
)
3498 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_ALTPCM
)
3499 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECLEV
)
3500 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IGAIN
)
3501 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_OGAIN
)
3502 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE1
)
3503 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE2
)
3504 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE3
)
3505 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL1
))
3506 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL2
))
3507 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL3
))
3508 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEIN
))
3509 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEOUT
))
3510 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_VIDEO
))
3511 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_RADIO
))
3512 COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_MONITOR
))
3513 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MUTE
)
3514 /* SOUND_MIXER_WRITE_ENHANCE, same value as WRITE_MUTE */
3515 /* SOUND_MIXER_WRITE_LOUD, same value as WRITE_MUTE */
3516 COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECSRC
)
3517 COMPATIBLE_IOCTL(SOUND_MIXER_INFO
)
3518 COMPATIBLE_IOCTL(SOUND_OLD_MIXER_INFO
)
3519 COMPATIBLE_IOCTL(SOUND_MIXER_ACCESS
)
3520 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE1
)
3521 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE2
)
3522 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE3
)
3523 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE4
)
3524 COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE5
)
3525 COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS
)
3526 COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS
)
3527 COMPATIBLE_IOCTL(OSS_GETVERSION
)
3529 COMPATIBLE_IOCTL(AUTOFS_IOC_READY
)
3530 COMPATIBLE_IOCTL(AUTOFS_IOC_FAIL
)
3531 COMPATIBLE_IOCTL(AUTOFS_IOC_CATATONIC
)
3532 COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOVER
)
3533 COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE
)
3535 COMPATIBLE_IOCTL(DEVFSDIOC_GET_PROTO_REV
)
3536 COMPATIBLE_IOCTL(DEVFSDIOC_SET_EVENT_MASK
)
3537 COMPATIBLE_IOCTL(DEVFSDIOC_RELEASE_EVENT_QUEUE
)
3538 COMPATIBLE_IOCTL(DEVFSDIOC_SET_DEBUG_MASK
)
3540 COMPATIBLE_IOCTL(RAW_SETBIND
)
3541 COMPATIBLE_IOCTL(RAW_GETBIND
)
3542 /* SMB ioctls which do not need any translations */
3543 COMPATIBLE_IOCTL(SMB_IOC_NEWCONN
)
3545 COMPATIBLE_IOCTL(ATMSIGD_CTRL
)
3546 COMPATIBLE_IOCTL(ATMARPD_CTRL
)
3547 COMPATIBLE_IOCTL(ATMLEC_CTRL
)
3548 COMPATIBLE_IOCTL(ATMLEC_MCAST
)
3549 COMPATIBLE_IOCTL(ATMLEC_DATA
)
3550 COMPATIBLE_IOCTL(ATM_SETSC
)
3551 COMPATIBLE_IOCTL(SIOCSIFATMTCP
)
3552 COMPATIBLE_IOCTL(SIOCMKCLIP
)
3553 COMPATIBLE_IOCTL(ATMARP_MKIP
)
3554 COMPATIBLE_IOCTL(ATMARP_SETENTRY
)
3555 COMPATIBLE_IOCTL(ATMARP_ENCAP
)
3556 COMPATIBLE_IOCTL(ATMTCP_CREATE
)
3557 COMPATIBLE_IOCTL(ATMTCP_REMOVE
)
3558 COMPATIBLE_IOCTL(ATMMPC_CTRL
)
3559 COMPATIBLE_IOCTL(ATMMPC_DATA
)
3560 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
3562 COMPATIBLE_IOCTL(VG_SET_EXTENDABLE
)
3563 COMPATIBLE_IOCTL(VG_STATUS_GET_COUNT
)
3564 COMPATIBLE_IOCTL(VG_STATUS_GET_NAMELIST
)
3565 COMPATIBLE_IOCTL(VG_REMOVE
)
3566 COMPATIBLE_IOCTL(VG_REDUCE
)
3567 COMPATIBLE_IOCTL(PE_LOCK_UNLOCK
)
3568 COMPATIBLE_IOCTL(PV_FLUSH
)
3569 COMPATIBLE_IOCTL(LVM_LOCK_LVM
)
3570 COMPATIBLE_IOCTL(LVM_GET_IOP_VERSION
)
3571 #ifdef LVM_TOTAL_RESET
3572 COMPATIBLE_IOCTL(LVM_RESET
)
3574 COMPATIBLE_IOCTL(LV_SET_ACCESS
)
3575 COMPATIBLE_IOCTL(LV_SET_STATUS
)
3576 COMPATIBLE_IOCTL(LV_SET_ALLOCATION
)
3578 #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
3579 COMPATIBLE_IOCTL(DRM_IOCTL_GET_MAGIC
)
3580 COMPATIBLE_IOCTL(DRM_IOCTL_IRQ_BUSID
)
3581 COMPATIBLE_IOCTL(DRM_IOCTL_AUTH_MAGIC
)
3582 COMPATIBLE_IOCTL(DRM_IOCTL_BLOCK
)
3583 COMPATIBLE_IOCTL(DRM_IOCTL_UNBLOCK
)
3584 COMPATIBLE_IOCTL(DRM_IOCTL_CONTROL
)
3585 COMPATIBLE_IOCTL(DRM_IOCTL_ADD_BUFS
)
3586 COMPATIBLE_IOCTL(DRM_IOCTL_MARK_BUFS
)
3587 COMPATIBLE_IOCTL(DRM_IOCTL_ADD_CTX
)
3588 COMPATIBLE_IOCTL(DRM_IOCTL_RM_CTX
)
3589 COMPATIBLE_IOCTL(DRM_IOCTL_MOD_CTX
)
3590 COMPATIBLE_IOCTL(DRM_IOCTL_GET_CTX
)
3591 COMPATIBLE_IOCTL(DRM_IOCTL_SWITCH_CTX
)
3592 COMPATIBLE_IOCTL(DRM_IOCTL_NEW_CTX
)
3593 COMPATIBLE_IOCTL(DRM_IOCTL_ADD_DRAW
)
3594 COMPATIBLE_IOCTL(DRM_IOCTL_RM_DRAW
)
3595 COMPATIBLE_IOCTL(DRM_IOCTL_LOCK
)
3596 COMPATIBLE_IOCTL(DRM_IOCTL_UNLOCK
)
3597 COMPATIBLE_IOCTL(DRM_IOCTL_FINISH
)
3600 COMPATIBLE_IOCTL(BLKELVGET
)
3601 COMPATIBLE_IOCTL(BLKELVSET
)
3602 /* And these ioctls need translation */
3603 HANDLE_IOCTL(SIOCGIFNAME
, dev_ifname32
)
3604 HANDLE_IOCTL(SIOCGIFCONF
, dev_ifconf
)
3605 HANDLE_IOCTL(SIOCGIFFLAGS
, dev_ifsioc
)
3606 HANDLE_IOCTL(SIOCSIFFLAGS
, dev_ifsioc
)
3607 HANDLE_IOCTL(SIOCGIFMETRIC
, dev_ifsioc
)
3608 HANDLE_IOCTL(SIOCSIFMETRIC
, dev_ifsioc
)
3609 HANDLE_IOCTL(SIOCGIFMTU
, dev_ifsioc
)
3610 HANDLE_IOCTL(SIOCSIFMTU
, dev_ifsioc
)
3611 HANDLE_IOCTL(SIOCGIFMEM
, dev_ifsioc
)
3612 HANDLE_IOCTL(SIOCSIFMEM
, dev_ifsioc
)
3613 HANDLE_IOCTL(SIOCGIFHWADDR
, dev_ifsioc
)
3614 HANDLE_IOCTL(SIOCSIFHWADDR
, dev_ifsioc
)
3615 HANDLE_IOCTL(SIOCADDMULTI
, dev_ifsioc
)
3616 HANDLE_IOCTL(SIOCDELMULTI
, dev_ifsioc
)
3617 HANDLE_IOCTL(SIOCGIFINDEX
, dev_ifsioc
)
3618 HANDLE_IOCTL(SIOCGIFMAP
, dev_ifsioc
)
3619 HANDLE_IOCTL(SIOCSIFMAP
, dev_ifsioc
)
3620 HANDLE_IOCTL(SIOCGIFADDR
, dev_ifsioc
)
3621 HANDLE_IOCTL(SIOCSIFADDR
, dev_ifsioc
)
3622 HANDLE_IOCTL(SIOCGIFBRDADDR
, dev_ifsioc
)
3623 HANDLE_IOCTL(SIOCSIFBRDADDR
, dev_ifsioc
)
3624 HANDLE_IOCTL(SIOCGIFDSTADDR
, dev_ifsioc
)
3625 HANDLE_IOCTL(SIOCSIFDSTADDR
, dev_ifsioc
)
3626 HANDLE_IOCTL(SIOCGIFNETMASK
, dev_ifsioc
)
3627 HANDLE_IOCTL(SIOCSIFNETMASK
, dev_ifsioc
)
3628 HANDLE_IOCTL(SIOCSIFPFLAGS
, dev_ifsioc
)
3629 HANDLE_IOCTL(SIOCGIFPFLAGS
, dev_ifsioc
)
3630 HANDLE_IOCTL(SIOCGPPPSTATS
, dev_ifsioc
)
3631 HANDLE_IOCTL(SIOCGPPPCSTATS
, dev_ifsioc
)
3632 HANDLE_IOCTL(SIOCGPPPVER
, dev_ifsioc
)
3633 HANDLE_IOCTL(SIOCGIFTXQLEN
, dev_ifsioc
)
3634 HANDLE_IOCTL(SIOCSIFTXQLEN
, dev_ifsioc
)
3635 HANDLE_IOCTL(SIOCETHTOOL
, dev_ifsioc
)
3636 HANDLE_IOCTL(SIOCADDRT
, routing_ioctl
)
3637 HANDLE_IOCTL(SIOCDELRT
, routing_ioctl
)
3638 /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
3639 HANDLE_IOCTL(SIOCRTMSG
, ret_einval
)
3640 HANDLE_IOCTL(SIOCGSTAMP
, do_siocgstamp
)
3641 HANDLE_IOCTL(HDIO_GETGEO
, hdio_getgeo
)
3642 HANDLE_IOCTL(BLKRAGET
, w_long
)
3643 HANDLE_IOCTL(BLKGETSIZE
, w_long
)
3644 HANDLE_IOCTL(0x1260, broken_blkgetsize
)
3645 HANDLE_IOCTL(BLKFRAGET
, w_long
)
3646 HANDLE_IOCTL(BLKSECTGET
, w_long
)
3647 HANDLE_IOCTL(BLKPG
, blkpg_ioctl_trans
)
3648 HANDLE_IOCTL(FBIOPUTCMAP32
, fbiogetputcmap
)
3649 HANDLE_IOCTL(FBIOGETCMAP32
, fbiogetputcmap
)
3650 HANDLE_IOCTL(FBIOSCURSOR32
, fbiogscursor
)
3651 HANDLE_IOCTL(FBIOGET_FSCREENINFO
, fb_ioctl_trans
)
3652 HANDLE_IOCTL(FBIOGETCMAP
, fb_ioctl_trans
)
3653 HANDLE_IOCTL(FBIOPUTCMAP
, fb_ioctl_trans
)
3654 HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS
, hdio_ioctl_trans
)
3655 HANDLE_IOCTL(HDIO_GET_UNMASKINTR
, hdio_ioctl_trans
)
3656 HANDLE_IOCTL(HDIO_GET_DMA
, hdio_ioctl_trans
)
3657 HANDLE_IOCTL(HDIO_GET_32BIT
, hdio_ioctl_trans
)
3658 HANDLE_IOCTL(HDIO_GET_MULTCOUNT
, hdio_ioctl_trans
)
3659 HANDLE_IOCTL(HDIO_GET_NOWERR
, hdio_ioctl_trans
)
3660 HANDLE_IOCTL(HDIO_GET_NICE
, hdio_ioctl_trans
)
3661 HANDLE_IOCTL(FDSETPRM32
, fd_ioctl_trans
)
3662 HANDLE_IOCTL(FDDEFPRM32
, fd_ioctl_trans
)
3663 HANDLE_IOCTL(FDGETPRM32
, fd_ioctl_trans
)
3664 HANDLE_IOCTL(FDSETDRVPRM32
, fd_ioctl_trans
)
3665 HANDLE_IOCTL(FDGETDRVPRM32
, fd_ioctl_trans
)
3666 HANDLE_IOCTL(FDGETDRVSTAT32
, fd_ioctl_trans
)
3667 HANDLE_IOCTL(FDPOLLDRVSTAT32
, fd_ioctl_trans
)
3668 HANDLE_IOCTL(FDGETFDCSTAT32
, fd_ioctl_trans
)
3669 HANDLE_IOCTL(FDWERRORGET32
, fd_ioctl_trans
)
3670 HANDLE_IOCTL(PPPIOCGIDLE32
, ppp_ioctl_trans
)
3671 HANDLE_IOCTL(PPPIOCSCOMPRESS32
, ppp_ioctl_trans
)
3672 HANDLE_IOCTL(MTIOCGET32
, mt_ioctl_trans
)
3673 HANDLE_IOCTL(MTIOCPOS32
, mt_ioctl_trans
)
3674 HANDLE_IOCTL(MTIOCGETCONFIG32
, mt_ioctl_trans
)
3675 HANDLE_IOCTL(MTIOCSETCONFIG32
, mt_ioctl_trans
)
3676 HANDLE_IOCTL(CDROMREADMODE2
, cdrom_ioctl_trans
)
3677 HANDLE_IOCTL(CDROMREADMODE1
, cdrom_ioctl_trans
)
3678 HANDLE_IOCTL(CDROMREADRAW
, cdrom_ioctl_trans
)
3679 HANDLE_IOCTL(CDROMREADCOOKED
, cdrom_ioctl_trans
)
3680 HANDLE_IOCTL(CDROMREADAUDIO
, cdrom_ioctl_trans
)
3681 HANDLE_IOCTL(CDROMREADALL
, cdrom_ioctl_trans
)
3682 HANDLE_IOCTL(CDROM_SEND_PACKET
, cdrom_ioctl_trans
)
3683 HANDLE_IOCTL(LOOP_SET_STATUS
, loop_status
)
3684 HANDLE_IOCTL(LOOP_GET_STATUS
, loop_status
)
3685 #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
3686 HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32
, ioc_settimeout
)
3687 HANDLE_IOCTL(PIO_FONTX
, do_fontx_ioctl
)
3688 HANDLE_IOCTL(GIO_FONTX
, do_fontx_ioctl
)
3689 HANDLE_IOCTL(PIO_UNIMAP
, do_unimap_ioctl
)
3690 HANDLE_IOCTL(GIO_UNIMAP
, do_unimap_ioctl
)
3691 HANDLE_IOCTL(KDFONTOP
, do_kdfontop_ioctl
)
3692 HANDLE_IOCTL(EXT2_IOC32_GETFLAGS
, do_ext2_ioctl
)
3693 HANDLE_IOCTL(EXT2_IOC32_SETFLAGS
, do_ext2_ioctl
)
3694 HANDLE_IOCTL(EXT2_IOC32_GETVERSION
, do_ext2_ioctl
)
3695 HANDLE_IOCTL(EXT2_IOC32_SETVERSION
, do_ext2_ioctl
)
3696 HANDLE_IOCTL(VIDIOCGTUNER32
, do_video_ioctl
)
3697 HANDLE_IOCTL(VIDIOCSTUNER32
, do_video_ioctl
)
3698 HANDLE_IOCTL(VIDIOCGWIN32
, do_video_ioctl
)
3699 HANDLE_IOCTL(VIDIOCSWIN32
, do_video_ioctl
)
3700 HANDLE_IOCTL(VIDIOCGFBUF32
, do_video_ioctl
)
3701 HANDLE_IOCTL(VIDIOCSFBUF32
, do_video_ioctl
)
3702 HANDLE_IOCTL(VIDIOCGFREQ32
, do_video_ioctl
)
3703 HANDLE_IOCTL(VIDIOCSFREQ32
, do_video_ioctl
)
3704 /* One SMB ioctl needs translations. */
3705 #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
3706 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32
, do_smb_getmountuid
)
3707 HANDLE_IOCTL(ATM_GETLINKRATE32
, do_atm_ioctl
)
3708 HANDLE_IOCTL(ATM_GETNAMES32
, do_atm_ioctl
)
3709 HANDLE_IOCTL(ATM_GETTYPE32
, do_atm_ioctl
)
3710 HANDLE_IOCTL(ATM_GETESI32
, do_atm_ioctl
)
3711 HANDLE_IOCTL(ATM_GETADDR32
, do_atm_ioctl
)
3712 HANDLE_IOCTL(ATM_RSTADDR32
, do_atm_ioctl
)
3713 HANDLE_IOCTL(ATM_ADDADDR32
, do_atm_ioctl
)
3714 HANDLE_IOCTL(ATM_DELADDR32
, do_atm_ioctl
)
3715 HANDLE_IOCTL(ATM_GETCIRANGE32
, do_atm_ioctl
)
3716 HANDLE_IOCTL(ATM_SETCIRANGE32
, do_atm_ioctl
)
3717 HANDLE_IOCTL(ATM_SETESI32
, do_atm_ioctl
)
3718 HANDLE_IOCTL(ATM_SETESIF32
, do_atm_ioctl
)
3719 HANDLE_IOCTL(ATM_GETSTAT32
, do_atm_ioctl
)
3720 HANDLE_IOCTL(ATM_GETSTATZ32
, do_atm_ioctl
)
3721 HANDLE_IOCTL(ATM_GETLOOP32
, do_atm_ioctl
)
3722 HANDLE_IOCTL(ATM_SETLOOP32
, do_atm_ioctl
)
3723 HANDLE_IOCTL(ATM_QUERYLOOP32
, do_atm_ioctl
)
3724 HANDLE_IOCTL(SONET_GETSTAT
, do_atm_ioctl
)
3725 HANDLE_IOCTL(SONET_GETSTATZ
, do_atm_ioctl
)
3726 HANDLE_IOCTL(SONET_GETDIAG
, do_atm_ioctl
)
3727 HANDLE_IOCTL(SONET_SETDIAG
, do_atm_ioctl
)
3728 HANDLE_IOCTL(SONET_CLRDIAG
, do_atm_ioctl
)
3729 HANDLE_IOCTL(SONET_SETFRAMING
, do_atm_ioctl
)
3730 HANDLE_IOCTL(SONET_GETFRAMING
, do_atm_ioctl
)
3731 HANDLE_IOCTL(SONET_GETFRSENSE
, do_atm_ioctl
)
3732 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
3733 HANDLE_IOCTL(VG_STATUS
, do_lvm_ioctl
)
3734 HANDLE_IOCTL(VG_CREATE
, do_lvm_ioctl
)
3735 HANDLE_IOCTL(VG_EXTEND
, do_lvm_ioctl
)
3736 HANDLE_IOCTL(LV_CREATE
, do_lvm_ioctl
)
3737 HANDLE_IOCTL(LV_REMOVE
, do_lvm_ioctl
)
3738 HANDLE_IOCTL(LV_EXTEND
, do_lvm_ioctl
)
3739 HANDLE_IOCTL(LV_REDUCE
, do_lvm_ioctl
)
3740 HANDLE_IOCTL(LV_STATUS_BYNAME
, do_lvm_ioctl
)
3741 HANDLE_IOCTL(LV_STATUS_BYINDEX
, do_lvm_ioctl
)
3742 HANDLE_IOCTL(LE_REMAP
, do_lvm_ioctl
)
3743 HANDLE_IOCTL(PV_CHANGE
, do_lvm_ioctl
)
3744 HANDLE_IOCTL(PV_STATUS
, do_lvm_ioctl
)
3746 #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
3747 HANDLE_IOCTL(DRM32_IOCTL_VERSION
, drm32_version
);
3748 HANDLE_IOCTL(DRM32_IOCTL_GET_UNIQUE
, drm32_getsetunique
);
3749 HANDLE_IOCTL(DRM32_IOCTL_SET_UNIQUE
, drm32_getsetunique
);
3750 HANDLE_IOCTL(DRM32_IOCTL_ADD_MAP
, drm32_addmap
);
3751 HANDLE_IOCTL(DRM32_IOCTL_INFO_BUFS
, drm32_info_bufs
);
3752 HANDLE_IOCTL(DRM32_IOCTL_FREE_BUFS
, drm32_free_bufs
);
3753 HANDLE_IOCTL(DRM32_IOCTL_MAP_BUFS
, drm32_map_bufs
);
3754 HANDLE_IOCTL(DRM32_IOCTL_DMA
, drm32_dma
);
3755 HANDLE_IOCTL(DRM32_IOCTL_RES_CTX
, drm32_res_ctx
);
3759 unsigned int ioctl32_hash_table
[1024];
3761 extern inline unsigned long ioctl32_hash(unsigned long cmd
)
3763 return ((cmd
>> 6) ^ (cmd
>> 4) ^ cmd
) & 0x3ff;
3766 static void ioctl32_insert_translation(struct ioctl_trans
*trans
)
3769 struct ioctl_trans
*t
;
3771 hash
= ioctl32_hash (trans
->cmd
);
3772 if (!ioctl32_hash_table
[hash
])
3773 ioctl32_hash_table
[hash
] = (u32
)(long)trans
;
3775 t
= (struct ioctl_trans
*)(long)ioctl32_hash_table
[hash
];
3777 t
= (struct ioctl_trans
*)(long)t
->next
;
3779 t
->next
= (u32
)(long)trans
;
3783 static int __init
init_sys32_ioctl(void)
3786 extern struct ioctl_trans ioctl_translations
[], ioctl_translations_end
[];
3788 for (i
= 0; &ioctl_translations
[i
] < &ioctl_translations_end
[0]; i
++)
3789 ioctl32_insert_translation(&ioctl_translations
[i
]);
3793 __initcall(init_sys32_ioctl
);
3795 static struct ioctl_trans
*additional_ioctls
;
3797 /* Always call these with kernel lock held! */
3799 int register_ioctl32_conversion(unsigned int cmd
, int (*handler
)(unsigned int, unsigned int, unsigned long, struct file
*))
3802 if (!additional_ioctls
) {
3803 additional_ioctls
= module_map(PAGE_SIZE
);
3804 if (!additional_ioctls
)
3806 memset(additional_ioctls
, 0, PAGE_SIZE
);
3808 for (i
= 0; i
< PAGE_SIZE
/sizeof(struct ioctl_trans
); i
++)
3809 if (!additional_ioctls
[i
].cmd
)
3811 if (i
== PAGE_SIZE
/sizeof(struct ioctl_trans
))
3813 additional_ioctls
[i
].cmd
= cmd
;
3815 additional_ioctls
[i
].handler
= (u32
)(long)sys_ioctl
;
3817 additional_ioctls
[i
].handler
= (u32
)(long)handler
;
3818 ioctl32_insert_translation(&additional_ioctls
[i
]);
3822 int unregister_ioctl32_conversion(unsigned int cmd
)
3824 unsigned long hash
= ioctl32_hash(cmd
);
3825 struct ioctl_trans
*t
, *t1
;
3827 t
= (struct ioctl_trans
*)(long)ioctl32_hash_table
[hash
];
3828 if (!t
) return -EINVAL
;
3829 if (t
->cmd
== cmd
&& t
>= additional_ioctls
&&
3830 (unsigned long)t
< ((unsigned long)additional_ioctls
) + PAGE_SIZE
) {
3831 ioctl32_hash_table
[hash
] = t
->next
;
3834 } else while (t
->next
) {
3835 t1
= (struct ioctl_trans
*)(long)t
->next
;
3836 if (t1
->cmd
== cmd
&& t1
>= additional_ioctls
&&
3837 (unsigned long)t1
< ((unsigned long)additional_ioctls
) + PAGE_SIZE
) {
3847 asmlinkage
int sys32_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
3851 int (*handler
)(unsigned int, unsigned int, unsigned long, struct file
* filp
);
3852 struct ioctl_trans
*t
;
3858 if (!filp
->f_op
|| !filp
->f_op
->ioctl
) {
3859 error
= sys_ioctl (fd
, cmd
, arg
);
3863 t
= (struct ioctl_trans
*)(long)ioctl32_hash_table
[ioctl32_hash (cmd
)];
3865 while (t
&& t
->cmd
!= cmd
)
3866 t
= (struct ioctl_trans
*)(long)t
->next
;
3868 handler
= (void *)(long)t
->handler
;
3869 error
= handler(fd
, cmd
, arg
, filp
);
3871 static int count
= 0;
3873 printk("sys32_ioctl: Unknown cmd fd(%d) "
3874 "cmd(%08x) arg(%08x)\n",
3875 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);