]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L (926_2): Moves compat32 functions from fs to v4l subsystem
authorArnd Bergmann <arnd@arndb.de>
Mon, 9 Jan 2006 17:24:57 +0000 (15:24 -0200)
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>
Mon, 9 Jan 2006 17:24:57 +0000 (15:24 -0200)
This moves the 32 bit ioctl compatibility handlers for
Video4Linux into a new file and adds explicit calls to them
to each v4l device driver.

Unfortunately, there does not seem to be any code handling
the v4l2 ioctls, so quite often the code goes through two
separate conversions, first from 32 bit v4l to 64 bit v4l,
and from there to 64 bit v4l2. My patch does not change
that, so there is still much room for improvement.

Also, some drivers have additional ioctl numbers, for
which the conversion should be handled internally to
that driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
42 files changed:
drivers/media/radio/miropcm20-radio.c
drivers/media/radio/radio-aimslab.c
drivers/media/radio/radio-aztech.c
drivers/media/radio/radio-cadet.c
drivers/media/radio/radio-gemtek-pci.c
drivers/media/radio/radio-gemtek.c
drivers/media/radio/radio-maestro.c
drivers/media/radio/radio-maxiradio.c
drivers/media/radio/radio-rtrack2.c
drivers/media/radio/radio-sf16fmi.c
drivers/media/radio/radio-sf16fmr2.c
drivers/media/radio/radio-terratec.c
drivers/media/radio/radio-trust.c
drivers/media/radio/radio-typhoon.c
drivers/media/radio/radio-zoltrix.c
drivers/media/video/Makefile
drivers/media/video/arv.c
drivers/media/video/bttv-driver.c
drivers/media/video/bw-qcam.c
drivers/media/video/c-qcam.c
drivers/media/video/compat_ioctl32.c [new file with mode: 0644]
drivers/media/video/cpia.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/meye.c
drivers/media/video/pms.c
drivers/media/video/saa5249.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/stradis.c
drivers/media/video/w9966.c
drivers/media/video/zoran_driver.c
drivers/media/video/zr36120.c
drivers/usb/media/dsbr100.c
drivers/usb/media/ov511.c
drivers/usb/media/pwc/pwc-if.c
drivers/usb/media/se401.c
drivers/usb/media/stv680.c
drivers/usb/media/usbvideo.c
drivers/usb/media/vicam.c
drivers/usb/media/w9968cf.c
fs/compat_ioctl.c
include/linux/compat_ioctl.h
include/linux/videodev2.h

