diff options
-rw-r--r-- | linux/drivers/media/video/Makefile | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/v4l2-compat-ioctl32.c (renamed from linux/drivers/media/video/compat_ioctl32.c) | 95 | ||||
-rw-r--r-- | v4l/obsolete.txt | 3 |
3 files changed, 47 insertions, 53 deletions
diff --git a/linux/drivers/media/video/Makefile b/linux/drivers/media/video/Makefile index 745780e1f..71117f5c8 100644 --- a/linux/drivers/media/video/Makefile +++ b/linux/drivers/media/video/Makefile @@ -10,7 +10,7 @@ stkwebcam-objs := stk-webcam.o stk-sensor.o videodev-objs := v4l2-dev.o v4l2-ioctl.o -obj-$(CONFIG_VIDEO_DEV) += videodev.o compat_ioctl32.o v4l2-int-device.o +obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-compat-ioctl32.o v4l2-int-device.o obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o diff --git a/linux/drivers/media/video/compat_ioctl32.c b/linux/drivers/media/video/v4l2-compat-ioctl32.c index a37f3a64e..9624be1a8 100644 --- a/linux/drivers/media/video/compat_ioctl32.c +++ b/linux/drivers/media/video/v4l2-compat-ioctl32.c @@ -33,7 +33,7 @@ struct video_tuner32 { static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) { - if(!access_ok(VERIFY_READ, up, sizeof(struct video_tuner32)) || + if (!access_ok(VERIFY_READ, up, sizeof(struct video_tuner32)) || get_user(kp->tuner, &up->tuner) || copy_from_user(kp->name, up->name, 32) || get_user(kp->rangelow, &up->rangelow) || @@ -47,7 +47,7 @@ static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) { - if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_tuner32)) || + if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_tuner32)) || put_user(kp->tuner, &up->tuner) || copy_to_user(up->name, kp->name, 32) || put_user(kp->rangelow, &up->rangelow) || @@ -66,7 +66,6 @@ struct video_audio32 { __u16 bass, treble; __u32 flags; __u8 name[16]; -// char name[16]; __u16 mode; __u16 balance; __u16 step; @@ -138,7 +137,7 @@ static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __u { u32 tmp = (u32)((unsigned long)kp->base); - if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_buffer32)) || + if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_buffer32)) || put_user(tmp, &up->base) || put_user(kp->height, &up->height) || put_user(kp->width, &up->width) || @@ -168,7 +167,7 @@ static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = file->f_op->unlocked_ioctl(file, cmd, arg); else if (file->f_op->ioctl) { lock_kernel(); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) ret = file->f_op->ioctl(file->f_dentry->d_inode, file, cmd, arg); #else ret = file->f_op->ioctl(file->f_path.dentry->d_inode, file, cmd, arg); @@ -184,7 +183,7 @@ static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) /* You get back everything except the clips... */ static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) { - if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) || + if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) || put_user(kp->x, &up->x) || put_user(kp->y, &up->y) || put_user(kp->width, &up->width) || @@ -197,14 +196,12 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __u } #endif -struct v4l2_clip32 -{ +struct v4l2_clip32 { struct v4l2_rect c; compat_caddr_t next; }; -struct v4l2_window32 -{ +struct v4l2_window32 { struct v4l2_rect w; enum v4l2_field field; __u32 chromakey; @@ -285,15 +282,13 @@ static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vb return 0; } -struct v4l2_format32 -{ +struct v4l2_format32 { enum v4l2_buf_type type; - union - { - struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE - struct v4l2_window32 win; // V4L2_BUF_TYPE_VIDEO_OVERLAY - struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE - __u8 raw_data[200]; // user-defined + union { + struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ + struct v4l2_window32 win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ + struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ + __u8 raw_data[200]; /* user-defined */ } fmt; }; @@ -310,7 +305,7 @@ static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user case V4L2_BUF_TYPE_VBI_CAPTURE: return get_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi); default: - printk("compat_ioctl : unexpected VIDIOC_FMT type %d\n", + printk(KERN_INFO "compat_ioctl: unexpected VIDIOC_FMT type %d\n", kp->type); return -ENXIO; } @@ -318,7 +313,7 @@ static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up) { - if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)) || + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)) || put_user(kp->type, &up->type)) return -EFAULT; switch (kp->type) { @@ -348,8 +343,7 @@ static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standa return 0; } -struct v4l2_standard32 -{ +struct v4l2_standard32 { __u32 index; __u32 id[2]; /* __u64 would get the alignment wrong */ __u8 name[24]; @@ -369,7 +363,7 @@ static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up) { - if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) || + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) || put_user(kp->index, &up->index) || copy_to_user(up->id, &kp->id, sizeof(__u64)) || copy_to_user(up->name, kp->name, 24) || @@ -395,8 +389,7 @@ static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user return 0; } -struct v4l2_buffer32 -{ +struct v4l2_buffer32 { __u32 index; enum v4l2_buf_type type; __u32 bytesused; @@ -427,7 +420,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user get_user(kp->memory, &up->memory) || get_user(kp->input, &up->input)) return -EFAULT; - switch(kp->memory) { + switch (kp->memory) { case V4L2_MEMORY_MMAP: break; case V4L2_MEMORY_USERPTR: @@ -442,7 +435,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user } break; case V4L2_MEMORY_OVERLAY: - if(get_user(kp->m.offset, &up->m.offset)) + if (get_user(kp->m.offset, &up->m.offset)) return -EFAULT; break; } @@ -458,7 +451,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user put_user(kp->memory, &up->memory) || put_user(kp->input, &up->input)) return -EFAULT; - switch(kp->memory) { + switch (kp->memory) { case V4L2_MEMORY_MMAP: if (put_user(kp->length, &up->length) || put_user(kp->m.offset, &up->m.offset)) @@ -485,8 +478,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user return 0; } -struct v4l2_framebuffer32 -{ +struct v4l2_framebuffer32 { __u32 capability; __u32 flags; compat_caddr_t base; @@ -511,7 +503,7 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame { u32 tmp = (u32)((unsigned long)kp->base); - if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) || + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) || put_user(tmp, &up->base) || put_user(kp->capability, &up->capability) || put_user(kp->flags, &up->flags)) @@ -549,8 +541,7 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user } #ifdef CONFIG_VIDEO_V4L1_COMPAT -struct video_code32 -{ +struct video_code32 { char loadwhat[16]; /* name or tag of file being passed */ compat_int_t datasize; unsigned char *data; @@ -558,28 +549,28 @@ struct video_code32 static inline int microcode32(struct video_code *kp, struct video_code32 __user *up) { - if(!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) || - copy_from_user(kp->loadwhat, up->loadwhat, sizeof (up->loadwhat)) || + if (!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) || + copy_from_user(kp->loadwhat, up->loadwhat, sizeof(up->loadwhat)) || get_user(kp->datasize, &up->datasize) || copy_from_user(kp->data, up->data, up->datasize)) return -EFAULT; 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) -#define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32) +#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) +#define VIDIOCSMICROCODE32 _IOW('v', 27, struct video_code32) #endif /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ -#define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) +#define VIDIOC_ENUMINPUT32 (VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4)) #define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32) #define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32) #define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32) @@ -689,7 +680,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg int realcmd = cmd; /* First, convert the command. */ - switch(cmd) { + switch (cmd) { #ifdef CONFIG_VIDEO_V4L1_COMPAT case VIDIOCGTUNER32: realcmd = cmd = VIDIOCGTUNER; break; case VIDIOCSTUNER32: realcmd = cmd = VIDIOCSTUNER; break; @@ -718,7 +709,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg case VIDIOC_TRY_FMT32: realcmd = cmd = VIDIOC_TRY_FMT; break; }; - switch(cmd) { + switch (cmd) { #ifdef CONFIG_VIDEO_V4L1_COMPAT case VIDIOCSTUNER: case VIDIOCGTUNER: @@ -810,20 +801,20 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg break; #endif }; - if(err) + if (err) goto out; - if(compatible_arg) + if (compatible_arg) err = native_ioctl(file, realcmd, (unsigned long)up); else { 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) { - switch(cmd) { + if (err == 0) { + switch (cmd) { #ifdef CONFIG_VIDEO_V4L1_COMPAT case VIDIOCGTUNER: err = put_video_tuner32(&karg.vt, up); diff --git a/v4l/obsolete.txt b/v4l/obsolete.txt index e720a48b8..95becc61a 100644 --- a/v4l/obsolete.txt +++ b/v4l/obsolete.txt @@ -1,3 +1,6 @@ +# This file was renamed to v4l2_compat_ioctl32 +video/compat-ioctl32 + # This file were replaced by videobuf-dma-sg and videobuf-core video/video-buf |