aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/v4l2-compat-ioctl32.c781
-rw-r--r--include/linux/videodev2.h2
2 files changed, 467 insertions, 316 deletions
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c
index 9b50b43b76a2..5084773d4f10 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -7,12 +7,14 @@
7 * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs 7 * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs
8 * Copyright (C) 2003 Pavel Machek (pavel@suse.cz) 8 * Copyright (C) 2003 Pavel Machek (pavel@suse.cz)
9 * Copyright (C) 2005 Philippe De Muyter (phdm@macqel.be) 9 * Copyright (C) 2005 Philippe De Muyter (phdm@macqel.be)
10 * Copyright (C) 2008 Hans Verkuil <hverkuil@xs4all.nl>
10 * 11 *
11 * These routines maintain argument size conversion between 32bit and 64bit 12 * These routines maintain argument size conversion between 32bit and 64bit
12 * ioctls. 13 * ioctls.
13 */ 14 */
14 15
15#include <linux/compat.h> 16#include <linux/compat.h>
17#define __OLD_VIDIOC_ /* To allow fixing old calls*/
16#include <linux/videodev.h> 18#include <linux/videodev.h>
17#include <linux/videodev2.h> 19#include <linux/videodev2.h>
18#include <linux/module.h> 20#include <linux/module.h>
@@ -58,7 +60,6 @@ static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user
58 return 0; 60 return 0;
59} 61}
60 62
61
62struct video_buffer32 { 63struct video_buffer32 {
63 compat_caddr_t base; 64 compat_caddr_t base;
64 compat_int_t height, width, depth, bytesperline; 65 compat_int_t height, width, depth, bytesperline;
@@ -99,7 +100,7 @@ static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __u
99} 100}
100 101
101struct video_clip32 { 102struct video_clip32 {
102 s32 x, y, width, height; /* Its really s32 in videodev.h */ 103 s32 x, y, width, height; /* It's really s32 in videodev.h */
103 compat_caddr_t next; 104 compat_caddr_t next;
104}; 105};
105 106
@@ -108,25 +109,72 @@ struct video_window32 {
108 compat_caddr_t clips; 109 compat_caddr_t clips;
109 compat_int_t clipcount; 110 compat_int_t clipcount;
110}; 111};
111#endif
112 112
113static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 113static int get_video_window32(struct video_window *kp, struct video_window32 __user *up)
114{ 114{
115 int ret = -ENOIOCTLCMD; 115 struct video_clip __user *uclips;
116 struct video_clip __user *kclips;
117 compat_caddr_t p;
118 int nclips;
116 119
117 if (file->f_op->unlocked_ioctl) 120 if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32)))
118 ret = file->f_op->unlocked_ioctl(file, cmd, arg); 121 return -EFAULT;
119 else if (file->f_op->ioctl) { 122
120 lock_kernel(); 123 if (get_user(nclips, &up->clipcount))
121 ret = file->f_op->ioctl(file->f_path.dentry->d_inode, file, cmd, arg); 124 return -EFAULT;
122 unlock_kernel(); 125
126 if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32)) ||
127 get_user(kp->x, &up->x) ||
128 get_user(kp->y, &up->y) ||
129 get_user(kp->width, &up->width) ||
130 get_user(kp->height, &up->height) ||
131 get_user(kp->chromakey, &up->chromakey) ||
132 get_user(kp->flags, &up->flags) ||
133 get_user(kp->clipcount, &up->clipcount))
134 return -EFAULT;
135
136 nclips = kp->clipcount;
137 kp->clips = NULL;
138
139 if (nclips == 0)
140 return 0;
141 if (get_user(p, &up->clips))
142 return -EFAULT;
143 uclips = compat_ptr(p);
144
145 /* If nclips < 0, then it is a clipping bitmap of size
146 VIDEO_CLIPMAP_SIZE */
147 if (nclips < 0) {
148 if (!access_ok(VERIFY_READ, uclips, VIDEO_CLIPMAP_SIZE))
149 return -EFAULT;
150 kp->clips = compat_alloc_user_space(VIDEO_CLIPMAP_SIZE);
151 if (copy_in_user(kp->clips, uclips, VIDEO_CLIPMAP_SIZE))
152 return -EFAULT;
153 return 0;
123 } 154 }
124 155
125 return ret; 156 /* Otherwise it is an array of video_clip structs. */
126} 157 if (!access_ok(VERIFY_READ, uclips, nclips * sizeof(struct video_clip)))
158 return -EFAULT;
127 159
160 kp->clips = compat_alloc_user_space(nclips * sizeof(struct video_clip));
161 kclips = kp->clips;
162 while (nclips--) {
163 int err;
164
165 err = copy_in_user(&kclips->x, &uclips->x, sizeof(kclips->x));
166 err |= copy_in_user(&kclips->y, &uclips->y, sizeof(kclips->y));
167 err |= copy_in_user(&kclips->width, &uclips->width, sizeof(kclips->width));
168 err |= copy_in_user(&kclips->height, &uclips->height, sizeof(kclips->height));
169 kclips->next = NULL;
170 if (err)
171 return -EFAULT;
172 kclips++;
173 uclips++;
174 }
175 return 0;
176}
128 177
129#ifdef CONFIG_VIDEO_V4L1_COMPAT
130/* You get back everything except the clips... */ 178/* You get back everything except the clips... */
131static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) 179static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
132{ 180{
@@ -141,8 +189,55 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __u
141 return -EFAULT; 189 return -EFAULT;
142 return 0; 190 return 0;
143} 191}
192
193struct video_code32 {
194 char loadwhat[16]; /* name or tag of file being passed */
195 compat_int_t datasize;
196 unsigned char *data;
197};
198
199static int get_microcode32(struct video_code *kp, struct video_code32 __user *up)
200{
201 if (!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) ||
202 copy_from_user(kp->loadwhat, up->loadwhat, sizeof(up->loadwhat)) ||
203 get_user(kp->datasize, &up->datasize) ||
204 copy_from_user(kp->data, up->data, up->datasize))
205 return -EFAULT;
206 return 0;
207}
208
209#define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32)
210#define VIDIOCSTUNER32 _IOW('v', 5, struct video_tuner32)
211#define VIDIOCGWIN32 _IOR('v', 9, struct video_window32)
212#define VIDIOCSWIN32 _IOW('v', 10, struct video_window32)
213#define VIDIOCGFBUF32 _IOR('v', 11, struct video_buffer32)
214#define VIDIOCSFBUF32 _IOW('v', 12, struct video_buffer32)
215#define VIDIOCGFREQ32 _IOR('v', 14, u32)
216#define VIDIOCSFREQ32 _IOW('v', 15, u32)
217#define VIDIOCSMICROCODE32 _IOW('v', 27, struct video_code32)
218
219#define VIDIOCCAPTURE32 _IOW('v', 8, s32)
220#define VIDIOCSYNC32 _IOW('v', 18, s32)
221#define VIDIOCSWRITEMODE32 _IOW('v', 25, s32)
222
144#endif 223#endif
145 224
225static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
226{
227 int ret = -ENOIOCTLCMD;
228
229 if (file->f_op->unlocked_ioctl)
230 ret = file->f_op->unlocked_ioctl(file, cmd, arg);
231 else if (file->f_op->ioctl) {
232 lock_kernel();
233 ret = file->f_op->ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
234 unlock_kernel();
235 }
236
237 return ret;
238}
239
240
146struct v4l2_clip32 { 241struct v4l2_clip32 {
147 struct v4l2_rect c; 242 struct v4l2_rect c;
148 compat_caddr_t next; 243 compat_caddr_t next;
@@ -229,12 +324,27 @@ static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vb
229 return 0; 324 return 0;
230} 325}
231 326
327static inline int get_v4l2_sliced_vbi_format(struct v4l2_sliced_vbi_format *kp, struct v4l2_sliced_vbi_format __user *up)
328{
329 if (copy_from_user(kp, up, sizeof(struct v4l2_sliced_vbi_format)))
330 return -EFAULT;
331 return 0;
332}
333
334static inline int put_v4l2_sliced_vbi_format(struct v4l2_sliced_vbi_format *kp, struct v4l2_sliced_vbi_format __user *up)
335{
336 if (copy_to_user(up, kp, sizeof(struct v4l2_sliced_vbi_format)))
337 return -EFAULT;
338 return 0;
339}
340
232struct v4l2_format32 { 341struct v4l2_format32 {
233 enum v4l2_buf_type type; 342 enum v4l2_buf_type type;
234 union { 343 union {
235 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ 344 struct v4l2_pix_format pix;
236 struct v4l2_window32 win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ 345 struct v4l2_window32 win;
237 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ 346 struct v4l2_vbi_format vbi;
347 struct v4l2_sliced_vbi_format sliced;
238 __u8 raw_data[200]; /* user-defined */ 348 __u8 raw_data[200]; /* user-defined */
239 } fmt; 349 } fmt;
240}; 350};
@@ -246,15 +356,27 @@ static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user
246 return -EFAULT; 356 return -EFAULT;
247 switch (kp->type) { 357 switch (kp->type) {
248 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 358 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
359 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
249 return get_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix); 360 return get_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix);
250 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 361 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
362 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
251 return get_v4l2_window32(&kp->fmt.win, &up->fmt.win); 363 return get_v4l2_window32(&kp->fmt.win, &up->fmt.win);
252 case V4L2_BUF_TYPE_VBI_CAPTURE: 364 case V4L2_BUF_TYPE_VBI_CAPTURE:
365 case V4L2_BUF_TYPE_VBI_OUTPUT:
253 return get_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi); 366 return get_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi);
367 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
368 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
369 return get_v4l2_sliced_vbi_format(&kp->fmt.sliced, &up->fmt.sliced);
370 case V4L2_BUF_TYPE_PRIVATE:
371 if (copy_from_user(kp, up, sizeof(kp->fmt.raw_data)))
372 return -EFAULT;
373 return 0;
374 case 0:
375 return -EINVAL;
254 default: 376 default:
255 printk(KERN_INFO "compat_ioctl: unexpected VIDIOC_FMT type %d\n", 377 printk(KERN_INFO "compat_ioctl32: unexpected VIDIOC_FMT type %d\n",
256 kp->type); 378 kp->type);
257 return -ENXIO; 379 return -EINVAL;
258 } 380 }
259} 381}
260 382
@@ -265,31 +387,30 @@ static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user
265 return -EFAULT; 387 return -EFAULT;
266 switch (kp->type) { 388 switch (kp->type) {
267 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 389 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
390 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
268 return put_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix); 391 return put_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix);
269 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 392 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
393 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
270 return put_v4l2_window32(&kp->fmt.win, &up->fmt.win); 394 return put_v4l2_window32(&kp->fmt.win, &up->fmt.win);
271 case V4L2_BUF_TYPE_VBI_CAPTURE: 395 case V4L2_BUF_TYPE_VBI_CAPTURE:
396 case V4L2_BUF_TYPE_VBI_OUTPUT:
272 return put_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi); 397 return put_v4l2_vbi_format(&kp->fmt.vbi, &up->fmt.vbi);
398 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
399 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
400 return put_v4l2_sliced_vbi_format(&kp->fmt.sliced, &up->fmt.sliced);
401 case V4L2_BUF_TYPE_PRIVATE:
402 if (copy_to_user(up, kp, sizeof(up->fmt.raw_data)))
403 return -EFAULT;
404 return 0;
405 case 0:
406 return -EINVAL;
273 default: 407 default:
274 return -ENXIO; 408 printk(KERN_INFO "compat_ioctl32: unexpected VIDIOC_FMT type %d\n",
409 kp->type);
410 return -EINVAL;
275 } 411 }
276} 412}
277 413
278static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
279{
280 if (copy_from_user(kp, up, sizeof(struct v4l2_standard)))
281 return -EFAULT;
282 return 0;
283
284}
285
286static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
287{
288 if (copy_to_user(up, kp, sizeof(struct v4l2_standard)))
289 return -EFAULT;
290 return 0;
291}
292
293struct v4l2_standard32 { 414struct v4l2_standard32 {
294 __u32 index; 415 __u32 index;
295 __u32 id[2]; /* __u64 would get the alignment wrong */ 416 __u32 id[2]; /* __u64 would get the alignment wrong */
@@ -321,21 +442,6 @@ static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32
321 return 0; 442 return 0;
322} 443}
323 444
324static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
325{
326 if (copy_from_user(kp, up, sizeof(struct v4l2_tuner)))
327 return -EFAULT;
328 return 0;
329
330}
331
332static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
333{
334 if (copy_to_user(up, kp, sizeof(struct v4l2_tuner)))
335 return -EFAULT;
336 return 0;
337}
338
339struct v4l2_buffer32 { 445struct v4l2_buffer32 {
340 __u32 index; 446 __u32 index;
341 enum v4l2_buf_type type; 447 enum v4l2_buf_type type;
@@ -459,149 +565,143 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
459 return 0; 565 return 0;
460} 566}
461 567
462static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 568struct v4l2_input32 {
463{ 569 __u32 index; /* Which input */
464 if (copy_from_user(kp, up, sizeof(struct v4l2_input) - 4)) 570 __u8 name[32]; /* Label */
465 return -EFAULT; 571 __u32 type; /* Type of input */
466 return 0; 572 __u32 audioset; /* Associated audios (bitfield) */
467} 573 __u32 tuner; /* Associated tuner */
468 574 v4l2_std_id std;
469static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 575 __u32 status;
576 __u32 reserved[4];
577} __attribute__ ((packed));
578
579/* The 64-bit v4l2_input struct has extra padding at the end of the struct.
580 Otherwise it is identical to the 32-bit version. */
581static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input32 __user *up)
470{ 582{
471 if (copy_to_user(up, kp, sizeof(struct v4l2_input) - 4)) 583 if (copy_from_user(kp, up, sizeof(struct v4l2_input32)))
472 return -EFAULT; 584 return -EFAULT;
473 return 0; 585 return 0;
474} 586}
475 587
476static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 588static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input32 __user *up)
477{ 589{
478 if (copy_from_user(kp, up, sizeof(struct v4l2_input))) 590 if (copy_to_user(up, kp, sizeof(struct v4l2_input32)))
479 return -EFAULT; 591 return -EFAULT;
480 return 0; 592 return 0;
481} 593}
482 594
483static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 595struct v4l2_ext_controls32 {
484{ 596 __u32 ctrl_class;
485 if (copy_to_user(up, kp, sizeof(struct v4l2_input))) 597 __u32 count;
486 return -EFAULT; 598 __u32 error_idx;
487 return 0; 599 __u32 reserved[2];
488} 600 compat_caddr_t controls; /* actually struct v4l2_ext_control32 * */
489
490#ifdef CONFIG_VIDEO_V4L1_COMPAT
491struct video_code32 {
492 char loadwhat[16]; /* name or tag of file being passed */
493 compat_int_t datasize;
494 unsigned char *data;
495}; 601};
496 602
497static inline int microcode32(struct video_code *kp, struct video_code32 __user *up) 603static int get_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext_controls32 __user *up)
498{ 604{
499 if (!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) || 605 struct v4l2_ext_control __user *ucontrols;
500 copy_from_user(kp->loadwhat, up->loadwhat, sizeof(up->loadwhat)) || 606 struct v4l2_ext_control __user *kcontrols;
501 get_user(kp->datasize, &up->datasize) || 607 int n;
502 copy_from_user(kp->data, up->data, up->datasize)) 608 compat_caddr_t p;
609
610 if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_ext_controls32)) ||
611 get_user(kp->ctrl_class, &up->ctrl_class) ||
612 get_user(kp->count, &up->count) ||
613 get_user(kp->error_idx, &up->error_idx) ||
614 copy_from_user(kp->reserved, up->reserved, sizeof(kp->reserved)))
615 return -EFAULT;
616 n = kp->count;
617 if (n == 0) {
618 kp->controls = NULL;
619 return 0;
620 }
621 if (get_user(p, &up->controls))
622 return -EFAULT;
623 ucontrols = compat_ptr(p);
624 if (!access_ok(VERIFY_READ, ucontrols, n * sizeof(struct v4l2_ext_control)))
625 return -EFAULT;
626 kcontrols = compat_alloc_user_space(n * sizeof(struct v4l2_ext_control));
627 kp->controls = kcontrols;
628 while (--n >= 0) {
629 if (copy_in_user(&kcontrols->id, &ucontrols->id, sizeof(__u32)))
630 return -EFAULT;
631 if (copy_in_user(&kcontrols->reserved2, &ucontrols->reserved2, sizeof(ucontrols->reserved2)))
503 return -EFAULT; 632 return -EFAULT;
633 /* Note: if the void * part of the union ever becomes relevant
634 then we need to know the type of the control in order to do
635 the right thing here. Luckily, that is not yet an issue. */
636 if (copy_in_user(&kcontrols->value, &ucontrols->value, sizeof(ucontrols->value)))
637 return -EFAULT;
638 ucontrols++;
639 kcontrols++;
640 }
504 return 0; 641 return 0;
505} 642}
506 643
507#define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32) 644static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext_controls32 __user *up)
508#define VIDIOCSTUNER32 _IOW('v', 5, struct video_tuner32)
509#define VIDIOCGWIN32 _IOR('v', 9, struct video_window32)
510#define VIDIOCSWIN32 _IOW('v', 10, struct video_window32)
511#define VIDIOCGFBUF32 _IOR('v', 11, struct video_buffer32)
512#define VIDIOCSFBUF32 _IOW('v', 12, struct video_buffer32)
513#define VIDIOCGFREQ32 _IOR('v', 14, u32)
514#define VIDIOCSFREQ32 _IOW('v', 15, u32)
515#define VIDIOCSMICROCODE32 _IOW('v', 27, struct video_code32)
516
517#endif
518
519/* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */
520#define VIDIOC_ENUMINPUT32 (VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4))
521#define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32)
522#define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32)
523#define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32)
524#define VIDIOC_G_FBUF32 _IOR ('V', 10, struct v4l2_framebuffer32)
525#define VIDIOC_S_FBUF32 _IOW ('V', 11, struct v4l2_framebuffer32)
526/* VIDIOC_OVERLAY is now _IOW, but was _IOWR */
527#define VIDIOC_OVERLAY32 _IOWR ('V', 14, compat_int_t)
528#define VIDIOC_QBUF32 _IOWR ('V', 15, struct v4l2_buffer32)
529#define VIDIOC_DQBUF32 _IOWR ('V', 17, struct v4l2_buffer32)
530#define VIDIOC_STREAMON32 _IOW ('V', 18, compat_int_t)
531#define VIDIOC_STREAMOFF32 _IOW ('V', 19, compat_int_t)
532#define VIDIOC_ENUMSTD32 _IOWR ('V', 25, struct v4l2_standard32)
533/* VIDIOC_S_CTRL is now _IOWR, but was _IOW */
534#define VIDIOC_S_CTRL32 _IOW ('V', 28, struct v4l2_control)
535#define VIDIOC_G_INPUT32 _IOR ('V', 38, compat_int_t)
536#define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t)
537#define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32)
538
539#ifdef CONFIG_VIDEO_V4L1_COMPAT
540enum {
541 MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip)
542};
543
544static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg)
545{ 645{
546 struct video_window32 __user *up = compat_ptr(arg); 646 struct v4l2_ext_control __user *ucontrols;
547 struct video_window __user *vw; 647 struct v4l2_ext_control __user *kcontrols = kp->controls;
548 struct video_clip __user *p; 648 int n = kp->count;
549 int nclips; 649 compat_caddr_t p;
550 u32 n; 650
551 651 if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_ext_controls32)) ||
552 if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32))) 652 put_user(kp->ctrl_class, &up->ctrl_class) ||
553 return -EFAULT; 653 put_user(kp->count, &up->count) ||
654 put_user(kp->error_idx, &up->error_idx) ||
655 copy_to_user(up->reserved, kp->reserved, sizeof(up->reserved)))
656 return -EFAULT;
657 if (!kp->count)
658 return 0;
554 659
555 if (get_user(nclips, &up->clipcount)) 660 if (get_user(p, &up->controls))
556 return -EFAULT; 661 return -EFAULT;
557 662 ucontrols = compat_ptr(p);
558 /* Peculiar interface... */ 663 if (!access_ok(VERIFY_WRITE, ucontrols, n * sizeof(struct v4l2_ext_control)))
559 if (nclips < 0)
560 nclips = VIDEO_CLIPMAP_SIZE;
561
562 if (nclips > MaxClips)
563 return -ENOMEM;
564
565 vw = compat_alloc_user_space(sizeof(struct video_window) +
566 nclips * sizeof(struct video_clip));
567
568 p = nclips ? (struct video_clip __user *)(vw + 1) : NULL;
569
570 if (get_user(n, &up->x) || put_user(n, &vw->x) ||
571 get_user(n, &up->y) || put_user(n, &vw->y) ||
572 get_user(n, &up->width) || put_user(n, &vw->width) ||
573 get_user(n, &up->height) || put_user(n, &vw->height) ||
574 get_user(n, &up->chromakey) || put_user(n, &vw->chromakey) ||
575 get_user(n, &up->flags) || put_user(n, &vw->flags) ||
576 get_user(n, &up->clipcount) || put_user(n, &vw->clipcount) ||
577 get_user(n, &up->clips) || put_user(p, &vw->clips))
578 return -EFAULT; 664 return -EFAULT;
579 665
580 if (nclips) { 666 while (--n >= 0) {
581 struct video_clip32 __user *u = compat_ptr(n); 667 if (copy_in_user(&ucontrols->id, &kcontrols->id, sizeof(__u32)))
582 int i; 668 return -EFAULT;
583 if (!u) 669 if (copy_in_user(&ucontrols->reserved2, &kcontrols->reserved2,
584 return -EINVAL; 670 sizeof(ucontrols->reserved2)))
585 for (i = 0; i < nclips; i++, u++, p++) { 671 return -EFAULT;
586 s32 v; 672 /* Note: if the void * part of the union ever becomes relevant
587 if (!access_ok(VERIFY_READ, u, sizeof(struct video_clip32)) || 673 then we need to know the type of the control in order to do
588 !access_ok(VERIFY_WRITE, p, sizeof(struct video_clip32)) || 674 the right thing here. Luckily, that is not yet an issue. */
589 get_user(v, &u->x) || 675 if (copy_in_user(&ucontrols->value, &kcontrols->value, sizeof(ucontrols->value)))
590 put_user(v, &p->x) || 676 return -EFAULT;
591 get_user(v, &u->y) || 677 ucontrols++;
592 put_user(v, &p->y) || 678 kcontrols++;
593 get_user(v, &u->width) ||
594 put_user(v, &p->width) ||
595 get_user(v, &u->height) ||
596 put_user(v, &p->height) ||
597 put_user(NULL, &p->next))
598 return -EFAULT;
599 }
600 } 679 }
601 680 return 0;
602 return native_ioctl(file, VIDIOCSWIN, (unsigned long)vw);
603} 681}
604#endif 682
683#define VIDIOC_G_FMT32 _IOWR('V', 4, struct v4l2_format32)
684#define VIDIOC_S_FMT32 _IOWR('V', 5, struct v4l2_format32)
685#define VIDIOC_QUERYBUF32 _IOWR('V', 9, struct v4l2_buffer32)
686#define VIDIOC_G_FBUF32 _IOR ('V', 10, struct v4l2_framebuffer32)
687#define VIDIOC_S_FBUF32 _IOW ('V', 11, struct v4l2_framebuffer32)
688#define VIDIOC_QBUF32 _IOWR('V', 15, struct v4l2_buffer32)
689#define VIDIOC_DQBUF32 _IOWR('V', 17, struct v4l2_buffer32)
690#define VIDIOC_ENUMSTD32 _IOWR('V', 25, struct v4l2_standard32)
691#define VIDIOC_ENUMINPUT32 _IOWR('V', 26, struct v4l2_input32)
692#define VIDIOC_TRY_FMT32 _IOWR('V', 64, struct v4l2_format32)
693#define VIDIOC_G_EXT_CTRLS32 _IOWR('V', 71, struct v4l2_ext_controls32)
694#define VIDIOC_S_EXT_CTRLS32 _IOWR('V', 72, struct v4l2_ext_controls32)
695#define VIDIOC_TRY_EXT_CTRLS32 _IOWR('V', 73, struct v4l2_ext_controls32)
696
697#define VIDIOC_OVERLAY32 _IOW ('V', 14, s32)
698#define VIDIOC_OVERLAY32_OLD _IOWR('V', 14, s32)
699#define VIDIOC_STREAMON32 _IOW ('V', 18, s32)
700#define VIDIOC_STREAMOFF32 _IOW ('V', 19, s32)
701#define VIDIOC_G_INPUT32 _IOR ('V', 38, s32)
702#define VIDIOC_S_INPUT32 _IOWR('V', 39, s32)
703#define VIDIOC_G_OUTPUT32 _IOR ('V', 46, s32)
704#define VIDIOC_S_OUTPUT32 _IOWR('V', 47, s32)
605 705
606static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 706static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
607{ 707{
@@ -616,45 +716,51 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
616 struct v4l2_format v2f; 716 struct v4l2_format v2f;
617 struct v4l2_buffer v2b; 717 struct v4l2_buffer v2b;
618 struct v4l2_framebuffer v2fb; 718 struct v4l2_framebuffer v2fb;
619 struct v4l2_standard v2s;
620 struct v4l2_input v2i; 719 struct v4l2_input v2i;
621 struct v4l2_tuner v2t; 720 struct v4l2_standard v2s;
721 struct v4l2_ext_controls v2ecs;
622 unsigned long vx; 722 unsigned long vx;
723 int vi;
623 } karg; 724 } karg;
624 void __user *up = compat_ptr(arg); 725 void __user *up = compat_ptr(arg);
625 int compatible_arg = 1; 726 int compatible_arg = 1;
626 int err = 0; 727 int err = 0;
627 int realcmd = cmd;
628 728
629 /* First, convert the command. */ 729 /* First, convert the command. */
630 switch (cmd) { 730 switch (cmd) {
631#ifdef CONFIG_VIDEO_V4L1_COMPAT 731#ifdef CONFIG_VIDEO_V4L1_COMPAT
632 case VIDIOCGTUNER32: realcmd = cmd = VIDIOCGTUNER; break; 732 case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break;
633 case VIDIOCSTUNER32: realcmd = cmd = VIDIOCSTUNER; break; 733 case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break;
634 case VIDIOCGWIN32: realcmd = cmd = VIDIOCGWIN; break; 734 case VIDIOCGWIN32: cmd = VIDIOCGWIN; break;
635 case VIDIOCGFBUF32: realcmd = cmd = VIDIOCGFBUF; break; 735 case VIDIOCSWIN32: cmd = VIDIOCSWIN; break;
636 case VIDIOCSFBUF32: realcmd = cmd = VIDIOCSFBUF; break; 736 case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break;
637 case VIDIOCGFREQ32: realcmd = cmd = VIDIOCGFREQ; break; 737 case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break;
638 case VIDIOCSFREQ32: realcmd = cmd = VIDIOCSFREQ; break; 738 case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break;
639 case VIDIOCSMICROCODE32: realcmd = cmd = VIDIOCSMICROCODE; break; 739 case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break;
740 case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break;
640#endif 741#endif
641 case VIDIOC_G_FMT32: realcmd = cmd = VIDIOC_G_FMT; break; 742 case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break;
642 case VIDIOC_S_FMT32: realcmd = cmd = VIDIOC_S_FMT; break; 743 case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break;
643 case VIDIOC_QUERYBUF32: realcmd = cmd = VIDIOC_QUERYBUF; break; 744 case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break;
644 case VIDIOC_QBUF32: realcmd = cmd = VIDIOC_QBUF; break; 745 case VIDIOC_G_FBUF32: cmd = VIDIOC_G_FBUF; break;
645 case VIDIOC_DQBUF32: realcmd = cmd = VIDIOC_DQBUF; break; 746 case VIDIOC_S_FBUF32: cmd = VIDIOC_S_FBUF; break;
646 case VIDIOC_STREAMON32: realcmd = cmd = VIDIOC_STREAMON; break; 747 case VIDIOC_QBUF32: cmd = VIDIOC_QBUF; break;
647 case VIDIOC_STREAMOFF32: realcmd = cmd = VIDIOC_STREAMOFF; break; 748 case VIDIOC_DQBUF32: cmd = VIDIOC_DQBUF; break;
648 case VIDIOC_G_FBUF32: realcmd = cmd = VIDIOC_G_FBUF; break; 749 case VIDIOC_ENUMSTD32: cmd = VIDIOC_ENUMSTD; break;
649 case VIDIOC_S_FBUF32: realcmd = cmd = VIDIOC_S_FBUF; break; 750 case VIDIOC_ENUMINPUT32: cmd = VIDIOC_ENUMINPUT; break;
650 case VIDIOC_OVERLAY32: realcmd = cmd = VIDIOC_OVERLAY; break; 751 case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break;
651 case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break; 752 case VIDIOC_G_EXT_CTRLS32: cmd = VIDIOC_G_EXT_CTRLS; break;
652 case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break; 753 case VIDIOC_S_EXT_CTRLS32: cmd = VIDIOC_S_EXT_CTRLS; break;
653 case VIDIOC_S_CTRL32: realcmd = cmd = VIDIOC_S_CTRL; break; 754 case VIDIOC_TRY_EXT_CTRLS32: cmd = VIDIOC_TRY_EXT_CTRLS; break;
654 case VIDIOC_G_INPUT32: realcmd = cmd = VIDIOC_G_INPUT; break; 755 case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break;
655 case VIDIOC_S_INPUT32: realcmd = cmd = VIDIOC_S_INPUT; break; 756 case VIDIOC_OVERLAY32_OLD: cmd = VIDIOC_OVERLAY; break;
656 case VIDIOC_TRY_FMT32: realcmd = cmd = VIDIOC_TRY_FMT; break; 757 case VIDIOC_STREAMON32: cmd = VIDIOC_STREAMON; break;
657 }; 758 case VIDIOC_STREAMOFF32: cmd = VIDIOC_STREAMOFF; break;
759 case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break;
760 case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break;
761 case VIDIOC_G_OUTPUT32: cmd = VIDIOC_G_OUTPUT; break;
762 case VIDIOC_S_OUTPUT32: cmd = VIDIOC_S_OUTPUT; break;
763 }
658 764
659 switch (cmd) { 765 switch (cmd) {
660#ifdef CONFIG_VIDEO_V4L1_COMPAT 766#ifdef CONFIG_VIDEO_V4L1_COMPAT
@@ -662,7 +768,6 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
662 case VIDIOCGTUNER: 768 case VIDIOCGTUNER:
663 err = get_video_tuner32(&karg.vt, up); 769 err = get_video_tuner32(&karg.vt, up);
664 compatible_arg = 0; 770 compatible_arg = 0;
665
666 break; 771 break;
667 772
668 case VIDIOCSFBUF: 773 case VIDIOCSFBUF:
@@ -670,19 +775,42 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
670 compatible_arg = 0; 775 compatible_arg = 0;
671 break; 776 break;
672 777
778 case VIDIOCSWIN:
779 err = get_video_window32(&karg.vw, up);
780 compatible_arg = 0;
781 break;
782
783 case VIDIOCGWIN:
784 case VIDIOCGFBUF:
785 case VIDIOCGFREQ:
786 compatible_arg = 0;
787 break;
788
789 case VIDIOCSMICROCODE:
790 err = get_microcode32(&karg.vc, up);
791 compatible_arg = 0;
792 break;
673 793
674 case VIDIOCSFREQ: 794 case VIDIOCSFREQ:
795 err = get_user(karg.vx, (u32 __user *)up);
796 compatible_arg = 0;
797 break;
798
799 case VIDIOCCAPTURE:
800 case VIDIOCSYNC:
801 case VIDIOCSWRITEMODE:
675#endif 802#endif
676 case VIDIOC_S_INPUT:
677 case VIDIOC_OVERLAY: 803 case VIDIOC_OVERLAY:
678 case VIDIOC_STREAMON: 804 case VIDIOC_STREAMON:
679 case VIDIOC_STREAMOFF: 805 case VIDIOC_STREAMOFF:
680 err = get_user(karg.vx, (u32 __user *)up); 806 case VIDIOC_S_INPUT:
681 compatible_arg = 1; 807 case VIDIOC_S_OUTPUT:
808 err = get_user(karg.vi, (s32 __user *)up);
809 compatible_arg = 0;
682 break; 810 break;
683 811
684 case VIDIOC_S_FBUF: 812 case VIDIOC_G_INPUT:
685 err = get_v4l2_framebuffer32(&karg.v2fb, up); 813 case VIDIOC_G_OUTPUT:
686 compatible_arg = 0; 814 compatible_arg = 0;
687 break; 815 break;
688 816
@@ -700,122 +828,108 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
700 compatible_arg = 0; 828 compatible_arg = 0;
701 break; 829 break;
702 830
703 case VIDIOC_ENUMSTD: 831 case VIDIOC_S_FBUF:
704 err = get_v4l2_standard(&karg.v2s, up); 832 err = get_v4l2_framebuffer32(&karg.v2fb, up);
705 compatible_arg = 0; 833 compatible_arg = 0;
706 break; 834 break;
707 835
708 case VIDIOC_ENUMSTD32: 836 case VIDIOC_G_FBUF:
709 err = get_v4l2_standard32(&karg.v2s, up);
710 compatible_arg = 0; 837 compatible_arg = 0;
711 break; 838 break;
712 839
713 case VIDIOC_ENUMINPUT: 840 case VIDIOC_ENUMSTD:
714 err = get_v4l2_input(&karg.v2i, up); 841 err = get_v4l2_standard32(&karg.v2s, up);
715 compatible_arg = 0; 842 compatible_arg = 0;
716 break; 843 break;
717 844
718 case VIDIOC_ENUMINPUT32: 845 case VIDIOC_ENUMINPUT:
719 err = get_v4l2_input32(&karg.v2i, up); 846 err = get_v4l2_input32(&karg.v2i, up);
720 compatible_arg = 0; 847 compatible_arg = 0;
721 break; 848 break;
722 849
723 case VIDIOC_G_TUNER: 850 case VIDIOC_G_EXT_CTRLS:
724 case VIDIOC_S_TUNER: 851 case VIDIOC_S_EXT_CTRLS:
725 err = get_v4l2_tuner(&karg.v2t, up); 852 case VIDIOC_TRY_EXT_CTRLS:
853 err = get_v4l2_ext_controls32(&karg.v2ecs, up);
726 compatible_arg = 0; 854 compatible_arg = 0;
727 break; 855 break;
728 856 }
729#ifdef CONFIG_VIDEO_V4L1_COMPAT
730 case VIDIOCGWIN:
731 case VIDIOCGFBUF:
732 case VIDIOCGFREQ:
733#endif
734 case VIDIOC_G_FBUF:
735 case VIDIOC_G_INPUT:
736 compatible_arg = 0;
737 break;
738#ifdef CONFIG_VIDEO_V4L1_COMPAT
739 case VIDIOCSMICROCODE:
740 err = microcode32(&karg.vc, up);
741 compatible_arg = 0;
742 break;
743#endif
744 };
745 if (err) 857 if (err)
746 goto out; 858 return err;
747 859
748 if (compatible_arg) 860 if (compatible_arg)
749 err = native_ioctl(file, realcmd, (unsigned long)up); 861 err = native_ioctl(file, cmd, (unsigned long)up);
750 else { 862 else {
751 mm_segment_t old_fs = get_fs(); 863 mm_segment_t old_fs = get_fs();
752 864
753 set_fs(KERNEL_DS); 865 set_fs(KERNEL_DS);
754 err = native_ioctl(file, realcmd, (unsigned long)&karg); 866 err = native_ioctl(file, cmd, (unsigned long)&karg);
755 set_fs(old_fs); 867 set_fs(old_fs);
756 } 868 }
757 if (err == 0) { 869
758 switch (cmd) { 870 /* Special case: even after an error we need to put the
871 results back for these ioctls since the error_idx will
872 contain information on which control failed. */
873 switch (cmd) {
874 case VIDIOC_G_EXT_CTRLS:
875 case VIDIOC_S_EXT_CTRLS:
876 case VIDIOC_TRY_EXT_CTRLS:
877 if (put_v4l2_ext_controls32(&karg.v2ecs, up))
878 err = -EFAULT;
879 break;
880 }
881 if (err)
882 return err;
883
884 switch (cmd) {
759#ifdef CONFIG_VIDEO_V4L1_COMPAT 885#ifdef CONFIG_VIDEO_V4L1_COMPAT
760 case VIDIOCGTUNER: 886 case VIDIOCGTUNER:
761 err = put_video_tuner32(&karg.vt, up); 887 err = put_video_tuner32(&karg.vt, up);
762 break; 888 break;
763 889
764 case VIDIOCGWIN: 890 case VIDIOCGWIN:
765 err = put_video_window32(&karg.vw, up); 891 err = put_video_window32(&karg.vw, up);
766 break; 892 break;
767 893
768 case VIDIOCGFBUF: 894 case VIDIOCGFBUF:
769 err = put_video_buffer32(&karg.vb, up); 895 err = put_video_buffer32(&karg.vb, up);
770 break; 896 break;
771 897
898 case VIDIOCGFREQ:
899 err = put_user(((u32)karg.vx), (u32 __user *)up);
900 break;
772#endif 901#endif
773 case VIDIOC_G_FBUF: 902 case VIDIOC_S_INPUT:
774 err = put_v4l2_framebuffer32(&karg.v2fb, up); 903 case VIDIOC_S_OUTPUT:
775 break; 904 case VIDIOC_G_INPUT:
776 905 case VIDIOC_G_OUTPUT:
777 case VIDIOC_G_FMT: 906 err = put_user(((s32)karg.vi), (s32 __user *)up);
778 case VIDIOC_S_FMT: 907 break;
779 case VIDIOC_TRY_FMT:
780 err = put_v4l2_format32(&karg.v2f, up);
781 break;
782
783 case VIDIOC_QUERYBUF:
784 case VIDIOC_QBUF:
785 case VIDIOC_DQBUF:
786 err = put_v4l2_buffer32(&karg.v2b, up);
787 break;
788
789 case VIDIOC_ENUMSTD:
790 err = put_v4l2_standard(&karg.v2s, up);
791 break;
792
793 case VIDIOC_ENUMSTD32:
794 err = put_v4l2_standard32(&karg.v2s, up);
795 break;
796
797 case VIDIOC_G_TUNER:
798 case VIDIOC_S_TUNER:
799 err = put_v4l2_tuner(&karg.v2t, up);
800 break;
801
802 case VIDIOC_ENUMINPUT:
803 err = put_v4l2_input(&karg.v2i, up);
804 break;
805
806 case VIDIOC_ENUMINPUT32:
807 err = put_v4l2_input32(&karg.v2i, up);
808 break;
809 908
810#ifdef CONFIG_VIDEO_V4L1_COMPAT 909 case VIDIOC_G_FBUF:
811 case VIDIOCGFREQ: 910 err = put_v4l2_framebuffer32(&karg.v2fb, up);
812#endif 911 break;
813 case VIDIOC_G_INPUT: 912
814 err = put_user(((u32)karg.vx), (u32 __user *)up); 913 case VIDIOC_G_FMT:
815 break; 914 case VIDIOC_S_FMT:
816 }; 915 case VIDIOC_TRY_FMT:
916 err = put_v4l2_format32(&karg.v2f, up);
917 break;
918
919 case VIDIOC_QUERYBUF:
920 case VIDIOC_QBUF:
921 case VIDIOC_DQBUF:
922 err = put_v4l2_buffer32(&karg.v2b, up);
923 break;
924
925 case VIDIOC_ENUMSTD:
926 err = put_v4l2_standard32(&karg.v2s, up);
927 break;
928
929 case VIDIOC_ENUMINPUT:
930 err = put_v4l2_input32(&karg.v2i, up);
931 break;
817 } 932 }
818out:
819 return err; 933 return err;
820} 934}
821 935
@@ -828,26 +942,48 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
828 942
829 switch (cmd) { 943 switch (cmd) {
830#ifdef CONFIG_VIDEO_V4L1_COMPAT 944#ifdef CONFIG_VIDEO_V4L1_COMPAT
831 case VIDIOCSWIN32: 945 case VIDIOCGCAP:
832 ret = do_set_window(file, cmd, arg); 946 case VIDIOCGCHAN:
833 break; 947 case VIDIOCSCHAN:
834 case VIDIOCGTUNER32: 948 case VIDIOCGTUNER32:
835 case VIDIOCSTUNER32: 949 case VIDIOCSTUNER32:
950 case VIDIOCGPICT:
951 case VIDIOCSPICT:
952 case VIDIOCCAPTURE32:
836 case VIDIOCGWIN32: 953 case VIDIOCGWIN32:
954 case VIDIOCSWIN32:
837 case VIDIOCGFBUF32: 955 case VIDIOCGFBUF32:
838 case VIDIOCSFBUF32: 956 case VIDIOCSFBUF32:
957 case VIDIOCKEY:
839 case VIDIOCGFREQ32: 958 case VIDIOCGFREQ32:
840 case VIDIOCSFREQ32: 959 case VIDIOCSFREQ32:
841 case VIDIOCGAUDIO: 960 case VIDIOCGAUDIO:
842 case VIDIOCSAUDIO: 961 case VIDIOCSAUDIO:
962 case VIDIOCSYNC32:
963 case VIDIOCMCAPTURE:
964 case VIDIOCGMBUF:
965 case VIDIOCGUNIT:
966 case VIDIOCGCAPTURE:
967 case VIDIOCSCAPTURE:
968 case VIDIOCSPLAYMODE:
969 case VIDIOCSWRITEMODE32:
970 case VIDIOCGPLAYINFO:
971 case VIDIOCSMICROCODE32:
843 case VIDIOCGVBIFMT: 972 case VIDIOCGVBIFMT:
844 case VIDIOCSVBIFMT: 973 case VIDIOCSVBIFMT:
845#endif 974#endif
975#ifdef __OLD_VIDIOC_
976 case VIDIOC_OVERLAY32_OLD:
977 case VIDIOC_S_PARM_OLD:
978 case VIDIOC_S_CTRL_OLD:
979 case VIDIOC_G_AUDIO_OLD:
980 case VIDIOC_G_AUDOUT_OLD:
981 case VIDIOC_CROPCAP_OLD:
982#endif
846 case VIDIOC_QUERYCAP: 983 case VIDIOC_QUERYCAP:
984 case VIDIOC_RESERVED:
847 case VIDIOC_ENUM_FMT: 985 case VIDIOC_ENUM_FMT:
848 case VIDIOC_G_FMT32: 986 case VIDIOC_G_FMT32:
849 case VIDIOC_CROPCAP:
850 case VIDIOC_S_CROP:
851 case VIDIOC_S_FMT32: 987 case VIDIOC_S_FMT32:
852 case VIDIOC_REQBUFS: 988 case VIDIOC_REQBUFS:
853 case VIDIOC_QUERYBUF32: 989 case VIDIOC_QUERYBUF32:
@@ -862,43 +998,56 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
862 case VIDIOC_S_PARM: 998 case VIDIOC_S_PARM:
863 case VIDIOC_G_STD: 999 case VIDIOC_G_STD:
864 case VIDIOC_S_STD: 1000 case VIDIOC_S_STD:
865 case VIDIOC_G_TUNER:
866 case VIDIOC_S_TUNER:
867 case VIDIOC_ENUMSTD:
868 case VIDIOC_ENUMSTD32: 1001 case VIDIOC_ENUMSTD32:
869 case VIDIOC_ENUMINPUT:
870 case VIDIOC_ENUMINPUT32: 1002 case VIDIOC_ENUMINPUT32:
871 case VIDIOC_G_CTRL: 1003 case VIDIOC_G_CTRL:
872 case VIDIOC_S_CTRL: 1004 case VIDIOC_S_CTRL:
873 case VIDIOC_S_CTRL32: 1005 case VIDIOC_G_TUNER:
874 case VIDIOC_S_FREQUENCY: 1006 case VIDIOC_S_TUNER:
875 case VIDIOC_G_FREQUENCY: 1007 case VIDIOC_G_AUDIO:
1008 case VIDIOC_S_AUDIO:
876 case VIDIOC_QUERYCTRL: 1009 case VIDIOC_QUERYCTRL:
1010 case VIDIOC_QUERYMENU:
877 case VIDIOC_G_INPUT32: 1011 case VIDIOC_G_INPUT32:
878 case VIDIOC_S_INPUT32: 1012 case VIDIOC_S_INPUT32:
1013 case VIDIOC_G_OUTPUT32:
1014 case VIDIOC_S_OUTPUT32:
1015 case VIDIOC_ENUMOUTPUT:
1016 case VIDIOC_G_AUDOUT:
1017 case VIDIOC_S_AUDOUT:
1018 case VIDIOC_G_MODULATOR:
1019 case VIDIOC_S_MODULATOR:
1020 case VIDIOC_S_FREQUENCY:
1021 case VIDIOC_G_FREQUENCY:
1022 case VIDIOC_CROPCAP:
1023 case VIDIOC_G_CROP:
1024 case VIDIOC_S_CROP:
1025 case VIDIOC_G_JPEGCOMP:
1026 case VIDIOC_S_JPEGCOMP:
1027 case VIDIOC_QUERYSTD:
879 case VIDIOC_TRY_FMT32: 1028 case VIDIOC_TRY_FMT32:
880 case VIDIOC_S_HW_FREQ_SEEK: 1029 case VIDIOC_ENUMAUDIO:
1030 case VIDIOC_ENUMAUDOUT:
1031 case VIDIOC_G_PRIORITY:
1032 case VIDIOC_S_PRIORITY:
1033 case VIDIOC_G_SLICED_VBI_CAP:
1034 case VIDIOC_LOG_STATUS:
1035 case VIDIOC_G_EXT_CTRLS32:
1036 case VIDIOC_S_EXT_CTRLS32:
1037 case VIDIOC_TRY_EXT_CTRLS32:
881 case VIDIOC_ENUM_FRAMESIZES: 1038 case VIDIOC_ENUM_FRAMESIZES:
882 case VIDIOC_ENUM_FRAMEINTERVALS: 1039 case VIDIOC_ENUM_FRAMEINTERVALS:
1040 case VIDIOC_G_ENC_INDEX:
1041 case VIDIOC_ENCODER_CMD:
1042 case VIDIOC_TRY_ENCODER_CMD:
1043 case VIDIOC_DBG_S_REGISTER:
1044 case VIDIOC_DBG_G_REGISTER:
1045 case VIDIOC_G_CHIP_IDENT:
1046 case VIDIOC_S_HW_FREQ_SEEK:
883 ret = do_video_ioctl(file, cmd, arg); 1047 ret = do_video_ioctl(file, cmd, arg);
884 break; 1048 break;
885 1049
886#ifdef CONFIG_VIDEO_V4L1_COMPAT 1050#ifdef CONFIG_VIDEO_V4L1_COMPAT
887 /* Little v, the video4linux ioctls (conflict?) */
888 case VIDIOCGCAP:
889 case VIDIOCGCHAN:
890 case VIDIOCSCHAN:
891 case VIDIOCGPICT:
892 case VIDIOCSPICT:
893 case VIDIOCCAPTURE:
894 case VIDIOCKEY:
895 case VIDIOCSYNC:
896 case VIDIOCMCAPTURE:
897 case VIDIOCGMBUF:
898 case VIDIOCGUNIT:
899 case VIDIOCGCAPTURE:
900 case VIDIOCSCAPTURE:
901
902 /* BTTV specific... */ 1051 /* BTTV specific... */
903 case _IOW('v', BASE_VIDIOCPRIVATE+0, char [256]): 1052 case _IOW('v', BASE_VIDIOCPRIVATE+0, char [256]):
904 case _IOR('v', BASE_VIDIOCPRIVATE+1, char [256]): 1053 case _IOR('v', BASE_VIDIOCPRIVATE+1, char [256]):
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 6e6743bd0f92..e2cfd6add78c 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1465,6 +1465,8 @@ struct v4l2_chip_ident {
1465#define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident) 1465#define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident)
1466#endif 1466#endif
1467#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1467#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1468/* Reminder: when adding new ioctls please add support for them to
1469 drivers/media/video/v4l2-compat-ioctl32.c as well! */
1468 1470
1469#ifdef __OLD_VIDIOC_ 1471#ifdef __OLD_VIDIOC_
1470/* for compatibility, will go away some day */ 1472/* for compatibility, will go away some day */