diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-08-06 09:16:27 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 10:53:51 -0400 |
commit | 8a36ecf0f4c0861330cc9e69885b0502fedac14a (patch) | |
tree | 836f060155a82d633bd381a5cc82a0fc9a619b08 /drivers | |
parent | 3702627899db1d6a818c6e0b4ba5205f94bfbef4 (diff) |
V4L/DVB (4475): Fix most Compat32 stuff on V4L2
Tested on x64 with a bttv board. Most Get ioctls are fixed. The only
non-completely working one is VIDIOCGAUDIO. All other IOR ioctls give the
same results on x86_64 and i386 architectures.
Thanks to Alastair Poole <netstar@gatheringofgray.com> for part of this
patch and tests on ppc64.
Signed-off-by: Alastair Poole <netstar@gatheringofgray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/compat_ioctl32.c | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c index b69ee1194815..d82a488f12a6 100644 --- a/drivers/media/video/compat_ioctl32.c +++ b/drivers/media/video/compat_ioctl32.c | |||
@@ -58,6 +58,7 @@ static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user | |||
58 | return 0; | 58 | return 0; |
59 | } | 59 | } |
60 | 60 | ||
61 | |||
61 | struct video_buffer32 { | 62 | struct video_buffer32 { |
62 | compat_caddr_t base; | 63 | compat_caddr_t base; |
63 | compat_int_t height, width, depth, bytesperline; | 64 | compat_int_t height, width, depth, bytesperline; |
@@ -618,6 +619,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
618 | struct video_buffer vb; | 619 | struct video_buffer vb; |
619 | struct video_window vw; | 620 | struct video_window vw; |
620 | struct video_code vc; | 621 | struct video_code vc; |
622 | struct video_audio va; | ||
621 | #endif | 623 | #endif |
622 | struct v4l2_format v2f; | 624 | struct v4l2_format v2f; |
623 | struct v4l2_buffer v2b; | 625 | struct v4l2_buffer v2b; |
@@ -635,31 +637,31 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
635 | /* First, convert the command. */ | 637 | /* First, convert the command. */ |
636 | switch(cmd) { | 638 | switch(cmd) { |
637 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | 639 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
638 | case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break; | 640 | case VIDIOCGTUNER32: realcmd = cmd = VIDIOCGTUNER; break; |
639 | case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break; | 641 | case VIDIOCSTUNER32: realcmd = cmd = VIDIOCSTUNER; break; |
640 | case VIDIOCGWIN32: cmd = VIDIOCGWIN; break; | 642 | case VIDIOCGWIN32: realcmd = cmd = VIDIOCGWIN; break; |
641 | case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break; | 643 | case VIDIOCGFBUF32: realcmd = cmd = VIDIOCGFBUF; break; |
642 | case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break; | 644 | case VIDIOCSFBUF32: realcmd = cmd = VIDIOCSFBUF; break; |
643 | case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break; | 645 | case VIDIOCGFREQ32: realcmd = cmd = VIDIOCGFREQ; break; |
644 | case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break; | 646 | case VIDIOCSFREQ32: realcmd = cmd = VIDIOCSFREQ; break; |
645 | case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; | 647 | case VIDIOCSMICROCODE32: realcmd = cmd = VIDIOCSMICROCODE; break; |
646 | #endif | 648 | #endif |
647 | case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; | 649 | case VIDIOC_G_FMT32: realcmd = cmd = VIDIOC_G_FMT; break; |
648 | case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; | 650 | case VIDIOC_S_FMT32: realcmd = cmd = VIDIOC_S_FMT; break; |
649 | case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; | 651 | case VIDIOC_QUERYBUF32: realcmd = cmd = VIDIOC_QUERYBUF; break; |
650 | case VIDIOC_QBUF32: cmd = VIDIOC_QBUF; break; | 652 | case VIDIOC_QBUF32: realcmd = cmd = VIDIOC_QBUF; break; |
651 | case VIDIOC_DQBUF32: cmd = VIDIOC_DQBUF; break; | 653 | case VIDIOC_DQBUF32: realcmd = cmd = VIDIOC_DQBUF; break; |
652 | case VIDIOC_STREAMON32: cmd = VIDIOC_STREAMON; break; | 654 | case VIDIOC_STREAMON32: realcmd = cmd = VIDIOC_STREAMON; break; |
653 | case VIDIOC_STREAMOFF32: cmd = VIDIOC_STREAMOFF; break; | 655 | case VIDIOC_STREAMOFF32: realcmd = cmd = VIDIOC_STREAMOFF; break; |
654 | case VIDIOC_G_FBUF32: cmd = VIDIOC_G_FBUF; break; | 656 | case VIDIOC_G_FBUF32: realcmd = cmd = VIDIOC_G_FBUF; break; |
655 | case VIDIOC_S_FBUF32: cmd = VIDIOC_S_FBUF; break; | 657 | case VIDIOC_S_FBUF32: realcmd = cmd = VIDIOC_S_FBUF; break; |
656 | case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break; | 658 | case VIDIOC_OVERLAY32: realcmd = cmd = VIDIOC_OVERLAY; break; |
657 | case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break; | 659 | case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break; |
658 | case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break; | 660 | case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break; |
659 | case VIDIOC_S_CTRL32: cmd = VIDIOC_S_CTRL; break; | 661 | case VIDIOC_S_CTRL32: realcmd = cmd = VIDIOC_S_CTRL; break; |
660 | case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; | 662 | case VIDIOC_G_INPUT32: realcmd = cmd = VIDIOC_G_INPUT; break; |
661 | case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; | 663 | case VIDIOC_S_INPUT32: realcmd = cmd = VIDIOC_S_INPUT; break; |
662 | case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; | 664 | case VIDIOC_TRY_FMT32: realcmd = cmd = VIDIOC_TRY_FMT; break; |
663 | }; | 665 | }; |
664 | 666 | ||
665 | switch(cmd) { | 667 | switch(cmd) { |
@@ -676,6 +678,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
676 | compatible_arg = 0; | 678 | compatible_arg = 0; |
677 | break; | 679 | break; |
678 | 680 | ||
681 | |||
679 | case VIDIOCSFREQ: | 682 | case VIDIOCSFREQ: |
680 | #endif | 683 | #endif |
681 | case VIDIOC_S_INPUT: | 684 | case VIDIOC_S_INPUT: |
@@ -683,7 +686,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
683 | case VIDIOC_STREAMON: | 686 | case VIDIOC_STREAMON: |
684 | case VIDIOC_STREAMOFF: | 687 | case VIDIOC_STREAMOFF: |
685 | err = get_user(karg.vx, (u32 __user *)up); | 688 | err = get_user(karg.vx, (u32 __user *)up); |
686 | compatible_arg = 0; | 689 | compatible_arg = 1; |
687 | break; | 690 | break; |
688 | 691 | ||
689 | case VIDIOC_S_FBUF: | 692 | case VIDIOC_S_FBUF: |
@@ -739,6 +742,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
739 | case VIDIOC_G_FBUF: | 742 | case VIDIOC_G_FBUF: |
740 | case VIDIOC_G_INPUT: | 743 | case VIDIOC_G_INPUT: |
741 | compatible_arg = 0; | 744 | compatible_arg = 0; |
745 | break; | ||
742 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | 746 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
743 | case VIDIOCSMICROCODE: | 747 | case VIDIOCSMICROCODE: |
744 | err = microcode32(&karg.vc, up); | 748 | err = microcode32(&karg.vc, up); |
@@ -755,7 +759,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
755 | mm_segment_t old_fs = get_fs(); | 759 | mm_segment_t old_fs = get_fs(); |
756 | 760 | ||
757 | set_fs(KERNEL_DS); | 761 | set_fs(KERNEL_DS); |
758 | err = native_ioctl(file, realcmd, (unsigned long)&karg); | 762 | err = native_ioctl(file, realcmd, (unsigned long) &karg); |
759 | set_fs(old_fs); | 763 | set_fs(old_fs); |
760 | } | 764 | } |
761 | if(err == 0) { | 765 | if(err == 0) { |
@@ -772,6 +776,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
772 | case VIDIOCGFBUF: | 776 | case VIDIOCGFBUF: |
773 | err = put_video_buffer32(&karg.vb, up); | 777 | err = put_video_buffer32(&karg.vb, up); |
774 | break; | 778 | break; |
779 | |||
775 | #endif | 780 | #endif |
776 | case VIDIOC_G_FBUF: | 781 | case VIDIOC_G_FBUF: |
777 | err = put_v4l2_framebuffer32(&karg.v2fb, up); | 782 | err = put_v4l2_framebuffer32(&karg.v2fb, up); |
@@ -841,10 +846,14 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
841 | case VIDIOCSFBUF32: | 846 | case VIDIOCSFBUF32: |
842 | case VIDIOCGFREQ32: | 847 | case VIDIOCGFREQ32: |
843 | case VIDIOCSFREQ32: | 848 | case VIDIOCSFREQ32: |
849 | case VIDIOCGAUDIO: | ||
850 | case VIDIOCSAUDIO: | ||
844 | #endif | 851 | #endif |
845 | case VIDIOC_QUERYCAP: | 852 | case VIDIOC_QUERYCAP: |
846 | case VIDIOC_ENUM_FMT: | 853 | case VIDIOC_ENUM_FMT: |
847 | case VIDIOC_G_FMT32: | 854 | case VIDIOC_G_FMT32: |
855 | case VIDIOC_CROPCAP: | ||
856 | case VIDIOC_S_CROP: | ||
848 | case VIDIOC_S_FMT32: | 857 | case VIDIOC_S_FMT32: |
849 | case VIDIOC_REQBUFS: | 858 | case VIDIOC_REQBUFS: |
850 | case VIDIOC_QUERYBUF32: | 859 | case VIDIOC_QUERYBUF32: |
@@ -882,8 +891,6 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
882 | case VIDIOCSPICT: | 891 | case VIDIOCSPICT: |
883 | case VIDIOCCAPTURE: | 892 | case VIDIOCCAPTURE: |
884 | case VIDIOCKEY: | 893 | case VIDIOCKEY: |
885 | case VIDIOCGAUDIO: | ||
886 | case VIDIOCSAUDIO: | ||
887 | case VIDIOCSYNC: | 894 | case VIDIOCSYNC: |
888 | case VIDIOCMCAPTURE: | 895 | case VIDIOCMCAPTURE: |
889 | case VIDIOCGMBUF: | 896 | case VIDIOCGMBUF: |