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)
6 * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs
7 * Copyright (C) 2003 Pavel Machek (pavel@suse.cz)
9 * These routines maintain argument size conversion between 32bit and 64bit
14 #include <linux/config.h>
15 #include <linux/types.h>
16 #include <linux/compat.h>
17 #include <linux/kernel.h>
18 #include <linux/compiler.h>
19 #include <linux/sched.h>
20 #include <linux/smp.h>
21 #include <linux/smp_lock.h>
22 #include <linux/ioctl.h>
24 #include <linux/if_bridge.h>
25 #include <linux/slab.h>
26 #include <linux/hdreg.h>
27 #include <linux/raid/md.h>
29 #include <linux/dirent.h>
30 #include <linux/route.h>
31 #include <linux/in6.h>
32 #include <linux/ipv6_route.h>
33 #include <linux/skbuff.h>
34 #include <linux/netlink.h>
37 #include <linux/file.h>
39 #include <linux/ppp_defs.h>
40 #include <linux/if_ppp.h>
41 #include <linux/if_pppox.h>
42 #include <linux/mtio.h>
43 #include <linux/cdrom.h>
44 #include <linux/loop.h>
45 #include <linux/auto_fs.h>
46 #include <linux/auto_fs4.h>
47 #include <linux/devfs_fs.h>
48 #include <linux/tty.h>
49 #include <linux/vt_kern.h>
51 #include <linux/ext2_fs.h>
52 #include <linux/videodev.h>
53 #include <linux/netdevice.h>
54 #include <linux/raw.h>
55 #include <linux/smb_fs.h>
56 #include <linux/blkpg.h>
57 #include <linux/blkdev.h>
58 #include <linux/elevator.h>
59 #include <linux/rtc.h>
60 #include <linux/pci.h>
61 #include <linux/module.h>
62 #include <linux/serial.h>
63 #include <linux/reiserfs_fs.h>
64 #include <linux/if_tun.h>
65 #include <linux/ctype.h>
66 #include <linux/ioctl32.h>
67 #include <linux/syscalls.h>
68 #include <linux/ncp_fs.h>
69 #include <linux/i2c.h>
70 #include <linux/i2c-dev.h>
71 #include <linux/wireless.h>
73 #include <net/sock.h> /* siocdevprivate_ioctl */
74 #include <net/bluetooth/bluetooth.h>
75 #include <net/bluetooth/hci.h>
76 #include <net/bluetooth/rfcomm.h>
78 #include <linux/capi.h>
80 #include <scsi/scsi.h>
83 #include <scsi/scsi_ioctl.h>
87 #include <asm/types.h>
88 #include <asm/uaccess.h>
89 #include <linux/ethtool.h>
90 #include <linux/mii.h>
91 #include <linux/if_bonding.h>
92 #include <linux/watchdog.h>
93 #include <linux/dm-ioctl.h>
95 #include <asm/module.h>
96 #include <linux/soundcard.h>
99 #include <linux/atm.h>
100 #include <linux/atmarp.h>
101 #include <linux/atmclip.h>
102 #include <linux/atmdev.h>
103 #include <linux/atmioc.h>
104 #include <linux/atmlec.h>
105 #include <linux/atmmpc.h>
106 #include <linux/atmsvc.h>
107 #include <linux/atm_tcp.h>
108 #include <linux/sonet.h>
109 #include <linux/atm_suni.h>
110 #include <linux/mtd/mtd.h>
112 #include <linux/usb.h>
113 #include <linux/usbdevice_fs.h>
114 #include <linux/nbd.h>
115 #include <linux/random.h>
116 #include <linux/filter.h>
117 #include <linux/msdos_fs.h>
119 #include <linux/hiddev.h>
126 /* Aiee. Someone does not find a difference between int and long */
127 #define EXT2_IOC32_GETFLAGS _IOR('f', 1, int)
128 #define EXT2_IOC32_SETFLAGS _IOW('f', 2, int)
129 #define EXT2_IOC32_GETVERSION _IOR('v', 1, int)
130 #define EXT2_IOC32_SETVERSION _IOW('v', 2, int)
132 static int w_long(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
134 mm_segment_t old_fs
= get_fs();
139 err
= sys_ioctl(fd
, cmd
, (unsigned long)&val
);
141 if (!err
&& put_user(val
, (u32 __user
*)compat_ptr(arg
)))
146 static int rw_long(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
148 mm_segment_t old_fs
= get_fs();
149 u32 __user
*argptr
= compat_ptr(arg
);
153 if(get_user(val
, argptr
))
156 err
= sys_ioctl(fd
, cmd
, (unsigned long)&val
);
158 if (!err
&& put_user(val
, argptr
))
163 static int do_ext2_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
165 /* These are just misnamed, they actually get/put from/to user an int */
167 case EXT2_IOC32_GETFLAGS
: cmd
= EXT2_IOC_GETFLAGS
; break;
168 case EXT2_IOC32_SETFLAGS
: cmd
= EXT2_IOC_SETFLAGS
; break;
169 case EXT2_IOC32_GETVERSION
: cmd
= EXT2_IOC_GETVERSION
; break;
170 case EXT2_IOC32_SETVERSION
: cmd
= EXT2_IOC_SETVERSION
; break;
172 return sys_ioctl(fd
, cmd
, (unsigned long)compat_ptr(arg
));
175 struct video_tuner32
{
178 compat_ulong_t rangelow
, rangehigh
;
179 u32 flags
; /* It is really u32 in videodev.h */
183 static int get_video_tuner32(struct video_tuner
*kp
, struct video_tuner32 __user
*up
)
187 if(get_user(kp
->tuner
, &up
->tuner
))
189 for(i
= 0; i
< 32; i
++)
190 __get_user(kp
->name
[i
], &up
->name
[i
]);
191 __get_user(kp
->rangelow
, &up
->rangelow
);
192 __get_user(kp
->rangehigh
, &up
->rangehigh
);
193 __get_user(kp
->flags
, &up
->flags
);
194 __get_user(kp
->mode
, &up
->mode
);
195 __get_user(kp
->signal
, &up
->signal
);
199 static int put_video_tuner32(struct video_tuner
*kp
, struct video_tuner32 __user
*up
)
203 if(put_user(kp
->tuner
, &up
->tuner
))
205 for(i
= 0; i
< 32; i
++)
206 __put_user(kp
->name
[i
], &up
->name
[i
]);
207 __put_user(kp
->rangelow
, &up
->rangelow
);
208 __put_user(kp
->rangehigh
, &up
->rangehigh
);
209 __put_user(kp
->flags
, &up
->flags
);
210 __put_user(kp
->mode
, &up
->mode
);
211 __put_user(kp
->signal
, &up
->signal
);
215 struct video_buffer32
{
217 compat_int_t height
, width
, depth
, bytesperline
;
220 static int get_video_buffer32(struct video_buffer
*kp
, struct video_buffer32 __user
*up
)
224 if (get_user(tmp
, &up
->base
))
227 /* This is actually a physical address stored
230 kp
->base
= (void *)(unsigned long) tmp
;
232 __get_user(kp
->height
, &up
->height
);
233 __get_user(kp
->width
, &up
->width
);
234 __get_user(kp
->depth
, &up
->depth
);
235 __get_user(kp
->bytesperline
, &up
->bytesperline
);
239 static int put_video_buffer32(struct video_buffer
*kp
, struct video_buffer32 __user
*up
)
241 u32 tmp
= (u32
)((unsigned long)kp
->base
);
243 if(put_user(tmp
, &up
->base
))
245 __put_user(kp
->height
, &up
->height
);
246 __put_user(kp
->width
, &up
->width
);
247 __put_user(kp
->depth
, &up
->depth
);
248 __put_user(kp
->bytesperline
, &up
->bytesperline
);
252 struct video_clip32
{
253 s32 x
, y
, width
, height
; /* Its really s32 in videodev.h */
257 struct video_window32
{
258 u32 x
, y
, width
, height
, chromakey
, flags
;
259 compat_caddr_t clips
;
260 compat_int_t clipcount
;
263 /* You get back everything except the clips... */
264 static int put_video_window32(struct video_window
*kp
, struct video_window32 __user
*up
)
266 if(put_user(kp
->x
, &up
->x
))
268 __put_user(kp
->y
, &up
->y
);
269 __put_user(kp
->width
, &up
->width
);
270 __put_user(kp
->height
, &up
->height
);
271 __put_user(kp
->chromakey
, &up
->chromakey
);
272 __put_user(kp
->flags
, &up
->flags
);
273 __put_user(kp
->clipcount
, &up
->clipcount
);
277 #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32)
278 #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32)
279 #define VIDIOCGWIN32 _IOR('v',9, struct video_window32)
280 #define VIDIOCSWIN32 _IOW('v',10, struct video_window32)
281 #define VIDIOCGFBUF32 _IOR('v',11, struct video_buffer32)
282 #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32)
283 #define VIDIOCGFREQ32 _IOR('v',14, u32)
284 #define VIDIOCSFREQ32 _IOW('v',15, u32)
287 MaxClips
= (~0U-sizeof(struct video_window
))/sizeof(struct video_clip
)
290 static int do_set_window(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
292 struct video_window32 __user
*up
= compat_ptr(arg
);
293 struct video_window __user
*vw
;
294 struct video_clip __user
*p
;
298 if (get_user(nclips
, &up
->clipcount
))
301 /* Peculiar interface... */
303 nclips
= VIDEO_CLIPMAP_SIZE
;
305 if (nclips
> MaxClips
)
308 vw
= compat_alloc_user_space(sizeof(struct video_window
) +
309 nclips
* sizeof(struct video_clip
));
311 p
= nclips
? (struct video_clip __user
*)(vw
+ 1) : NULL
;
313 if (get_user(n
, &up
->x
) || put_user(n
, &vw
->x
) ||
314 get_user(n
, &up
->y
) || put_user(n
, &vw
->y
) ||
315 get_user(n
, &up
->width
) || put_user(n
, &vw
->width
) ||
316 get_user(n
, &up
->height
) || put_user(n
, &vw
->height
) ||
317 get_user(n
, &up
->chromakey
) || put_user(n
, &vw
->chromakey
) ||
318 get_user(n
, &up
->flags
) || put_user(n
, &vw
->flags
) ||
319 get_user(n
, &up
->clipcount
) || put_user(n
, &vw
->clipcount
) ||
320 get_user(n
, &up
->clips
) || put_user(p
, &vw
->clips
))
324 struct video_clip32 __user
*u
= compat_ptr(n
);
328 for (i
= 0; i
< nclips
; i
++, u
++, p
++) {
330 if (get_user(v
, &u
->x
) ||
331 put_user(v
, &p
->x
) ||
332 get_user(v
, &u
->y
) ||
333 put_user(v
, &p
->y
) ||
334 get_user(v
, &u
->width
) ||
335 put_user(v
, &p
->width
) ||
336 get_user(v
, &u
->height
) ||
337 put_user(v
, &p
->height
) ||
338 put_user(NULL
, &p
->next
))
343 return sys_ioctl(fd
, VIDIOCSWIN
, (unsigned long)p
);
346 static int do_video_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
349 struct video_tuner vt
;
350 struct video_buffer vb
;
351 struct video_window vw
;
354 mm_segment_t old_fs
= get_fs();
355 void __user
*up
= compat_ptr(arg
);
358 /* First, convert the command. */
360 case VIDIOCGTUNER32
: cmd
= VIDIOCGTUNER
; break;
361 case VIDIOCSTUNER32
: cmd
= VIDIOCSTUNER
; break;
362 case VIDIOCGWIN32
: cmd
= VIDIOCGWIN
; break;
363 case VIDIOCGFBUF32
: cmd
= VIDIOCGFBUF
; break;
364 case VIDIOCSFBUF32
: cmd
= VIDIOCSFBUF
; break;
365 case VIDIOCGFREQ32
: cmd
= VIDIOCGFREQ
; break;
366 case VIDIOCSFREQ32
: cmd
= VIDIOCSFREQ
; break;
372 err
= get_video_tuner32(&karg
.vt
, up
);
376 err
= get_video_buffer32(&karg
.vb
, up
);
380 err
= get_user(karg
.vx
, (u32 __user
*)up
);
387 err
= sys_ioctl(fd
, cmd
, (unsigned long)&karg
);
393 err
= put_video_tuner32(&karg
.vt
, up
);
397 err
= put_video_window32(&karg
.vw
, up
);
401 err
= put_video_buffer32(&karg
.vb
, up
);
405 err
= put_user(((u32
)karg
.vx
), (u32 __user
*)up
);
414 static int do_siocgstamp(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
416 struct compat_timeval __user
*up
= compat_ptr(arg
);
418 mm_segment_t old_fs
= get_fs();
422 err
= sys_ioctl(fd
, cmd
, (unsigned long)&ktv
);
425 err
= put_user(ktv
.tv_sec
, &up
->tv_sec
);
426 err
|= __put_user(ktv
.tv_usec
, &up
->tv_usec
);
432 compat_ulong_t mem_start
;
433 compat_ulong_t mem_end
;
434 unsigned short base_addr
;
441 #define IFHWADDRLEN 6
444 char ifrn_name
[IFNAMSIZ
]; /* if name, e.g. "en0" */
447 struct sockaddr ifru_addr
;
448 struct sockaddr ifru_dstaddr
;
449 struct sockaddr ifru_broadaddr
;
450 struct sockaddr ifru_netmask
;
451 struct sockaddr ifru_hwaddr
;
453 compat_int_t ifru_ivalue
;
454 compat_int_t ifru_mtu
;
455 struct ifmap32 ifru_map
;
456 char ifru_slave
[IFNAMSIZ
]; /* Just fits the size */
457 char ifru_newname
[IFNAMSIZ
];
458 compat_caddr_t ifru_data
;
459 /* XXXX? ifru_settings should be here */
464 compat_int_t ifc_len
; /* size of buffer */
465 compat_caddr_t ifcbuf
;
468 static int dev_ifname32(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
470 struct net_device
*dev
;
471 struct ifreq32 ifr32
;
474 if (copy_from_user(&ifr32
, compat_ptr(arg
), sizeof(ifr32
)))
477 dev
= dev_get_by_index(ifr32
.ifr_ifindex
);
481 strlcpy(ifr32
.ifr_name
, dev
->name
, sizeof(ifr32
.ifr_name
));
484 err
= copy_to_user(compat_ptr(arg
), &ifr32
, sizeof(ifr32
));
485 return (err
? -EFAULT
: 0);
488 static int dev_ifconf(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
490 struct ifconf32 ifc32
;
492 struct ifconf __user
*uifc
;
493 struct ifreq32 __user
*ifr32
;
494 struct ifreq __user
*ifr
;
498 if (copy_from_user(&ifc32
, compat_ptr(arg
), sizeof(struct ifconf32
)))
501 if (ifc32
.ifcbuf
== 0) {
505 uifc
= compat_alloc_user_space(sizeof(struct ifconf
));
507 size_t len
=((ifc32
.ifc_len
/ sizeof (struct ifreq32
)) + 1) *
508 sizeof (struct ifreq
);
509 uifc
= compat_alloc_user_space(sizeof(struct ifconf
) + len
);
511 ifr
= ifc
.ifc_req
= (void __user
*)(uifc
+ 1);
512 ifr32
= compat_ptr(ifc32
.ifcbuf
);
513 for (i
= 0; i
< ifc32
.ifc_len
; i
+= sizeof (struct ifreq32
)) {
514 if (copy_in_user(ifr
, ifr32
, sizeof(struct ifreq32
)))
520 if (copy_to_user(uifc
, &ifc
, sizeof(struct ifconf
)))
523 err
= sys_ioctl (fd
, SIOCGIFCONF
, (unsigned long)uifc
);
527 if (copy_from_user(&ifc
, uifc
, sizeof(struct ifconf
)))
531 ifr32
= compat_ptr(ifc32
.ifcbuf
);
532 for (i
= 0, j
= 0; i
< ifc32
.ifc_len
&& j
< ifc
.ifc_len
;
533 i
+= sizeof (struct ifreq32
), j
+= sizeof (struct ifreq
)) {
534 if (copy_in_user(ifr32
, ifr
, sizeof (struct ifreq32
)))
540 if (ifc32
.ifcbuf
== 0) {
541 /* Translate from 64-bit structure multiple to
545 i
= ((i
/ sizeof(struct ifreq
)) * sizeof(struct ifreq32
));
548 if (i
<= ifc32
.ifc_len
)
551 ifc32
.ifc_len
= i
- sizeof (struct ifreq32
);
553 if (copy_to_user(compat_ptr(arg
), &ifc32
, sizeof(struct ifconf32
)))
559 static int ethtool_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
561 struct ifreq __user
*ifr
;
562 struct ifreq32 __user
*ifr32
;
566 ifr
= compat_alloc_user_space(sizeof(*ifr
));
567 ifr32
= compat_ptr(arg
);
569 if (copy_in_user(&ifr
->ifr_name
, &ifr32
->ifr_name
, IFNAMSIZ
))
572 if (get_user(data
, &ifr32
->ifr_ifru
.ifru_data
))
575 datap
= compat_ptr(data
);
576 if (put_user(datap
, &ifr
->ifr_ifru
.ifru_data
))
579 return sys_ioctl(fd
, cmd
, (unsigned long) ifr
);
582 static int bond_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
585 struct ifreq __user
*uifr
;
586 struct ifreq32 __user
*ifr32
= compat_ptr(arg
);
593 case SIOCBONDENSLAVE
:
594 case SIOCBONDRELEASE
:
595 case SIOCBONDSETHWADDR
:
596 case SIOCBONDCHANGEACTIVE
:
597 if (copy_from_user(&kifr
, ifr32
, sizeof(struct ifreq32
)))
602 err
= sys_ioctl (fd
, cmd
, (unsigned long)&kifr
);
606 case SIOCBONDSLAVEINFOQUERY
:
607 case SIOCBONDINFOQUERY
:
608 uifr
= compat_alloc_user_space(sizeof(*uifr
));
609 if (copy_in_user(&uifr
->ifr_name
, &ifr32
->ifr_name
, IFNAMSIZ
))
612 if (get_user(data
, &ifr32
->ifr_ifru
.ifru_data
))
615 datap
= compat_ptr(data
);
616 if (put_user(datap
, &uifr
->ifr_ifru
.ifru_data
))
619 return sys_ioctl (fd
, cmd
, (unsigned long)uifr
);
625 int siocdevprivate_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
627 struct ifreq __user
*u_ifreq64
;
628 struct ifreq32 __user
*u_ifreq32
= compat_ptr(arg
);
629 char tmp_buf
[IFNAMSIZ
];
633 if (copy_from_user(&tmp_buf
[0], &(u_ifreq32
->ifr_ifrn
.ifrn_name
[0]),
636 if (__get_user(data32
, &u_ifreq32
->ifr_ifru
.ifru_data
))
638 data64
= compat_ptr(data32
);
640 u_ifreq64
= compat_alloc_user_space(sizeof(*u_ifreq64
));
642 /* Don't check these user accesses, just let that get trapped
643 * in the ioctl handler instead.
645 copy_to_user(&u_ifreq64
->ifr_ifrn
.ifrn_name
[0], &tmp_buf
[0], IFNAMSIZ
);
646 __put_user(data64
, &u_ifreq64
->ifr_ifru
.ifru_data
);
648 return sys_ioctl(fd
, cmd
, (unsigned long) u_ifreq64
);
651 static int dev_ifsioc(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
654 struct ifreq32 __user
*uifr32
;
655 struct ifmap32 __user
*uifmap32
;
659 uifr32
= compat_ptr(arg
);
660 uifmap32
= &uifr32
->ifr_ifru
.ifru_map
;
663 err
= copy_from_user(&ifr
, uifr32
, sizeof(ifr
.ifr_name
));
664 err
|= __get_user(ifr
.ifr_map
.mem_start
, &uifmap32
->mem_start
);
665 err
|= __get_user(ifr
.ifr_map
.mem_end
, &uifmap32
->mem_end
);
666 err
|= __get_user(ifr
.ifr_map
.base_addr
, &uifmap32
->base_addr
);
667 err
|= __get_user(ifr
.ifr_map
.irq
, &uifmap32
->irq
);
668 err
|= __get_user(ifr
.ifr_map
.dma
, &uifmap32
->dma
);
669 err
|= __get_user(ifr
.ifr_map
.port
, &uifmap32
->port
);
674 if (copy_from_user(&ifr
, uifr32
, sizeof(*uifr32
)))
680 err
= sys_ioctl (fd
, cmd
, (unsigned long)&ifr
);
695 if (copy_to_user(uifr32
, &ifr
, sizeof(*uifr32
)))
699 err
= copy_to_user(uifr32
, &ifr
, sizeof(ifr
.ifr_name
));
700 err
|= __put_user(ifr
.ifr_map
.mem_start
, &uifmap32
->mem_start
);
701 err
|= __put_user(ifr
.ifr_map
.mem_end
, &uifmap32
->mem_end
);
702 err
|= __put_user(ifr
.ifr_map
.base_addr
, &uifmap32
->base_addr
);
703 err
|= __put_user(ifr
.ifr_map
.irq
, &uifmap32
->irq
);
704 err
|= __put_user(ifr
.ifr_map
.dma
, &uifmap32
->dma
);
705 err
|= __put_user(ifr
.ifr_map
.port
, &uifmap32
->port
);
716 struct sockaddr rt_dst
; /* target address */
717 struct sockaddr rt_gateway
; /* gateway addr (RTF_GATEWAY) */
718 struct sockaddr rt_genmask
; /* target network mask (IP) */
719 unsigned short rt_flags
;
722 unsigned char rt_tos
;
723 unsigned char rt_class
;
725 short rt_metric
; /* +1 for binary compatibility! */
726 /* char * */ u32 rt_dev
; /* forcing the device at add */
727 u32 rt_mtu
; /* per route MTU/Window */
728 u32 rt_window
; /* Window clamping */
729 unsigned short rt_irtt
; /* Initial RTT */
734 struct in6_addr rtmsg_dst
;
735 struct in6_addr rtmsg_src
;
736 struct in6_addr rtmsg_gateway
;
746 static int routing_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
754 mm_segment_t old_fs
= get_fs();
756 struct socket
*mysock
= sockfd_lookup(fd
, &ret
);
758 if (mysock
&& mysock
->sk
&& mysock
->sk
->sk_family
== AF_INET6
) { /* ipv6 */
759 struct in6_rtmsg32 __user
*ur6
= compat_ptr(arg
);
760 ret
= copy_from_user (&r6
.rtmsg_dst
, &(ur6
->rtmsg_dst
),
761 3 * sizeof(struct in6_addr
));
762 ret
|= __get_user (r6
.rtmsg_type
, &(ur6
->rtmsg_type
));
763 ret
|= __get_user (r6
.rtmsg_dst_len
, &(ur6
->rtmsg_dst_len
));
764 ret
|= __get_user (r6
.rtmsg_src_len
, &(ur6
->rtmsg_src_len
));
765 ret
|= __get_user (r6
.rtmsg_metric
, &(ur6
->rtmsg_metric
));
766 ret
|= __get_user (r6
.rtmsg_info
, &(ur6
->rtmsg_info
));
767 ret
|= __get_user (r6
.rtmsg_flags
, &(ur6
->rtmsg_flags
));
768 ret
|= __get_user (r6
.rtmsg_ifindex
, &(ur6
->rtmsg_ifindex
));
772 struct rtentry32 __user
*ur4
= compat_ptr(arg
);
773 ret
= copy_from_user (&r4
.rt_dst
, &(ur4
->rt_dst
),
774 3 * sizeof(struct sockaddr
));
775 ret
|= __get_user (r4
.rt_flags
, &(ur4
->rt_flags
));
776 ret
|= __get_user (r4
.rt_metric
, &(ur4
->rt_metric
));
777 ret
|= __get_user (r4
.rt_mtu
, &(ur4
->rt_mtu
));
778 ret
|= __get_user (r4
.rt_window
, &(ur4
->rt_window
));
779 ret
|= __get_user (r4
.rt_irtt
, &(ur4
->rt_irtt
));
780 ret
|= __get_user (rtdev
, &(ur4
->rt_dev
));
782 ret
|= copy_from_user (devname
, compat_ptr(rtdev
), 15);
783 r4
.rt_dev
= devname
; devname
[15] = 0;
794 ret
= sys_ioctl (fd
, cmd
, (unsigned long) r
);
804 struct hd_geometry32
{
806 unsigned char sectors
;
807 unsigned short cylinders
;
811 static int hdio_getgeo(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
813 mm_segment_t old_fs
= get_fs();
814 struct hd_geometry geo
;
815 struct hd_geometry32 __user
*ugeo
;
819 err
= sys_ioctl(fd
, HDIO_GETGEO
, (unsigned long)&geo
);
821 ugeo
= compat_ptr(arg
);
823 err
= copy_to_user (ugeo
, &geo
, 4);
824 err
|= __put_user (geo
.start
, &ugeo
->start
);
826 return err
? -EFAULT
: 0;
829 struct fb_fix_screeninfo32
{
831 compat_caddr_t smem_start
;
840 compat_caddr_t mmio_start
;
850 compat_caddr_t green
;
852 compat_caddr_t transp
;
855 static int fb_getput_cmap(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
857 struct fb_cmap_user __user
*cmap
;
858 struct fb_cmap32 __user
*cmap32
;
862 cmap
= compat_alloc_user_space(sizeof(*cmap
));
863 cmap32
= compat_ptr(arg
);
865 if (copy_in_user(&cmap
->start
, &cmap32
->start
, 2 * sizeof(__u32
)))
868 if (get_user(data
, &cmap32
->red
) ||
869 put_user(compat_ptr(data
), &cmap
->red
) ||
870 get_user(data
, &cmap32
->green
) ||
871 put_user(compat_ptr(data
), &cmap
->green
) ||
872 get_user(data
, &cmap32
->blue
) ||
873 put_user(compat_ptr(data
), &cmap
->blue
) ||
874 get_user(data
, &cmap32
->transp
) ||
875 put_user(compat_ptr(data
), &cmap
->transp
))
878 err
= sys_ioctl(fd
, cmd
, (unsigned long) cmap
);
881 if (copy_in_user(&cmap32
->start
,
889 static int do_fscreeninfo_to_user(struct fb_fix_screeninfo
*fix
,
890 struct fb_fix_screeninfo32 __user
*fix32
)
895 err
= copy_to_user(&fix32
->id
, &fix
->id
, sizeof(fix32
->id
));
897 data
= (__u32
) (unsigned long) fix
->smem_start
;
898 err
|= put_user(data
, &fix32
->smem_start
);
900 err
|= put_user(fix
->smem_len
, &fix32
->smem_len
);
901 err
|= put_user(fix
->type
, &fix32
->type
);
902 err
|= put_user(fix
->type_aux
, &fix32
->type_aux
);
903 err
|= put_user(fix
->visual
, &fix32
->visual
);
904 err
|= put_user(fix
->xpanstep
, &fix32
->xpanstep
);
905 err
|= put_user(fix
->ypanstep
, &fix32
->ypanstep
);
906 err
|= put_user(fix
->ywrapstep
, &fix32
->ywrapstep
);
907 err
|= put_user(fix
->line_length
, &fix32
->line_length
);
909 data
= (__u32
) (unsigned long) fix
->mmio_start
;
910 err
|= put_user(data
, &fix32
->mmio_start
);
912 err
|= put_user(fix
->mmio_len
, &fix32
->mmio_len
);
913 err
|= put_user(fix
->accel
, &fix32
->accel
);
914 err
|= copy_to_user(fix32
->reserved
, fix
->reserved
,
915 sizeof(fix
->reserved
));
920 static int fb_get_fscreeninfo(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
923 struct fb_fix_screeninfo fix
;
924 struct fb_fix_screeninfo32 __user
*fix32
;
927 fix32
= compat_ptr(arg
);
931 err
= sys_ioctl(fd
, cmd
, (unsigned long) &fix
);
935 err
= do_fscreeninfo_to_user(&fix
, fix32
);
940 static int fb_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
945 case FBIOGET_FSCREENINFO
:
946 err
= fb_get_fscreeninfo(fd
,cmd
, arg
);
951 err
= fb_getput_cmap(fd
, cmd
, arg
);
958 printk("%s: Unknown fb ioctl cmd fd(%d) "
959 "cmd(%08x) arg(%08lx)\n",
960 __FUNCTION__
, fd
, cmd
, arg
);
969 static int hdio_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
971 mm_segment_t old_fs
= get_fs();
973 unsigned int __user
*uvp
;
977 error
= sys_ioctl(fd
, cmd
, (long)&kval
);
981 uvp
= compat_ptr(arg
);
982 if(put_user(kval
, uvp
))
989 typedef struct sg_io_hdr32
{
990 compat_int_t interface_id
; /* [i] 'S' for SCSI generic (required) */
991 compat_int_t dxfer_direction
; /* [i] data transfer direction */
992 unsigned char cmd_len
; /* [i] SCSI command length ( <= 16 bytes) */
993 unsigned char mx_sb_len
; /* [i] max length to write to sbp */
994 unsigned short iovec_count
; /* [i] 0 implies no scatter gather */
995 compat_uint_t dxfer_len
; /* [i] byte count of data transfer */
996 compat_uint_t dxferp
; /* [i], [*io] points to data transfer memory
997 or scatter gather list */
998 compat_uptr_t cmdp
; /* [i], [*i] points to command to perform */
999 compat_uptr_t sbp
; /* [i], [*o] points to sense_buffer memory */
1000 compat_uint_t timeout
; /* [i] MAX_UINT->no timeout (unit: millisec) */
1001 compat_uint_t flags
; /* [i] 0 -> default, see SG_FLAG... */
1002 compat_int_t pack_id
; /* [i->o] unused internally (normally) */
1003 compat_uptr_t usr_ptr
; /* [i->o] unused internally */
1004 unsigned char status
; /* [o] scsi status */
1005 unsigned char masked_status
; /* [o] shifted, masked scsi status */
1006 unsigned char msg_status
; /* [o] messaging level data (optional) */
1007 unsigned char sb_len_wr
; /* [o] byte count actually written to sbp */
1008 unsigned short host_status
; /* [o] errors from host adapter */
1009 unsigned short driver_status
; /* [o] errors from software driver */
1010 compat_int_t resid
; /* [o] dxfer_len - actual_transferred */
1011 compat_uint_t duration
; /* [o] time taken by cmd (unit: millisec) */
1012 compat_uint_t info
; /* [o] auxiliary information */
1013 } sg_io_hdr32_t
; /* 64 bytes long (on sparc32) */
1015 typedef struct sg_iovec32
{
1016 compat_uint_t iov_base
;
1017 compat_uint_t iov_len
;
1020 static int sg_build_iovec(sg_io_hdr_t __user
*sgio
, void __user
*dxferp
, u16 iovec_count
)
1022 sg_iovec_t __user
*iov
= (sg_iovec_t __user
*) (sgio
+ 1);
1023 sg_iovec32_t __user
*iov32
= dxferp
;
1026 for (i
= 0; i
< iovec_count
; i
++) {
1029 if (get_user(base
, &iov32
[i
].iov_base
) ||
1030 get_user(len
, &iov32
[i
].iov_len
) ||
1031 put_user(compat_ptr(base
), &iov
[i
].iov_base
) ||
1032 put_user(len
, &iov
[i
].iov_len
))
1036 if (put_user(iov
, &sgio
->dxferp
))
1041 static int sg_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1043 sg_io_hdr_t __user
*sgio
;
1044 sg_io_hdr32_t __user
*sgio32
;
1047 void __user
*dxferp
;
1050 sgio32
= compat_ptr(arg
);
1051 if (get_user(iovec_count
, &sgio32
->iovec_count
))
1055 void __user
*top
= compat_alloc_user_space(0);
1056 void __user
*new = compat_alloc_user_space(sizeof(sg_io_hdr_t
) +
1057 (iovec_count
* sizeof(sg_iovec_t
)));
1064 /* Ok, now construct. */
1065 if (copy_in_user(&sgio
->interface_id
, &sgio32
->interface_id
,
1067 (2 * sizeof(unsigned char)) +
1068 (1 * sizeof(unsigned short)) +
1069 (1 * sizeof(unsigned int))))
1072 if (get_user(data
, &sgio32
->dxferp
))
1074 dxferp
= compat_ptr(data
);
1076 if (sg_build_iovec(sgio
, dxferp
, iovec_count
))
1079 if (put_user(dxferp
, &sgio
->dxferp
))
1084 unsigned char __user
*cmdp
;
1085 unsigned char __user
*sbp
;
1087 if (get_user(data
, &sgio32
->cmdp
))
1089 cmdp
= compat_ptr(data
);
1091 if (get_user(data
, &sgio32
->sbp
))
1093 sbp
= compat_ptr(data
);
1095 if (put_user(cmdp
, &sgio
->cmdp
) ||
1096 put_user(sbp
, &sgio
->sbp
))
1100 if (copy_in_user(&sgio
->timeout
, &sgio32
->timeout
,
1104 if (get_user(data
, &sgio32
->usr_ptr
))
1106 if (put_user(compat_ptr(data
), &sgio
->usr_ptr
))
1109 if (copy_in_user(&sgio
->status
, &sgio32
->status
,
1110 (4 * sizeof(unsigned char)) +
1111 (2 * sizeof(unsigned (short))) +
1115 err
= sys_ioctl(fd
, cmd
, (unsigned long) sgio
);
1120 if (copy_in_user(&sgio32
->pack_id
, &sgio
->pack_id
,
1122 get_user(datap
, &sgio
->usr_ptr
) ||
1123 put_user((u32
)(unsigned long)datap
,
1124 &sgio32
->usr_ptr
) ||
1125 copy_in_user(&sgio32
->status
, &sgio
->status
,
1126 (4 * sizeof(unsigned char)) +
1127 (2 * sizeof(unsigned short)) +
1135 struct sock_fprog32
{
1137 compat_caddr_t filter
;
1140 #define PPPIOCSPASS32 _IOW('t', 71, struct sock_fprog32)
1141 #define PPPIOCSACTIVE32 _IOW('t', 70, struct sock_fprog32)
1143 static int ppp_sock_fprog_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1145 struct sock_fprog32 __user
*u_fprog32
= compat_ptr(arg
);
1146 struct sock_fprog __user
*u_fprog64
= compat_alloc_user_space(sizeof(struct sock_fprog
));
1147 void __user
*fptr64
;
1151 if (get_user(flen
, &u_fprog32
->len
) ||
1152 get_user(fptr32
, &u_fprog32
->filter
))
1155 fptr64
= compat_ptr(fptr32
);
1157 if (put_user(flen
, &u_fprog64
->len
) ||
1158 put_user(fptr64
, &u_fprog64
->filter
))
1161 if (cmd
== PPPIOCSPASS32
)
1164 cmd
= PPPIOCSACTIVE
;
1166 return sys_ioctl(fd
, cmd
, (unsigned long) u_fprog64
);
1169 struct ppp_option_data32
{
1172 compat_int_t transmit
;
1174 #define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
1177 compat_time_t xmit_idle
;
1178 compat_time_t recv_idle
;
1180 #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
1182 static int ppp_gidle(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1184 struct ppp_idle __user
*idle
;
1185 struct ppp_idle32 __user
*idle32
;
1186 __kernel_time_t xmit
, recv
;
1189 idle
= compat_alloc_user_space(sizeof(*idle
));
1190 idle32
= compat_ptr(arg
);
1192 err
= sys_ioctl(fd
, PPPIOCGIDLE
, (unsigned long) idle
);
1195 if (get_user(xmit
, &idle
->xmit_idle
) ||
1196 get_user(recv
, &idle
->recv_idle
) ||
1197 put_user(xmit
, &idle32
->xmit_idle
) ||
1198 put_user(recv
, &idle32
->recv_idle
))
1204 static int ppp_scompress(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1206 struct ppp_option_data __user
*odata
;
1207 struct ppp_option_data32 __user
*odata32
;
1211 odata
= compat_alloc_user_space(sizeof(*odata
));
1212 odata32
= compat_ptr(arg
);
1214 if (get_user(data
, &odata32
->ptr
))
1217 datap
= compat_ptr(data
);
1218 if (put_user(datap
, &odata
->ptr
))
1221 if (copy_in_user(&odata
->length
, &odata32
->length
,
1222 sizeof(__u32
) + sizeof(int)))
1225 return sys_ioctl(fd
, PPPIOCSCOMPRESS
, (unsigned long) odata
);
1228 static int ppp_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1234 err
= ppp_gidle(fd
, cmd
, arg
);
1237 case PPPIOCSCOMPRESS32
:
1238 err
= ppp_scompress(fd
, cmd
, arg
);
1245 printk("ppp_ioctl: Unknown cmd fd(%d) "
1246 "cmd(%08x) arg(%08x)\n",
1247 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1258 compat_long_t mt_type
;
1259 compat_long_t mt_resid
;
1260 compat_long_t mt_dsreg
;
1261 compat_long_t mt_gstat
;
1262 compat_long_t mt_erreg
;
1263 compat_daddr_t mt_fileno
;
1264 compat_daddr_t mt_blkno
;
1266 #define MTIOCGET32 _IOR('m', 2, struct mtget32)
1269 compat_long_t mt_blkno
;
1271 #define MTIOCPOS32 _IOR('m', 3, struct mtpos32)
1273 struct mtconfiginfo32
{
1274 compat_long_t mt_type
;
1275 compat_long_t ifc_type
;
1276 unsigned short irqnr
;
1277 unsigned short dmanr
;
1278 unsigned short port
;
1279 compat_ulong_t debug
;
1280 compat_uint_t have_dens
:1;
1281 compat_uint_t have_bsf
:1;
1282 compat_uint_t have_fsr
:1;
1283 compat_uint_t have_bsr
:1;
1284 compat_uint_t have_eod
:1;
1285 compat_uint_t have_seek
:1;
1286 compat_uint_t have_tell
:1;
1287 compat_uint_t have_ras1
:1;
1288 compat_uint_t have_ras2
:1;
1289 compat_uint_t have_ras3
:1;
1290 compat_uint_t have_qfa
:1;
1291 compat_uint_t pad1
:5;
1294 #define MTIOCGETCONFIG32 _IOR('m', 4, struct mtconfiginfo32)
1295 #define MTIOCSETCONFIG32 _IOW('m', 5, struct mtconfiginfo32)
1297 static int mt_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1299 mm_segment_t old_fs
= get_fs();
1300 struct mtconfiginfo info
;
1301 struct mtconfiginfo32 __user
*uinfo32
;
1303 struct mtget32 __user
*umget32
;
1305 struct mtpos32 __user
*upos32
;
1319 case MTIOCGETCONFIG32
:
1320 kcmd
= MTIOCGETCONFIG
;
1323 case MTIOCSETCONFIG32
:
1324 kcmd
= MTIOCSETCONFIG
;
1326 uinfo32
= compat_ptr(arg
);
1327 err
= __get_user(info
.mt_type
, &uinfo32
->mt_type
);
1328 err
|= __get_user(info
.ifc_type
, &uinfo32
->ifc_type
);
1329 err
|= __get_user(info
.irqnr
, &uinfo32
->irqnr
);
1330 err
|= __get_user(info
.dmanr
, &uinfo32
->dmanr
);
1331 err
|= __get_user(info
.port
, &uinfo32
->port
);
1332 err
|= __get_user(info
.debug
, &uinfo32
->debug
);
1333 err
|= __copy_from_user((char *)&info
.debug
1334 + sizeof(info
.debug
),
1335 (char __user
*)&uinfo32
->debug
1336 + sizeof(uinfo32
->debug
), sizeof(__u32
));
1344 printk("mt_ioctl: Unknown cmd fd(%d) "
1345 "cmd(%08x) arg(%08x)\n",
1346 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1351 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
1357 upos32
= compat_ptr(arg
);
1358 err
= __put_user(pos
.mt_blkno
, &upos32
->mt_blkno
);
1361 umget32
= compat_ptr(arg
);
1362 err
= __put_user(get
.mt_type
, &umget32
->mt_type
);
1363 err
|= __put_user(get
.mt_resid
, &umget32
->mt_resid
);
1364 err
|= __put_user(get
.mt_dsreg
, &umget32
->mt_dsreg
);
1365 err
|= __put_user(get
.mt_gstat
, &umget32
->mt_gstat
);
1366 err
|= __put_user(get
.mt_erreg
, &umget32
->mt_erreg
);
1367 err
|= __put_user(get
.mt_fileno
, &umget32
->mt_fileno
);
1368 err
|= __put_user(get
.mt_blkno
, &umget32
->mt_blkno
);
1370 case MTIOCGETCONFIG32
:
1371 uinfo32
= compat_ptr(arg
);
1372 err
= __put_user(info
.mt_type
, &uinfo32
->mt_type
);
1373 err
|= __put_user(info
.ifc_type
, &uinfo32
->ifc_type
);
1374 err
|= __put_user(info
.irqnr
, &uinfo32
->irqnr
);
1375 err
|= __put_user(info
.dmanr
, &uinfo32
->dmanr
);
1376 err
|= __put_user(info
.port
, &uinfo32
->port
);
1377 err
|= __put_user(info
.debug
, &uinfo32
->debug
);
1378 err
|= __copy_to_user((char __user
*)&uinfo32
->debug
1379 + sizeof(uinfo32
->debug
),
1380 (char *)&info
.debug
+ sizeof(info
.debug
), sizeof(__u32
));
1382 case MTIOCSETCONFIG32
:
1385 return err
? -EFAULT
: 0;
1388 struct cdrom_read_audio32
{
1389 union cdrom_addr addr
;
1391 compat_int_t nframes
;
1395 struct cdrom_generic_command32
{
1396 unsigned char cmd
[CDROM_PACKET_SIZE
];
1397 compat_caddr_t buffer
;
1398 compat_uint_t buflen
;
1400 compat_caddr_t sense
;
1401 unsigned char data_direction
;
1403 compat_int_t timeout
;
1404 compat_caddr_t reserved
[1];
1407 static int cdrom_do_read_audio(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1409 struct cdrom_read_audio __user
*cdread_audio
;
1410 struct cdrom_read_audio32 __user
*cdread_audio32
;
1414 cdread_audio
= compat_alloc_user_space(sizeof(*cdread_audio
));
1415 cdread_audio32
= compat_ptr(arg
);
1417 if (copy_in_user(&cdread_audio
->addr
,
1418 &cdread_audio32
->addr
,
1419 (sizeof(*cdread_audio32
) -
1420 sizeof(compat_caddr_t
))))
1423 if (get_user(data
, &cdread_audio32
->buf
))
1425 datap
= compat_ptr(data
);
1426 if (put_user(datap
, &cdread_audio
->buf
))
1429 return sys_ioctl(fd
, cmd
, (unsigned long) cdread_audio
);
1432 static int cdrom_do_generic_command(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1434 struct cdrom_generic_command __user
*cgc
;
1435 struct cdrom_generic_command32 __user
*cgc32
;
1440 cgc
= compat_alloc_user_space(sizeof(*cgc
));
1441 cgc32
= compat_ptr(arg
);
1443 if (copy_in_user(&cgc
->cmd
, &cgc32
->cmd
, sizeof(cgc
->cmd
)) ||
1444 get_user(data
, &cgc32
->buffer
) ||
1445 put_user(compat_ptr(data
), &cgc
->buffer
) ||
1446 copy_in_user(&cgc
->buflen
, &cgc32
->buflen
,
1447 (sizeof(unsigned int) + sizeof(int))) ||
1448 get_user(data
, &cgc32
->sense
) ||
1449 put_user(compat_ptr(data
), &cgc
->sense
) ||
1450 get_user(dir
, &cgc32
->data_direction
) ||
1451 put_user(dir
, &cgc
->data_direction
) ||
1452 get_user(itmp
, &cgc32
->quiet
) ||
1453 put_user(itmp
, &cgc
->quiet
) ||
1454 get_user(itmp
, &cgc32
->timeout
) ||
1455 put_user(itmp
, &cgc
->timeout
) ||
1456 get_user(data
, &cgc32
->reserved
[0]) ||
1457 put_user(compat_ptr(data
), &cgc
->reserved
[0]))
1460 return sys_ioctl(fd
, cmd
, (unsigned long) cgc
);
1463 static int cdrom_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1468 case CDROMREADAUDIO
:
1469 err
= cdrom_do_read_audio(fd
, cmd
, arg
);
1472 case CDROM_SEND_PACKET
:
1473 err
= cdrom_do_generic_command(fd
, cmd
, arg
);
1480 printk("cdrom_ioctl: Unknown cmd fd(%d) "
1481 "cmd(%08x) arg(%08x)\n",
1482 (int)fd
, (unsigned int)cmd
, (unsigned int)arg
);
1491 struct loop_info32
{
1492 compat_int_t lo_number
; /* ioctl r/o */
1493 compat_dev_t lo_device
; /* ioctl r/o */
1494 compat_ulong_t lo_inode
; /* ioctl r/o */
1495 compat_dev_t lo_rdevice
; /* ioctl r/o */
1496 compat_int_t lo_offset
;
1497 compat_int_t lo_encrypt_type
;
1498 compat_int_t lo_encrypt_key_size
; /* ioctl w/o */
1499 compat_int_t lo_flags
; /* ioctl r/o */
1500 char lo_name
[LO_NAME_SIZE
];
1501 unsigned char lo_encrypt_key
[LO_KEY_SIZE
]; /* ioctl w/o */
1502 compat_ulong_t lo_init
[2];
1506 static int loop_status(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1508 mm_segment_t old_fs
= get_fs();
1510 struct loop_info32 __user
*ul
;
1513 ul
= compat_ptr(arg
);
1515 case LOOP_SET_STATUS
:
1516 err
= get_user(l
.lo_number
, &ul
->lo_number
);
1517 err
|= __get_user(l
.lo_device
, &ul
->lo_device
);
1518 err
|= __get_user(l
.lo_inode
, &ul
->lo_inode
);
1519 err
|= __get_user(l
.lo_rdevice
, &ul
->lo_rdevice
);
1520 err
|= __copy_from_user(&l
.lo_offset
, &ul
->lo_offset
,
1521 8 + (unsigned long)l
.lo_init
- (unsigned long)&l
.lo_offset
);
1526 err
= sys_ioctl (fd
, cmd
, (unsigned long)&l
);
1530 case LOOP_GET_STATUS
:
1532 err
= sys_ioctl (fd
, cmd
, (unsigned long)&l
);
1535 err
= put_user(l
.lo_number
, &ul
->lo_number
);
1536 err
|= __put_user(l
.lo_device
, &ul
->lo_device
);
1537 err
|= __put_user(l
.lo_inode
, &ul
->lo_inode
);
1538 err
|= __put_user(l
.lo_rdevice
, &ul
->lo_rdevice
);
1539 err
|= __copy_to_user(&ul
->lo_offset
, &l
.lo_offset
,
1540 (unsigned long)l
.lo_init
- (unsigned long)&l
.lo_offset
);
1548 printk("%s: Unknown loop ioctl cmd, fd(%d) "
1549 "cmd(%08x) arg(%08lx)\n",
1550 __FUNCTION__
, fd
, cmd
, arg
);
1556 extern int tty_ioctl(struct inode
* inode
, struct file
* file
, unsigned int cmd
, unsigned long arg
);
1560 static int vt_check(struct file
*file
)
1562 struct tty_struct
*tty
;
1563 struct inode
*inode
= file
->f_dentry
->d_inode
;
1565 if (file
->f_op
->ioctl
!= tty_ioctl
)
1568 tty
= (struct tty_struct
*)file
->private_data
;
1569 if (tty_paranoia_check(tty
, inode
, "tty_ioctl"))
1572 if (tty
->driver
->ioctl
!= vt_ioctl
)
1576 * To have permissions to do most of the vt ioctls, we either have
1577 * to be the owner of the tty, or super-user.
1579 if (current
->signal
->tty
== tty
|| capable(CAP_SYS_ADMIN
))
1584 struct consolefontdesc32
{
1585 unsigned short charcount
; /* characters in font (256 or 512) */
1586 unsigned short charheight
; /* scan lines per character (1-32) */
1587 compat_caddr_t chardata
; /* font data in expanded form */
1590 static int do_fontx_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
, struct file
*file
)
1592 struct consolefontdesc32 __user
*user_cfd
= compat_ptr(arg
);
1593 struct console_font_op op
;
1594 compat_caddr_t data
;
1597 perm
= vt_check(file
);
1598 if (perm
< 0) return perm
;
1604 op
.op
= KD_FONT_OP_SET
;
1607 if (get_user(op
.height
, &user_cfd
->charheight
) ||
1608 get_user(op
.charcount
, &user_cfd
->charcount
) ||
1609 get_user(data
, &user_cfd
->chardata
))
1611 op
.data
= compat_ptr(data
);
1612 return con_font_op(fg_console
, &op
);
1614 op
.op
= KD_FONT_OP_GET
;
1617 if (get_user(op
.height
, &user_cfd
->charheight
) ||
1618 get_user(op
.charcount
, &user_cfd
->charcount
) ||
1619 get_user(data
, &user_cfd
->chardata
))
1623 op
.data
= compat_ptr(data
);
1624 i
= con_font_op(fg_console
, &op
);
1627 if (put_user(op
.height
, &user_cfd
->charheight
) ||
1628 put_user(op
.charcount
, &user_cfd
->charcount
) ||
1629 put_user((compat_caddr_t
)(unsigned long)op
.data
,
1630 &user_cfd
->chardata
))
1637 struct console_font_op32
{
1638 compat_uint_t op
; /* operation code KD_FONT_OP_* */
1639 compat_uint_t flags
; /* KD_FONT_FLAG_* */
1640 compat_uint_t width
, height
; /* font size */
1641 compat_uint_t charcount
;
1642 compat_caddr_t data
; /* font data with height fixed to 32 */
1645 static int do_kdfontop_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
, struct file
*file
)
1647 struct console_font_op op
;
1648 struct console_font_op32 __user
*fontop
= compat_ptr(arg
);
1649 int perm
= vt_check(file
), i
;
1650 struct vt_struct
*vt
;
1652 if (perm
< 0) return perm
;
1654 if (copy_from_user(&op
, fontop
, sizeof(struct console_font_op32
)))
1656 if (!perm
&& op
.op
!= KD_FONT_OP_GET
)
1658 op
.data
= compat_ptr(((struct console_font_op32
*)&op
)->data
);
1659 op
.flags
|= KD_FONT_FLAG_OLD
;
1660 vt
= (struct vt_struct
*)((struct tty_struct
*)file
->private_data
)->driver_data
;
1661 i
= con_font_op(vt
->vc_num
, &op
);
1663 ((struct console_font_op32
*)&op
)->data
= (unsigned long)op
.data
;
1664 if (copy_to_user(fontop
, &op
, sizeof(struct console_font_op32
)))
1669 struct unimapdesc32
{
1670 unsigned short entry_ct
;
1671 compat_caddr_t entries
;
1674 static int do_unimap_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
, struct file
*file
)
1676 struct unimapdesc32 tmp
;
1677 struct unimapdesc32 __user
*user_ud
= compat_ptr(arg
);
1678 int perm
= vt_check(file
);
1680 if (perm
< 0) return perm
;
1681 if (copy_from_user(&tmp
, user_ud
, sizeof tmp
))
1685 if (!perm
) return -EPERM
;
1686 return con_set_unimap(fg_console
, tmp
.entry_ct
, compat_ptr(tmp
.entries
));
1688 return con_get_unimap(fg_console
, tmp
.entry_ct
, &(user_ud
->entry_ct
), compat_ptr(tmp
.entries
));
1693 #endif /* CONFIG_VT */
1695 static int do_smb_getmountuid(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1697 mm_segment_t old_fs
= get_fs();
1698 __kernel_uid_t kuid
;
1701 cmd
= SMB_IOC_GETMOUNTUID
;
1704 err
= sys_ioctl(fd
, cmd
, (unsigned long)&kuid
);
1708 err
= put_user(kuid
, (compat_uid_t __user
*)compat_ptr(arg
));
1713 struct atmif_sioc32
{
1714 compat_int_t number
;
1715 compat_int_t length
;
1719 struct atm_iobuf32
{
1720 compat_int_t length
;
1721 compat_caddr_t buffer
;
1724 #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32)
1725 #define ATM_GETNAMES32 _IOW('a', ATMIOC_ITF+3, struct atm_iobuf32)
1726 #define ATM_GETTYPE32 _IOW('a', ATMIOC_ITF+4, struct atmif_sioc32)
1727 #define ATM_GETESI32 _IOW('a', ATMIOC_ITF+5, struct atmif_sioc32)
1728 #define ATM_GETADDR32 _IOW('a', ATMIOC_ITF+6, struct atmif_sioc32)
1729 #define ATM_RSTADDR32 _IOW('a', ATMIOC_ITF+7, struct atmif_sioc32)
1730 #define ATM_ADDADDR32 _IOW('a', ATMIOC_ITF+8, struct atmif_sioc32)
1731 #define ATM_DELADDR32 _IOW('a', ATMIOC_ITF+9, struct atmif_sioc32)
1732 #define ATM_GETCIRANGE32 _IOW('a', ATMIOC_ITF+10, struct atmif_sioc32)
1733 #define ATM_SETCIRANGE32 _IOW('a', ATMIOC_ITF+11, struct atmif_sioc32)
1734 #define ATM_SETESI32 _IOW('a', ATMIOC_ITF+12, struct atmif_sioc32)
1735 #define ATM_SETESIF32 _IOW('a', ATMIOC_ITF+13, struct atmif_sioc32)
1736 #define ATM_GETSTAT32 _IOW('a', ATMIOC_SARCOM+0, struct atmif_sioc32)
1737 #define ATM_GETSTATZ32 _IOW('a', ATMIOC_SARCOM+1, struct atmif_sioc32)
1738 #define ATM_GETLOOP32 _IOW('a', ATMIOC_SARCOM+2, struct atmif_sioc32)
1739 #define ATM_SETLOOP32 _IOW('a', ATMIOC_SARCOM+3, struct atmif_sioc32)
1740 #define ATM_QUERYLOOP32 _IOW('a', ATMIOC_SARCOM+4, struct atmif_sioc32)
1745 } atm_ioctl_map
[] = {
1746 { ATM_GETLINKRATE32
, ATM_GETLINKRATE
},
1747 { ATM_GETNAMES32
, ATM_GETNAMES
},
1748 { ATM_GETTYPE32
, ATM_GETTYPE
},
1749 { ATM_GETESI32
, ATM_GETESI
},
1750 { ATM_GETADDR32
, ATM_GETADDR
},
1751 { ATM_RSTADDR32
, ATM_RSTADDR
},
1752 { ATM_ADDADDR32
, ATM_ADDADDR
},
1753 { ATM_DELADDR32
, ATM_DELADDR
},
1754 { ATM_GETCIRANGE32
, ATM_GETCIRANGE
},
1755 { ATM_SETCIRANGE32
, ATM_SETCIRANGE
},
1756 { ATM_SETESI32
, ATM_SETESI
},
1757 { ATM_SETESIF32
, ATM_SETESIF
},
1758 { ATM_GETSTAT32
, ATM_GETSTAT
},
1759 { ATM_GETSTATZ32
, ATM_GETSTATZ
},
1760 { ATM_GETLOOP32
, ATM_GETLOOP
},
1761 { ATM_SETLOOP32
, ATM_SETLOOP
},
1762 { ATM_QUERYLOOP32
, ATM_QUERYLOOP
}
1765 #define NR_ATM_IOCTL (sizeof(atm_ioctl_map)/sizeof(atm_ioctl_map[0]))
1768 static int do_atm_iobuf(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1770 struct atm_iobuf __user
*iobuf
;
1771 struct atm_iobuf32 __user
*iobuf32
;
1776 iobuf
= compat_alloc_user_space(sizeof(*iobuf
));
1777 iobuf32
= compat_ptr(arg
);
1779 if (get_user(len
, &iobuf32
->length
) ||
1780 get_user(data
, &iobuf32
->buffer
))
1782 datap
= compat_ptr(data
);
1783 if (put_user(len
, &iobuf
->length
) ||
1784 put_user(datap
, &iobuf
->buffer
))
1787 err
= sys_ioctl(fd
, cmd
, (unsigned long)iobuf
);
1790 if (copy_in_user(&iobuf32
->length
, &iobuf
->length
,
1798 static int do_atmif_sioc(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1800 struct atmif_sioc __user
*sioc
;
1801 struct atmif_sioc32 __user
*sioc32
;
1806 sioc
= compat_alloc_user_space(sizeof(*sioc
));
1807 sioc32
= compat_ptr(arg
);
1809 if (copy_in_user(&sioc
->number
, &sioc32
->number
, 2 * sizeof(int)) ||
1810 get_user(data
, &sioc32
->arg
))
1812 datap
= compat_ptr(data
);
1813 if (put_user(datap
, &sioc
->arg
))
1816 err
= sys_ioctl(fd
, cmd
, (unsigned long) sioc
);
1819 if (copy_in_user(&sioc32
->length
, &sioc
->length
,
1826 static int do_atm_ioctl(unsigned int fd
, unsigned int cmd32
, unsigned long arg
)
1829 unsigned int cmd
= 0;
1833 case SONET_GETSTATZ
:
1837 case SONET_SETFRAMING
:
1838 case SONET_GETFRAMING
:
1839 case SONET_GETFRSENSE
:
1840 return do_atmif_sioc(fd
, cmd32
, arg
);
1843 for (i
= 0; i
< NR_ATM_IOCTL
; i
++) {
1844 if (cmd32
== atm_ioctl_map
[i
].cmd32
) {
1845 cmd
= atm_ioctl_map
[i
].cmd
;
1849 if (i
== NR_ATM_IOCTL
)
1854 return do_atm_iobuf(fd
, cmd
, arg
);
1856 case ATM_GETLINKRATE
:
1863 case ATM_GETCIRANGE
:
1864 case ATM_SETCIRANGE
:
1872 return do_atmif_sioc(fd
, cmd
, arg
);
1878 static __attribute_used__
int
1879 ret_einval(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1884 static int broken_blkgetsize(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1886 /* The mkswap binary hard codes it to Intel value :-((( */
1887 return w_long(fd
, BLKGETSIZE
, arg
);
1890 struct blkpg_ioctl_arg32
{
1893 compat_int_t datalen
;
1894 compat_caddr_t data
;
1897 static int blkpg_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1899 struct blkpg_ioctl_arg32 __user
*ua32
= compat_ptr(arg
);
1900 struct blkpg_ioctl_arg __user
*a
= compat_alloc_user_space(sizeof(*a
));
1901 compat_caddr_t udata
;
1905 err
= get_user(n
, &ua32
->op
);
1906 err
|= put_user(n
, &a
->op
);
1907 err
|= get_user(n
, &ua32
->flags
);
1908 err
|= put_user(n
, &a
->flags
);
1909 err
|= get_user(n
, &ua32
->datalen
);
1910 err
|= put_user(n
, &a
->datalen
);
1911 err
|= get_user(udata
, &ua32
->data
);
1912 err
|= put_user(compat_ptr(udata
), &a
->data
);
1916 return sys_ioctl(fd
, cmd
, (unsigned long)a
);
1919 static int ioc_settimeout(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1921 return rw_long(fd
, AUTOFS_IOC_SETTIMEOUT
, arg
);
1924 /* Fix sizeof(sizeof()) breakage */
1925 #define BLKBSZGET_32 _IOR(0x12,112,int)
1926 #define BLKBSZSET_32 _IOW(0x12,113,int)
1927 #define BLKGETSIZE64_32 _IOR(0x12,114,int)
1929 static int do_blkbszget(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1931 return sys_ioctl(fd
, BLKBSZGET
, (unsigned long)compat_ptr(arg
));
1934 static int do_blkbszset(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
1936 return sys_ioctl(fd
, BLKBSZSET
, (unsigned long)compat_ptr(arg
));
1939 static int do_blkgetsize64(unsigned int fd
, unsigned int cmd
,
1942 return sys_ioctl(fd
, BLKGETSIZE64
, (unsigned long)compat_ptr(arg
));
1945 /* Bluetooth ioctls */
1946 #define HCIUARTSETPROTO _IOW('U', 200, int)
1947 #define HCIUARTGETPROTO _IOR('U', 201, int)
1949 #define BNEPCONNADD _IOW('B', 200, int)
1950 #define BNEPCONNDEL _IOW('B', 201, int)
1951 #define BNEPGETCONNLIST _IOR('B', 210, int)
1952 #define BNEPGETCONNINFO _IOR('B', 211, int)
1954 #define CMTPCONNADD _IOW('C', 200, int)
1955 #define CMTPCONNDEL _IOW('C', 201, int)
1956 #define CMTPGETCONNLIST _IOR('C', 210, int)
1957 #define CMTPGETCONNINFO _IOR('C', 211, int)
1959 #define HIDPCONNADD _IOW('H', 200, int)
1960 #define HIDPCONNDEL _IOW('H', 201, int)
1961 #define HIDPGETCONNLIST _IOR('H', 210, int)
1962 #define HIDPGETCONNINFO _IOR('H', 211, int)
1964 struct floppy_struct32
{
1968 compat_uint_t track
;
1969 compat_uint_t stretch
;
1972 unsigned char spec1
;
1973 unsigned char fmt_gap
;
1974 const compat_caddr_t name
;
1977 struct floppy_drive_params32
{
1979 compat_ulong_t max_dtr
;
1983 compat_ulong_t spinup
;
1984 compat_ulong_t spindown
;
1985 unsigned char spindown_offset
;
1986 unsigned char select_delay
;
1988 unsigned char tracks
;
1989 compat_ulong_t timeout
;
1990 unsigned char interleave_sect
;
1991 struct floppy_max_errors max_errors
;
1994 short autodetect
[8];
1995 compat_int_t checkfreq
;
1996 compat_int_t native_format
;
1999 struct floppy_drive_struct32
{
2001 compat_ulong_t spinup_date
;
2002 compat_ulong_t select_date
;
2003 compat_ulong_t first_read_date
;
2004 short probed_format
;
2008 compat_int_t generation
;
2009 compat_int_t keep_data
;
2010 compat_int_t fd_ref
;
2011 compat_int_t fd_device
;
2012 compat_int_t last_checked
;
2013 compat_caddr_t dmabuf
;
2014 compat_int_t bufblocks
;
2017 struct floppy_fdc_state32
{
2021 unsigned char version
;
2023 compat_ulong_t address
;
2024 unsigned int rawcmd
:2;
2025 unsigned int reset
:1;
2026 unsigned int need_configure
:1;
2027 unsigned int perp_mode
:2;
2028 unsigned int has_fifo
:1;
2029 unsigned int driver_version
;
2030 unsigned char track
[4];
2033 struct floppy_write_errors32
{
2034 unsigned int write_errors
;
2035 compat_ulong_t first_error_sector
;
2036 compat_int_t first_error_generation
;
2037 compat_ulong_t last_error_sector
;
2038 compat_int_t last_error_generation
;
2039 compat_uint_t badness
;
2042 #define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32)
2043 #define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32)
2044 #define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32)
2045 #define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32)
2046 #define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32)
2047 #define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32)
2048 #define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32)
2049 #define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32)
2050 #define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32)
2055 } fd_ioctl_trans_table
[] = {
2056 { FDSETPRM32
, FDSETPRM
},
2057 { FDDEFPRM32
, FDDEFPRM
},
2058 { FDGETPRM32
, FDGETPRM
},
2059 { FDSETDRVPRM32
, FDSETDRVPRM
},
2060 { FDGETDRVPRM32
, FDGETDRVPRM
},
2061 { FDGETDRVSTAT32
, FDGETDRVSTAT
},
2062 { FDPOLLDRVSTAT32
, FDPOLLDRVSTAT
},
2063 { FDGETFDCSTAT32
, FDGETFDCSTAT
},
2064 { FDWERRORGET32
, FDWERRORGET
}
2067 #define NR_FD_IOCTL_TRANS (sizeof(fd_ioctl_trans_table)/sizeof(fd_ioctl_trans_table[0]))
2069 static int fd_ioctl_trans(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2071 mm_segment_t old_fs
= get_fs();
2073 unsigned int kcmd
= 0;
2076 for (i
= 0; i
< NR_FD_IOCTL_TRANS
; i
++)
2077 if (cmd
== fd_ioctl_trans_table
[i
].cmd32
) {
2078 kcmd
= fd_ioctl_trans_table
[i
].cmd
;
2090 struct floppy_struct32 __user
*uf
;
2091 struct floppy_struct
*f
;
2093 uf
= compat_ptr(arg
);
2094 f
= karg
= kmalloc(sizeof(struct floppy_struct
), GFP_KERNEL
);
2097 if (cmd
== FDGETPRM32
)
2099 err
= __get_user(f
->size
, &uf
->size
);
2100 err
|= __get_user(f
->sect
, &uf
->sect
);
2101 err
|= __get_user(f
->head
, &uf
->head
);
2102 err
|= __get_user(f
->track
, &uf
->track
);
2103 err
|= __get_user(f
->stretch
, &uf
->stretch
);
2104 err
|= __get_user(f
->gap
, &uf
->gap
);
2105 err
|= __get_user(f
->rate
, &uf
->rate
);
2106 err
|= __get_user(f
->spec1
, &uf
->spec1
);
2107 err
|= __get_user(f
->fmt_gap
, &uf
->fmt_gap
);
2108 err
|= __get_user(name
, &uf
->name
);
2109 f
->name
= compat_ptr(name
);
2119 struct floppy_drive_params32 __user
*uf
;
2120 struct floppy_drive_params
*f
;
2122 uf
= compat_ptr(arg
);
2123 f
= karg
= kmalloc(sizeof(struct floppy_drive_params
), GFP_KERNEL
);
2126 if (cmd
== FDGETDRVPRM32
)
2128 err
= __get_user(f
->cmos
, &uf
->cmos
);
2129 err
|= __get_user(f
->max_dtr
, &uf
->max_dtr
);
2130 err
|= __get_user(f
->hlt
, &uf
->hlt
);
2131 err
|= __get_user(f
->hut
, &uf
->hut
);
2132 err
|= __get_user(f
->srt
, &uf
->srt
);
2133 err
|= __get_user(f
->spinup
, &uf
->spinup
);
2134 err
|= __get_user(f
->spindown
, &uf
->spindown
);
2135 err
|= __get_user(f
->spindown_offset
, &uf
->spindown_offset
);
2136 err
|= __get_user(f
->select_delay
, &uf
->select_delay
);
2137 err
|= __get_user(f
->rps
, &uf
->rps
);
2138 err
|= __get_user(f
->tracks
, &uf
->tracks
);
2139 err
|= __get_user(f
->timeout
, &uf
->timeout
);
2140 err
|= __get_user(f
->interleave_sect
, &uf
->interleave_sect
);
2141 err
|= __copy_from_user(&f
->max_errors
, &uf
->max_errors
, sizeof(f
->max_errors
));
2142 err
|= __get_user(f
->flags
, &uf
->flags
);
2143 err
|= __get_user(f
->read_track
, &uf
->read_track
);
2144 err
|= __copy_from_user(f
->autodetect
, uf
->autodetect
, sizeof(f
->autodetect
));
2145 err
|= __get_user(f
->checkfreq
, &uf
->checkfreq
);
2146 err
|= __get_user(f
->native_format
, &uf
->native_format
);
2153 case FDGETDRVSTAT32
:
2154 case FDPOLLDRVSTAT32
:
2155 karg
= kmalloc(sizeof(struct floppy_drive_struct
), GFP_KERNEL
);
2159 case FDGETFDCSTAT32
:
2160 karg
= kmalloc(sizeof(struct floppy_fdc_state
), GFP_KERNEL
);
2165 karg
= kmalloc(sizeof(struct floppy_write_errors
), GFP_KERNEL
);
2173 err
= sys_ioctl (fd
, kcmd
, (unsigned long)karg
);
2180 struct floppy_struct
*f
= karg
;
2181 struct floppy_struct32 __user
*uf
= compat_ptr(arg
);
2183 err
= __put_user(f
->size
, &uf
->size
);
2184 err
|= __put_user(f
->sect
, &uf
->sect
);
2185 err
|= __put_user(f
->head
, &uf
->head
);
2186 err
|= __put_user(f
->track
, &uf
->track
);
2187 err
|= __put_user(f
->stretch
, &uf
->stretch
);
2188 err
|= __put_user(f
->gap
, &uf
->gap
);
2189 err
|= __put_user(f
->rate
, &uf
->rate
);
2190 err
|= __put_user(f
->spec1
, &uf
->spec1
);
2191 err
|= __put_user(f
->fmt_gap
, &uf
->fmt_gap
);
2192 err
|= __put_user((u64
)f
->name
, (compat_caddr_t __user
*)&uf
->name
);
2197 struct floppy_drive_params32 __user
*uf
;
2198 struct floppy_drive_params
*f
= karg
;
2200 uf
= compat_ptr(arg
);
2201 err
= __put_user(f
->cmos
, &uf
->cmos
);
2202 err
|= __put_user(f
->max_dtr
, &uf
->max_dtr
);
2203 err
|= __put_user(f
->hlt
, &uf
->hlt
);
2204 err
|= __put_user(f
->hut
, &uf
->hut
);
2205 err
|= __put_user(f
->srt
, &uf
->srt
);
2206 err
|= __put_user(f
->spinup
, &uf
->spinup
);
2207 err
|= __put_user(f
->spindown
, &uf
->spindown
);
2208 err
|= __put_user(f
->spindown_offset
, &uf
->spindown_offset
);
2209 err
|= __put_user(f
->select_delay
, &uf
->select_delay
);
2210 err
|= __put_user(f
->rps
, &uf
->rps
);
2211 err
|= __put_user(f
->tracks
, &uf
->tracks
);
2212 err
|= __put_user(f
->timeout
, &uf
->timeout
);
2213 err
|= __put_user(f
->interleave_sect
, &uf
->interleave_sect
);
2214 err
|= __copy_to_user(&uf
->max_errors
, &f
->max_errors
, sizeof(f
->max_errors
));
2215 err
|= __put_user(f
->flags
, &uf
->flags
);
2216 err
|= __put_user(f
->read_track
, &uf
->read_track
);
2217 err
|= __copy_to_user(uf
->autodetect
, f
->autodetect
, sizeof(f
->autodetect
));
2218 err
|= __put_user(f
->checkfreq
, &uf
->checkfreq
);
2219 err
|= __put_user(f
->native_format
, &uf
->native_format
);
2222 case FDGETDRVSTAT32
:
2223 case FDPOLLDRVSTAT32
:
2225 struct floppy_drive_struct32 __user
*uf
;
2226 struct floppy_drive_struct
*f
= karg
;
2228 uf
= compat_ptr(arg
);
2229 err
= __put_user(f
->flags
, &uf
->flags
);
2230 err
|= __put_user(f
->spinup_date
, &uf
->spinup_date
);
2231 err
|= __put_user(f
->select_date
, &uf
->select_date
);
2232 err
|= __put_user(f
->first_read_date
, &uf
->first_read_date
);
2233 err
|= __put_user(f
->probed_format
, &uf
->probed_format
);
2234 err
|= __put_user(f
->track
, &uf
->track
);
2235 err
|= __put_user(f
->maxblock
, &uf
->maxblock
);
2236 err
|= __put_user(f
->maxtrack
, &uf
->maxtrack
);
2237 err
|= __put_user(f
->generation
, &uf
->generation
);
2238 err
|= __put_user(f
->keep_data
, &uf
->keep_data
);
2239 err
|= __put_user(f
->fd_ref
, &uf
->fd_ref
);
2240 err
|= __put_user(f
->fd_device
, &uf
->fd_device
);
2241 err
|= __put_user(f
->last_checked
, &uf
->last_checked
);
2242 err
|= __put_user((u64
)f
->dmabuf
, &uf
->dmabuf
);
2243 err
|= __put_user((u64
)f
->bufblocks
, &uf
->bufblocks
);
2246 case FDGETFDCSTAT32
:
2248 struct floppy_fdc_state32 __user
*uf
;
2249 struct floppy_fdc_state
*f
= karg
;
2251 uf
= compat_ptr(arg
);
2252 err
= __put_user(f
->spec1
, &uf
->spec1
);
2253 err
|= __put_user(f
->spec2
, &uf
->spec2
);
2254 err
|= __put_user(f
->dtr
, &uf
->dtr
);
2255 err
|= __put_user(f
->version
, &uf
->version
);
2256 err
|= __put_user(f
->dor
, &uf
->dor
);
2257 err
|= __put_user(f
->address
, &uf
->address
);
2258 err
|= __copy_to_user((char __user
*)&uf
->address
+ sizeof(uf
->address
),
2259 (char *)&f
->address
+ sizeof(f
->address
), sizeof(int));
2260 err
|= __put_user(f
->driver_version
, &uf
->driver_version
);
2261 err
|= __copy_to_user(uf
->track
, f
->track
, sizeof(f
->track
));
2266 struct floppy_write_errors32 __user
*uf
;
2267 struct floppy_write_errors
*f
= karg
;
2269 uf
= compat_ptr(arg
);
2270 err
= __put_user(f
->write_errors
, &uf
->write_errors
);
2271 err
|= __put_user(f
->first_error_sector
, &uf
->first_error_sector
);
2272 err
|= __put_user(f
->first_error_generation
, &uf
->first_error_generation
);
2273 err
|= __put_user(f
->last_error_sector
, &uf
->last_error_sector
);
2274 err
|= __put_user(f
->last_error_generation
, &uf
->last_error_generation
);
2275 err
|= __put_user(f
->badness
, &uf
->badness
);
2284 out
: if (karg
) kfree(karg
);
2288 struct mtd_oob_buf32
{
2291 compat_caddr_t ptr
; /* unsigned char* */
2294 #define MEMWRITEOOB32 _IOWR('M',3,struct mtd_oob_buf32)
2295 #define MEMREADOOB32 _IOWR('M',4,struct mtd_oob_buf32)
2297 static int mtd_rw_oob(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2299 struct mtd_oob_buf __user
*buf
= compat_alloc_user_space(sizeof(*buf
));
2300 struct mtd_oob_buf32 __user
*buf32
= compat_ptr(arg
);
2303 unsigned int real_cmd
;
2306 real_cmd
= (cmd
== MEMREADOOB32
) ?
2307 MEMREADOOB
: MEMWRITEOOB
;
2309 if (copy_in_user(&buf
->start
, &buf32
->start
,
2311 get_user(data
, &buf32
->ptr
))
2313 datap
= compat_ptr(data
);
2314 if (put_user(datap
, &buf
->ptr
))
2317 err
= sys_ioctl(fd
, real_cmd
, (unsigned long) buf
);
2320 if (copy_in_user(&buf32
->start
, &buf
->start
,
2328 #define VFAT_IOCTL_READDIR_BOTH32 _IOR('r', 1, struct compat_dirent[2])
2329 #define VFAT_IOCTL_READDIR_SHORT32 _IOR('r', 2, struct compat_dirent[2])
2332 put_dirent32 (struct dirent
*d
, struct compat_dirent __user
*d32
)
2336 if ((ret
= verify_area(VERIFY_WRITE
, d32
,
2337 sizeof(struct compat_dirent
))))
2340 __put_user(d
->d_ino
, &d32
->d_ino
);
2341 __put_user(d
->d_off
, &d32
->d_off
);
2342 __put_user(d
->d_reclen
, &d32
->d_reclen
);
2343 __copy_to_user(d32
->d_name
, d
->d_name
, d
->d_reclen
);
2347 static int vfat_ioctl32(unsigned fd
, unsigned cmd
, unsigned long arg
)
2349 struct compat_dirent __user
*p
= compat_ptr(arg
);
2351 mm_segment_t oldfs
= get_fs();
2356 case VFAT_IOCTL_READDIR_BOTH32
:
2357 cmd
= VFAT_IOCTL_READDIR_BOTH
;
2359 case VFAT_IOCTL_READDIR_SHORT32
:
2360 cmd
= VFAT_IOCTL_READDIR_SHORT
;
2365 ret
= sys_ioctl(fd
,cmd
,(unsigned long)&d
);
2368 ret
|= put_dirent32(&d
[0], p
);
2369 ret
|= put_dirent32(&d
[1], p
+ 1);
2374 #define REISERFS_IOC_UNPACK32 _IOW(0xCD,1,int)
2376 static int reiserfs_ioctl32(unsigned fd
, unsigned cmd
, unsigned long ptr
)
2378 if (cmd
== REISERFS_IOC_UNPACK32
)
2379 cmd
= REISERFS_IOC_UNPACK
;
2381 return sys_ioctl(fd
,cmd
,ptr
);
2384 struct raw32_config_request
2386 compat_int_t raw_minor
;
2389 } __attribute__((packed
));
2391 static int get_raw32_request(struct raw_config_request
*req
, struct raw32_config_request __user
*user_req
)
2395 if ((ret
= verify_area(VERIFY_READ
, user_req
,
2396 sizeof(struct raw32_config_request
))))
2399 ret
= __get_user(req
->raw_minor
, &user_req
->raw_minor
);
2400 ret
|= __get_user(req
->block_major
, &user_req
->block_major
);
2401 ret
|= __get_user(req
->block_minor
, &user_req
->block_minor
);
2403 return ret
? -EFAULT
: 0;
2406 static int set_raw32_request(struct raw_config_request
*req
, struct raw32_config_request __user
*user_req
)
2410 if ((ret
= verify_area(VERIFY_WRITE
, user_req
,
2411 sizeof(struct raw32_config_request
))))
2414 ret
= __put_user(req
->raw_minor
, &user_req
->raw_minor
);
2415 ret
|= __put_user(req
->block_major
, &user_req
->block_major
);
2416 ret
|= __put_user(req
->block_minor
, &user_req
->block_minor
);
2418 return ret
? -EFAULT
: 0;
2421 static int raw_ioctl(unsigned fd
, unsigned cmd
, unsigned long arg
)
2428 struct raw_config_request req
;
2429 struct raw32_config_request __user
*user_req
= compat_ptr(arg
);
2430 mm_segment_t oldfs
= get_fs();
2432 if ((ret
= get_raw32_request(&req
, user_req
)))
2436 ret
= sys_ioctl(fd
,cmd
,(unsigned long)&req
);
2439 if ((!ret
) && (cmd
== RAW_GETBIND
)) {
2440 ret
= set_raw32_request(&req
, user_req
);
2445 ret
= sys_ioctl(fd
, cmd
, arg
);
2451 struct serial_struct32
{
2457 compat_int_t xmit_fifo_size
;
2458 compat_int_t custom_divisor
;
2459 compat_int_t baud_base
;
2460 unsigned short close_delay
;
2462 char reserved_char
[1];
2464 unsigned short closing_wait
; /* time to wait before closing */
2465 unsigned short closing_wait2
; /* no longer used... */
2466 compat_uint_t iomem_base
;
2467 unsigned short iomem_reg_shift
;
2468 unsigned int port_high
;
2469 /* compat_ulong_t iomap_base FIXME */
2470 compat_int_t reserved
[1];
2473 static int serial_struct_ioctl(unsigned fd
, unsigned cmd
, unsigned long arg
)
2475 typedef struct serial_struct SS
;
2476 typedef struct serial_struct32 SS32
;
2477 struct serial_struct32 __user
*ss32
= compat_ptr(arg
);
2479 struct serial_struct ss
;
2480 mm_segment_t oldseg
= get_fs();
2483 if (cmd
== TIOCSSERIAL
) {
2484 if (verify_area(VERIFY_READ
, ss32
, sizeof(SS32
)))
2486 __copy_from_user(&ss
, ss32
, offsetof(SS32
, iomem_base
));
2487 __get_user(udata
, &ss32
->iomem_base
);
2488 ss
.iomem_base
= compat_ptr(udata
);
2489 __get_user(ss
.iomem_reg_shift
, &ss32
->iomem_reg_shift
);
2490 __get_user(ss
.port_high
, &ss32
->port_high
);
2491 ss
.iomap_base
= 0UL;
2494 err
= sys_ioctl(fd
,cmd
,(unsigned long)(&ss
));
2496 if (cmd
== TIOCGSERIAL
&& err
>= 0) {
2497 if (verify_area(VERIFY_WRITE
, ss32
, sizeof(SS32
)))
2499 __copy_to_user(ss32
,&ss
,offsetof(SS32
,iomem_base
));
2500 __put_user((unsigned long)ss
.iomem_base
>> 32 ?
2501 0xffffffff : (unsigned)(unsigned long)ss
.iomem_base
,
2503 __put_user(ss
.iomem_reg_shift
, &ss32
->iomem_reg_shift
);
2504 __put_user(ss
.port_high
, &ss32
->port_high
);
2510 struct usbdevfs_ctrltransfer32
{
2516 u32 timeout
; /* in milliseconds */
2517 compat_caddr_t data
;
2520 #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
2522 static int do_usbdevfs_control(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2524 struct usbdevfs_ctrltransfer32 __user
*p32
= compat_ptr(arg
);
2525 struct usbdevfs_ctrltransfer __user
*p
;
2527 p
= compat_alloc_user_space(sizeof(*p
));
2528 if (copy_in_user(p
, p32
, (sizeof(*p32
) - sizeof(compat_caddr_t
))) ||
2529 get_user(udata
, &p32
->data
) ||
2530 put_user(compat_ptr(udata
), &p
->data
))
2532 return sys_ioctl(fd
, USBDEVFS_CONTROL
, (unsigned long)p
);
2536 struct usbdevfs_bulktransfer32
{
2539 compat_uint_t timeout
; /* in milliseconds */
2540 compat_caddr_t data
;
2543 #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32)
2545 static int do_usbdevfs_bulk(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2547 struct usbdevfs_bulktransfer32 __user
*p32
= compat_ptr(arg
);
2548 struct usbdevfs_bulktransfer __user
*p
;
2550 compat_caddr_t addr
;
2552 p
= compat_alloc_user_space(sizeof(*p
));
2554 if (get_user(n
, &p32
->ep
) || put_user(n
, &p
->ep
) ||
2555 get_user(n
, &p32
->len
) || put_user(n
, &p
->len
) ||
2556 get_user(n
, &p32
->timeout
) || put_user(n
, &p
->timeout
) ||
2557 get_user(addr
, &p32
->data
) || put_user(compat_ptr(addr
), &p
->data
))
2560 return sys_ioctl(fd
, USBDEVFS_BULK
, (unsigned long)p
);
2563 /* This needs more work before we can enable it. Unfortunately
2564 * because of the fancy asynchronous way URB status/error is written
2565 * back to userspace, we'll need to fiddle with USB devio internals
2566 * and/or reimplement entirely the frontend of it ourselves. -DaveM
2570 * When an URB is submitted via usbdevicefs it is put onto an
2571 * asynchronous queue. When the URB completes, it may be reaped
2572 * via another ioctl. During this reaping the status is written
2573 * back to userspace along with the length of the transfer.
2575 * We must translate into 64-bit kernel types so we pass in a kernel
2576 * space copy of the usbdevfs_urb structure. This would mean that we
2577 * must do something to deal with the async entry reaping. First we
2578 * have to deal somehow with this transitory memory we've allocated.
2579 * This is problematic since there are many call sites from which the
2580 * async entries can be destroyed (and thus when we'd need to free up
2581 * this kernel memory). One of which is the close() op of usbdevicefs.
2582 * To handle that we'd need to make our own file_operations struct which
2583 * overrides usbdevicefs's release op with our own which runs usbdevicefs's
2584 * real release op then frees up the kernel memory.
2586 * But how to keep track of these kernel buffers? We'd need to either
2587 * keep track of them in some table _or_ know about usbdevicefs internals
2588 * (ie. the exact layout of its file private, which is actually defined
2589 * in linux/usbdevice_fs.h, the layout of the async queues are private to
2592 * There is one possible other solution I considered, also involving knowledge
2593 * of usbdevicefs internals:
2595 * After an URB is submitted, we "fix up" the address back to the user
2596 * space one. This would work if the status/length fields written back
2597 * by the async URB completion lines up perfectly in the 32-bit type with
2598 * the 64-bit kernel type. Unfortunately, it does not because the iso
2599 * frame descriptors, at the end of the struct, can be written back.
2601 * I think we'll just need to simply duplicate the devio URB engine here.
2604 struct usbdevfs_urb32
{
2606 unsigned char endpoint
;
2607 compat_int_t status
;
2608 compat_uint_t flags
;
2609 compat_caddr_t buffer
;
2610 compat_int_t buffer_length
;
2611 compat_int_t actual_length
;
2612 compat_int_t start_frame
;
2613 compat_int_t number_of_packets
;
2614 compat_int_t error_count
;
2615 compat_uint_t signr
;
2616 compat_caddr_t usercontext
; /* unused */
2617 struct usbdevfs_iso_packet_desc iso_frame_desc
[0];
2620 #define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32)
2622 static int get_urb32(struct usbdevfs_urb
*kurb
,
2623 struct usbdevfs_urb32
*uurb
)
2625 if (get_user(kurb
->type
, &uurb
->type
) ||
2626 __get_user(kurb
->endpoint
, &uurb
->endpoint
) ||
2627 __get_user(kurb
->status
, &uurb
->status
) ||
2628 __get_user(kurb
->flags
, &uurb
->flags
) ||
2629 __get_user(kurb
->buffer_length
, &uurb
->buffer_length
) ||
2630 __get_user(kurb
->actual_length
, &uurb
->actual_length
) ||
2631 __get_user(kurb
->start_frame
, &uurb
->start_frame
) ||
2632 __get_user(kurb
->number_of_packets
, &uurb
->number_of_packets
) ||
2633 __get_user(kurb
->error_count
, &uurb
->error_count
) ||
2634 __get_user(kurb
->signr
, &uurb
->signr
))
2637 kurb
->usercontext
= 0; /* unused currently */
2642 /* Just put back the values which usbdevfs actually changes. */
2643 static int put_urb32(struct usbdevfs_urb
*kurb
,
2644 struct usbdevfs_urb32
*uurb
)
2646 if (put_user(kurb
->status
, &uurb
->status
) ||
2647 __put_user(kurb
->actual_length
, &uurb
->actual_length
) ||
2648 __put_user(kurb
->error_count
, &uurb
->error_count
))
2651 if (kurb
->number_of_packets
!= 0) {
2654 for (i
= 0; i
< kurb
->number_of_packets
; i
++) {
2655 if (__put_user(kurb
->iso_frame_desc
[i
].actual_length
,
2656 &uurb
->iso_frame_desc
[i
].actual_length
) ||
2657 __put_user(kurb
->iso_frame_desc
[i
].status
,
2658 &uurb
->iso_frame_desc
[i
].status
))
2666 static int get_urb32_isoframes(struct usbdevfs_urb
*kurb
,
2667 struct usbdevfs_urb32
*uurb
)
2669 unsigned int totlen
;
2672 if (kurb
->type
!= USBDEVFS_URB_TYPE_ISO
) {
2673 kurb
->number_of_packets
= 0;
2677 if (kurb
->number_of_packets
< 1 ||
2678 kurb
->number_of_packets
> 128)
2681 if (copy_from_user(&kurb
->iso_frame_desc
[0],
2682 &uurb
->iso_frame_desc
[0],
2683 sizeof(struct usbdevfs_iso_packet_desc
) *
2684 kurb
->number_of_packets
))
2688 for (i
= 0; i
< kurb
->number_of_packets
; i
++) {
2689 unsigned int this_len
;
2691 this_len
= kurb
->iso_frame_desc
[i
].length
;
2692 if (this_len
> 1023)
2701 kurb
->buffer_length
= totlen
;
2706 static int do_usbdevfs_urb(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2708 struct usbdevfs_urb
*kurb
;
2709 struct usbdevfs_urb32
*uurb
;
2710 mm_segment_t old_fs
;
2713 unsigned int buflen
;
2716 uurb
= compat_ptr(arg
);
2719 kurb
= kmalloc(sizeof(struct usbdevfs_urb
) +
2720 (sizeof(struct usbdevfs_iso_packet_desc
) * 128),
2726 if (get_urb32(kurb
, uurb
))
2729 err
= get_urb32_isoframes(kurb
, uurb
);
2734 if (__get_user(udata
, &uurb
->buffer
))
2736 uptr
= compat_ptr(udata
);
2738 buflen
= kurb
->buffer_length
;
2739 err
= verify_area(VERIFY_WRITE
, uptr
, buflen
);
2746 err
= sys_ioctl(fd
, USBDEVFS_SUBMITURB
, (unsigned long) kurb
);
2750 /* RED-PEN Shit, this doesn't work for async URBs :-( XXX */
2751 if (put_urb32(kurb
, uurb
)) {
2762 #define USBDEVFS_REAPURB32 _IOW('U', 12, u32)
2763 #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, u32)
2765 static int do_usbdevfs_reapurb(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2767 mm_segment_t old_fs
;
2774 (cmd
== USBDEVFS_REAPURB32
?
2776 USBDEVFS_REAPURBNDELAY
),
2777 (unsigned long) &kptr
);
2781 put_user((u32
)(u64
)kptr
, (u32 __user
*)compat_ptr(arg
)))
2787 struct usbdevfs_disconnectsignal32
{
2789 compat_caddr_t context
;
2792 #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32)
2794 static int do_usbdevfs_discsignal(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2796 struct usbdevfs_disconnectsignal kdis
;
2797 struct usbdevfs_disconnectsignal32 __user
*udis
;
2798 mm_segment_t old_fs
;
2802 udis
= compat_ptr(arg
);
2804 if (get_user(kdis
.signr
, &udis
->signr
) ||
2805 __get_user(uctx
, &udis
->context
))
2808 kdis
.context
= compat_ptr(uctx
);
2812 err
= sys_ioctl(fd
, USBDEVFS_DISCSIGNAL
, (unsigned long) &kdis
);
2829 struct i2c_rdwr_ioctl_data32
{
2830 compat_caddr_t msgs
; /* struct i2c_msg __user *msgs */
2834 struct i2c_smbus_ioctl_data32
{
2838 compat_caddr_t data
; /* union i2c_smbus_data *data */
2841 static int do_i2c_rdwr_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2843 struct i2c_rdwr_ioctl_data __user
*tdata
;
2844 struct i2c_rdwr_ioctl_data32 __user
*udata
;
2845 struct i2c_msg __user
*tmsgs
;
2846 struct i2c_msg32 __user
*umsgs
;
2847 compat_caddr_t datap
;
2850 tdata
= compat_alloc_user_space(sizeof(*tdata
));
2853 if (verify_area(VERIFY_WRITE
, tdata
, sizeof(*tdata
)))
2856 udata
= compat_ptr(arg
);
2857 if (verify_area(VERIFY_READ
, udata
, sizeof(*udata
)))
2859 if (__get_user(nmsgs
, &udata
->nmsgs
) || __put_user(nmsgs
, &tdata
->nmsgs
))
2861 if (nmsgs
> I2C_RDRW_IOCTL_MAX_MSGS
)
2863 if (__get_user(datap
, &udata
->msgs
))
2865 umsgs
= compat_ptr(datap
);
2866 if (verify_area(VERIFY_READ
, umsgs
, sizeof(struct i2c_msg
) * nmsgs
))
2869 tmsgs
= compat_alloc_user_space(sizeof(struct i2c_msg
) * nmsgs
);
2872 if (verify_area(VERIFY_WRITE
, tmsgs
, sizeof(struct i2c_msg
) * nmsgs
))
2874 if (__put_user(tmsgs
, &tdata
->msgs
))
2876 for (i
= 0; i
< nmsgs
; i
++) {
2877 if (__copy_in_user(&tmsgs
[i
].addr
,
2881 if (__get_user(datap
, &umsgs
[i
].buf
) ||
2882 __put_user(compat_ptr(datap
), &tmsgs
[i
].buf
))
2885 return sys_ioctl(fd
, cmd
, (unsigned long)tdata
);
2888 static int do_i2c_smbus_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2890 struct i2c_smbus_ioctl_data __user
*tdata
;
2891 struct i2c_smbus_ioctl_data32 __user
*udata
;
2892 compat_caddr_t datap
;
2894 tdata
= compat_alloc_user_space(sizeof(*tdata
));
2897 if (verify_area(VERIFY_WRITE
, tdata
, sizeof(*tdata
)))
2900 udata
= compat_ptr(arg
);
2901 if (verify_area(VERIFY_READ
, udata
, sizeof(*udata
)))
2904 if (__copy_in_user(&tdata
->read_write
, &udata
->read_write
, 2 * sizeof(u8
)))
2906 if (__copy_in_user(&tdata
->size
, &udata
->size
, 2 * sizeof(u32
)))
2908 if (__get_user(datap
, &udata
->data
) ||
2909 __put_user(compat_ptr(datap
), &tdata
->data
))
2912 return sys_ioctl(fd
, cmd
, (unsigned long)tdata
);
2915 struct compat_iw_point
{
2916 compat_caddr_t pointer
;
2921 static int do_wireless_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2923 struct iwreq __user
*iwr
;
2924 struct iwreq __user
*iwr_u
;
2925 struct iw_point __user
*iwp
;
2926 struct compat_iw_point __user
*iwp_u
;
2927 compat_caddr_t pointer
;
2928 __u16 length
, flags
;
2930 iwr_u
= compat_ptr(arg
);
2931 iwp_u
= (struct compat_iw_point __user
*) &iwr_u
->u
.data
;
2932 iwr
= compat_alloc_user_space(sizeof(*iwr
));
2938 if (verify_area(VERIFY_WRITE
, iwr
, sizeof(*iwr
)))
2941 if (__copy_in_user(&iwr
->ifr_ifrn
.ifrn_name
[0],
2942 &iwr_u
->ifr_ifrn
.ifrn_name
[0],
2943 sizeof(iwr
->ifr_ifrn
.ifrn_name
)))
2946 if (__get_user(pointer
, &iwp_u
->pointer
) ||
2947 __get_user(length
, &iwp_u
->length
) ||
2948 __get_user(flags
, &iwp_u
->flags
))
2951 if (__put_user(compat_ptr(pointer
), &iwp
->pointer
) ||
2952 __put_user(length
, &iwp
->length
) ||
2953 __put_user(flags
, &iwp
->flags
))
2956 return sys_ioctl(fd
, cmd
, (unsigned long) iwr
);
2959 /* Since old style bridge ioctl's endup using SIOCDEVPRIVATE
2960 * for some operations; this forces use of the newer bridge-utils that
2961 * use compatiable ioctls
2963 static int old_bridge_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
2967 if (get_user(tmp
, (u32 __user
*) arg
))
2969 if (tmp
== BRCTL_GET_VERSION
)
2970 return BRCTL_VERSION
+ 1;
2974 #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE)
2975 struct ncp_ioctl_request_32
{
2978 compat_caddr_t data
;
2981 struct ncp_fs_info_v2_32
{
2995 struct ncp_objectname_ioctl_32
2998 u32 object_name_len
;
2999 compat_caddr_t object_name
; /* an userspace data, in most cases user name */
3002 struct ncp_privatedata_ioctl_32
3005 compat_caddr_t data
; /* ~1000 for NDS */
3008 #define NCP_IOC_NCPREQUEST_32 _IOR('n', 1, struct ncp_ioctl_request_32)
3009 #define NCP_IOC_GETMOUNTUID2_32 _IOW('n', 2, u32)
3010 #define NCP_IOC_GET_FS_INFO_V2_32 _IOWR('n', 4, struct ncp_fs_info_v2_32)
3011 #define NCP_IOC_GETOBJECTNAME_32 _IOWR('n', 9, struct ncp_objectname_ioctl_32)
3012 #define NCP_IOC_SETOBJECTNAME_32 _IOR('n', 9, struct ncp_objectname_ioctl_32)
3013 #define NCP_IOC_GETPRIVATEDATA_32 _IOWR('n', 10, struct ncp_privatedata_ioctl_32)
3014 #define NCP_IOC_SETPRIVATEDATA_32 _IOR('n', 10, struct ncp_privatedata_ioctl_32)
3016 static int do_ncp_ncprequest(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
3018 struct ncp_ioctl_request_32 n32
;
3019 struct ncp_ioctl_request __user
*p
= compat_alloc_user_space(sizeof(*p
));
3021 if (copy_from_user(&n32
, compat_ptr(arg
), sizeof(n32
)) ||
3022 put_user(n32
.function
, &p
->function
) ||
3023 put_user(n32
.size
, &p
->size
) ||
3024 put_user(compat_ptr(n32
.data
), &p
->data
))
3027 return sys_ioctl(fd
, NCP_IOC_NCPREQUEST
, (unsigned long)p
);
3030 static int do_ncp_getmountuid2(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
3032 mm_segment_t old_fs
= get_fs();
3033 __kernel_uid_t kuid
;
3036 cmd
= NCP_IOC_GETMOUNTUID2
;
3039 err
= sys_ioctl(fd
, cmd
, (unsigned long)&kuid
);
3043 err
= put_user(kuid
,
3044 (unsigned int __user
*) compat_ptr(arg
));
3049 static int do_ncp_getfsinfo2(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
3051 mm_segment_t old_fs
= get_fs();
3052 struct ncp_fs_info_v2_32 n32
;
3053 struct ncp_fs_info_v2 n
;
3056 if (copy_from_user(&n32
, compat_ptr(arg
), sizeof(n32
)))
3058 if (n32
.version
!= NCP_GET_FS_INFO_VERSION_V2
)
3060 n
.version
= NCP_GET_FS_INFO_VERSION_V2
;
3063 err
= sys_ioctl(fd
, NCP_IOC_GET_FS_INFO_V2
, (unsigned long)&n
);
3067 n32
.version
= n
.version
;
3068 n32
.mounted_uid
= n
.mounted_uid
;
3069 n32
.connection
= n
.connection
;
3070 n32
.buffer_size
= n
.buffer_size
;
3071 n32
.volume_number
= n
.volume_number
;
3072 n32
.directory_id
= n
.directory_id
;
3073 n32
.dummy1
= n
.dummy1
;
3074 n32
.dummy2
= n
.dummy2
;
3075 n32
.dummy3
= n
.dummy3
;
3076 err
= copy_to_user(compat_ptr(arg
), &n32
, sizeof(n32
)) ? -EFAULT
: 0;
3081 static int do_ncp_getobjectname(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
3083 struct ncp_objectname_ioctl_32 n32
, __user
*p32
= compat_ptr(arg
);
3084 struct ncp_objectname_ioctl __user
*p
= compat_alloc_user_space(sizeof(*p
));
3089 if (copy_from_user(&n32
, p32
, sizeof(n32
)) ||
3090 put_user(n32
.object_name_len
, &p
->object_name_len
) ||
3091 put_user(compat_ptr(n32
.object_name
), &p
->object_name
))
3094 err
= sys_ioctl(fd
, NCP_IOC_GETOBJECTNAME
, (unsigned long)p
);
3098 if (get_user(auth_type
, &p
->auth_type
) ||
3099 put_user(auth_type
, &p32
->auth_type
) ||
3100 get_user(name_len
, &p
->object_name_len
) ||
3101 put_user(name_len
, &p32
->object_name_len
))
3107 static int do_ncp_setobjectname(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
3109 struct ncp_objectname_ioctl_32 n32
, __user
*p32
= compat_ptr(arg
);
3110 struct ncp_objectname_ioctl __user
*p
= compat_alloc_user_space(sizeof(*p
));
3112 if (copy_from_user(&n32
, p32
, sizeof(n32
)) ||
3113 put_user(n32
.auth_type
, &p
->auth_type
) ||
3114 put_user(n32
.object_name_len
, &p
->object_name_len
) ||
3115 put_user(compat_ptr(n32
.object_name
), &p
->object_name
))
3118 return sys_ioctl(fd
, NCP_IOC_SETOBJECTNAME
, (unsigned long)p
);
3121 static int do_ncp_getprivatedata(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
3123 struct ncp_privatedata_ioctl_32 n32
, __user
*p32
= compat_ptr(arg
);
3124 struct ncp_privatedata_ioctl __user
*p
=
3125 compat_alloc_user_space(sizeof(*p
));
3129 if (copy_from_user(&n32
, p32
, sizeof(n32
)) ||
3130 put_user(n32
.len
, &p
->len
) ||
3131 put_user(compat_ptr(n32
.data
), &p
->data
))
3134 err
= sys_ioctl(fd
, NCP_IOC_GETPRIVATEDATA
, (unsigned long)p
);
3138 if (get_user(len
, &p
->len
) ||
3139 put_user(len
, &p32
->len
))
3145 static int do_ncp_setprivatedata(unsigned int fd
, unsigned int cmd
, unsigned long arg
)
3147 struct ncp_privatedata_ioctl_32 n32
;
3148 struct ncp_privatedata_ioctl_32 __user
*p32
= compat_ptr(arg
);
3149 struct ncp_privatedata_ioctl __user
*p
=
3150 compat_alloc_user_space(sizeof(*p
));
3152 if (copy_from_user(&n32
, p32
, sizeof(n32
)) ||
3153 put_user(n32
.len
, &p
->len
) ||
3154 put_user(compat_ptr(n32
.data
), &p
->data
))
3157 return sys_ioctl(fd
, NCP_IOC_SETPRIVATEDATA
, (unsigned long)p
);
3165 HANDLE_IOCTL(MEMREADOOB32
, mtd_rw_oob
)
3166 HANDLE_IOCTL(MEMWRITEOOB32
, mtd_rw_oob
)
3168 HANDLE_IOCTL(SIOCGIFNAME
, dev_ifname32
)
3169 HANDLE_IOCTL(SIOCGIFCONF
, dev_ifconf
)
3170 HANDLE_IOCTL(SIOCGIFFLAGS
, dev_ifsioc
)
3171 HANDLE_IOCTL(SIOCSIFFLAGS
, dev_ifsioc
)
3172 HANDLE_IOCTL(SIOCGIFMETRIC
, dev_ifsioc
)
3173 HANDLE_IOCTL(SIOCSIFMETRIC
, dev_ifsioc
)
3174 HANDLE_IOCTL(SIOCGIFMTU
, dev_ifsioc
)
3175 HANDLE_IOCTL(SIOCSIFMTU
, dev_ifsioc
)
3176 HANDLE_IOCTL(SIOCGIFMEM
, dev_ifsioc
)
3177 HANDLE_IOCTL(SIOCSIFMEM
, dev_ifsioc
)
3178 HANDLE_IOCTL(SIOCGIFHWADDR
, dev_ifsioc
)
3179 HANDLE_IOCTL(SIOCSIFHWADDR
, dev_ifsioc
)
3180 HANDLE_IOCTL(SIOCADDMULTI
, dev_ifsioc
)
3181 HANDLE_IOCTL(SIOCDELMULTI
, dev_ifsioc
)
3182 HANDLE_IOCTL(SIOCGIFINDEX
, dev_ifsioc
)
3183 HANDLE_IOCTL(SIOCGIFMAP
, dev_ifsioc
)
3184 HANDLE_IOCTL(SIOCSIFMAP
, dev_ifsioc
)
3185 HANDLE_IOCTL(SIOCGIFADDR
, dev_ifsioc
)
3186 HANDLE_IOCTL(SIOCSIFADDR
, dev_ifsioc
)
3187 HANDLE_IOCTL(SIOCGIFBRDADDR
, dev_ifsioc
)
3188 HANDLE_IOCTL(SIOCSIFBRDADDR
, dev_ifsioc
)
3189 HANDLE_IOCTL(SIOCGIFDSTADDR
, dev_ifsioc
)
3190 HANDLE_IOCTL(SIOCSIFDSTADDR
, dev_ifsioc
)
3191 HANDLE_IOCTL(SIOCGIFNETMASK
, dev_ifsioc
)
3192 HANDLE_IOCTL(SIOCSIFNETMASK
, dev_ifsioc
)
3193 HANDLE_IOCTL(SIOCSIFPFLAGS
, dev_ifsioc
)
3194 HANDLE_IOCTL(SIOCGIFPFLAGS
, dev_ifsioc
)
3195 HANDLE_IOCTL(SIOCGIFTXQLEN
, dev_ifsioc
)
3196 HANDLE_IOCTL(SIOCSIFTXQLEN
, dev_ifsioc
)
3197 HANDLE_IOCTL(TUNSETIFF
, dev_ifsioc
)
3198 HANDLE_IOCTL(SIOCETHTOOL
, ethtool_ioctl
)
3199 HANDLE_IOCTL(SIOCBONDENSLAVE
, bond_ioctl
)
3200 HANDLE_IOCTL(SIOCBONDRELEASE
, bond_ioctl
)
3201 HANDLE_IOCTL(SIOCBONDSETHWADDR
, bond_ioctl
)
3202 HANDLE_IOCTL(SIOCBONDSLAVEINFOQUERY
, bond_ioctl
)
3203 HANDLE_IOCTL(SIOCBONDINFOQUERY
, bond_ioctl
)
3204 HANDLE_IOCTL(SIOCBONDCHANGEACTIVE
, bond_ioctl
)
3205 HANDLE_IOCTL(SIOCADDRT
, routing_ioctl
)
3206 HANDLE_IOCTL(SIOCDELRT
, routing_ioctl
)
3207 HANDLE_IOCTL(SIOCBRADDIF
, dev_ifsioc
)
3208 HANDLE_IOCTL(SIOCBRDELIF
, dev_ifsioc
)
3209 /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
3210 HANDLE_IOCTL(SIOCRTMSG
, ret_einval
)
3211 HANDLE_IOCTL(SIOCGSTAMP
, do_siocgstamp
)
3213 HANDLE_IOCTL(HDIO_GETGEO
, hdio_getgeo
)
3214 HANDLE_IOCTL(BLKRAGET
, w_long
)
3215 HANDLE_IOCTL(BLKGETSIZE
, w_long
)
3216 HANDLE_IOCTL(0x1260, broken_blkgetsize
)
3217 HANDLE_IOCTL(BLKFRAGET
, w_long
)
3218 HANDLE_IOCTL(BLKSECTGET
, w_long
)
3219 HANDLE_IOCTL(FBIOGET_FSCREENINFO
, fb_ioctl_trans
)
3220 HANDLE_IOCTL(BLKPG
, blkpg_ioctl_trans
)
3221 HANDLE_IOCTL(FBIOGETCMAP
, fb_ioctl_trans
)
3222 HANDLE_IOCTL(FBIOPUTCMAP
, fb_ioctl_trans
)
3223 HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS
, hdio_ioctl_trans
)
3224 HANDLE_IOCTL(HDIO_GET_UNMASKINTR
, hdio_ioctl_trans
)
3225 HANDLE_IOCTL(HDIO_GET_DMA
, hdio_ioctl_trans
)
3226 HANDLE_IOCTL(HDIO_GET_32BIT
, hdio_ioctl_trans
)
3227 HANDLE_IOCTL(HDIO_GET_MULTCOUNT
, hdio_ioctl_trans
)
3228 HANDLE_IOCTL(HDIO_GET_NOWERR
, hdio_ioctl_trans
)
3229 HANDLE_IOCTL(HDIO_GET_NICE
, hdio_ioctl_trans
)
3230 HANDLE_IOCTL(FDSETPRM32
, fd_ioctl_trans
)
3231 HANDLE_IOCTL(FDDEFPRM32
, fd_ioctl_trans
)
3232 HANDLE_IOCTL(FDGETPRM32
, fd_ioctl_trans
)
3233 HANDLE_IOCTL(FDSETDRVPRM32
, fd_ioctl_trans
)
3234 HANDLE_IOCTL(FDGETDRVPRM32
, fd_ioctl_trans
)
3235 HANDLE_IOCTL(FDGETDRVSTAT32
, fd_ioctl_trans
)
3236 HANDLE_IOCTL(FDPOLLDRVSTAT32
, fd_ioctl_trans
)
3237 HANDLE_IOCTL(FDGETFDCSTAT32
, fd_ioctl_trans
)
3238 HANDLE_IOCTL(FDWERRORGET32
, fd_ioctl_trans
)
3239 HANDLE_IOCTL(SG_IO
,sg_ioctl_trans
)
3240 HANDLE_IOCTL(PPPIOCGIDLE32
, ppp_ioctl_trans
)
3241 HANDLE_IOCTL(PPPIOCSCOMPRESS32
, ppp_ioctl_trans
)
3242 HANDLE_IOCTL(PPPIOCSPASS32
, ppp_sock_fprog_ioctl_trans
)
3243 HANDLE_IOCTL(PPPIOCSACTIVE32
, ppp_sock_fprog_ioctl_trans
)
3244 HANDLE_IOCTL(MTIOCGET32
, mt_ioctl_trans
)
3245 HANDLE_IOCTL(MTIOCPOS32
, mt_ioctl_trans
)
3246 HANDLE_IOCTL(MTIOCGETCONFIG32
, mt_ioctl_trans
)
3247 HANDLE_IOCTL(MTIOCSETCONFIG32
, mt_ioctl_trans
)
3248 HANDLE_IOCTL(CDROMREADAUDIO
, cdrom_ioctl_trans
)
3249 HANDLE_IOCTL(CDROM_SEND_PACKET
, cdrom_ioctl_trans
)
3250 HANDLE_IOCTL(LOOP_SET_STATUS
, loop_status
)
3251 HANDLE_IOCTL(LOOP_GET_STATUS
, loop_status
)
3252 #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
3253 HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32
, ioc_settimeout
)
3255 HANDLE_IOCTL(PIO_FONTX
, do_fontx_ioctl
)
3256 HANDLE_IOCTL(GIO_FONTX
, do_fontx_ioctl
)
3257 HANDLE_IOCTL(PIO_UNIMAP
, do_unimap_ioctl
)
3258 HANDLE_IOCTL(GIO_UNIMAP
, do_unimap_ioctl
)
3259 HANDLE_IOCTL(KDFONTOP
, do_kdfontop_ioctl
)
3261 HANDLE_IOCTL(EXT2_IOC32_GETFLAGS
, do_ext2_ioctl
)
3262 HANDLE_IOCTL(EXT2_IOC32_SETFLAGS
, do_ext2_ioctl
)
3263 HANDLE_IOCTL(EXT2_IOC32_GETVERSION
, do_ext2_ioctl
)
3264 HANDLE_IOCTL(EXT2_IOC32_SETVERSION
, do_ext2_ioctl
)
3265 HANDLE_IOCTL(VIDIOCGTUNER32
, do_video_ioctl
)
3266 HANDLE_IOCTL(VIDIOCSTUNER32
, do_video_ioctl
)
3267 HANDLE_IOCTL(VIDIOCGWIN32
, do_video_ioctl
)
3268 HANDLE_IOCTL(VIDIOCSWIN32
, do_set_window
)
3269 HANDLE_IOCTL(VIDIOCGFBUF32
, do_video_ioctl
)
3270 HANDLE_IOCTL(VIDIOCSFBUF32
, do_video_ioctl
)
3271 HANDLE_IOCTL(VIDIOCGFREQ32
, do_video_ioctl
)
3272 HANDLE_IOCTL(VIDIOCSFREQ32
, do_video_ioctl
)
3273 /* One SMB ioctl needs translations. */
3274 #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
3275 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32
, do_smb_getmountuid
)
3276 HANDLE_IOCTL(ATM_GETLINKRATE32
, do_atm_ioctl
)
3277 HANDLE_IOCTL(ATM_GETNAMES32
, do_atm_ioctl
)
3278 HANDLE_IOCTL(ATM_GETTYPE32
, do_atm_ioctl
)
3279 HANDLE_IOCTL(ATM_GETESI32
, do_atm_ioctl
)
3280 HANDLE_IOCTL(ATM_GETADDR32
, do_atm_ioctl
)
3281 HANDLE_IOCTL(ATM_RSTADDR32
, do_atm_ioctl
)
3282 HANDLE_IOCTL(ATM_ADDADDR32
, do_atm_ioctl
)
3283 HANDLE_IOCTL(ATM_DELADDR32
, do_atm_ioctl
)
3284 HANDLE_IOCTL(ATM_GETCIRANGE32
, do_atm_ioctl
)
3285 HANDLE_IOCTL(ATM_SETCIRANGE32
, do_atm_ioctl
)
3286 HANDLE_IOCTL(ATM_SETESI32
, do_atm_ioctl
)
3287 HANDLE_IOCTL(ATM_SETESIF32
, do_atm_ioctl
)
3288 HANDLE_IOCTL(ATM_GETSTAT32
, do_atm_ioctl
)
3289 HANDLE_IOCTL(ATM_GETSTATZ32
, do_atm_ioctl
)
3290 HANDLE_IOCTL(ATM_GETLOOP32
, do_atm_ioctl
)
3291 HANDLE_IOCTL(ATM_SETLOOP32
, do_atm_ioctl
)
3292 HANDLE_IOCTL(ATM_QUERYLOOP32
, do_atm_ioctl
)
3293 HANDLE_IOCTL(SONET_GETSTAT
, do_atm_ioctl
)
3294 HANDLE_IOCTL(SONET_GETSTATZ
, do_atm_ioctl
)
3295 HANDLE_IOCTL(SONET_GETDIAG
, do_atm_ioctl
)
3296 HANDLE_IOCTL(SONET_SETDIAG
, do_atm_ioctl
)
3297 HANDLE_IOCTL(SONET_CLRDIAG
, do_atm_ioctl
)
3298 HANDLE_IOCTL(SONET_SETFRAMING
, do_atm_ioctl
)
3299 HANDLE_IOCTL(SONET_GETFRAMING
, do_atm_ioctl
)
3300 HANDLE_IOCTL(SONET_GETFRSENSE
, do_atm_ioctl
)
3302 HANDLE_IOCTL(BLKBSZGET_32
, do_blkbszget
)
3303 HANDLE_IOCTL(BLKBSZSET_32
, do_blkbszset
)
3304 HANDLE_IOCTL(BLKGETSIZE64_32
, do_blkgetsize64
)
3306 HANDLE_IOCTL(VFAT_IOCTL_READDIR_BOTH32
, vfat_ioctl32
)
3307 HANDLE_IOCTL(VFAT_IOCTL_READDIR_SHORT32
, vfat_ioctl32
)
3308 HANDLE_IOCTL(REISERFS_IOC_UNPACK32
, reiserfs_ioctl32
)
3310 HANDLE_IOCTL(RAW_SETBIND
, raw_ioctl
)
3311 HANDLE_IOCTL(RAW_GETBIND
, raw_ioctl
)
3313 HANDLE_IOCTL(TIOCGSERIAL
, serial_struct_ioctl
)
3314 HANDLE_IOCTL(TIOCSSERIAL
, serial_struct_ioctl
)
3316 HANDLE_IOCTL(USBDEVFS_CONTROL32
, do_usbdevfs_control
)
3317 HANDLE_IOCTL(USBDEVFS_BULK32
, do_usbdevfs_bulk
)
3318 /*HANDLE_IOCTL(USBDEVFS_SUBMITURB32, do_usbdevfs_urb)*/
3319 HANDLE_IOCTL(USBDEVFS_REAPURB32
, do_usbdevfs_reapurb
)
3320 HANDLE_IOCTL(USBDEVFS_REAPURBNDELAY32
, do_usbdevfs_reapurb
)
3321 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32
, do_usbdevfs_discsignal
)
3323 HANDLE_IOCTL(I2C_FUNCS
, w_long
)
3324 HANDLE_IOCTL(I2C_RDWR
, do_i2c_rdwr_ioctl
)
3325 HANDLE_IOCTL(I2C_SMBUS
, do_i2c_smbus_ioctl
)
3327 HANDLE_IOCTL(SIOCGIWRANGE
, do_wireless_ioctl
)
3328 HANDLE_IOCTL(SIOCSIWSPY
, do_wireless_ioctl
)
3329 HANDLE_IOCTL(SIOCGIWSPY
, do_wireless_ioctl
)
3330 HANDLE_IOCTL(SIOCSIWTHRSPY
, do_wireless_ioctl
)
3331 HANDLE_IOCTL(SIOCGIWTHRSPY
, do_wireless_ioctl
)
3332 HANDLE_IOCTL(SIOCGIWAPLIST
, do_wireless_ioctl
)
3333 HANDLE_IOCTL(SIOCGIWSCAN
, do_wireless_ioctl
)
3334 HANDLE_IOCTL(SIOCSIWESSID
, do_wireless_ioctl
)
3335 HANDLE_IOCTL(SIOCGIWESSID
, do_wireless_ioctl
)
3336 HANDLE_IOCTL(SIOCSIWNICKN
, do_wireless_ioctl
)
3337 HANDLE_IOCTL(SIOCGIWNICKN
, do_wireless_ioctl
)
3338 HANDLE_IOCTL(SIOCSIWENCODE
, do_wireless_ioctl
)
3339 HANDLE_IOCTL(SIOCGIWENCODE
, do_wireless_ioctl
)
3340 HANDLE_IOCTL(SIOCSIFBR
, old_bridge_ioctl
)
3341 HANDLE_IOCTL(SIOCGIFBR
, old_bridge_ioctl
)
3343 #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE)
3344 HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32
, do_ncp_ncprequest
)
3345 HANDLE_IOCTL(NCP_IOC_GETMOUNTUID2_32
, do_ncp_getmountuid2
)
3346 HANDLE_IOCTL(NCP_IOC_GET_FS_INFO_V2_32
, do_ncp_getfsinfo2
)
3347 HANDLE_IOCTL(NCP_IOC_GETOBJECTNAME_32
, do_ncp_getobjectname
)
3348 HANDLE_IOCTL(NCP_IOC_SETOBJECTNAME_32
, do_ncp_setobjectname
)
3349 HANDLE_IOCTL(NCP_IOC_GETPRIVATEDATA_32
, do_ncp_getprivatedata
)
3350 HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32
, do_ncp_setprivatedata
)