summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/compat_ioctl32.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-08-06 10:16:27 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-08-06 10:16:27 -0300
commit82dff6ef69cc6308e8793007bda9818fd8e9226c (patch)
tree378d50ea5a78f71b8c06c26ab99866150a81377c /linux/drivers/media/video/compat_ioctl32.c
parent4faae47ad7fcefa192d328f69f76477976cf40a7 (diff)
downloadmediapointer-dvb-s2-82dff6ef69cc6308e8793007bda9818fd8e9226c.tar.gz
mediapointer-dvb-s2-82dff6ef69cc6308e8793007bda9818fd8e9226c.tar.bz2
Fix most Compat32 stuff on V4L2
From: Mauro Carvalho Chehab <mchehab@infradead.org> 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 'linux/drivers/media/video/compat_ioctl32.c')
-rw-r--r--linux/drivers/media/video/compat_ioctl32.c119
1 files changed, 93 insertions, 26 deletions
diff --git a/linux/drivers/media/video/compat_ioctl32.c b/linux/drivers/media/video/compat_ioctl32.c
index 8e80a76ec..ea5efbd64 100644
--- a/linux/drivers/media/video/compat_ioctl32.c
+++ b/linux/drivers/media/video/compat_ioctl32.c
@@ -60,6 +60,56 @@ static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user
return 0;
}
+#if 0 /*FIXME */
+struct video_audio32 {
+ compat_int_t audio;
+ __u16 volume;
+ __u16 bass, treble;
+ __u32 flags;
+ __u8 name[16];
+// char name[16];
+ __u16 mode;
+ __u16 balance;
+ __u16 step;
+};
+
+static int get_video_audio32(struct video_audio *kp,
+ struct video_audio32 __user *up)
+{
+ if (!access_ok(VERIFY_READ, up, sizeof(struct video_audio32)) ||
+ get_user(kp->audio, &up->audio) ||
+ get_user(kp->volume, &up->volume) ||
+ get_user(kp->bass, &up->bass) ||
+ get_user(kp->treble, &up->treble) ||
+ get_user(kp->flags, &up->flags) ||
+ copy_from_user(kp->name, up->name, sizeof(up->name)) ||
+ get_user(kp->mode, &up->mode) ||
+ get_user(kp->balance, &up->balance) ||
+ get_user(kp->step, &up->step))
+ return -EFAULT;
+
+ return 0;
+}
+
+static int put_video_audio32(struct video_audio *kp,
+ struct video_audio32 __user *up)
+{
+ if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_audio32)) ||
+ put_user(kp->audio, &up->audio) ||
+ put_user(kp->volume, &up->volume) ||
+ put_user(kp->bass, &up->bass) ||
+ put_user(kp->treble, &up->treble) ||
+ put_user(kp->flags, &up->flags) ||
+ copy_to_user(kp->name, up->name, sizeof(up->name)) ||
+ put_user(kp->mode, &up->mode) ||
+ put_user(kp->balance, &up->balance) ||
+ put_user(kp->step, &up->step))
+ return -EFAULT;
+
+ return 0;
+}
+#endif
+
struct video_buffer32 {
compat_caddr_t base;
compat_int_t height, width, depth, bytesperline;
@@ -620,6 +670,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
struct video_buffer vb;
struct video_window vw;
struct video_code vc;
+ struct video_audio va;
#endif
struct v4l2_format v2f;
struct v4l2_buffer v2b;
@@ -637,31 +688,31 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
/* First, convert the command. */
switch(cmd) {
#ifdef CONFIG_VIDEO_V4L1_COMPAT
- case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break;
- case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break;
- case VIDIOCGWIN32: cmd = VIDIOCGWIN; break;
- case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break;
- case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break;
- case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break;
- case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break;
- case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break;
+ case VIDIOCGTUNER32: realcmd = cmd = VIDIOCGTUNER; break;
+ case VIDIOCSTUNER32: realcmd = cmd = VIDIOCSTUNER; break;
+ case VIDIOCGWIN32: realcmd = cmd = VIDIOCGWIN; break;
+ case VIDIOCGFBUF32: realcmd = cmd = VIDIOCGFBUF; break;
+ case VIDIOCSFBUF32: realcmd = cmd = VIDIOCSFBUF; break;
+ case VIDIOCGFREQ32: realcmd = cmd = VIDIOCGFREQ; break;
+ case VIDIOCSFREQ32: realcmd = cmd = VIDIOCSFREQ; break;
+ case VIDIOCSMICROCODE32: realcmd = cmd = VIDIOCSMICROCODE; break;
#endif
- case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break;
- case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break;
- case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break;
- case VIDIOC_QBUF32: cmd = VIDIOC_QBUF; break;
- case VIDIOC_DQBUF32: cmd = VIDIOC_DQBUF; break;
- case VIDIOC_STREAMON32: cmd = VIDIOC_STREAMON; break;
- case VIDIOC_STREAMOFF32: cmd = VIDIOC_STREAMOFF; break;
- case VIDIOC_G_FBUF32: cmd = VIDIOC_G_FBUF; break;
- case VIDIOC_S_FBUF32: cmd = VIDIOC_S_FBUF; break;
- case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break;
+ case VIDIOC_G_FMT32: realcmd = cmd = VIDIOC_G_FMT; break;
+ case VIDIOC_S_FMT32: realcmd = cmd = VIDIOC_S_FMT; break;
+ case VIDIOC_QUERYBUF32: realcmd = cmd = VIDIOC_QUERYBUF; break;
+ case VIDIOC_QBUF32: realcmd = cmd = VIDIOC_QBUF; break;
+ case VIDIOC_DQBUF32: realcmd = cmd = VIDIOC_DQBUF; break;
+ case VIDIOC_STREAMON32: realcmd = cmd = VIDIOC_STREAMON; break;
+ case VIDIOC_STREAMOFF32: realcmd = cmd = VIDIOC_STREAMOFF; break;
+ case VIDIOC_G_FBUF32: realcmd = cmd = VIDIOC_G_FBUF; break;
+ case VIDIOC_S_FBUF32: realcmd = cmd = VIDIOC_S_FBUF; break;
+ case VIDIOC_OVERLAY32: realcmd = cmd = VIDIOC_OVERLAY; break;
case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break;
case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break;
- case VIDIOC_S_CTRL32: cmd = VIDIOC_S_CTRL; break;
- case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break;
- case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break;
- case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break;
+ case VIDIOC_S_CTRL32: realcmd = cmd = VIDIOC_S_CTRL; break;
+ case VIDIOC_G_INPUT32: realcmd = cmd = VIDIOC_G_INPUT; break;
+ case VIDIOC_S_INPUT32: realcmd = cmd = VIDIOC_S_INPUT; break;
+ case VIDIOC_TRY_FMT32: realcmd = cmd = VIDIOC_TRY_FMT; break;
};
switch(cmd) {
@@ -678,6 +729,13 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
compatible_arg = 0;
break;
+#if 0 /*FIXME*/
+ case VIDIOCSAUDIO:
+ err = get_video_audio32(&karg.va, up);
+ compatible_arg = 0;
+ break;
+#endif
+
case VIDIOCSFREQ:
#endif
case VIDIOC_S_INPUT:
@@ -685,7 +743,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
case VIDIOC_STREAMON:
case VIDIOC_STREAMOFF:
err = get_user(karg.vx, (u32 __user *)up);
- compatible_arg = 0;
+ compatible_arg = 1;
break;
case VIDIOC_S_FBUF:
@@ -741,6 +799,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
case VIDIOC_G_FBUF:
case VIDIOC_G_INPUT:
compatible_arg = 0;
+ break;
#ifdef CONFIG_VIDEO_V4L1_COMPAT
case VIDIOCSMICROCODE:
err = microcode32(&karg.vc, up);
@@ -757,7 +816,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
- err = native_ioctl(file, realcmd, (unsigned long)&karg);
+ err = native_ioctl(file, realcmd, (unsigned long) &karg);
set_fs(old_fs);
}
if(err == 0) {
@@ -774,6 +833,12 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
case VIDIOCGFBUF:
err = put_video_buffer32(&karg.vb, up);
break;
+#if 0 /*FIXME*/
+ case VIDIOCGAUDIO:
+ err = put_video_audio32(&karg.va, up);
+ break;
+#endif
+
#endif
case VIDIOC_G_FBUF:
err = put_v4l2_framebuffer32(&karg.v2fb, up);
@@ -843,10 +908,14 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
case VIDIOCSFBUF32:
case VIDIOCGFREQ32:
case VIDIOCSFREQ32:
+ case VIDIOCGAUDIO:
+ case VIDIOCSAUDIO:
#endif
case VIDIOC_QUERYCAP:
case VIDIOC_ENUM_FMT:
case VIDIOC_G_FMT32:
+ case VIDIOC_CROPCAP:
+ case VIDIOC_S_CROP:
case VIDIOC_S_FMT32:
case VIDIOC_REQBUFS:
case VIDIOC_QUERYBUF32:
@@ -884,8 +953,6 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
case VIDIOCSPICT:
case VIDIOCCAPTURE:
case VIDIOCKEY:
- case VIDIOCGAUDIO:
- case VIDIOCSAUDIO:
case VIDIOCSYNC:
case VIDIOCMCAPTURE:
case VIDIOCGMBUF: