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))
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))
155 enum v4l2_field field;
157 compat_caddr_t clips; /* actually struct v4l2_clip32 * */
159 compat_caddr_t bitmap;
162 static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
164 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_window32)) ||
165 copy_from_user(&kp->w, &up->w, sizeof(up->w)) ||
166 get_user(kp->field, &up->field) ||
167 get_user(kp->chromakey, &up->chromakey) ||
168 get_user(kp->clipcount, &up->clipcount))
170 if (kp->clipcount > 2048)
173 struct v4l2_clip32 __user *uclips;
174 struct v4l2_clip __user *kclips;
175 int n = kp->clipcount;
178 if (get_user(p, &up->clips))
180 uclips = compat_ptr(p);
181 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip));
184 if (copy_in_user(&kclips->c, &uclips->c, sizeof(uclips->c)))
186 if (put_user(n ? kclips + 1 : NULL, &kclips->next))
196 static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
198 if (copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
199 put_user(kp->field, &up->field) ||
200 put_user(kp->chromakey, &up->chromakey) ||
201 put_user(kp->clipcount, &up->clipcount))
206 static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
208 if (copy_from_user(kp, up, sizeof(struct v4l2_pix_format)))
213 static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
215 if (copy_to_user(up, kp, sizeof(struct v4l2_pix_format)))
220 static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
222 if (copy_from_user(kp, up, sizeof(struct v4l2_vbi_format)))
227 static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
229 if (copy_to_user(up, kp, sizeof(struct v4l2_vbi_format)))
236 enum v4l2_buf_type type;
239 struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE
240 struct v4l2_window32 win; // V4L2_BUF_TYPE_VIDEO_OVERLAY
241 struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE
242 __u8 raw_data[200]; // user-defined
246 static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
248 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_format32)) ||
249 get_user(kp->type, &up->type))
252 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
253 return get_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix);
254 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
255 return get_v4l2_window32(&kp->fmt.win, &up->fmt.win);
256 case V4L2_BUF_TYPE_VBI_CAPTURE:
257 return get_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi);
259 printk("compat_ioctl : unexpected VIDIOC_FMT type %d\n",
265 static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
267 if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)) ||
268 put_user(kp->type, &up->type))
271 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
272 return put_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix);
273 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
274 return put_v4l2_window32(&kp->fmt.win, &up->fmt.win);
275 case V4L2_BUF_TYPE_VBI_CAPTURE:
276 return put_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi);
282 static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
284 if (copy_from_user(kp, up, sizeof(struct v4l2_standard)))
290 static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
292 if (copy_to_user(up, kp, sizeof(struct v4l2_standard)))
297 struct v4l2_standard32
300 __u32 id[2]; /* __u64 would get the alignment wrong */
302 struct v4l2_fract frameperiod; /* Frames, not fields */
307 static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
309 /* other fields are not set by the user, nor used by the driver */
310 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard32)) ||
311 get_user(kp->index, &up->index))
316 static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
318 if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) ||
319 put_user(kp->index, &up->index) ||
320 copy_to_user(up->id, &kp->id, sizeof(__u64)) ||
321 copy_to_user(up->name, kp->name, 24) ||
322 copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) ||
323 put_user(kp->framelines, &up->framelines) ||
324 copy_to_user(up->reserved, kp->reserved, 4 * sizeof(__u32)))
329 static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
331 if (copy_from_user(kp, up, sizeof(struct v4l2_tuner)))
337 static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
339 if (copy_to_user(up, kp, sizeof(struct v4l2_tuner)))
347 enum v4l2_buf_type type;
350 enum v4l2_field field;
351 struct compat_timeval timestamp;
352 struct v4l2_timecode timecode;
355 /* memory location */
356 enum v4l2_memory memory;
359 compat_long_t userptr;
366 static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user *up)
369 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_buffer32)) ||
370 get_user(kp->index, &up->index) ||
371 get_user(kp->type, &up->type) ||
372 get_user(kp->flags, &up->flags) ||
373 get_user(kp->memory, &up->memory) ||
374 get_user(kp->input, &up->input))
377 case V4L2_MEMORY_MMAP:
379 case V4L2_MEMORY_USERPTR:
383 if (get_user(kp->length, &up->length) ||
384 get_user(tmp, &up->m.userptr))
387 kp->m.userptr = (unsigned long)compat_ptr(tmp);
390 case V4L2_MEMORY_OVERLAY:
391 if(get_user(kp->m.offset, &up->m.offset))
398 static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user *up)
400 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_buffer32)) ||
401 put_user(kp->index, &up->index) ||
402 put_user(kp->type, &up->type) ||
403 put_user(kp->flags, &up->flags) ||
404 put_user(kp->memory, &up->memory) ||
405 put_user(kp->input, &up->input))
408 case V4L2_MEMORY_MMAP:
409 if (put_user(kp->length, &up->length) ||
410 put_user(kp->m.offset, &up->m.offset))
413 case V4L2_MEMORY_USERPTR:
414 if (put_user(kp->length, &up->length) ||
415 put_user(kp->m.userptr, &up->m.userptr))
418 case V4L2_MEMORY_OVERLAY:
419 if (put_user(kp->m.offset, &up->m.offset))
423 if (put_user(kp->bytesused, &up->bytesused) ||
424 put_user(kp->field, &up->field) ||
425 put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) ||
426 put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) ||
427 copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) ||
428 put_user(kp->sequence, &up->sequence) ||
429 put_user(kp->reserved, &up->reserved))
434 struct v4l2_framebuffer32
439 struct v4l2_pix_format fmt;
442 static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_framebuffer32 __user *up)
446 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_framebuffer32)) ||
447 get_user(tmp, &up->base) ||
448 get_user(kp->capability, &up->capability) ||
449 get_user(kp->flags, &up->flags))
451 kp->base = compat_ptr(tmp);
452 get_v4l2_pix_format(&kp->fmt, &up->fmt);
456 static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_framebuffer32 __user *up)
458 u32 tmp = (u32)((unsigned long)kp->base);
460 if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) ||
461 put_user(tmp, &up->base) ||
462 put_user(kp->capability, &up->capability) ||
463 put_user(kp->flags, &up->flags))
465 put_v4l2_pix_format(&kp->fmt, &up->fmt);
469 static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
471 if (copy_from_user(kp, up, sizeof(struct v4l2_input) - 4))
476 static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
478 if (copy_to_user(up, kp, sizeof(struct v4l2_input) - 4))
483 static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
485 if (copy_from_user(kp, up, sizeof(struct v4l2_input)))
490 static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
492 if (copy_to_user(up, kp, sizeof(struct v4l2_input)))
497 #ifdef CONFIG_VIDEO_V4L1_COMPAT
500 char loadwhat[16]; /* name or tag of file being passed */
501 compat_int_t datasize;
505 static inline int microcode32(struct video_code *kp, struct video_code32 __user *up)
507 if(!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) ||
508 copy_from_user(kp->loadwhat, up->loadwhat, sizeof (up->loadwhat)) ||
509 get_user(kp->datasize, &up->datasize) ||
510 copy_from_user(kp->data, up->data, up->datasize))
515 #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32)
516 #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32)
517 #define VIDIOCGWIN32 _IOR('v',9, struct video_window32)
518 #define VIDIOCSWIN32 _IOW('v',10, struct video_window32)
519 #define VIDIOCGFBUF32 _IOR('v',11, struct video_buffer32)
520 #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32)
521 #define VIDIOCGFREQ32 _IOR('v',14, u32)
522 #define VIDIOCSFREQ32 _IOW('v',15, u32)
523 #define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32)
527 /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */
528 #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4)
529 #define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32)
530 #define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32)
531 #define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32)
532 #define VIDIOC_G_FBUF32 _IOR ('V', 10, struct v4l2_framebuffer32)
533 #define VIDIOC_S_FBUF32 _IOW ('V', 11, struct v4l2_framebuffer32)
534 /* VIDIOC_OVERLAY is now _IOW, but was _IOWR */
535 #define VIDIOC_OVERLAY32 _IOWR ('V', 14, compat_int_t)
536 #define VIDIOC_QBUF32 _IOWR ('V', 15, struct v4l2_buffer32)
537 #define VIDIOC_DQBUF32 _IOWR ('V', 17, struct v4l2_buffer32)
538 #define VIDIOC_STREAMON32 _IOW ('V', 18, compat_int_t)
539 #define VIDIOC_STREAMOFF32 _IOW ('V', 19, compat_int_t)
540 #define VIDIOC_ENUMSTD32 _IOWR ('V', 25, struct v4l2_standard32)
541 /* VIDIOC_S_CTRL is now _IOWR, but was _IOW */
542 #define VIDIOC_S_CTRL32 _IOW ('V', 28, struct v4l2_control)
543 #define VIDIOC_G_INPUT32 _IOR ('V', 38, compat_int_t)
544 #define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t)
545 #define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32)
547 #ifdef CONFIG_VIDEO_V4L1_COMPAT
549 MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip)
552 static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg)
554 struct video_window32 __user *up = compat_ptr(arg);
555 struct video_window __user *vw;
556 struct video_clip __user *p;
560 if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32)))
563 if (get_user(nclips, &up->clipcount))
566 /* Peculiar interface... */
568 nclips = VIDEO_CLIPMAP_SIZE;
570 if (nclips > MaxClips)
573 vw = compat_alloc_user_space(sizeof(struct video_window) +
574 nclips * sizeof(struct video_clip));
576 p = nclips ? (struct video_clip __user *)(vw + 1) : NULL;
578 if (get_user(n, &up->x) || put_user(n, &vw->x) ||
579 get_user(n, &up->y) || put_user(n, &vw->y) ||
580 get_user(n, &up->width) || put_user(n, &vw->width) ||
581 get_user(n, &up->height) || put_user(n, &vw->height) ||
582 get_user(n, &up->chromakey) || put_user(n, &vw->chromakey) ||
583 get_user(n, &up->flags) || put_user(n, &vw->flags) ||
584 get_user(n, &up->clipcount) || put_user(n, &vw->clipcount) ||
585 get_user(n, &up->clips) || put_user(p, &vw->clips))
589 struct video_clip32 __user *u = compat_ptr(n);
593 for (i = 0; i < nclips; i++, u++, p++) {
595 if (!access_ok(VERIFY_READ, u, sizeof(struct video_clip32)) ||
596 !access_ok(VERIFY_WRITE, p, sizeof(struct video_clip32)) ||
597 get_user(v, &u->x) ||
598 put_user(v, &p->x) ||
599 get_user(v, &u->y) ||
600 put_user(v, &p->y) ||
601 get_user(v, &u->width) ||
602 put_user(v, &p->width) ||
603 get_user(v, &u->height) ||
604 put_user(v, &p->height) ||
605 put_user(NULL, &p->next))
610 return native_ioctl(file, VIDIOCSWIN, (unsigned long)vw);
614 static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
617 #ifdef CONFIG_VIDEO_V4L1_COMPAT
618 struct video_tuner vt;
619 struct video_buffer vb;
620 struct video_window vw;
621 struct video_code vc;
622 struct video_audio va;
624 struct v4l2_format v2f;
625 struct v4l2_buffer v2b;
626 struct v4l2_framebuffer v2fb;
627 struct v4l2_standard v2s;
628 struct v4l2_input v2i;
629 struct v4l2_tuner v2t;
632 void __user *up = compat_ptr(arg);
633 int compatible_arg = 1;
637 /* First, convert the command. */
639 #ifdef CONFIG_VIDEO_V4L1_COMPAT
640 case VIDIOCGTUNER32: realcmd = cmd = VIDIOCGTUNER; break;
641 case VIDIOCSTUNER32: realcmd = cmd = VIDIOCSTUNER; break;
642 case VIDIOCGWIN32: realcmd = cmd = VIDIOCGWIN; break;
643 case VIDIOCGFBUF32: realcmd = cmd = VIDIOCGFBUF; break;
644 case VIDIOCSFBUF32: realcmd = cmd = VIDIOCSFBUF; break;
645 case VIDIOCGFREQ32: realcmd = cmd = VIDIOCGFREQ; break;
646 case VIDIOCSFREQ32: realcmd = cmd = VIDIOCSFREQ; break;
647 case VIDIOCSMICROCODE32: realcmd = cmd = VIDIOCSMICROCODE; break;
649 case VIDIOC_G_FMT32: realcmd = cmd = VIDIOC_G_FMT; break;
650 case VIDIOC_S_FMT32: realcmd = cmd = VIDIOC_S_FMT; break;
651 case VIDIOC_QUERYBUF32: realcmd = cmd = VIDIOC_QUERYBUF; break;
652 case VIDIOC_QBUF32: realcmd = cmd = VIDIOC_QBUF; break;
653 case VIDIOC_DQBUF32: realcmd = cmd = VIDIOC_DQBUF; break;
654 case VIDIOC_STREAMON32: realcmd = cmd = VIDIOC_STREAMON; break;
655 case VIDIOC_STREAMOFF32: realcmd = cmd = VIDIOC_STREAMOFF; break;
656 case VIDIOC_G_FBUF32: realcmd = cmd = VIDIOC_G_FBUF; break;
657 case VIDIOC_S_FBUF32: realcmd = cmd = VIDIOC_S_FBUF; break;
658 case VIDIOC_OVERLAY32: realcmd = cmd = VIDIOC_OVERLAY; break;
659 case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break;
660 case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break;
661 case VIDIOC_S_CTRL32: realcmd = cmd = VIDIOC_S_CTRL; break;
662 case VIDIOC_G_INPUT32: realcmd = cmd = VIDIOC_G_INPUT; break;
663 case VIDIOC_S_INPUT32: realcmd = cmd = VIDIOC_S_INPUT; break;
664 case VIDIOC_TRY_FMT32: realcmd = cmd = VIDIOC_TRY_FMT; break;
668 #ifdef CONFIG_VIDEO_V4L1_COMPAT
671 err = get_video_tuner32(&karg.vt, up);
677 err = get_video_buffer32(&karg.vb, up);
686 case VIDIOC_STREAMON:
687 case VIDIOC_STREAMOFF:
688 err = get_user(karg.vx, (u32 __user *)up);
693 err = get_v4l2_framebuffer32(&karg.v2fb, up);
700 err = get_v4l2_format32(&karg.v2f, up);
704 case VIDIOC_QUERYBUF:
707 err = get_v4l2_buffer32(&karg.v2b, up);
712 err = get_v4l2_standard(&karg.v2s, up);
716 case VIDIOC_ENUMSTD32:
717 err = get_v4l2_standard32(&karg.v2s, up);
721 case VIDIOC_ENUMINPUT:
722 err = get_v4l2_input(&karg.v2i, up);
726 case VIDIOC_ENUMINPUT32:
727 err = get_v4l2_input32(&karg.v2i, up);
733 err = get_v4l2_tuner(&karg.v2t, up);
737 #ifdef CONFIG_VIDEO_V4L1_COMPAT
746 #ifdef CONFIG_VIDEO_V4L1_COMPAT
747 case VIDIOCSMICROCODE:
748 err = microcode32(&karg.vc, up);
757 err = native_ioctl(file, realcmd, (unsigned long)up);
759 mm_segment_t old_fs = get_fs();
762 err = native_ioctl(file, realcmd, (unsigned long) &karg);
767 #ifdef CONFIG_VIDEO_V4L1_COMPAT
769 err = put_video_tuner32(&karg.vt, up);
773 err = put_video_window32(&karg.vw, up);
777 err = put_video_buffer32(&karg.vb, up);
782 err = put_v4l2_framebuffer32(&karg.v2fb, up);
788 err = put_v4l2_format32(&karg.v2f, up);
791 case VIDIOC_QUERYBUF:
794 err = put_v4l2_buffer32(&karg.v2b, up);
798 err = put_v4l2_standard(&karg.v2s, up);
801 case VIDIOC_ENUMSTD32:
802 err = put_v4l2_standard32(&karg.v2s, up);
807 err = put_v4l2_tuner(&karg.v2t, up);
810 case VIDIOC_ENUMINPUT:
811 err = put_v4l2_input(&karg.v2i, up);
814 case VIDIOC_ENUMINPUT32:
815 err = put_v4l2_input32(&karg.v2i, up);
818 #ifdef CONFIG_VIDEO_V4L1_COMPAT
822 err = put_user(((u32)karg.vx), (u32 __user *)up);
830 long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
832 int ret = -ENOIOCTLCMD;
834 if (!file->f_op->ioctl)
838 #ifdef CONFIG_VIDEO_V4L1_COMPAT
840 ret = do_set_window(file, cmd, arg);
854 case VIDIOC_QUERYCAP:
855 case VIDIOC_ENUM_FMT:
861 case VIDIOC_QUERYBUF32:
862 case VIDIOC_G_FBUF32:
863 case VIDIOC_S_FBUF32:
864 case VIDIOC_OVERLAY32:
867 case VIDIOC_STREAMON32:
868 case VIDIOC_STREAMOFF32:
875 case VIDIOC_ENUMSTD32:
876 case VIDIOC_ENUMINPUT:
877 case VIDIOC_ENUMINPUT32:
880 case VIDIOC_S_CTRL32:
881 case VIDIOC_S_FREQUENCY:
882 case VIDIOC_G_FREQUENCY:
883 case VIDIOC_QUERYCTRL:
884 case VIDIOC_G_INPUT32:
885 case VIDIOC_S_INPUT32:
886 case VIDIOC_TRY_FMT32:
887 case VIDIOC_S_HW_FREQ_SEEK:
888 ret = do_video_ioctl(file, cmd, arg);
891 #ifdef CONFIG_VIDEO_V4L1_COMPAT
892 /* Little v, the video4linux ioctls (conflict?) */
907 /* BTTV specific... */
908 case _IOW('v', BASE_VIDIOCPRIVATE+0, char [256]):
909 case _IOR('v', BASE_VIDIOCPRIVATE+1, char [256]):
910 case _IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int):
911 case _IOW('v' , BASE_VIDIOCPRIVATE+3, char [16]): /* struct bttv_pll_info */
912 case _IOR('v' , BASE_VIDIOCPRIVATE+4, int):
913 case _IOR('v' , BASE_VIDIOCPRIVATE+5, int):
914 case _IOR('v' , BASE_VIDIOCPRIVATE+6, int):
915 case _IOR('v' , BASE_VIDIOCPRIVATE+7, int):
916 ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
920 v4l_print_ioctl("compat_ioctl32", cmd);
925 long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
930 EXPORT_SYMBOL_GPL(v4l_compat_ioctl32);
932 MODULE_LICENSE("GPL");