index c2ebe8754a9569bf326430a08920e3a096a2aa07..dc292da2605ffb4204dfcfb7c24b1ffc23256c42 100644 (file)
@@ -220,6 +220,7 @@ static struct file_operations pcm20_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = pcm20_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 877c770558e9c407350da4ea90d92b2e875cefd2..914deab4e04440c462e28a28998ff2c8c2e92141 100644 (file)
@@ -299,6 +299,7 @@ static struct file_operations rtrack_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = rt_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 5319a9c9a9796bbf4e0d769a3e120cd98d5dc952..523be820f9c64c3f6fd48fa226aebea16f5489ae 100644 (file)
@@ -256,6 +256,7 @@ static struct file_operations aztech_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = az_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 9b0406318f2d9d31fa74f98dca827d343a1c1443..f1b5ac81e9d2bc734d6dd3345c12d0bd46fa235e 100644 (file)
@@ -490,6 +490,7 @@ static struct file_operations cadet_fops = {
        .release        = cadet_release,
        .read           = cadet_read,
        .ioctl          = cadet_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 630cc786d0a4f5065c357b150435dc1108a5dce7..42c8fce04aa2650aeded8b2f6e21f9adec07ac85 100644 (file)
@@ -301,6 +301,7 @@ static struct file_operations gemtek_pci_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = gemtek_pci_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 6418f03b9ce4b74b1711e03a718efe952028bd06..47173be97b9fa5dbd74d84e6e5ebce0007393609 100644 (file)
@@ -233,6 +233,7 @@ static struct file_operations gemtek_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = gemtek_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index e5e2021a7312f4c82eee58b96e2a5bde455809dc..c30effdf711feb6ba8e5457b5c908ca472abeb52 100644 (file)
@@ -72,6 +72,7 @@ static struct file_operations maestro_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = radio_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 02d39a50d5ed2b742d6e2b65678056a249e096b7..30869308332af3bff2d3af7ba6e2098f0738fe0a 100644 (file)
@@ -80,6 +80,7 @@ static struct file_operations maxiradio_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = radio_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 static struct video_device maxiradio_radio =
index b2256d675b4434f8f8553b13d4892089a6edff6e..28a47c9e7a819a4791d122d02380ca12e46ffd40 100644 (file)
@@ -199,6 +199,7 @@ static struct file_operations rtrack2_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = rt_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 6f03ce4dd7b0e4fb076c72dcfe9cdec20b122c8f..0229f792a05969717a7271356a03a1a6c51da3ce 100644 (file)
@@ -225,6 +225,7 @@ static struct file_operations fmi_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = fmi_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 71971e9bb3422c36acb8280becdfbf03a9c37944..26632cead09a7dc7dd5d59388b719b6f3684b842 100644 (file)
@@ -356,6 +356,7 @@ static struct file_operations fmr2_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = fmr2_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index b03573c6840e56e632bd52f60aa90aabc45abc81..fcfde2e4f1958d47d1c4ec34d69f610cb1733e0b 100644 (file)
@@ -276,6 +276,7 @@ static struct file_operations terratec_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = tt_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index b300bedf7c743825cdffd13b5a58c212d28ff8e2..5a099a50d4d060e1af66e7a31711d7b3182fb2c8 100644 (file)
@@ -255,6 +255,7 @@ static struct file_operations trust_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = tr_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index f304f3c147637c92a7956f88c7fc548429f3338a..8ac9a8ef909441e98171dbb4b4f4e65d5c16b749 100644 (file)
@@ -261,6 +261,7 @@ static struct file_operations typhoon_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = typhoon_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 4c6d6fb49034e04a04d1c2d220e574b5aed1d434..d590e80c922e336a69d610f26f18f3cf28898652 100644 (file)
@@ -313,6 +313,7 @@ static struct file_operations zoltrix_fops =
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = zol_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 82060f9909d89db008fa0c5c48dc32b46d5b0cc3..618a08ab940a0b143a30b78c1838c1772e8eda25 100644 (file)
@@ -8,7 +8,8 @@ zoran-objs      :=      zr36120.o zr36120_i2c.o zr36120_mem.o
 zr36067-objs   :=      zoran_procfs.o zoran_device.o \
                        zoran_driver.o zoran_card.o
 tuner-objs     :=      tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o
-obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o
+
+obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o
 
 obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \
        tda7432.o tda9875.o ir-kbd-i2c.o ir-kbd-gpio.o
index 881cdcb1875d3f6dce6f9200065e27fe502738f7..7d5a068353f28d8c65ee077ceefa2e7f3d56fd60 100644 (file)
@@ -749,6 +749,7 @@ static struct file_operations ar_fops = {
        .release        = video_exclusive_release,
        .read           = ar_read,
        .ioctl          = ar_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 1ddf9ba613ef96c3e8b142dd41d322c02391cb3c..03f925724ce931af57d2702a97a52e2ceb452f4d 100644 (file)
@@ -3120,6 +3120,7 @@ static struct file_operations bttv_fops =
        .open     = bttv_open,
        .release  = bttv_release,
        .ioctl    = bttv_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek   = no_llseek,
        .read     = bttv_read,
        .mmap     = bttv_mmap,
index 0065d0c240d1465f5d93251430a1a8aa07f0e939..6bad93ef969fd402d6131a1a9c0d0a594c769d3b 100644 (file)
@@ -875,6 +875,7 @@ static struct file_operations qcam_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = qcam_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .read           = qcam_read,
        .llseek         = no_llseek,
 };
index 75442ec49f352b0a4e9c2cbf245abc3a930b71f7..9976db4f6da8f77d6f41961bc6115a23c82a25f2 100644 (file)
@@ -687,6 +687,7 @@ static struct file_operations qcam_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = qcam_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .read           = qcam_read,
        .llseek         = no_llseek,
 };
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c
new file mode 100644 (file)
index 0000000..42dc11c
--- /dev/null
@@ -0,0 +1,318 @@
+#include <linux/config.h>
+#include <linux/compat.h>
+#include <linux/videodev.h>
+
+#ifdef CONFIG_COMPAT
+struct video_tuner32 {
+       compat_int_t tuner;
+       char name[32];
+       compat_ulong_t rangelow, rangehigh;
+       u32 flags;      /* It is really u32 in videodev.h */
+       u16 mode, signal;
+};
+
+static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
+{
+       int i;
+
+       if(get_user(kp->tuner, &up->tuner))
+               return -EFAULT;
+       for(i = 0; i < 32; i++)
+               __get_user(kp->name[i], &up->name[i]);
+       __get_user(kp->rangelow, &up->rangelow);
+       __get_user(kp->rangehigh, &up->rangehigh);
+       __get_user(kp->flags, &up->flags);
+       __get_user(kp->mode, &up->mode);
+       __get_user(kp->signal, &up->signal);
+       return 0;
+}
+
+static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
+{
+       int i;
+
+       if(put_user(kp->tuner, &up->tuner))
+               return -EFAULT;
+       for(i = 0; i < 32; i++)
+               __put_user(kp->name[i], &up->name[i]);
+       __put_user(kp->rangelow, &up->rangelow);
+       __put_user(kp->rangehigh, &up->rangehigh);
+       __put_user(kp->flags, &up->flags);
+       __put_user(kp->mode, &up->mode);
+       __put_user(kp->signal, &up->signal);
+       return 0;
+}
+
+struct video_buffer32 {
+       compat_caddr_t base;
+       compat_int_t height, width, depth, bytesperline;
+};
+
+static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
+{
+       u32 tmp;
+
+       if (get_user(tmp, &up->base))
+               return -EFAULT;
+
+       /* This is actually a physical address stored
+        * as a void pointer.
+        */
+       kp->base = (void *)(unsigned long) tmp;
+
+       __get_user(kp->height, &up->height);
+       __get_user(kp->width, &up->width);
+       __get_user(kp->depth, &up->depth);
+       __get_user(kp->bytesperline, &up->bytesperline);
+       return 0;
+}
+
+static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
+{
+       u32 tmp = (u32)((unsigned long)kp->base);
+
+       if(put_user(tmp, &up->base))
+               return -EFAULT;
+       __put_user(kp->height, &up->height);
+       __put_user(kp->width, &up->width);
+       __put_user(kp->depth, &up->depth);
+       __put_user(kp->bytesperline, &up->bytesperline);
+       return 0;
+}
+
+struct video_clip32 {
+       s32 x, y, width, height;        /* Its really s32 in videodev.h */
+       compat_caddr_t next;
+};
+
+struct video_window32 {
+       u32 x, y, width, height, chromakey, flags;
+       compat_caddr_t clips;
+       compat_int_t clipcount;
+};
+
+static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+       int ret = -ENOIOCTLCMD;
+
+       if (file->f_ops->unlocked_ioctl)
+               ret = file->f_ops->unlocked_ioctl(file, cmd, arg);
+       else if (file->f_ops->ioctl) {
+               lock_kernel();
+               ret = file->f_ops->ioctl(file->f_dentry->d_inode, file, cmd, arg);
+               unlock_kernel();
+       }
+
+       return ret;
+}
+
+
+/* You get back everything except the clips... */
+static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
+{
+       if(put_user(kp->x, &up->x))
+               return -EFAULT;
+       __put_user(kp->y, &up->y);
+       __put_user(kp->width, &up->width);
+       __put_user(kp->height, &up->height);
+       __put_user(kp->chromakey, &up->chromakey);
+       __put_user(kp->flags, &up->flags);
+       __put_user(kp->clipcount, &up->clipcount);
+       return 0;
+}
+
+#define VIDIOCGTUNER32         _IOWR('v',4, struct video_tuner32)
+#define VIDIOCSTUNER32         _IOW('v',5, struct video_tuner32)
+#define VIDIOCGWIN32           _IOR('v',9, struct video_window32)
+#define VIDIOCSWIN32           _IOW('v',10, struct video_window32)
+#define VIDIOCGFBUF32          _IOR('v',11, struct video_buffer32)
+#define VIDIOCSFBUF32          _IOW('v',12, struct video_buffer32)
+#define VIDIOCGFREQ32          _IOR('v',14, u32)
+#define VIDIOCSFREQ32          _IOW('v',15, u32)
+
+enum {
+       MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip)
+};
+
+static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg)
+{
+       struct video_window32 __user *up = compat_ptr(arg);
+       struct video_window __user *vw;
+       struct video_clip __user *p;
+       int nclips;
+       u32 n;
+
+       if (get_user(nclips, &up->clipcount))
+               return -EFAULT;
+
+       /* Peculiar interface... */
+       if (nclips < 0)
+               nclips = VIDEO_CLIPMAP_SIZE;
+
+       if (nclips > MaxClips)
+               return -ENOMEM;
+
+       vw = compat_alloc_user_space(sizeof(struct video_window) +
+                                   nclips * sizeof(struct video_clip));
+
+       p = nclips ? (struct video_clip __user *)(vw + 1) : NULL;
+
+       if (get_user(n, &up->x) || put_user(n, &vw->x) ||
+           get_user(n, &up->y) || put_user(n, &vw->y) ||
+           get_user(n, &up->width) || put_user(n, &vw->width) ||
+           get_user(n, &up->height) || put_user(n, &vw->height) ||
+           get_user(n, &up->chromakey) || put_user(n, &vw->chromakey) ||
+           get_user(n, &up->flags) || put_user(n, &vw->flags) ||
+           get_user(n, &up->clipcount) || put_user(n, &vw->clipcount) ||
+           get_user(n, &up->clips) || put_user(p, &vw->clips))
+               return -EFAULT;
+
+       if (nclips) {
+               struct video_clip32 __user *u = compat_ptr(n);
+               int i;
+               if (!u)
+                       return -EINVAL;
+               for (i = 0; i < nclips; i++, u++, p++) {
+                       s32 v;
+                       if (get_user(v, &u->x) ||
+                           put_user(v, &p->x) ||
+                           get_user(v, &u->y) ||
+                           put_user(v, &p->y) ||
+                           get_user(v, &u->width) ||
+                           put_user(v, &p->width) ||
+                           get_user(v, &u->height) ||
+                           put_user(v, &p->height) ||
+                           put_user(NULL, &p->next))
+                               return -EFAULT;
+               }
+       }
+
+       return native_ioctl(file, VIDIOCSWIN, (unsigned long)p);
+}
+
+static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+       union {
+               struct video_tuner vt;
+               struct video_buffer vb;
+               struct video_window vw;
+               unsigned long vx;
+       } karg;
+       mm_segment_t old_fs = get_fs();
+       void __user *up = compat_ptr(arg);
+       int err = 0;
+
+       /* First, convert the command. */
+       switch(cmd) {
+       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;
+       };
+
+       switch(cmd) {
+       case VIDIOCSTUNER:
+       case VIDIOCGTUNER:
+               err = get_video_tuner32(&karg.vt, up);
+               break;
+
+       case VIDIOCSFBUF:
+               err = get_video_buffer32(&karg.vb, up);
+               break;
+
+       case VIDIOCSFREQ:
+               err = get_user(karg.vx, (u32 __user *)up);
+               break;
+       };
+       if(err)
+               goto out;
+
+       set_fs(KERNEL_DS);
+       err = native_ioctl(file, cmd, (unsigned long)&karg);
+       set_fs(old_fs);
+
+       if(err == 0) {
+               switch(cmd) {
+               case VIDIOCGTUNER:
+                       err = put_video_tuner32(&karg.vt, up);
+                       break;
+
+               case VIDIOCGWIN:
+                       err = put_video_window32(&karg.vw, up);
+                       break;
+
+               case VIDIOCGFBUF:
+                       err = put_video_buffer32(&karg.vb, up);
+                       break;
+
+               case VIDIOCGFREQ:
+                       err = put_user(((u32)karg.vx), (u32 __user *)up);
+                       break;
+               };
+       }
+out:
+       return err;
+}
+
+long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
+{
+       int ret = -ENOIOCTLCMD;
+
+       if (!file->f_ops->ioctl)
+               return ret;
+
+       switch (cmd) {
+       case VIDIOCSWIN32:
+               ret = do_set_window(file, cmd, arg);
+               break;
+       case VIDIOCGTUNER32:
+       case VIDIOCSTUNER32:
+       case VIDIOCGWIN32:
+       case VIDIOCGFBUF32:
+       case VIDIOCSFBUF32:
+       case VIDIOCGFREQ32:
+       case VIDIOCSFREQ32
+               ret = do_video_ioctl(file, cmd, arg);
+               break;
+
+       /* Little v, the video4linux ioctls (conflict?) */
+       case VIDIOCGCAP:
+       case VIDIOCGCHAN:
+       case VIDIOCSCHAN:
+       case VIDIOCGPICT:
+       case VIDIOCSPICT:
+       case VIDIOCCAPTURE:
+       case VIDIOCKEY:
+       case VIDIOCGAUDIO:
+       case VIDIOCSAUDIO:
+       case VIDIOCSYNC:
+       case VIDIOCMCAPTURE:
+       case VIDIOCGMBUF:
+       case VIDIOCGUNIT:
+       case VIDIOCGCAPTURE:
+       case VIDIOCSCAPTURE:
+
+       /* BTTV specific... */
+       case _IOW('v',  BASE_VIDIOCPRIVATE+0, char [256]):
+       case _IOR('v',  BASE_VIDIOCPRIVATE+1, char [256]):
+       case _IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int):
+       case _IOW('v' , BASE_VIDIOCPRIVATE+3, char [16]): /* struct bttv_pll_info */
+       case _IOR('v' , BASE_VIDIOCPRIVATE+4, int):
+       case _IOR('v' , BASE_VIDIOCPRIVATE+5, int):
+       case _IOR('v' , BASE_VIDIOCPRIVATE+6, int):
+       case _IOR('v' , BASE_VIDIOCPRIVATE+7, int):
+               ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
+               break;
+
+       return ret;
+}
+#else
+long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
+{
+       return -ENOIOCTLCMD;
+}
+#endif
+EXPORT_SYMBOL_GPL(v4l_compat_ioctl32);
index b7ec9bf45085ea6e31ba526938654eb24a32f647..9f59541155d9bfbd004d22d2aed584b5173f8677 100644 (file)
@@ -3807,6 +3807,7 @@ static struct file_operations cpia_fops = {
        .read           = cpia_read,
        .mmap           = cpia_mmap,
        .ioctl          = cpia_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 24a48f8a48c18a16be2dd96e278703ae7f153753..bc025c46aedf973dfa84043de853bf4514e036dc 100644 (file)
@@ -1740,6 +1740,7 @@ static struct file_operations video_fops =
        .poll          = video_poll,
        .mmap          = video_mmap,
        .ioctl         = video_ioctl,
+       .compat_ioctl  = v4l_compat_ioctl32,
        .llseek        = no_llseek,
 };
 
