aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe De Muyter <phdm@macqel.be>2006-01-09 12:25:00 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:25:00 -0500
commit13d133bc66ea78cf2d60c78a41082c87432e0e94 (patch)
treeff0cc26a83656c8f4c570bb057888d1f811a36d2
parentcf664a6458b254ce665d129c0960cff4f32b91f3 (diff)
V4L/DVB (3152): Fixes some troubles at v4l2 compat stuff
- This patch fixes merge and typo problems in v4l2/compat, and fixes VIDIOC_STREAMON, VIDIOC_STREAMOFF & VIDIOC_S_FBUF. Signed-off-by: Philippe De Muyter <phdm@macqel.be> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
-rw-r--r--drivers/media/video/compat_ioctl32.c62
1 files changed, 54 insertions, 8 deletions
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c
index 4b14942dd91c..27945e082195 100644
--- a/drivers/media/video/compat_ioctl32.c
+++ b/drivers/media/video/compat_ioctl32.c
@@ -106,11 +106,11 @@ static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
106{ 106{
107 int ret = -ENOIOCTLCMD; 107 int ret = -ENOIOCTLCMD;
108 108
109 if (file->f_ops->unlocked_ioctl) 109 if (file->f_op->unlocked_ioctl)
110 ret = file->f_ops->unlocked_ioctl(file, cmd, arg); 110 ret = file->f_op->unlocked_ioctl(file, cmd, arg);
111 else if (file->f_ops->ioctl) { 111 else if (file->f_op->ioctl) {
112 lock_kernel(); 112 lock_kernel();
113 ret = file->f_ops->ioctl(file->f_dentry->d_inode, file, cmd, arg); 113 ret = file->f_op->ioctl(file->f_dentry->d_inode, file, cmd, arg);
114 unlock_kernel(); 114 unlock_kernel();
115 } 115 }
116 116
@@ -367,6 +367,19 @@ struct v4l2_framebuffer32
367 struct v4l2_pix_format fmt; 367 struct v4l2_pix_format fmt;
368}; 368};
369 369
370static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_framebuffer32 __user *up)
371{
372 u32 tmp;
373
374 if (get_user(tmp, &up->base))
375 return -EFAULT;
376 kp->base = compat_ptr(tmp);
377 __get_user(kp->capability, &up->capability);
378 __get_user(kp->flags, &up->flags);
379 get_v4l2_pix_format(&kp->fmt, &up->fmt);
380 return 0;
381}
382
370static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_framebuffer32 __user *up) 383static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_framebuffer32 __user *up)
371{ 384{
372 u32 tmp = (u32)((unsigned long)kp->base); 385 u32 tmp = (u32)((unsigned long)kp->base);
@@ -404,6 +417,7 @@ struct v4l2_input32 /* identical layout, but different size */
404#define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32) 417#define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32)
405#define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32) 418#define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32)
406#define VIDIOC_G_FBUF32 _IOR ('V', 10, struct v4l2_framebuffer32) 419#define VIDIOC_G_FBUF32 _IOR ('V', 10, struct v4l2_framebuffer32)
420#define VIDIOC_S_FBUF32 _IOW ('V', 11, struct v4l2_framebuffer32)
407/* VIDIOC_OVERLAY is now _IOW, but was _IOWR */ 421/* VIDIOC_OVERLAY is now _IOW, but was _IOWR */
408#define VIDIOC_OVERLAY32 _IOWR ('V', 14, compat_int_t) 422#define VIDIOC_OVERLAY32 _IOWR ('V', 14, compat_int_t)
409#define VIDIOC_QBUF32 _IOWR ('V', 15, struct v4l2_buffer32) 423#define VIDIOC_QBUF32 _IOWR ('V', 15, struct v4l2_buffer32)
@@ -511,6 +525,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
511 case VIDIOC_STREAMON32: cmd = VIDIOC_STREAMON; break; 525 case VIDIOC_STREAMON32: cmd = VIDIOC_STREAMON; break;
512 case VIDIOC_STREAMOFF32: cmd = VIDIOC_STREAMOFF; break; 526 case VIDIOC_STREAMOFF32: cmd = VIDIOC_STREAMOFF; break;
513 case VIDIOC_G_FBUF32: cmd = VIDIOC_G_FBUF; break; 527 case VIDIOC_G_FBUF32: cmd = VIDIOC_G_FBUF; break;
528 case VIDIOC_S_FBUF32: cmd = VIDIOC_S_FBUF; break;
514 case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break; 529 case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break;
515 case VIDIOC_ENUMSTD32: cmd = VIDIOC_ENUMSTD; break; 530 case VIDIOC_ENUMSTD32: cmd = VIDIOC_ENUMSTD; break;
516 case VIDIOC_ENUMINPUT32: cmd = VIDIOC_ENUMINPUT; break; 531 case VIDIOC_ENUMINPUT32: cmd = VIDIOC_ENUMINPUT; break;
@@ -536,10 +551,16 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
536 case VIDIOCSFREQ: 551 case VIDIOCSFREQ:
537 case VIDIOC_S_INPUT: 552 case VIDIOC_S_INPUT:
538 case VIDIOC_OVERLAY: 553 case VIDIOC_OVERLAY:
554 case VIDIOC_STREAMON:
555 case VIDIOC_STREAMOFF:
539 err = get_user(karg.vx, (u32 __user *)up); 556 err = get_user(karg.vx, (u32 __user *)up);
540 compatible_arg = 0; 557 compatible_arg = 0;
541 break; 558 break;
542 }; 559
560 case VIDIOC_S_FBUF:
561 err = get_v4l2_framebuffer32(&karg.v2fb, up);
562 compatible_arg = 0;
563 break;
543 564
544 case VIDIOC_G_FMT: 565 case VIDIOC_G_FMT:
545 case VIDIOC_S_FMT: 566 case VIDIOC_S_FMT:
@@ -566,17 +587,18 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
566 case VIDIOC_G_FBUF: 587 case VIDIOC_G_FBUF:
567 case VIDIOC_G_INPUT: 588 case VIDIOC_G_INPUT:
568 compatible_arg = 0; 589 compatible_arg = 0;
590 };
569 591
570 if(err) 592 if(err)
571 goto out; 593 goto out;
572 594
573 if(compatible_arg) 595 if(compatible_arg)
574 err = sys_ioctl(fd, cmd, (unsigned long)up); 596 err = native_ioctl(file, cmd, (unsigned long)up);
575 else { 597 else {
576 mm_segment_t old_fs = get_fs(); 598 mm_segment_t old_fs = get_fs();
577 599
578 set_fs(KERNEL_DS); 600 set_fs(KERNEL_DS);
579 err = sys_ioctl(fd, cmd, (unsigned long)&karg); 601 err = native_ioctl(file, cmd, (unsigned long)&karg);
580 set_fs(old_fs); 602 set_fs(old_fs);
581 } 603 }
582 if(err == 0) { 604 if(err == 0) {
@@ -627,7 +649,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
627{ 649{
628 int ret = -ENOIOCTLCMD; 650 int ret = -ENOIOCTLCMD;
629 651
630 if (!file->f_ops->ioctl) 652 if (!file->f_op->ioctl)
631 return ret; 653 return ret;
632 654
633 switch (cmd) { 655 switch (cmd) {
@@ -641,6 +663,30 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
641 case VIDIOCSFBUF32: 663 case VIDIOCSFBUF32:
642 case VIDIOCGFREQ32: 664 case VIDIOCGFREQ32:
643 case VIDIOCSFREQ32: 665 case VIDIOCSFREQ32:
666 case VIDIOC_QUERYCAP:
667 case VIDIOC_ENUM_FMT:
668 case VIDIOC_G_FMT32:
669 case VIDIOC_S_FMT32:
670 case VIDIOC_REQBUFS:
671 case VIDIOC_QUERYBUF32:
672 case VIDIOC_G_FBUF32:
673 case VIDIOC_S_FBUF32:
674 case VIDIOC_OVERLAY32:
675 case VIDIOC_QBUF32:
676 case VIDIOC_DQBUF32:
677 case VIDIOC_STREAMON32:
678 case VIDIOC_STREAMOFF32:
679 case VIDIOC_G_PARM:
680 case VIDIOC_G_STD:
681 case VIDIOC_S_STD:
682 case VIDIOC_ENUMSTD32:
683 case VIDIOC_ENUMINPUT32:
684 case VIDIOC_G_CTRL:
685 case VIDIOC_S_CTRL32:
686 case VIDIOC_QUERYCTRL:
687 case VIDIOC_G_INPUT32:
688 case VIDIOC_S_INPUT32:
689 case VIDIOC_TRY_FMT32:
644 ret = do_video_ioctl(file, cmd, arg); 690 ret = do_video_ioctl(file, cmd, arg);
645 break; 691 break;
646 692