2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
3 * Separated from fs stuff by Arnd Bergmann <arnd@arndb.de>
5 * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com)
6 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
7 * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs
8 * Copyright (C) 2003 Pavel Machek (pavel@suse.cz)
9 * Copyright (C) 2005 Philippe De Muyter (phdm@macqel.be)
11 * These routines maintain argument size conversion between 32bit and 64bit
15 #include <linux/config.h>
16 #include <linux/compat.h>
17 #include <linux/videodev.h>
18 #include <linux/videodev2.h>
19 #include <linux/module.h>
20 #include <linux/smp_lock.h>
21 #include <media/v4l2-common.h>
26 struct video_tuner32
{
29 compat_ulong_t rangelow
, rangehigh
;
30 u32 flags
; /* It is really u32 in videodev.h */
34 static int get_video_tuner32(struct video_tuner
*kp
, struct video_tuner32 __user
*up
)
36 if(!access_ok(VERIFY_READ
, up
, sizeof(struct video_tuner32
)) ||
37 get_user(kp
->tuner
, &up
->tuner
) ||
38 copy_from_user(kp
->name
, up
->name
, 32) ||
39 get_user(kp
->rangelow
, &up
->rangelow
) ||
40 get_user(kp
->rangehigh
, &up
->rangehigh
) ||
41 get_user(kp
->flags
, &up
->flags
) ||
42 get_user(kp
->mode
, &up
->mode
) ||
43 get_user(kp
->signal
, &up
->signal
))
48 static int put_video_tuner32(struct video_tuner
*kp
, struct video_tuner32 __user
*up
)
50 if(!access_ok(VERIFY_WRITE
, up
, sizeof(struct video_tuner32
)) ||
51 put_user(kp
->tuner
, &up
->tuner
) ||
52 copy_to_user(up
->name
, kp
->name
, 32) ||
53 put_user(kp
->rangelow
, &up
->rangelow
) ||
54 put_user(kp
->rangehigh
, &up
->rangehigh
) ||
55 put_user(kp
->flags
, &up
->flags
) ||
56 put_user(kp
->mode
, &up
->mode
) ||
57 put_user(kp
->signal
, &up
->signal
))
62 struct video_buffer32
{
64 compat_int_t height
, width
, depth
, bytesperline
;
67 static int get_video_buffer32(struct video_buffer
*kp
, struct video_buffer32 __user
*up
)
71 if (!access_ok(VERIFY_READ
, up
, sizeof(struct video_buffer32
)) ||
72 get_user(tmp
, &up
->base
) ||
73 get_user(kp
->height
, &up
->height
) ||
74 get_user(kp
->width
, &up
->width
) ||
75 get_user(kp
->depth
, &up
->depth
) ||
76 get_user(kp
->bytesperline
, &up
->bytesperline
))
79 /* This is actually a physical address stored
82 kp
->base
= (void *)(unsigned long) tmp
;
87 static int put_video_buffer32(struct video_buffer
*kp
, struct video_buffer32 __user
*up
)
89 u32 tmp
= (u32
)((unsigned long)kp
->base
);
91 if(!access_ok(VERIFY_WRITE
, up
, sizeof(struct video_buffer32
)) ||
92 put_user(tmp
, &up
->base
) ||
93 put_user(kp
->height
, &up
->height
) ||
94 put_user(kp
->width
, &up
->width
) ||
95 put_user(kp
->depth
, &up
->depth
) ||
96 put_user(kp
->bytesperline
, &up
->bytesperline
))
101 struct video_clip32
{
102 s32 x
, y
, width
, height
; /* Its really s32 in videodev.h */
106 struct video_window32
{
107 u32 x
, y
, width
, height
, chromakey
, flags
;
108 compat_caddr_t clips
;
109 compat_int_t clipcount
;
112 static int native_ioctl(struct file
*file
, unsigned int cmd
, unsigned long arg
)
114 int ret
= -ENOIOCTLCMD
;
116 if (file
->f_op
->unlocked_ioctl
)
117 ret
= file
->f_op
->unlocked_ioctl(file
, cmd
, arg
);
118 else if (file
->f_op
->ioctl
) {
120 ret
= file
->f_op
->ioctl(file
->f_dentry
->d_inode
, file
, cmd
, arg
);
128 /* You get back everything except the clips... */
129 static int put_video_window32(struct video_window
*kp
, struct video_window32 __user
*up
)
131 if(!access_ok(VERIFY_WRITE
, up
, sizeof(struct video_window32
)) ||
132 put_user(kp
->x
, &up
->x
) ||
133 put_user(kp
->y
, &up
->y
) ||
134 put_user(kp
->width
, &up
->width
) ||
135 put_user(kp
->height
, &up
->height
) ||
136 put_user(kp
->chromakey
, &up
->chromakey
) ||
137 put_user(kp
->flags
, &up
->flags
) ||
138 put_user(kp
->clipcount
, &up
->clipcount
))
152 enum v4l2_field field
;
154 compat_caddr_t clips
; /* actually struct v4l2_clip32 * */
156 compat_caddr_t bitmap
;
159 static int get_v4l2_window32(struct v4l2_window
*kp
, struct v4l2_window32 __user
*up
)
161 if (!access_ok(VERIFY_READ
, up
, sizeof(struct v4l2_window32
)) ||
162 copy_from_user(&kp
->w
, &up
->w
, sizeof(up
->w
)) ||
163 get_user(kp
->field
, &up
->field
) ||
164 get_user(kp
->chromakey
, &up
->chromakey
) ||
165 get_user(kp
->clipcount
, &up
->clipcount
))
167 if (kp
->clipcount
> 2048)
170 struct v4l2_clip32 __user
*uclips
;
171 struct v4l2_clip __user
*kclips
;
172 int n
= kp
->clipcount
;
175 if (get_user(p
, &up
->clips
))
177 uclips
= compat_ptr(p
);
178 kclips
= compat_alloc_user_space(n
* sizeof(struct v4l2_clip
));
181 if (copy_in_user(&kclips
->c
, &uclips
->c
, sizeof(uclips
->c
)))
183 if (put_user(n
? kclips
+ 1 : NULL
, &kclips
->next
))
193 static int put_v4l2_window32(struct v4l2_window
*kp
, struct v4l2_window32 __user
*up
)
195 if (copy_to_user(&up
->w
, &kp
->w
, sizeof(up
->w
)) ||
196 put_user(kp
->field
, &up
->field
) ||
197 put_user(kp
->chromakey
, &up
->chromakey
) ||
198 put_user(kp
->clipcount
, &up
->clipcount
))
203 static inline int get_v4l2_pix_format(struct v4l2_pix_format
*kp
, struct v4l2_pix_format __user
*up
)
205 if (copy_from_user(kp
, up
, sizeof(struct v4l2_pix_format
)))
210 static inline int put_v4l2_pix_format(struct v4l2_pix_format
*kp
, struct v4l2_pix_format __user
*up
)
212 if (copy_to_user(up
, kp
, sizeof(struct v4l2_pix_format
)))
217 static inline int get_v4l2_vbi_format(struct v4l2_vbi_format
*kp
, struct v4l2_vbi_format __user
*up
)
219 if (copy_from_user(kp
, up
, sizeof(struct v4l2_vbi_format
)))
224 static inline int put_v4l2_vbi_format(struct v4l2_vbi_format
*kp
, struct v4l2_vbi_format __user
*up
)
226 if (copy_to_user(up
, kp
, sizeof(struct v4l2_vbi_format
)))
233 enum v4l2_buf_type type
;
236 struct v4l2_pix_format pix
; // V4L2_BUF_TYPE_VIDEO_CAPTURE
237 struct v4l2_window32 win
; // V4L2_BUF_TYPE_VIDEO_OVERLAY
238 struct v4l2_vbi_format vbi
; // V4L2_BUF_TYPE_VBI_CAPTURE
239 __u8 raw_data
[200]; // user-defined
243 static int get_v4l2_format32(struct v4l2_format
*kp
, struct v4l2_format32 __user
*up
)
245 if (!access_ok(VERIFY_READ
, up
, sizeof(struct v4l2_format32
)) ||
246 get_user(kp
->type
, &up
->type
))
249 case V4L2_BUF_TYPE_VIDEO_CAPTURE
:
250 return get_v4l2_pix_format(&kp
->fmt
.pix
, &up
->fmt
.pix
);
251 case V4L2_BUF_TYPE_VIDEO_OVERLAY
:
252 return get_v4l2_window32(&kp
->fmt
.win
, &up
->fmt
.win
);
253 case V4L2_BUF_TYPE_VBI_CAPTURE
:
254 return get_v4l2_vbi_format(&kp
->fmt
.vbi
, &up
->fmt
.vbi
);
256 printk("compat_ioctl : unexpected VIDIOC_FMT type %d\n",
262 static int put_v4l2_format32(struct v4l2_format
*kp
, struct v4l2_format32 __user
*up
)
264 if(!access_ok(VERIFY_WRITE
, up
, sizeof(struct v4l2_format32
)) ||
265 put_user(kp
->type
, &up
->type
))
268 case V4L2_BUF_TYPE_VIDEO_CAPTURE
:
269 return put_v4l2_pix_format(&kp
->fmt
.pix
, &up
->fmt
.pix
);
270 case V4L2_BUF_TYPE_VIDEO_OVERLAY
:
271 return put_v4l2_window32(&kp
->fmt
.win
, &up
->fmt
.win
);
272 case V4L2_BUF_TYPE_VBI_CAPTURE
:
273 return put_v4l2_vbi_format(&kp
->fmt
.vbi
, &up
->fmt
.vbi
);
279 static inline int get_v4l2_standard(struct v4l2_standard
*kp
, struct v4l2_standard __user
*up
)
281 if (copy_from_user(kp
, up
, sizeof(struct v4l2_standard
)))
287 static inline int put_v4l2_standard(struct v4l2_standard
*kp
, struct v4l2_standard __user
*up
)
289 if (copy_to_user(up
, kp
, sizeof(struct v4l2_standard
)))
294 struct v4l2_standard32
297 __u32 id
[2]; /* __u64 would get the alignment wrong */
299 struct v4l2_fract frameperiod
; /* Frames, not fields */
304 static int get_v4l2_standard32(struct v4l2_standard
*kp
, struct v4l2_standard32 __user
*up
)
306 /* other fields are not set by the user, nor used by the driver */
307 if (!access_ok(VERIFY_READ
, up
, sizeof(struct v4l2_standard32
)) ||
308 get_user(kp
->index
, &up
->index
))
313 static int put_v4l2_standard32(struct v4l2_standard
*kp
, struct v4l2_standard32 __user
*up
)
315 if(!access_ok(VERIFY_WRITE
, up
, sizeof(struct v4l2_standard32
)) ||
316 put_user(kp
->index
, &up
->index
) ||
317 copy_to_user(up
->id
, &kp
->id
, sizeof(__u64
)) ||
318 copy_to_user(up
->name
, kp
->name
, 24) ||
319 copy_to_user(&up
->frameperiod
, &kp
->frameperiod
, sizeof(kp
->frameperiod
)) ||
320 put_user(kp
->framelines
, &up
->framelines
) ||
321 copy_to_user(up
->reserved
, kp
->reserved
, 4 * sizeof(__u32
)))
326 static inline int get_v4l2_tuner(struct v4l2_tuner
*kp
, struct v4l2_tuner __user
*up
)
328 if (copy_from_user(kp
, up
, sizeof(struct v4l2_tuner
)))
334 static inline int put_v4l2_tuner(struct v4l2_tuner
*kp
, struct v4l2_tuner __user
*up
)
336 if (copy_to_user(up
, kp
, sizeof(struct v4l2_tuner
)))
344 enum v4l2_buf_type type
;
347 enum v4l2_field field
;
348 struct compat_timeval timestamp
;
349 struct v4l2_timecode timecode
;
352 /* memory location */
353 enum v4l2_memory memory
;
356 compat_long_t userptr
;
363 static int get_v4l2_buffer32(struct v4l2_buffer
*kp
, struct v4l2_buffer32 __user
*up
)
366 if (!access_ok(VERIFY_READ
, up
, sizeof(struct v4l2_buffer32
)) ||
367 get_user(kp
->index
, &up
->index
) ||
368 get_user(kp
->type
, &up
->type
) ||
369 get_user(kp
->flags
, &up
->flags
) ||
370 get_user(kp
->memory
, &up
->memory
) ||
371 get_user(kp
->input
, &up
->input
))
374 case V4L2_MEMORY_MMAP
:
376 case V4L2_MEMORY_USERPTR
:
380 if (get_user(kp
->length
, &up
->length
) ||
381 get_user(tmp
, &up
->m
.userptr
))
384 kp
->m
.userptr
= (unsigned long)compat_ptr(tmp
);
387 case V4L2_MEMORY_OVERLAY
:
388 if(get_user(kp
->m
.offset
, &up
->m
.offset
))
395 static int put_v4l2_buffer32(struct v4l2_buffer
*kp
, struct v4l2_buffer32 __user
*up
)
397 if (!access_ok(VERIFY_WRITE
, up
, sizeof(struct v4l2_buffer32
)) ||
398 put_user(kp
->index
, &up
->index
) ||
399 put_user(kp
->type
, &up
->type
) ||
400 put_user(kp
->flags
, &up
->flags
) ||
401 put_user(kp
->memory
, &up
->memory
) ||
402 put_user(kp
->input
, &up
->input
))
405 case V4L2_MEMORY_MMAP
:
406 if (put_user(kp
->length
, &up
->length
) ||
407 put_user(kp
->m
.offset
, &up
->m
.offset
))
410 case V4L2_MEMORY_USERPTR
:
411 if (put_user(kp
->length
, &up
->length
) ||
412 put_user(kp
->m
.userptr
, &up
->m
.userptr
))
415 case V4L2_MEMORY_OVERLAY
:
416 if (put_user(kp
->m
.offset
, &up
->m
.offset
))
420 if (put_user(kp
->bytesused
, &up
->bytesused
) ||
421 put_user(kp
->field
, &up
->field
) ||
422 put_user(kp
->timestamp
.tv_sec
, &up
->timestamp
.tv_sec
) ||
423 put_user(kp
->timestamp
.tv_usec
, &up
->timestamp
.tv_usec
) ||
424 copy_to_user(&up
->timecode
, &kp
->timecode
, sizeof(struct v4l2_timecode
)) ||
425 put_user(kp
->sequence
, &up
->sequence
) ||
426 put_user(kp
->reserved
, &up
->reserved
))
431 struct v4l2_framebuffer32
436 struct v4l2_pix_format fmt
;
439 static int get_v4l2_framebuffer32(struct v4l2_framebuffer
*kp
, struct v4l2_framebuffer32 __user
*up
)
443 if (!access_ok(VERIFY_READ
, up
, sizeof(struct v4l2_framebuffer32
)) ||
444 get_user(tmp
, &up
->base
) ||
445 get_user(kp
->capability
, &up
->capability
) ||
446 get_user(kp
->flags
, &up
->flags
))
448 kp
->base
= compat_ptr(tmp
);
449 get_v4l2_pix_format(&kp
->fmt
, &up
->fmt
);
453 static int put_v4l2_framebuffer32(struct v4l2_framebuffer
*kp
, struct v4l2_framebuffer32 __user
*up
)
455 u32 tmp
= (u32
)((unsigned long)kp
->base
);
457 if(!access_ok(VERIFY_WRITE
, up
, sizeof(struct v4l2_framebuffer32
)) ||
458 put_user(tmp
, &up
->base
) ||
459 put_user(kp
->capability
, &up
->capability
) ||
460 put_user(kp
->flags
, &up
->flags
))
462 put_v4l2_pix_format(&kp
->fmt
, &up
->fmt
);
466 static inline int get_v4l2_input32(struct v4l2_input
*kp
, struct v4l2_input __user
*up
)
468 if (copy_from_user(kp
, up
, sizeof(struct v4l2_input
) - 4))
473 static inline int put_v4l2_input32(struct v4l2_input
*kp
, struct v4l2_input __user
*up
)
475 if (copy_to_user(up
, kp
, sizeof(struct v4l2_input
) - 4))
480 static inline int get_v4l2_input(struct v4l2_input
*kp
, struct v4l2_input __user
*up
)
482 if (copy_from_user(kp
, up
, sizeof(struct v4l2_input
)))
487 static inline int put_v4l2_input(struct v4l2_input
*kp
, struct v4l2_input __user
*up
)
489 if (copy_to_user(up
, kp
, sizeof(struct v4l2_input
)))
494 #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32)
495 #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32)
496 #define VIDIOCGWIN32 _IOR('v',9, struct video_window32)
497 #define VIDIOCSWIN32 _IOW('v',10, struct video_window32)
498 #define VIDIOCGFBUF32 _IOR('v',11, struct video_buffer32)
499 #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32)
500 #define VIDIOCGFREQ32 _IOR('v',14, u32)
501 #define VIDIOCSFREQ32 _IOW('v',15, u32)
503 /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */
504 #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4)
505 #define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32)
506 #define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32)
507 #define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32)
508 #define VIDIOC_G_FBUF32 _IOR ('V', 10, struct v4l2_framebuffer32)
509 #define VIDIOC_S_FBUF32 _IOW ('V', 11, struct v4l2_framebuffer32)
510 /* VIDIOC_OVERLAY is now _IOW, but was _IOWR */
511 #define VIDIOC_OVERLAY32 _IOWR ('V', 14, compat_int_t)
512 #define VIDIOC_QBUF32 _IOWR ('V', 15, struct v4l2_buffer32)
513 #define VIDIOC_DQBUF32 _IOWR ('V', 17, struct v4l2_buffer32)
514 #define VIDIOC_STREAMON32 _IOW ('V', 18, compat_int_t)
515 #define VIDIOC_STREAMOFF32 _IOW ('V', 19, compat_int_t)
516 #define VIDIOC_ENUMSTD32 _IOWR ('V', 25, struct v4l2_standard32)
517 /* VIDIOC_S_CTRL is now _IOWR, but was _IOW */
518 #define VIDIOC_S_CTRL32 _IOW ('V', 28, struct v4l2_control)
519 #define VIDIOC_G_INPUT32 _IOR ('V', 38, compat_int_t)
520 #define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t)
521 #define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32)
524 MaxClips
= (~0U-sizeof(struct video_window
))/sizeof(struct video_clip
)
527 static int do_set_window(struct file
*file
, unsigned int cmd
, unsigned long arg
)
529 struct video_window32 __user
*up
= compat_ptr(arg
);
530 struct video_window __user
*vw
;
531 struct video_clip __user
*p
;
535 if (!access_ok(VERIFY_READ
, up
, sizeof(struct video_window32
)))
538 if (get_user(nclips
, &up
->clipcount
))
541 /* Peculiar interface... */
543 nclips
= VIDEO_CLIPMAP_SIZE
;
545 if (nclips
> MaxClips
)
548 vw
= compat_alloc_user_space(sizeof(struct video_window
) +
549 nclips
* sizeof(struct video_clip
));
551 p
= nclips
? (struct video_clip __user
*)(vw
+ 1) : NULL
;
553 if (get_user(n
, &up
->x
) || put_user(n
, &vw
->x
) ||
554 get_user(n
, &up
->y
) || put_user(n
, &vw
->y
) ||
555 get_user(n
, &up
->width
) || put_user(n
, &vw
->width
) ||
556 get_user(n
, &up
->height
) || put_user(n
, &vw
->height
) ||
557 get_user(n
, &up
->chromakey
) || put_user(n
, &vw
->chromakey
) ||
558 get_user(n
, &up
->flags
) || put_user(n
, &vw
->flags
) ||
559 get_user(n
, &up
->clipcount
) || put_user(n
, &vw
->clipcount
) ||
560 get_user(n
, &up
->clips
) || put_user(p
, &vw
->clips
))
564 struct video_clip32 __user
*u
= compat_ptr(n
);
568 for (i
= 0; i
< nclips
; i
++, u
++, p
++) {
570 if (!access_ok(VERIFY_READ
, u
, sizeof(struct video_clip32
)) ||
571 !access_ok(VERIFY_WRITE
, p
, sizeof(struct video_clip32
)) ||
572 get_user(v
, &u
->x
) ||
573 put_user(v
, &p
->x
) ||
574 get_user(v
, &u
->y
) ||
575 put_user(v
, &p
->y
) ||
576 get_user(v
, &u
->width
) ||
577 put_user(v
, &p
->width
) ||
578 get_user(v
, &u
->height
) ||
579 put_user(v
, &p
->height
) ||
580 put_user(NULL
, &p
->next
))
585 return native_ioctl(file
, VIDIOCSWIN
, (unsigned long)vw
);
588 static int do_video_ioctl(struct file
*file
, unsigned int cmd
, unsigned long arg
)
591 struct video_tuner vt
;
592 struct video_buffer vb
;
593 struct video_window vw
;
594 struct v4l2_format v2f
;
595 struct v4l2_buffer v2b
;
596 struct v4l2_framebuffer v2fb
;
597 struct v4l2_standard v2s
;
598 struct v4l2_input v2i
;
599 struct v4l2_tuner v2t
;
602 void __user
*up
= compat_ptr(arg
);
603 int compatible_arg
= 1;
607 /* First, convert the command. */
609 case VIDIOCGTUNER32
: cmd
= VIDIOCGTUNER
; break;
610 case VIDIOCSTUNER32
: cmd
= VIDIOCSTUNER
; break;
611 case VIDIOCGWIN32
: cmd
= VIDIOCGWIN
; break;
612 case VIDIOCGFBUF32
: cmd
= VIDIOCGFBUF
; break;
613 case VIDIOCSFBUF32
: cmd
= VIDIOCSFBUF
; break;
614 case VIDIOCGFREQ32
: cmd
= VIDIOCGFREQ
; break;
615 case VIDIOCSFREQ32
: cmd
= VIDIOCSFREQ
; break;
616 case VIDIOC_G_FMT32
: cmd
= VIDIOC_G_FMT
; break;
617 case VIDIOC_S_FMT32
: cmd
= VIDIOC_S_FMT
; break;
618 case VIDIOC_QUERYBUF32
: cmd
= VIDIOC_QUERYBUF
; break;
619 case VIDIOC_QBUF32
: cmd
= VIDIOC_QBUF
; break;
620 case VIDIOC_DQBUF32
: cmd
= VIDIOC_DQBUF
; break;
621 case VIDIOC_STREAMON32
: cmd
= VIDIOC_STREAMON
; break;
622 case VIDIOC_STREAMOFF32
: cmd
= VIDIOC_STREAMOFF
; break;
623 case VIDIOC_G_FBUF32
: cmd
= VIDIOC_G_FBUF
; break;
624 case VIDIOC_S_FBUF32
: cmd
= VIDIOC_S_FBUF
; break;
625 case VIDIOC_OVERLAY32
: cmd
= VIDIOC_OVERLAY
; break;
626 case VIDIOC_ENUMSTD32
: realcmd
= VIDIOC_ENUMSTD
; break;
627 case VIDIOC_ENUMINPUT32
: realcmd
= VIDIOC_ENUMINPUT
; break;
628 case VIDIOC_S_CTRL32
: cmd
= VIDIOC_S_CTRL
; break;
629 case VIDIOC_G_INPUT32
: cmd
= VIDIOC_G_INPUT
; break;
630 case VIDIOC_S_INPUT32
: cmd
= VIDIOC_S_INPUT
; break;
631 case VIDIOC_TRY_FMT32
: cmd
= VIDIOC_TRY_FMT
; break;
637 err
= get_video_tuner32(&karg
.vt
, up
);
643 err
= get_video_buffer32(&karg
.vb
, up
);
650 case VIDIOC_STREAMON
:
651 case VIDIOC_STREAMOFF
:
652 err
= get_user(karg
.vx
, (u32 __user
*)up
);
657 err
= get_v4l2_framebuffer32(&karg
.v2fb
, up
);
664 err
= get_v4l2_format32(&karg
.v2f
, up
);
668 case VIDIOC_QUERYBUF
:
671 err
= get_v4l2_buffer32(&karg
.v2b
, up
);
676 err
= get_v4l2_standard(&karg
.v2s
, up
);
680 case VIDIOC_ENUMSTD32
:
681 err
= get_v4l2_standard32(&karg
.v2s
, up
);
685 case VIDIOC_ENUMINPUT
:
686 err
= get_v4l2_input(&karg
.v2i
, up
);
690 case VIDIOC_ENUMINPUT32
:
691 err
= get_v4l2_input32(&karg
.v2i
, up
);
697 err
= get_v4l2_tuner(&karg
.v2t
, up
);
713 err
= native_ioctl(file
, realcmd
, (unsigned long)up
);
715 mm_segment_t old_fs
= get_fs();
718 err
= native_ioctl(file
, realcmd
, (unsigned long)&karg
);
724 err
= put_video_tuner32(&karg
.vt
, up
);
728 err
= put_video_window32(&karg
.vw
, up
);
732 err
= put_video_buffer32(&karg
.vb
, up
);
736 err
= put_v4l2_framebuffer32(&karg
.v2fb
, up
);
742 err
= put_v4l2_format32(&karg
.v2f
, up
);
745 case VIDIOC_QUERYBUF
:
748 err
= put_v4l2_buffer32(&karg
.v2b
, up
);
752 err
= put_v4l2_standard(&karg
.v2s
, up
);
755 case VIDIOC_ENUMSTD32
:
756 err
= put_v4l2_standard32(&karg
.v2s
, up
);
761 err
= put_v4l2_tuner(&karg
.v2t
, up
);
764 case VIDIOC_ENUMINPUT
:
765 err
= put_v4l2_input(&karg
.v2i
, up
);
768 case VIDIOC_ENUMINPUT32
:
769 err
= put_v4l2_input32(&karg
.v2i
, up
);
774 err
= put_user(((u32
)karg
.vx
), (u32 __user
*)up
);
782 long v4l_compat_ioctl32(struct file
*file
, unsigned int cmd
, unsigned long arg
)
784 int ret
= -ENOIOCTLCMD
;
786 if (!file
->f_op
->ioctl
)
791 ret
= do_set_window(file
, cmd
, arg
);
800 case VIDIOC_QUERYCAP
:
801 case VIDIOC_ENUM_FMT
:
805 case VIDIOC_QUERYBUF32
:
806 case VIDIOC_G_FBUF32
:
807 case VIDIOC_S_FBUF32
:
808 case VIDIOC_OVERLAY32
:
811 case VIDIOC_STREAMON32
:
812 case VIDIOC_STREAMOFF32
:
819 case VIDIOC_ENUMSTD32
:
820 case VIDIOC_ENUMINPUT
:
821 case VIDIOC_ENUMINPUT32
:
823 case VIDIOC_S_CTRL32
:
824 case VIDIOC_QUERYCTRL
:
825 case VIDIOC_G_INPUT32
:
826 case VIDIOC_S_INPUT32
:
827 case VIDIOC_TRY_FMT32
:
828 ret
= do_video_ioctl(file
, cmd
, arg
);
831 /* Little v, the video4linux ioctls (conflict?) */
848 /* BTTV specific... */
849 case _IOW('v', BASE_VIDIOCPRIVATE
+0, char [256]):
850 case _IOR('v', BASE_VIDIOCPRIVATE
+1, char [256]):
851 case _IOR('v' , BASE_VIDIOCPRIVATE
+2, unsigned int):
852 case _IOW('v' , BASE_VIDIOCPRIVATE
+3, char [16]): /* struct bttv_pll_info */
853 case _IOR('v' , BASE_VIDIOCPRIVATE
+4, int):
854 case _IOR('v' , BASE_VIDIOCPRIVATE
+5, int):
855 case _IOR('v' , BASE_VIDIOCPRIVATE
+6, int):
856 case _IOR('v' , BASE_VIDIOCPRIVATE
+7, int):
857 ret
= native_ioctl(file
, cmd
, (unsigned long)compat_ptr(arg
));
860 v4l_print_ioctl("compat_ioctl32", cmd
);
865 long v4l_compat_ioctl32(struct file
*file
, unsigned int cmd
, unsigned long arg
)
870 EXPORT_SYMBOL_GPL(v4l_compat_ioctl32
);
872 MODULE_LICENSE("GPL");