@@ -1767,6 +1768,7 @@ static struct file_operations radio_fops =
        .open          = video_open,
        .release       = video_release,
        .ioctl         = radio_ioctl,
+       .compat_ioctl  = v4l_compat_ioctl32,
        .llseek        = no_llseek,
 };
 
index 3f2a882bc20a6a6b31b00af7bef5278596f253db..2869464aee0d699677efccf99593dcdeb11526d3 100644 (file)
@@ -1754,6 +1754,7 @@ static struct file_operations meye_fops = {
        .release        = meye_release,
        .mmap           = meye_mmap,
        .ioctl          = meye_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .poll           = meye_poll,
        .llseek         = no_llseek,
 };
index 2504207b2e3da83167668a1f947e965b79308704..9e6448639480c75f22553f4e4a9b924a7b194101 100644 (file)
@@ -883,6 +883,7 @@ static struct file_operations pms_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = pms_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .read           = pms_read,
        .llseek         = no_llseek,
 };
index a51c7bd96618ef767123dfec1b3a923b29fb5520..73b4f0e2abf086d7974e76b6148f2822a8b33ecc 100644 (file)
@@ -702,6 +702,7 @@ static struct file_operations saa_fops = {
        .open           = saa5249_open,
        .release        = saa5249_release,
        .ioctl          = saa5249_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 45c852df13ed56c24c2f0332314144a1ef05d3ff..9b9e1e7f05efe448f927b580fcd5afdfc82411dc 100644 (file)
@@ -2262,6 +2262,7 @@ static struct file_operations video_fops =
        .poll     = video_poll,
        .mmap     = video_mmap,
        .ioctl    = video_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek   = no_llseek,
 };
 
