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/compat.h>
16 #include <linux/videodev.h>
17 #include <linux/videodev2.h>
18 #include <linux/module.h>
19 #include <linux/smp_lock.h>
20 #include <media/v4l2-ioctl.h>
24 #ifdef CONFIG_VIDEO_V4L1_COMPAT
25 struct video_tuner32 {
28 compat_ulong_t rangelow, rangehigh;
29 u32 flags; /* It is really u32 in videodev.h */
33 static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
35 if (!access_ok(VERIFY_READ, up, sizeof(struct video_tuner32)) ||
36 get_user(kp->tuner, &up->tuner) ||
37 copy_from_user(kp->name, up->name, 32) ||
38 get_user(kp->rangelow, &up->rangelow) ||
39 get_user(kp->rangehigh, &up->rangehigh) ||
40 get_user(kp->flags, &up->flags) ||
41 get_user(kp->mode, &up->mode) ||
42 get_user(kp->signal, &up->signal))
47 static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
49 if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_tuner32)) ||
50 put_user(kp->tuner, &up->tuner) ||
51 copy_to_user(up->name, kp->name, 32) ||
52 put_user(kp->rangelow, &up->rangelow) ||
53 put_user(kp->rangehigh, &up->rangehigh) ||
54 put_user(kp->flags, &up->flags) ||
55 put_user(kp->mode, &up->mode) ||
56 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;
113 static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
115 int ret = -ENOIOCTLCMD;
117 if (file->f_op->unlocked_ioctl)
118 ret = file->f_op->unlocked_ioctl(file, cmd, arg);
119 else if (file->f_op->ioctl) {
121 ret = file->f_op->ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
129 #ifdef CONFIG_VIDEO_V4L1_COMPAT
130 /* You get back everything except the clips... */
131 static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
133 if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) ||
134 put_user(kp->x, &up->x) ||
135 put_user(kp->y, &up->y) ||
136 put_user(kp->width, &up->width) ||
137 put_user(kp->height, &up->height) ||
138 put_user(kp->chromakey, &up->chromakey) ||
139 put_user(kp->flags, &up->flags) ||
140 put_user(kp->clipcount, &up->clipcount))
151 struct v4l2_window32 {
153 enum v4l2_field field;
155 compat_caddr_t clips; /* actually struct v4l2_clip32 * */
157 compat_caddr_t bitmap;
160 static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
162 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_window32)) ||
163 copy_from_user(&kp->w, &up->w, sizeof(up->w)) ||
164 get_user(kp->field, &up->field) ||
165 get_user(kp->chromakey, &up->chromakey) ||
166 get_user(kp->clipcount, &up->clipcount))
168 if (kp->clipcount > 2048)
171 struct v4l2_clip32 __user *uclips;
172 struct v4l2_clip __user *kclips;
173 int n = kp->clipcount;
176 if (get_user(p, &up->clips))
178 uclips = compat_ptr(p);
179 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip));
182 if (copy_in_user(&kclips->c, &uclips->c, sizeof(uclips->c)))
184 if (put_user(n ? kclips + 1 : NULL, &kclips->next))
194 static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
196 if (copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
197 put_user(kp->field, &up->field) ||
198 put_user(kp->chromakey, &up->chromakey) ||
199 put_user(kp->clipcount, &up->clipcount))
204 static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
206 if (copy_from_user(kp, up, sizeof(struct v4l2_pix_format)))
211 static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
213 if (copy_to_user(up, kp, sizeof(struct v4l2_pix_format)))
218 static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
220 if (copy_from_user(kp, up, sizeof(struct v4l2_vbi_format)))
225 static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
227 if (copy_to_user(up, kp, sizeof(struct v4l2_vbi_format)))
232 struct v4l2_format32 {
233 enum v4l2_buf_type type;
235 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
236 struct v4l2_window32 win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
237 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
238 __u8 raw_data[200]; /* user-defined */
242 static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
244 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_format32)) ||
245 get_user(kp->type, &up->type))
248 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
249 return get_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix);
250 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
251 return get_v4l2_window32(&kp->fmt.win, &up->fmt.win);
252 case V4L2_BUF_TYPE_VBI_CAPTURE:
253 return get_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi);
255 printk(KERN_INFO "compat_ioctl: unexpected VIDIOC_FMT type %d\n",
261 static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
263 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)) ||
264 put_user(kp->type, &up->type))
267 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
268 return put_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix);
269 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
270 return put_v4l2_window32(&kp->fmt.win, &up->fmt.win);
271 case V4L2_BUF_TYPE_VBI_CAPTURE:
272 return put_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi);
278 static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
280 if (copy_from_user(kp, up, sizeof(struct v4l2_standard)))
286 static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
288 if (copy_to_user(up, kp, sizeof(struct v4l2_standard)))
293 struct v4l2_standard32 {
295 __u32 id[2]; /* __u64 would get the alignment wrong */
297 struct v4l2_fract frameperiod; /* Frames, not fields */
302 static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
304 /* other fields are not set by the user, nor used by the driver */
305 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard32)) ||
306 get_user(kp->index, &up->index))
311 static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
313 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) ||
314 put_user(kp->index, &up->index) ||
315 copy_to_user(up->id, &kp->id, sizeof(__u64)) ||
316 copy_to_user(up->name, kp->name, 24) ||
317 copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) ||
318 put_user(kp->framelines, &up->framelines) ||
319 copy_to_user(up->reserved, kp->reserved, 4 * sizeof(__u32)))
324 static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
326 if (copy_from_user(kp, up, sizeof(struct v4l2_tuner)))
332 static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
334 if (copy_to_user(up, kp, sizeof(struct v4l2_tuner)))
339 struct v4l2_buffer32 {
341 enum v4l2_buf_type type;
344 enum v4l2_field field;
345 struct compat_timeval timestamp;
346 struct v4l2_timecode timecode;
349 /* memory location */
350 enum v4l2_memory memory;
353 compat_long_t userptr;
360 static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user *up)
363 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_buffer32)) ||
364 get_user(kp->index, &up->index) ||
365 get_user(kp->type, &up->type) ||
366 get_user(kp->flags, &up->flags) ||
367 get_user(kp->memory, &up->memory) ||
368 get_user(kp->input, &up->input))
370 switch (kp->memory) {
371 case V4L2_MEMORY_MMAP:
373 case V4L2_MEMORY_USERPTR:
377 if (get_user(kp->length, &up->length) ||
378 get_user(tmp, &up->m.userptr))
381 kp->m.userptr = (unsigned long)compat_ptr(tmp);
384 case V4L2_MEMORY_OVERLAY:
385 if (get_user(kp->m.offset, &up->m.offset))
392 static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user *up)
394 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_buffer32)) ||
395 put_user(kp->index, &up->index) ||
396 put_user(kp->type, &up->type) ||
397 put_user(kp->flags, &up->flags) ||
398 put_user(kp->memory, &up->memory) ||
399 put_user(kp->input, &up->input))
401 switch (kp->memory) {
402 case V4L2_MEMORY_MMAP:
403 if (put_user(kp->length, &up->length) ||
404 put_user(kp->m.offset, &up->m.offset))
407 case V4L2_MEMORY_USERPTR:
408 if (put_user(kp->length, &up->length) ||
409 put_user(kp->m.userptr, &up->m.userptr))
412 case V4L2_MEMORY_OVERLAY:
413 if (put_user(kp->m.offset, &up->m.offset))
417 if (put_user(kp->bytesused, &up->bytesused) ||
418 put_user(kp->field, &up->field) ||
419 put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) ||
420 put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) ||
421 copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) ||
422 put_user(kp->sequence, &up->sequence) ||
423 put_user(kp->reserved, &up->reserved))
428 struct v4l2_framebuffer32 {
432 struct v4l2_pix_format fmt;
435 static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_framebuffer32 __user *up)
439 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_framebuffer32)) ||
440 get_user(tmp, &up->base) ||
441 get_user(kp->capability, &up->capability) ||
442 get_user(kp->flags, &up->flags))
444 kp->base = compat_ptr(tmp);
445 get_v4l2_pix_format(&kp->fmt, &up->fmt);
449 static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_framebuffer32 __user *up)
451 u32 tmp = (u32)((unsigned long)kp->base);
453 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) ||
454 put_user(tmp, &up->base) ||
455 put_user(kp->capability, &up->capability) ||
456 put_user(kp->flags, &up->flags))
458 put_v4l2_pix_format(&kp->fmt, &up->fmt);
462 static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
464 if (copy_from_user(kp, up, sizeof(struct v4l2_input) - 4))
469 static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
471 if (copy_to_user(up, kp, sizeof(struct v4l2_input) - 4))
476 static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
478 if (copy_from_user(kp, up, sizeof(struct v4l2_input)))
483 static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
485 if (copy_to_user(up, kp, sizeof(struct v4l2_input)))
490 #ifdef CONFIG_VIDEO_V4L1_COMPAT
491 struct video_code32 {
492 char loadwhat[16]; /* name or tag of file being passed */
493 compat_int_t datasize;
497 static inline int microcode32(struct video_code *kp, struct video_code32 __user *up)
499 if (!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) ||
500 copy_from_user(kp->loadwhat, up->loadwhat, sizeof(up->loadwhat)) ||
501 get_user(kp->datasize, &up->datasize) ||
502 copy_from_user(kp->data, up->data, up->datasize))
507 #define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32)
508 #define VIDIOCSTUNER32 _IOW('v', 5, struct video_tuner32)
509 #define VIDIOCGWIN32 _IOR('v', 9, struct video_window32)
510 #define VIDIOCSWIN32 _IOW('v', 10, struct video_window32)
511 #define VIDIOCGFBUF32 _IOR('v', 11, struct video_buffer32)
512 #define VIDIOCSFBUF32 _IOW('v', 12, struct video_buffer32)
513 #define VIDIOCGFREQ32 _IOR('v', 14, u32)
514 #define VIDIOCSFREQ32 _IOW('v', 15, u32)
515 #define VIDIOCSMICROCODE32 _IOW('v', 27, struct video_code32)
519 /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */
520 #define VIDIOC_ENUMINPUT32 (VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4))
521 #define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32)
522 #define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32)
523 #define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32)
524 #define VIDIOC_G_FBUF32 _IOR ('V', 10, struct v4l2_framebuffer32)
525 #define VIDIOC_S_FBUF32 _IOW ('V', 11, struct v4l2_framebuffer32)
526 /* VIDIOC_OVERLAY is now _IOW, but was _IOWR */
527 #define VIDIOC_OVERLAY32 _IOWR ('V', 14, compat_int_t)
528 #define VIDIOC_QBUF32 _IOWR ('V', 15, struct v4l2_buffer32)
529 #define VIDIOC_DQBUF32 _IOWR ('V', 17, struct v4l2_buffer32)
530 #define VIDIOC_STREAMON32 _IOW ('V', 18, compat_int_t)
531 #define VIDIOC_STREAMOFF32 _IOW ('V', 19, compat_int_t)
532 #define VIDIOC_ENUMSTD32 _IOWR ('V', 25, struct v4l2_standard32)
533 /* VIDIOC_S_CTRL is now _IOWR, but was _IOW */
534 #define VIDIOC_S_CTRL32 _IOW ('V', 28, struct v4l2_control)
535 #define VIDIOC_G_INPUT32 _IOR ('V', 38, compat_int_t)
536 #define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t)
537 #define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32)
539 #ifdef CONFIG_VIDEO_V4L1_COMPAT
541 MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip)
544 static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg)
546 struct video_window32 __user *up = compat_ptr(arg);
547 struct video_window __user *vw;
548 struct video_clip __user *p;
552 if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32)))
555 if (get_user(nclips, &up->clipcount))
558 /* Peculiar interface... */
560 nclips = VIDEO_CLIPMAP_SIZE;
562 if (nclips > MaxClips)
565 vw = compat_alloc_user_space(sizeof(struct video_window) +
566 nclips * sizeof(struct video_clip));
568 p = nclips ? (struct video_clip __user *)(vw + 1) : NULL;
570 if (get_user(n, &up->x) || put_user(n, &vw->x) ||
571 get_user(n, &up->y) || put_user(n, &vw->y) ||
572 get_user(n, &up->width) || put_user(n, &vw->width) ||
573 get_user(n, &up->height) || put_user(n, &vw->height) ||
574 get_user(n, &up->chromakey) || put_user(n, &vw->chromakey) ||
575 get_user(n, &up->flags) || put_user(n, &vw->flags) ||
576 get_user(n, &up->clipcount) || put_user(n, &vw->clipcount) ||
577 get_user(n, &up->clips) || put_user(p, &vw->clips))
581 struct video_clip32 __user *u = compat_ptr(n);
585 for (i = 0; i < nclips; i++, u++, p++) {
587 if (!access_ok(VERIFY_READ, u, sizeof(struct video_clip32)) ||
588 !access_ok(VERIFY_WRITE, p, sizeof(struct video_clip32)) ||
589 get_user(v, &u->x) ||
590 put_user(v, &p->x) ||
591 get_user(v, &u->y) ||
592 put_user(v, &p->y) ||
593 get_user(v, &u->width) ||
594 put_user(v, &p->width) ||
595 get_user(v, &u->height) ||
596 put_user(v, &p->height) ||
597 put_user(NULL, &p->next))
602 return native_ioctl(file, VIDIOCSWIN, (unsigned long)vw);
606 static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
609 #ifdef CONFIG_VIDEO_V4L1_COMPAT
610 struct video_tuner vt;
611 struct video_buffer vb;
612 struct video_window vw;
613 struct video_code vc;
614 struct video_audio va;
616 struct v4l2_format v2f;
617 struct v4l2_buffer v2b;
618 struct v4l2_framebuffer v2fb;
619 struct v4l2_standard v2s;
620 struct v4l2_input v2i;
621 struct v4l2_tuner v2t;
624 void __user *up = compat_ptr(arg);
625 int compatible_arg = 1;
629 /* First, convert the command. */
631 #ifdef CONFIG_VIDEO_V4L1_COMPAT
632 case VIDIOCGTUNER32: realcmd = cmd = VIDIOCGTUNER; break;
633 case VIDIOCSTUNER32: realcmd = cmd = VIDIOCSTUNER; break;
634 case VIDIOCGWIN32: realcmd = cmd = VIDIOCGWIN; break;
635 case VIDIOCGFBUF32: realcmd = cmd = VIDIOCGFBUF; break;
636 case VIDIOCSFBUF32: realcmd = cmd = VIDIOCSFBUF; break;
637 case VIDIOCGFREQ32: realcmd = cmd = VIDIOCGFREQ; break;
638 case VIDIOCSFREQ32: realcmd = cmd = VIDIOCSFREQ; break;
639 case VIDIOCSMICROCODE32: realcmd = cmd = VIDIOCSMICROCODE; break;
641 case VIDIOC_G_FMT32: realcmd = cmd = VIDIOC_G_FMT; break;
642 case VIDIOC_S_FMT32: realcmd = cmd = VIDIOC_S_FMT; break;
643 case VIDIOC_QUERYBUF32: realcmd = cmd = VIDIOC_QUERYBUF; break;
644 case VIDIOC_QBUF32: realcmd = cmd = VIDIOC_QBUF; break;
645 case VIDIOC_DQBUF32: realcmd = cmd = VIDIOC_DQBUF; break;
646 case VIDIOC_STREAMON32: realcmd = cmd = VIDIOC_STREAMON; break;
647 case VIDIOC_STREAMOFF32: realcmd = cmd = VIDIOC_STREAMOFF; break;
648 case VIDIOC_G_FBUF32: realcmd = cmd = VIDIOC_G_FBUF; break;
649 case VIDIOC_S_FBUF32: realcmd = cmd = VIDIOC_S_FBUF; break;
650 case VIDIOC_OVERLAY32: realcmd = cmd = VIDIOC_OVERLAY; break;
651 case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break;
652 case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break;
653 case VIDIOC_S_CTRL32: realcmd = cmd = VIDIOC_S_CTRL; break;
654 case VIDIOC_G_INPUT32: realcmd = cmd = VIDIOC_G_INPUT; break;
655 case VIDIOC_S_INPUT32: realcmd = cmd = VIDIOC_S_INPUT; break;
656 case VIDIOC_TRY_FMT32: realcmd = cmd = VIDIOC_TRY_FMT; break;
660 #ifdef CONFIG_VIDEO_V4L1_COMPAT
663 err = get_video_tuner32(&karg.vt, up);
669 err = get_video_buffer32(&karg.vb, up);
678 case VIDIOC_STREAMON:
679 case VIDIOC_STREAMOFF:
680 err = get_user(karg.vx, (u32 __user *)up);
685 err = get_v4l2_framebuffer32(&karg.v2fb, up);
692 err = get_v4l2_format32(&karg.v2f, up);
696 case VIDIOC_QUERYBUF:
699 err = get_v4l2_buffer32(&karg.v2b, up);
704 err = get_v4l2_standard(&karg.v2s, up);
708 case VIDIOC_ENUMSTD32:
709 err = get_v4l2_standard32(&karg.v2s, up);
713 case VIDIOC_ENUMINPUT:
714 err = get_v4l2_input(&karg.v2i, up);
718 case VIDIOC_ENUMINPUT32:
719 err = get_v4l2_input32(&karg.v2i, up);
725 err = get_v4l2_tuner(&karg.v2t, up);
729 #ifdef CONFIG_VIDEO_V4L1_COMPAT
738 #ifdef CONFIG_VIDEO_V4L1_COMPAT
739 case VIDIOCSMICROCODE:
740 err = microcode32(&karg.vc, up);
749 err = native_ioctl(file, realcmd, (unsigned long)up);
751 mm_segment_t old_fs = get_fs();
754 err = native_ioctl(file, realcmd, (unsigned long)&karg);
759 #ifdef CONFIG_VIDEO_V4L1_COMPAT
761 err = put_video_tuner32(&karg.vt, up);
765 err = put_video_window32(&karg.vw, up);
769 err = put_video_buffer32(&karg.vb, up);
774 err = put_v4l2_framebuffer32(&karg.v2fb, up);
780 err = put_v4l2_format32(&karg.v2f, up);
783 case VIDIOC_QUERYBUF:
786 err = put_v4l2_buffer32(&karg.v2b, up);
790 err = put_v4l2_standard(&karg.v2s, up);
793 case VIDIOC_ENUMSTD32:
794 err = put_v4l2_standard32(&karg.v2s, up);
799 err = put_v4l2_tuner(&karg.v2t, up);
802 case VIDIOC_ENUMINPUT:
803 err = put_v4l2_input(&karg.v2i, up);
806 case VIDIOC_ENUMINPUT32:
807 err = put_v4l2_input32(&karg.v2i, up);
810 #ifdef CONFIG_VIDEO_V4L1_COMPAT
814 err = put_user(((u32)karg.vx), (u32 __user *)up);
822 long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
824 int ret = -ENOIOCTLCMD;
826 if (!file->f_op->ioctl && !file->f_op->unlocked_ioctl)
830 #ifdef CONFIG_VIDEO_V4L1_COMPAT
832 ret = do_set_window(file, cmd, arg);
846 case VIDIOC_QUERYCAP:
847 case VIDIOC_ENUM_FMT:
853 case VIDIOC_QUERYBUF32:
854 case VIDIOC_G_FBUF32:
855 case VIDIOC_S_FBUF32:
856 case VIDIOC_OVERLAY32:
859 case VIDIOC_STREAMON32:
860 case VIDIOC_STREAMOFF32:
868 case VIDIOC_ENUMSTD32:
869 case VIDIOC_ENUMINPUT:
870 case VIDIOC_ENUMINPUT32:
873 case VIDIOC_S_CTRL32:
874 case VIDIOC_S_FREQUENCY:
875 case VIDIOC_G_FREQUENCY:
876 case VIDIOC_QUERYCTRL:
877 case VIDIOC_G_INPUT32:
878 case VIDIOC_S_INPUT32:
879 case VIDIOC_TRY_FMT32:
880 case VIDIOC_S_HW_FREQ_SEEK:
881 case VIDIOC_ENUM_FRAMESIZES:
882 case VIDIOC_ENUM_FRAMEINTERVALS:
883 ret = do_video_ioctl(file, cmd, arg);
886 #ifdef CONFIG_VIDEO_V4L1_COMPAT
887 /* Little v, the video4linux ioctls (conflict?) */
902 /* BTTV specific... */
903 case _IOW('v', BASE_VIDIOCPRIVATE+0, char [256]):
904 case _IOR('v', BASE_VIDIOCPRIVATE+1, char [256]):
905 case _IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int):
906 case _IOW('v' , BASE_VIDIOCPRIVATE+3, char [16]): /* struct bttv_pll_info */
907 case _IOR('v' , BASE_VIDIOCPRIVATE+4, int):
908 case _IOR('v' , BASE_VIDIOCPRIVATE+5, int):
909 case _IOR('v' , BASE_VIDIOCPRIVATE+6, int):
910 case _IOR('v' , BASE_VIDIOCPRIVATE+7, int):
911 ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
915 v4l_print_ioctl("compat_ioctl32", cmd);
920 long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
925 EXPORT_SYMBOL_GPL(v4l_compat_ioctl32);
927 MODULE_LICENSE("GPL");