aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-10-21 23:04:45 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:25 -0500
commitd1f81da2361804d62f7ade2703eda68dda6cdb48 (patch)
treec0c238f22d3fae1c07edfaa15ae26724bd31aee4 /drivers/media/video
parentda40b59305f373d386435ece69244c570e3954b6 (diff)
V4L/DVB (9484): v4l: rename compat_ioctl32.c to v4l2-compat-ioctl32.c
All core v4l sources should start with 'v4l2-' This file was the last one for which this was not the case. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/Makefile2
-rw-r--r--drivers/media/video/v4l2-compat-ioctl32.c (renamed from drivers/media/video/compat_ioctl32.c)92
2 files changed, 43 insertions, 51 deletions
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 16962f3aa157..52f2e958db77 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -10,7 +10,7 @@ stkwebcam-objs := stk-webcam.o stk-sensor.o
10 10
11videodev-objs := v4l2-dev.o v4l2-ioctl.o 11videodev-objs := v4l2-dev.o v4l2-ioctl.o
12 12
13obj-$(CONFIG_VIDEO_DEV) += videodev.o compat_ioctl32.o v4l2-int-device.o 13obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-compat-ioctl32.o v4l2-int-device.o
14 14
15obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o 15obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o
16 16
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c
index 0ea85a05e5c0..3b310ab3e3de 100644
--- a/drivers/media/video/compat_ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -32,7 +32,7 @@ struct video_tuner32 {
32 32
33static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) 33static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
34{ 34{
35 if(!access_ok(VERIFY_READ, up, sizeof(struct video_tuner32)) || 35 if (!access_ok(VERIFY_READ, up, sizeof(struct video_tuner32)) ||
36 get_user(kp->tuner, &up->tuner) || 36 get_user(kp->tuner, &up->tuner) ||
37 copy_from_user(kp->name, up->name, 32) || 37 copy_from_user(kp->name, up->name, 32) ||
38 get_user(kp->rangelow, &up->rangelow) || 38 get_user(kp->rangelow, &up->rangelow) ||
@@ -46,7 +46,7 @@ static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user
46 46
47static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) 47static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
48{ 48{
49 if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_tuner32)) || 49 if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_tuner32)) ||
50 put_user(kp->tuner, &up->tuner) || 50 put_user(kp->tuner, &up->tuner) ||
51 copy_to_user(up->name, kp->name, 32) || 51 copy_to_user(up->name, kp->name, 32) ||
52 put_user(kp->rangelow, &up->rangelow) || 52 put_user(kp->rangelow, &up->rangelow) ||
@@ -88,7 +88,7 @@ static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __u
88{ 88{
89 u32 tmp = (u32)((unsigned long)kp->base); 89 u32 tmp = (u32)((unsigned long)kp->base);
90 90
91 if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_buffer32)) || 91 if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_buffer32)) ||
92 put_user(tmp, &up->base) || 92 put_user(tmp, &up->base) ||
93 put_user(kp->height, &up->height) || 93 put_user(kp->height, &up->height) ||
94 put_user(kp->width, &up->width) || 94 put_user(kp->width, &up->width) ||
@@ -130,7 +130,7 @@ static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
130/* You get back everything except the clips... */ 130/* You get back everything except the clips... */
131static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) 131static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
132{ 132{
133 if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) || 133 if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) ||
134 put_user(kp->x, &up->x) || 134 put_user(kp->x, &up->x) ||
135 put_user(kp->y, &up->y) || 135 put_user(kp->y, &up->y) ||
136 put_user(kp->width, &up->width) || 136 put_user(kp->width, &up->width) ||
@@ -143,14 +143,12 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __u
143} 143}
144#endif 144#endif
145 145
146struct v4l2_clip32 146struct v4l2_clip32 {
147{
148 struct v4l2_rect c; 147 struct v4l2_rect c;
149 compat_caddr_t next; 148 compat_caddr_t next;
150}; 149};
151 150
152struct v4l2_window32 151struct v4l2_window32 {
153{
154 struct v4l2_rect w; 152 struct v4l2_rect w;
155 enum v4l2_field field; 153 enum v4l2_field field;
156 __u32 chromakey; 154 __u32 chromakey;
@@ -231,15 +229,13 @@ static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vb
231 return 0; 229 return 0;
232} 230}
233 231
234struct v4l2_format32 232struct v4l2_format32 {
235{
236 enum v4l2_buf_type type; 233 enum v4l2_buf_type type;
237 union 234 union {
238 { 235 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
239 struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE 236 struct v4l2_window32 win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
240 struct v4l2_window32 win; // V4L2_BUF_TYPE_VIDEO_OVERLAY 237 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
241 struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE 238 __u8 raw_data[200]; /* user-defined */
242 __u8 raw_data[200]; // user-defined
243 } fmt; 239 } fmt;
244}; 240};
245 241
@@ -256,7 +252,7 @@ static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user
256 case V4L2_BUF_TYPE_VBI_CAPTURE: 252 case V4L2_BUF_TYPE_VBI_CAPTURE:
257 return get_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi); 253 return get_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi);
258 default: 254 default:
259 printk("compat_ioctl : unexpected VIDIOC_FMT type %d\n", 255 printk(KERN_INFO "compat_ioctl: unexpected VIDIOC_FMT type %d\n",
260 kp->type); 256 kp->type);
261 return -ENXIO; 257 return -ENXIO;
262 } 258 }
@@ -264,7 +260,7 @@ static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user
264 260
265static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up) 261static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
266{ 262{
267 if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)) || 263 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)) ||
268 put_user(kp->type, &up->type)) 264 put_user(kp->type, &up->type))
269 return -EFAULT; 265 return -EFAULT;
270 switch (kp->type) { 266 switch (kp->type) {
@@ -294,8 +290,7 @@ static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standa
294 return 0; 290 return 0;
295} 291}
296 292
297struct v4l2_standard32 293struct v4l2_standard32 {
298{
299 __u32 index; 294 __u32 index;
300 __u32 id[2]; /* __u64 would get the alignment wrong */ 295 __u32 id[2]; /* __u64 would get the alignment wrong */
301 __u8 name[24]; 296 __u8 name[24];
@@ -315,7 +310,7 @@ static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32
315 310
316static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up) 311static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
317{ 312{
318 if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) || 313 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) ||
319 put_user(kp->index, &up->index) || 314 put_user(kp->index, &up->index) ||
320 copy_to_user(up->id, &kp->id, sizeof(__u64)) || 315 copy_to_user(up->id, &kp->id, sizeof(__u64)) ||
321 copy_to_user(up->name, kp->name, 24) || 316 copy_to_user(up->name, kp->name, 24) ||
@@ -341,8 +336,7 @@ static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user
341 return 0; 336 return 0;
342} 337}
343 338
344struct v4l2_buffer32 339struct v4l2_buffer32 {
345{
346 __u32 index; 340 __u32 index;
347 enum v4l2_buf_type type; 341 enum v4l2_buf_type type;
348 __u32 bytesused; 342 __u32 bytesused;
@@ -373,7 +367,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
373 get_user(kp->memory, &up->memory) || 367 get_user(kp->memory, &up->memory) ||
374 get_user(kp->input, &up->input)) 368 get_user(kp->input, &up->input))
375 return -EFAULT; 369 return -EFAULT;
376 switch(kp->memory) { 370 switch (kp->memory) {
377 case V4L2_MEMORY_MMAP: 371 case V4L2_MEMORY_MMAP:
378 break; 372 break;
379 case V4L2_MEMORY_USERPTR: 373 case V4L2_MEMORY_USERPTR:
@@ -388,7 +382,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
388 } 382 }
389 break; 383 break;
390 case V4L2_MEMORY_OVERLAY: 384 case V4L2_MEMORY_OVERLAY:
391 if(get_user(kp->m.offset, &up->m.offset)) 385 if (get_user(kp->m.offset, &up->m.offset))
392 return -EFAULT; 386 return -EFAULT;
393 break; 387 break;
394 } 388 }
@@ -404,7 +398,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
404 put_user(kp->memory, &up->memory) || 398 put_user(kp->memory, &up->memory) ||
405 put_user(kp->input, &up->input)) 399 put_user(kp->input, &up->input))
406 return -EFAULT; 400 return -EFAULT;
407 switch(kp->memory) { 401 switch (kp->memory) {
408 case V4L2_MEMORY_MMAP: 402 case V4L2_MEMORY_MMAP:
409 if (put_user(kp->length, &up->length) || 403 if (put_user(kp->length, &up->length) ||
410 put_user(kp->m.offset, &up->m.offset)) 404 put_user(kp->m.offset, &up->m.offset))
@@ -431,8 +425,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
431 return 0; 425 return 0;
432} 426}
433 427
434struct v4l2_framebuffer32 428struct v4l2_framebuffer32 {
435{
436 __u32 capability; 429 __u32 capability;
437 __u32 flags; 430 __u32 flags;
438 compat_caddr_t base; 431 compat_caddr_t base;
@@ -457,7 +450,7 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
457{ 450{
458 u32 tmp = (u32)((unsigned long)kp->base); 451 u32 tmp = (u32)((unsigned long)kp->base);
459 452
460 if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) || 453 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) ||
461 put_user(tmp, &up->base) || 454 put_user(tmp, &up->base) ||
462 put_user(kp->capability, &up->capability) || 455 put_user(kp->capability, &up->capability) ||
463 put_user(kp->flags, &up->flags)) 456 put_user(kp->flags, &up->flags))
@@ -495,8 +488,7 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user
495} 488}
496 489
497#ifdef CONFIG_VIDEO_V4L1_COMPAT 490#ifdef CONFIG_VIDEO_V4L1_COMPAT
498struct video_code32 491struct video_code32 {
499{
500 char loadwhat[16]; /* name or tag of file being passed */ 492 char loadwhat[16]; /* name or tag of file being passed */
501 compat_int_t datasize; 493 compat_int_t datasize;
502 unsigned char *data; 494 unsigned char *data;
@@ -504,28 +496,28 @@ struct video_code32
504 496
505static inline int microcode32(struct video_code *kp, struct video_code32 __user *up) 497static inline int microcode32(struct video_code *kp, struct video_code32 __user *up)
506{ 498{
507 if(!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) || 499 if (!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) ||
508 copy_from_user(kp->loadwhat, up->loadwhat, sizeof (up->loadwhat)) || 500 copy_from_user(kp->loadwhat, up->loadwhat, sizeof(up->loadwhat)) ||
509 get_user(kp->datasize, &up->datasize) || 501 get_user(kp->datasize, &up->datasize) ||
510 copy_from_user(kp->data, up->data, up->datasize)) 502 copy_from_user(kp->data, up->data, up->datasize))
511 return -EFAULT; 503 return -EFAULT;
512 return 0; 504 return 0;
513} 505}
514 506
515#define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32) 507#define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32)
516#define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32) 508#define VIDIOCSTUNER32 _IOW('v', 5, struct video_tuner32)
517#define VIDIOCGWIN32 _IOR('v',9, struct video_window32) 509#define VIDIOCGWIN32 _IOR('v', 9, struct video_window32)
518#define VIDIOCSWIN32 _IOW('v',10, struct video_window32) 510#define VIDIOCSWIN32 _IOW('v', 10, struct video_window32)
519#define VIDIOCGFBUF32 _IOR('v',11, struct video_buffer32) 511#define VIDIOCGFBUF32 _IOR('v', 11, struct video_buffer32)
520#define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32) 512#define VIDIOCSFBUF32 _IOW('v', 12, struct video_buffer32)
521#define VIDIOCGFREQ32 _IOR('v',14, u32) 513#define VIDIOCGFREQ32 _IOR('v', 14, u32)
522#define VIDIOCSFREQ32 _IOW('v',15, u32) 514#define VIDIOCSFREQ32 _IOW('v', 15, u32)
523#define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32) 515#define VIDIOCSMICROCODE32 _IOW('v', 27, struct video_code32)
524 516
525#endif 517#endif
526 518
527/* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ 519/* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */
528#define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) 520#define VIDIOC_ENUMINPUT32 (VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4))
529#define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32) 521#define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32)
530#define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32) 522#define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32)
531#define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32) 523#define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32)
@@ -635,7 +627,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
635 int realcmd = cmd; 627 int realcmd = cmd;
636 628
637 /* First, convert the command. */ 629 /* First, convert the command. */
638 switch(cmd) { 630 switch (cmd) {
639#ifdef CONFIG_VIDEO_V4L1_COMPAT 631#ifdef CONFIG_VIDEO_V4L1_COMPAT
640 case VIDIOCGTUNER32: realcmd = cmd = VIDIOCGTUNER; break; 632 case VIDIOCGTUNER32: realcmd = cmd = VIDIOCGTUNER; break;
641 case VIDIOCSTUNER32: realcmd = cmd = VIDIOCSTUNER; break; 633 case VIDIOCSTUNER32: realcmd = cmd = VIDIOCSTUNER; break;
@@ -664,7 +656,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
664 case VIDIOC_TRY_FMT32: realcmd = cmd = VIDIOC_TRY_FMT; break; 656 case VIDIOC_TRY_FMT32: realcmd = cmd = VIDIOC_TRY_FMT; break;
665 }; 657 };
666 658
667 switch(cmd) { 659 switch (cmd) {
668#ifdef CONFIG_VIDEO_V4L1_COMPAT 660#ifdef CONFIG_VIDEO_V4L1_COMPAT
669 case VIDIOCSTUNER: 661 case VIDIOCSTUNER:
670 case VIDIOCGTUNER: 662 case VIDIOCGTUNER:
@@ -750,20 +742,20 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
750 break; 742 break;
751#endif 743#endif
752 }; 744 };
753 if(err) 745 if (err)
754 goto out; 746 goto out;
755 747
756 if(compatible_arg) 748 if (compatible_arg)
757 err = native_ioctl(file, realcmd, (unsigned long)up); 749 err = native_ioctl(file, realcmd, (unsigned long)up);
758 else { 750 else {
759 mm_segment_t old_fs = get_fs(); 751 mm_segment_t old_fs = get_fs();
760 752
761 set_fs(KERNEL_DS); 753 set_fs(KERNEL_DS);
762 err = native_ioctl(file, realcmd, (unsigned long) &karg); 754 err = native_ioctl(file, realcmd, (unsigned long)&karg);
763 set_fs(old_fs); 755 set_fs(old_fs);
764 } 756 }
765 if(err == 0) { 757 if (err == 0) {
766 switch(cmd) { 758 switch (cmd) {
767#ifdef CONFIG_VIDEO_V4L1_COMPAT 759#ifdef CONFIG_VIDEO_V4L1_COMPAT
768 case VIDIOCGTUNER: 760 case VIDIOCGTUNER:
769 err = put_video_tuner32(&karg.vt, up); 761 err = put_video_tuner32(&karg.vt, up);