@@ -2271,6 +2272,7 @@ static struct file_operations radio_fops =
        .open     = video_open,
        .release  = video_release,
        .ioctl    = radio_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek   = no_llseek,
 };
 
index d4497dbae05c7b641abaa617e9f17563847ecd0e..6ee54a45411f19ae95b1cf9f3cebe6b8b8b0f82d 100644 (file)
@@ -1974,6 +1974,7 @@ static struct file_operations saa_fops =
        .open           = saa_open,
        .release        = saa_release,
        .ioctl          = saa_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .read           = saa_read,
        .llseek         = no_llseek,
        .write          = saa_write,
index c318ba32fbafa9ba88f31abf647b91dbef32ccb5..b7b0afffd21434b0fb7bc2c0e24c79175b063b42 100644 (file)
@@ -187,6 +187,7 @@ static struct file_operations w9966_fops = {
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
        .ioctl          = w9966_v4l_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .read           = w9966_v4l_read,
        .llseek         = no_llseek,
 };
index 4034f1b45366922bffe95a4f3005c298ee7510d9..15283f44e79f6b56ba6bd708f8710ed9779156aa 100644 (file)
@@ -4678,6 +4678,7 @@ static struct file_operations zoran_fops = {
        .open = zoran_open,
        .release = zoran_close,
        .ioctl = zoran_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek = no_llseek,
        .read = zoran_read,
        .write = zoran_write,
index 07286816d7dfd4828df6aa879f17e02c864ac2d1..d4c633b8a7f5cc71420ee3816614907c522f22db 100644 (file)
@@ -1490,6 +1490,7 @@ static struct video_device zr36120_template=
        .write          = zoran_write,
        .poll           = zoran_poll,
        .ioctl          = zoran_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .mmap           = zoran_mmap,
        .minor          = -1,
 };
