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-common.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))
61 struct video_buffer32 {
63 compat_int_t height, width, depth, bytesperline;
66 static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
70 if (!access_ok(VERIFY_READ, up, sizeof(struct video_buffer32)) ||
71 get_user(tmp, &up->base) ||
72 get_user(kp->height, &up->height) ||
73 get_user(kp->width, &up->width) ||
74 get_user(kp->depth, &up->depth) ||
75 get_user(kp->bytesperline, &up->bytesperline))
78 /* This is actually a physical address stored
81 kp->base = (void *)(unsigned long) tmp;
86 static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
88 u32 tmp = (u32)((unsigned long)kp->base);
90 if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_buffer32)) ||
91 put_user(tmp, &up->base) ||
92 put_user(kp->height, &up->height) ||
93 put_user(kp->width, &up->width) ||
94 put_user(kp->depth, &up->depth) ||
95 put_user(kp->bytesperline, &up->bytesperline))
100 struct video_clip32 {
101 s32 x, y, width, height; /* Its really s32 in videodev.h */
105 struct video_window32 {
106 u32 x, y, width, height, chromakey, flags;
107 compat_caddr_t clips;
108 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 #ifdef CONFIG_VIDEO_V4L1_COMPAT
129 /* You get back everything except the clips... */
130 static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
132 if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) ||
133 put_user(kp->x, &up->x) ||
134 put_user(kp->y, &up->y) ||
135 put_user(kp->width, &up->width) ||
136 put_user(kp->height, &up->height) ||
137 put_user(kp->chromakey, &up->chromakey) ||
138 put_user(kp->flags, &up->flags) ||
139 put_user(kp->clipcount, &up->clipcount))
154 enum v4l2_field field;
156 compat_caddr_t clips; /* actually struct v4l2_clip32 * */
158 compat_caddr_t bitmap;
161 static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
163 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_window32)) ||
164 copy_from_user(&kp->w, &up->w, sizeof(up->w)) ||
165 get_user(kp->field, &up->field) ||
166 get_user(kp->chromakey, &up->chromakey) ||
167 get_user(kp->clipcount, &up->clipcount))
169 if (kp->clipcount > 2048)
172 struct v4l2_clip32 __user *uclips;
173 struct v4l2_clip __user *kclips;
174 int n = kp->clipcount;
177 if (get_user(p, &up->clips))
179 uclips = compat_ptr(p);
180 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip));
183 if (copy_in_user(&kclips->c, &uclips->c, sizeof(uclips->c)))
185 if (put_user(n ? kclips + 1 : NULL, &kclips->next))
195 static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
197 if (copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
198 put_user(kp->field, &up->field) ||
199 put_user(kp->chromakey, &up->chromakey) ||
200 put_user(kp->clipcount, &up->clipcount))
205 static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
207 if (copy_from_user(kp, up, sizeof(struct v4l2_pix_format)))
212 static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
214 if (copy_to_user(up, kp, sizeof(struct v4l2_pix_format)))
219 static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
221 if (copy_from_user(kp, up, sizeof(struct v4l2_vbi_format)))
226 static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
228 if (copy_to_user(up, kp, sizeof(struct v4l2_vbi_format)))
235 enum v4l2_buf_type type;
238 struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE
239 struct v4l2_window32 win; // V4L2_BUF_TYPE_VIDEO_OVERLAY
240 struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE
241 __u8 raw_data[200]; // user-defined
245 static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
247 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_format32)) ||
248 get_user(kp->type, &up->type))
251 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
252 return get_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix);
253 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
254 return get_v4l2_window32(&kp->fmt.win, &up->fmt.win);
255 case V4L2_BUF_TYPE_VBI_CAPTURE:
256 return get_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi);
258 printk("compat_ioctl : unexpected VIDIOC_FMT type %d\n",
264 static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
266 if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)) ||
267 put_user(kp->type, &up->type))
270 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
271 return put_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix);
272 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
273 return put_v4l2_window32(&kp->fmt.win, &up->fmt.win);
274 case V4L2_BUF_TYPE_VBI_CAPTURE:
275 return put_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi);
281 static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
283 if (copy_from_user(kp, up, sizeof(struct v4l2_standard)))
289 static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
291 if (copy_to_user(up, kp, sizeof(struct v4l2_standard)))
296 struct v4l2_standard32
299 __u32 id[2]; /* __u64 would get the alignment wrong */
301 struct v4l2_fract frameperiod; /* Frames, not fields */
306 static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
308 /* other fields are not set by the user, nor used by the driver */
309 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard32)) ||
310 get_user(kp->index, &up->index))
315 static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
317 if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) ||
318 put_user(kp->index, &up->index) ||
319 copy_to_user(up->id, &kp->id, sizeof(__u64)) ||
320 copy_to_user(up->name, kp->name, 24) ||
321 copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) ||
322 put_user(kp->framelines, &up->framelines) ||
323 copy_to_user(up->reserved, kp->reserved, 4 * sizeof(__u32)))
328 static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
330 if (copy_from_user(kp, up, sizeof(struct v4l2_tuner)))
336 static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
338 if (copy_to_user(up, kp, sizeof(struct v4l2_tuner)))
346 enum v4l2_buf_type type;
349 enum v4l2_field field;
350 struct compat_timeval timestamp;
351 struct v4l2_timecode timecode;
354 /* memory location */
355 enum v4l2_memory memory;
358 compat_long_t userptr;
365 static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user *up)
368 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_buffer32)) ||
369 get_user(kp->index, &up->index) ||
370 get_user(kp->type, &up->type) ||
371 get_user(kp->flags, &up->flags) ||
372 get_user(kp->memory, &up->memory) ||
373 get_user(kp->input, &up->input))
376 case V4L2_MEMORY_MMAP:
378 case V4L2_MEMORY_USERPTR:
382 if (get_user(kp->length, &up->length) ||
383 get_user(tmp, &up->m.userptr))
386 kp->m.userptr = (unsigned long)compat_ptr(tmp);
389 case V4L2_MEMORY_OVERLAY:
390 if(get_user(kp->m.offset, &up->m.offset))
397 static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user *up)
399 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_buffer32)) ||
400 put_user(kp->index, &up->index) ||
401 put_user(kp->type, &up->type) ||
402 put_user(kp->flags, &up->flags) ||
403 put_user(kp->memory, &up->memory) ||
404 put_user(kp->input, &up->input))
407 case V4L2_MEMORY_MMAP:
408 if (put_user(kp->length, &up->length) ||
409 put_user(kp->m.offset, &up->m.offset))
412 case V4L2_MEMORY_USERPTR:
413 if (put_user(kp->length, &up->length) ||
414 put_user(kp->m.userptr, &up->m.userptr))
417 case V4L2_MEMORY_OVERLAY:
418 if (put_user(kp->m.offset, &up->m.offset))
422 if (put_user(kp->bytesused, &up->bytesused) ||
423 put_user(kp->field, &up->field) ||
424 put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) ||
425 put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) ||
426 copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) ||
427 put_user(kp->sequence, &up->sequence) ||
428 put_user(kp->reserved, &up->reserved))
433 struct v4l2_framebuffer32
438 struct v4l2_pix_format fmt;
441 static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_framebuffer32 __user *up)
445 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_framebuffer32)) ||
446 get_user(tmp, &up->base) ||
447 get_user(kp->capability, &up->capability) ||
448 get_user(kp->flags, &up->flags))
450 kp->base = compat_ptr(tmp);
451 get_v4l2_pix_format(&kp->fmt, &up->fmt);
455 static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_framebuffer32 __user *up)
457 u32 tmp = (u32)((unsigned long)kp->base);
459 if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) ||
460 put_user(tmp, &up->base) ||
461 put_user(kp->capability, &up->capability) ||
462 put_user(kp->flags, &up->flags))
464 put_v4l2_pix_format(&kp->fmt, &up->fmt);
468 static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
470 if (copy_from_user(kp, up, sizeof(struct v4l2_input) - 4))
475 static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
477 if (copy_to_user(up, kp, sizeof(struct v4l2_input) - 4))
482 static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
484 if (copy_from_user(kp, up, sizeof(struct v4l2_input)))
489 static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
491 if (copy_to_user(up, kp, sizeof(struct v4l2_input)))
496 #ifdef CONFIG_VIDEO_V4L1_COMPAT
499 char loadwhat[16]; /* name or tag of file being passed */
500 compat_int_t datasize;
504 static inline int microcode32(struct video_code *kp, struct video_code32 __user *up)
506 if(!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) ||
507 copy_from_user(kp->loadwhat, up->loadwhat, sizeof (up->loadwhat)) ||
508 get_user(kp->datasize, &up->datasize) ||
509 copy_from_user(kp->data, up->data, up->datasize))
514 #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32)
515 #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32)
516 #define VIDIOCGWIN32 _IOR('v',9, struct video_window32)
517 #define VIDIOCSWIN32 _IOW('v',10, struct video_window32)
518 #define VIDIOCGFBUF32 _IOR('v',11, struct video_buffer32)
519 #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32)
520 #define VIDIOCGFREQ32 _IOR('v',14, u32)
521 #define VIDIOCSFREQ32 _IOW('v',15, u32)
522 #define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32)
526 /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */
527 #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4)
528 #define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32)
529 #define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32)
530 #define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32)
531 #define VIDIOC_G_FBUF32 _IOR ('V', 10, struct v4l2_framebuffer32)
532 #define VIDIOC_S_FBUF32 _IOW ('V', 11, struct v4l2_framebuffer32)
533 /* VIDIOC_OVERLAY is now _IOW, but was _IOWR */
534 #define VIDIOC_OVERLAY32 _IOWR ('V', 14, compat_int_t)
535 #define VIDIOC_QBUF32 _IOWR ('V', 15, struct v4l2_buffer32)
536 #define VIDIOC_DQBUF32 _IOWR ('V', 17, struct v4l2_buffer32)
537 #define VIDIOC_STREAMON32 _IOW ('V', 18, compat_int_t)
538 #define VIDIOC_STREAMOFF32 _IOW ('V', 19, compat_int_t)
539 #define VIDIOC_ENUMSTD32 _IOWR ('V', 25, struct v4l2_standard32)
540 /* VIDIOC_S_CTRL is now _IOWR, but was _IOW */
541 #define VIDIOC_S_CTRL32 _IOW ('V', 28, struct v4l2_control)
542 #define VIDIOC_G_INPUT32 _IOR ('V', 38, compat_int_t)
543 #define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t)
544 #define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32)
546 #ifdef CONFIG_VIDEO_V4L1_COMPAT
548 MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip)
551 static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg)
553 struct video_window32 __user *up = compat_ptr(arg);
554 struct video_window __user *vw;
555 struct video_clip __user *p;
559 if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32)))
562 if (get_user(nclips, &up->clipcount))
565 /* Peculiar interface... */
567 nclips = VIDEO_CLIPMAP_SIZE;
569 if (nclips > MaxClips)
572 vw = compat_alloc_user_space(sizeof(struct video_window) +
573 nclips * sizeof(struct video_clip));
575 p = nclips ? (struct video_clip __user *)(vw + 1) : NULL;
577 if (get_user(n, &up->x) || put_user(n, &vw->x) ||
578 get_user(n, &up->y) || put_user(n, &vw->y) ||
579 get_user(n, &up->width) || put_user(n, &vw->width) ||
580 get_user(n, &up->height) || put_user(n, &vw->height) ||
581 get_user(n, &up->chromakey) || put_user(n, &vw->chromakey) ||
582 get_user(n, &up->flags) || put_user(n, &vw->flags) ||
583 get_user(n, &up->clipcount) || put_user(n, &vw->clipcount) ||
584 get_user(n, &up->clips) || put_user(p, &vw->clips))
588 struct video_clip32 __user *u = compat_ptr(n);
592 for (i = 0; i < nclips; i++, u++, p++) {
594 if (!access_ok(VERIFY_READ, u, sizeof(struct video_clip32)) ||
595 !access_ok(VERIFY_WRITE, p, sizeof(struct video_clip32)) ||
596 get_user(v, &u->x) ||
597 put_user(v, &p->x) ||
598 get_user(v, &u->y) ||
599 put_user(v, &p->y) ||
600 get_user(v, &u->width) ||
601 put_user(v, &p->width) ||
602 get_user(v, &u->height) ||
603 put_user(v, &p->height) ||
604 put_user(NULL, &p->next))
609 return native_ioctl(file, VIDIOCSWIN, (unsigned long)vw);
613 static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
616 #ifdef CONFIG_VIDEO_V4L1_COMPAT
617 struct video_tuner vt;
618 struct video_buffer vb;
619 struct video_window vw;
620 struct video_code vc;
622 struct v4l2_format v2f;
623 struct v4l2_buffer v2b;
624 struct v4l2_framebuffer v2fb;
625 struct v4l2_standard v2s;
626 struct v4l2_input v2i;
627 struct v4l2_tuner v2t;
630 void __user *up = compat_ptr(arg);
631 int compatible_arg = 1;
635 /* First, convert the command. */
637 #ifdef CONFIG_VIDEO_V4L1_COMPAT
638 case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break;
639 case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break;
640 case VIDIOCGWIN32: cmd = VIDIOCGWIN; break;
641 case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break;
642 case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break;
643 case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break;
644 case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break;
645 case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break;
647 case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break;
648 case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break;
649 case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break;
650 case VIDIOC_QBUF32: cmd = VIDIOC_QBUF; break;
651 case VIDIOC_DQBUF32: cmd = VIDIOC_DQBUF; break;
652 case VIDIOC_STREAMON32: cmd = VIDIOC_STREAMON; break;
653 case VIDIOC_STREAMOFF32: cmd = VIDIOC_STREAMOFF; break;
654 case VIDIOC_G_FBUF32: cmd = VIDIOC_G_FBUF; break;
655 case VIDIOC_S_FBUF32: cmd = VIDIOC_S_FBUF; break;
656 case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break;
657 case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break;
658 case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break;
659 case VIDIOC_S_CTRL32: cmd = VIDIOC_S_CTRL; break;
660 case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break;
661 case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break;
662 case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break;
666 #ifdef CONFIG_VIDEO_V4L1_COMPAT
669 err = get_video_tuner32(&karg.vt, up);
675 err = get_video_buffer32(&karg.vb, up);
683 case VIDIOC_STREAMON:
684 case VIDIOC_STREAMOFF:
685 err = get_user(karg.vx, (u32 __user *)up);
690 err = get_v4l2_framebuffer32(&karg.v2fb, up);
697 err = get_v4l2_format32(&karg.v2f, up);
701 case VIDIOC_QUERYBUF:
704 err = get_v4l2_buffer32(&karg.v2b, up);
709 err = get_v4l2_standard(&karg.v2s, up);
713 case VIDIOC_ENUMSTD32:
714 err = get_v4l2_standard32(&karg.v2s, up);
718 case VIDIOC_ENUMINPUT:
719 err = get_v4l2_input(&karg.v2i, up);
723 case VIDIOC_ENUMINPUT32:
724 err = get_v4l2_input32(&karg.v2i, up);
730 err = get_v4l2_tuner(&karg.v2t, up);
734 #ifdef CONFIG_VIDEO_V4L1_COMPAT
742 #ifdef CONFIG_VIDEO_V4L1_COMPAT
743 case VIDIOCSMICROCODE:
744 err = microcode32(&karg.vc, up);
753 err = native_ioctl(file, realcmd, (unsigned long)up);
755 mm_segment_t old_fs = get_fs();
758 err = native_ioctl(file, realcmd, (unsigned long)&karg);
763 #ifdef CONFIG_VIDEO_V4L1_COMPAT
765 err = put_video_tuner32(&karg.vt, up);
769 err = put_video_window32(&karg.vw, up);
773 err = put_video_buffer32(&karg.vb, up);
777 err = put_v4l2_framebuffer32(&karg.v2fb, up);
783 err = put_v4l2_format32(&karg.v2f, up);
786 case VIDIOC_QUERYBUF:
789 err = put_v4l2_buffer32(&karg.v2b, up);
793 err = put_v4l2_standard(&karg.v2s, up);
796 case VIDIOC_ENUMSTD32:
797 err = put_v4l2_standard32(&karg.v2s, up);
802 err = put_v4l2_tuner(&karg.v2t, up);
805 case VIDIOC_ENUMINPUT:
806 err = put_v4l2_input(&karg.v2i, up);
809 case VIDIOC_ENUMINPUT32:
810 err = put_v4l2_input32(&karg.v2i, up);
813 #ifdef CONFIG_VIDEO_V4L1_COMPAT
817 err = put_user(((u32)karg.vx), (u32 __user *)up);
825 long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
827 int ret = -ENOIOCTLCMD;
829 if (!file->f_op->ioctl)
833 #ifdef CONFIG_VIDEO_V4L1_COMPAT
835 ret = do_set_window(file, cmd, arg);
845 case VIDIOC_QUERYCAP:
846 case VIDIOC_ENUM_FMT:
850 case VIDIOC_QUERYBUF32:
851 case VIDIOC_G_FBUF32:
852 case VIDIOC_S_FBUF32:
853 case VIDIOC_OVERLAY32:
856 case VIDIOC_STREAMON32:
857 case VIDIOC_STREAMOFF32:
864 case VIDIOC_ENUMSTD32:
865 case VIDIOC_ENUMINPUT:
866 case VIDIOC_ENUMINPUT32:
868 case VIDIOC_S_CTRL32:
869 case VIDIOC_QUERYCTRL:
870 case VIDIOC_G_INPUT32:
871 case VIDIOC_S_INPUT32:
872 case VIDIOC_TRY_FMT32:
873 ret = do_video_ioctl(file, cmd, arg);
876 #ifdef CONFIG_VIDEO_V4L1_COMPAT
877 /* Little v, the video4linux ioctls (conflict?) */
894 /* BTTV specific... */
895 case _IOW('v', BASE_VIDIOCPRIVATE+0, char [256]):
896 case _IOR('v', BASE_VIDIOCPRIVATE+1, char [256]):
897 case _IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int):
898 case _IOW('v' , BASE_VIDIOCPRIVATE+3, char [16]): /* struct bttv_pll_info */
899 case _IOR('v' , BASE_VIDIOCPRIVATE+4, int):
900 case _IOR('v' , BASE_VIDIOCPRIVATE+5, int):
901 case _IOR('v' , BASE_VIDIOCPRIVATE+6, int):
902 case _IOR('v' , BASE_VIDIOCPRIVATE+7, int):
903 ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
907 v4l_print_ioctl("compat_ioctl32", cmd);
912 long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
917 EXPORT_SYMBOL_GPL(v4l_compat_ioctl32);
919 MODULE_LICENSE("GPL");