index 6a5700e9d4280eb7575426be882920953f1705dd..25646804d5be012c0e121bf0e44eb6b943162272 100644 (file)
@@ -127,6 +127,7 @@ static struct file_operations usb_dsbr100_fops = {
        .open =         usb_dsbr100_open,
        .release =      usb_dsbr100_close,
        .ioctl =        usb_dsbr100_ioctl,
+       .compat_ioctl = v4l_compat_ioctl32,
        .llseek =       no_llseek,
 };
 
index 3a0e8ce67ebedc10c22b38a224db5b3fcad63fc1..8af665bbe330b40478b7d2588a263ccc8849f739 100644 (file)
@@ -4774,6 +4774,7 @@ static struct file_operations ov511_fops = {
        .read =         ov51x_v4l1_read,
        .mmap =         ov51x_v4l1_mmap,
        .ioctl =        ov51x_v4l1_ioctl,
+       .compat_ioctl = v4l_compat_ioctl32,
        .llseek =       no_llseek,
 };
 
index 09ca6128ac209a213ca76e2c656d1daca2d662ac..4f9b0dc6fd7bdd6fd22e71588c23b045c2747ec2 100644 (file)
@@ -154,6 +154,7 @@ static struct file_operations pwc_fops = {
        .poll =         pwc_video_poll,
        .mmap =         pwc_video_mmap,
        .ioctl =        pwc_video_ioctl,
+       .compat_ioctl = v4l_compat_ioctl32,
        .llseek =       no_llseek,
 };
 static struct video_device pwc_template = {
index b2ae29af59404f89434b7e5d7f1f2d7cd229d7cc..2ba562285fda9b42c3e39f5d3f376e0332c1907e 100644 (file)
@@ -1193,6 +1193,7 @@ static struct file_operations se401_fops = {
         .read =         se401_read,
         .mmap =         se401_mmap,
        .ioctl =        se401_ioctl,
+       .compat_ioctl = v4l_compat_ioctl32,
        .llseek =       no_llseek,
 };
 static struct video_device se401_template = {
index 774038b352cd1e7644eb42c97fc0cbe9e877fc89..b497a6a0a2060eccf5ff81da5ef558728d2f9f84 100644 (file)
@@ -1343,6 +1343,7 @@ static struct file_operations stv680_fops = {
        .read =         stv680_read,
        .mmap =         stv680_mmap,
        .ioctl =        stv680_ioctl,
+       .compat_ioctl = v4l_compat_ioctl32,
        .llseek =       no_llseek,
 };
 static struct video_device stv680_template = {
index 4bd113325ef9b1441d7b244a7cb2ea8b106a69e1..63a72e550a1bd049d0346d10d1ea440554d5354f 100644 (file)
@@ -953,6 +953,7 @@ static struct file_operations usbvideo_fops = {
        .read =   usbvideo_v4l_read,
        .mmap =   usbvideo_v4l_mmap,
        .ioctl =  usbvideo_v4l_ioctl,
+       .compat_ioctl = v4l_compat_ioctl32,
        .llseek = no_llseek,
 };
 static const struct video_device usbvideo_template = {
index 1c73155c8d772cda08a5ca0934021161488563bd..5df1440738712622a3570ccbe154f4816c2258c1 100644 (file)
@@ -1236,6 +1236,7 @@ static struct file_operations vicam_fops = {
        .read           = vicam_read,
        .mmap           = vicam_mmap,
        .ioctl          = vicam_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
index 3605a6f3067b0b7602fff8f4fac14402287d1c47..bff9434c8e5578fcf0648dc6c6e09356e61613aa 100644 (file)
@@ -3490,6 +3490,7 @@ static struct file_operations w9968cf_fops = {
        .release = w9968cf_release,
        .read =    w9968cf_read,
        .ioctl =   w9968cf_ioctl,
+       .compat_ioctl = v4l_compat_ioctl32,
        .mmap =    w9968cf_mmap,
        .llseek =  no_llseek,
 };
index 43a2508ac69670d972516a0f5d2ad96f8e7bfa02..55d9a3a954cfe7fc35a5ccdc4eb7b6f1afbcff72 100644 (file)
@@ -207,244 +207,6 @@ static int do_ext3_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
        return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg));
 }
 
-struct video_tuner32 {
-       compat_int_t tuner;
-       char name[32];
-       compat_ulong_t rangelow, rangehigh;
-       u32 flags;      /* It is really u32 in videodev.h */
-       u16 mode, signal;
-};
-
-static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
-{
-       int i;
-
-       if(get_user(kp->tuner, &up->tuner))
-               return -EFAULT;
-       for(i = 0; i < 32; i++)
-               __get_user(kp->name[i], &up->name[i]);
-       __get_user(kp->rangelow, &up->rangelow);
-       __get_user(kp->rangehigh, &up->rangehigh);
-       __get_user(kp->flags, &up->flags);
-       __get_user(kp->mode, &up->mode);
-       __get_user(kp->signal, &up->signal);
-       return 0;
-}
-
-static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
-{
-       int i;
-
-       if(put_user(kp->tuner, &up->tuner))
-               return -EFAULT;
-       for(i = 0; i < 32; i++)
-               __put_user(kp->name[i], &up->name[i]);
-       __put_user(kp->rangelow, &up->rangelow);
-       __put_user(kp->rangehigh, &up->rangehigh);
-       __put_user(kp->flags, &up->flags);
-       __put_user(kp->mode, &up->mode);
-       __put_user(kp->signal, &up->signal);
-       return 0;
-}
-
-struct video_buffer32 {
-       compat_caddr_t base;
-       compat_int_t height, width, depth, bytesperline;
-};
-
-static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
-{
-       u32 tmp;
-
-       if (get_user(tmp, &up->base))
-               return -EFAULT;
-
-       /* This is actually a physical address stored
-        * as a void pointer.
-        */
-       kp->base = (void *)(unsigned long) tmp;
-
-       __get_user(kp->height, &up->height);
-       __get_user(kp->width, &up->width);
-       __get_user(kp->depth, &up->depth);
-       __get_user(kp->bytesperline, &up->bytesperline);
-       return 0;
-}
-
-static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
-{
-       u32 tmp = (u32)((unsigned long)kp->base);
-
-       if(put_user(tmp, &up->base))
-               return -EFAULT;
-       __put_user(kp->height, &up->height);
-       __put_user(kp->width, &up->width);
-       __put_user(kp->depth, &up->depth);
-       __put_user(kp->bytesperline, &up->bytesperline);
-       return 0;
-}
-
-struct video_clip32 {
-       s32 x, y, width, height;        /* Its really s32 in videodev.h */
-       compat_caddr_t next;
-};
-
-struct video_window32 {
-       u32 x, y, width, height, chromakey, flags;
-       compat_caddr_t clips;
-       compat_int_t clipcount;
-};
-
-/* You get back everything except the clips... */
-static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
-{
-       if(put_user(kp->x, &up->x))
-               return -EFAULT;
-       __put_user(kp->y, &up->y);
-       __put_user(kp->width, &up->width);
-       __put_user(kp->height, &up->height);
-       __put_user(kp->chromakey, &up->chromakey);
-       __put_user(kp->flags, &up->flags);
-       __put_user(kp->clipcount, &up->clipcount);
-       return 0;
-}
-
-#define VIDIOCGTUNER32         _IOWR('v',4, struct video_tuner32)
-#define VIDIOCSTUNER32         _IOW('v',5, struct video_tuner32)
-#define VIDIOCGWIN32           _IOR('v',9, struct video_window32)
-#define VIDIOCSWIN32           _IOW('v',10, struct video_window32)
-#define VIDIOCGFBUF32          _IOR('v',11, struct video_buffer32)
-#define VIDIOCSFBUF32          _IOW('v',12, struct video_buffer32)
-#define VIDIOCGFREQ32          _IOR('v',14, u32)
-#define VIDIOCSFREQ32          _IOW('v',15, u32)
-
-enum {
-       MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip)
-};
-
-static int do_set_window(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-       struct video_window32 __user *up = compat_ptr(arg);
-       struct video_window __user *vw;
-       struct video_clip __user *p;
-       int nclips;
-       u32 n;
-
-       if (get_user(nclips, &up->clipcount))
-               return -EFAULT;
-
-       /* Peculiar interface... */
-       if (nclips < 0)
-               nclips = VIDEO_CLIPMAP_SIZE;
-
-       if (nclips > MaxClips)
-               return -ENOMEM;
-
-       vw = compat_alloc_user_space(sizeof(struct video_window) +
-                                   nclips * sizeof(struct video_clip));
-
-       p = nclips ? (struct video_clip __user *)(vw + 1) : NULL;
-
-       if (get_user(n, &up->x) || put_user(n, &vw->x) ||
-           get_user(n, &up->y) || put_user(n, &vw->y) ||
-           get_user(n, &up->width) || put_user(n, &vw->width) ||
-           get_user(n, &up->height) || put_user(n, &vw->height) ||
-           get_user(n, &up->chromakey) || put_user(n, &vw->chromakey) ||
-           get_user(n, &up->flags) || put_user(n, &vw->flags) ||
-           get_user(n, &up->clipcount) || put_user(n, &vw->clipcount) ||
-           get_user(n, &up->clips) || put_user(p, &vw->clips))
-               return -EFAULT;
-
-       if (nclips) {
-               struct video_clip32 __user *u = compat_ptr(n);
-               int i;
-               if (!u)
-                       return -EINVAL;
-               for (i = 0; i < nclips; i++, u++, p++) {
-                       s32 v;
-                       if (get_user(v, &u->x) ||
-                           put_user(v, &p->x) ||
-                           get_user(v, &u->y) ||
-                           put_user(v, &p->y) ||
-                           get_user(v, &u->width) ||
-                           put_user(v, &p->width) ||
-                           get_user(v, &u->height) ||
-                           put_user(v, &p->height) ||
-                           put_user(NULL, &p->next))
-                               return -EFAULT;
-               }
-       }
-
-       return sys_ioctl(fd, VIDIOCSWIN, (unsigned long)p);
-}
-
-static int do_video_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-       union {
-               struct video_tuner vt;
-               struct video_buffer vb;
-               struct video_window vw;
-               unsigned long vx;
-       } karg;
-       mm_segment_t old_fs = get_fs();
-       void __user *up = compat_ptr(arg);
-       int err = 0;
-
-       /* First, convert the command. */
-       switch(cmd) {
-       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;
-       };
-
-       switch(cmd) {
-       case VIDIOCSTUNER:
-       case VIDIOCGTUNER:
-               err = get_video_tuner32(&karg.vt, up);
-               break;
-
-       case VIDIOCSFBUF:
-               err = get_video_buffer32(&karg.vb, up);
-               break;
-
-       case VIDIOCSFREQ:
-               err = get_user(karg.vx, (u32 __user *)up);
-               break;
-       };
-       if(err)
-               goto out;
-
-       set_fs(KERNEL_DS);
-       err = sys_ioctl(fd, cmd, (unsigned long)&karg);
-       set_fs(old_fs);
-
-       if(err == 0) {
-               switch(cmd) {
-               case VIDIOCGTUNER:
-                       err = put_video_tuner32(&karg.vt, up);
-                       break;
-
-               case VIDIOCGWIN:
-                       err = put_video_window32(&karg.vw, up);
-                       break;
-
-               case VIDIOCGFBUF:
-                       err = put_video_buffer32(&karg.vb, up);
-                       break;
-
-               case VIDIOCGFREQ:
-                       err = put_user(((u32)karg.vx), (u32 __user *)up);
-                       break;
-               };
-       }
-out:
-       return err;
-}
-
 struct compat_dmx_event {
        dmx_event_t     event;
        compat_time_t   timeStamp;
@@ -3015,14 +2777,6 @@ COMPATIBLE_IOCTL(EXT3_IOC_GROUP_ADD)
 #ifdef CONFIG_JBD_DEBUG
 HANDLE_IOCTL(EXT3_IOC32_WAIT_FOR_READONLY, do_ext3_ioctl)
 #endif
-HANDLE_IOCTL(VIDIOCGTUNER32, do_video_ioctl)
-HANDLE_IOCTL(VIDIOCSTUNER32, do_video_ioctl)
-HANDLE_IOCTL(VIDIOCGWIN32, do_video_ioctl)
-HANDLE_IOCTL(VIDIOCSWIN32, do_set_window)
-HANDLE_IOCTL(VIDIOCGFBUF32, do_video_ioctl)
-HANDLE_IOCTL(VIDIOCSFBUF32, do_video_ioctl)
-HANDLE_IOCTL(VIDIOCGFREQ32, do_video_ioctl)
-HANDLE_IOCTL(VIDIOCSFREQ32, do_video_ioctl)
 /* One SMB ioctl needs translations. */
 #define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
index 119f9d064cc6100a1671af7e127bdab31e9cce64..339878952f12f7fe4e3b81ff86691a6923344a34 100644 (file)
@@ -218,32 +218,6 @@ COMPATIBLE_IOCTL(VT_RESIZE)
 COMPATIBLE_IOCTL(VT_RESIZEX)
 COMPATIBLE_IOCTL(VT_LOCKSWITCH)
 COMPATIBLE_IOCTL(VT_UNLOCKSWITCH)
-/* Little v */
-/* Little v, the video4linux ioctls (conflict?) */
-COMPATIBLE_IOCTL(VIDIOCGCAP)
-COMPATIBLE_IOCTL(VIDIOCGCHAN)
-COMPATIBLE_IOCTL(VIDIOCSCHAN)
-COMPATIBLE_IOCTL(VIDIOCGPICT)
-COMPATIBLE_IOCTL(VIDIOCSPICT)
-COMPATIBLE_IOCTL(VIDIOCCAPTURE)
-COMPATIBLE_IOCTL(VIDIOCKEY)
-COMPATIBLE_IOCTL(VIDIOCGAUDIO)
-COMPATIBLE_IOCTL(VIDIOCSAUDIO)
-COMPATIBLE_IOCTL(VIDIOCSYNC)
-COMPATIBLE_IOCTL(VIDIOCMCAPTURE)
-COMPATIBLE_IOCTL(VIDIOCGMBUF)
-COMPATIBLE_IOCTL(VIDIOCGUNIT)
-COMPATIBLE_IOCTL(VIDIOCGCAPTURE)
-COMPATIBLE_IOCTL(VIDIOCSCAPTURE)
-/* BTTV specific... */
-COMPATIBLE_IOCTL(_IOW('v',  BASE_VIDIOCPRIVATE+0, char [256]))
-COMPATIBLE_IOCTL(_IOR('v',  BASE_VIDIOCPRIVATE+1, char [256]))
-COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int))
-COMPATIBLE_IOCTL(_IOW('v' , BASE_VIDIOCPRIVATE+3, char [16])) /* struct bttv_pll_info */
-COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+4, int))
-COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+5, int))
-COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+6, int))
-COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+7, int))
 /* Little p (/dev/rtc, /dev/envctrl, etc.) */
 COMPATIBLE_IOCTL(RTC_AIE_ON)
 COMPATIBLE_IOCTL(RTC_AIE_OFF)
index 1cded681eb6d2a1041270441f99dd4473e7c6c96..13f78ec4bf766bbc412463869945744dc2df5c52 100644 (file)
@@ -1117,6 +1117,9 @@ typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
                           unsigned int cmd, void *arg);
 int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
                               int cmd, void *arg, v4l2_kioctl driver_ioctl);
+/* 32 Bits compatibility layer for 64 bits processors */
+extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
+                               unsigned long arg);
 
 #endif /* __KERNEL__ */
 #endif /* __LINUX_VIDEODEV2_H */