aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-11-20 00:05:42 -0500
committerSteve French <sfrench@us.ibm.com>2005-11-20 00:05:42 -0500
commit1e6b39fbb61800e3ecee58dc8c4bca57c89365cd (patch)
tree513ce034cff05371496713b8327f9dc074bdcc6d /fs
parentcdbce9c87e4ebd186389919b95e49592ec35dae6 (diff)
parent3bedff1d73b86e0cf52634efb447e9ada08f2cc6 (diff)
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'fs')
-rw-r--r--fs/compat_ioctl.c169
1 files changed, 169 insertions, 0 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 26300fccb4fc..31b7efd94d66 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -49,6 +49,8 @@
49#include <linux/vt_kern.h> 49#include <linux/vt_kern.h>
50#include <linux/fb.h> 50#include <linux/fb.h>
51#include <linux/ext2_fs.h> 51#include <linux/ext2_fs.h>
52#include <linux/ext3_jbd.h>
53#include <linux/ext3_fs.h>
52#include <linux/videodev.h> 54#include <linux/videodev.h>
53#include <linux/netdevice.h> 55#include <linux/netdevice.h>
54#include <linux/raw.h> 56#include <linux/raw.h>
@@ -121,6 +123,11 @@
121 123
122#include <linux/hiddev.h> 124#include <linux/hiddev.h>
123 125
126#include <linux/dvb/audio.h>
127#include <linux/dvb/dmx.h>
128#include <linux/dvb/frontend.h>
129#include <linux/dvb/video.h>
130
124#undef INCLUDES 131#undef INCLUDES
125#endif 132#endif
126 133
@@ -129,6 +136,15 @@
129/* Aiee. Someone does not find a difference between int and long */ 136/* Aiee. Someone does not find a difference between int and long */
130#define EXT2_IOC32_GETFLAGS _IOR('f', 1, int) 137#define EXT2_IOC32_GETFLAGS _IOR('f', 1, int)
131#define EXT2_IOC32_SETFLAGS _IOW('f', 2, int) 138#define EXT2_IOC32_SETFLAGS _IOW('f', 2, int)
139#define EXT3_IOC32_GETVERSION _IOR('f', 3, int)
140#define EXT3_IOC32_SETVERSION _IOW('f', 4, int)
141#define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int)
142#define EXT3_IOC32_SETRSVSZ _IOW('f', 6, int)
143#define EXT3_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
144#ifdef CONFIG_JBD_DEBUG
145#define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
146#endif
147
132#define EXT2_IOC32_GETVERSION _IOR('v', 1, int) 148#define EXT2_IOC32_GETVERSION _IOR('v', 1, int)
133#define EXT2_IOC32_SETVERSION _IOW('v', 2, int) 149#define EXT2_IOC32_SETVERSION _IOW('v', 2, int)
134 150
@@ -175,6 +191,22 @@ static int do_ext2_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
175 return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg)); 191 return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg));
176} 192}
177 193
194static int do_ext3_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
195{
196 /* These are just misnamed, they actually get/put from/to user an int */
197 switch (cmd) {
198 case EXT3_IOC32_GETVERSION: cmd = EXT3_IOC_GETVERSION; break;
199 case EXT3_IOC32_SETVERSION: cmd = EXT3_IOC_SETVERSION; break;
200 case EXT3_IOC32_GETRSVSZ: cmd = EXT3_IOC_GETRSVSZ; break;
201 case EXT3_IOC32_SETRSVSZ: cmd = EXT3_IOC_SETRSVSZ; break;
202 case EXT3_IOC32_GROUP_EXTEND: cmd = EXT3_IOC_GROUP_EXTEND; break;
203#ifdef CONFIG_JBD_DEBUG
204 case EXT3_IOC32_WAIT_FOR_READONLY: cmd = EXT3_IOC_WAIT_FOR_READONLY; break;
205#endif
206 }
207 return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg));
208}
209
178struct video_tuner32 { 210struct video_tuner32 {
179 compat_int_t tuner; 211 compat_int_t tuner;
180 char name[32]; 212 char name[32];
@@ -413,6 +445,128 @@ out:
413 return err; 445 return err;
414} 446}
415 447
448struct compat_dmx_event {
449 dmx_event_t event;
450 compat_time_t timeStamp;
451 union
452 {
453 dmx_scrambling_status_t scrambling;
454 } u;
455};
456
457static int do_dmx_get_event(unsigned int fd, unsigned int cmd, unsigned long arg)
458{
459 struct dmx_event kevent;
460 mm_segment_t old_fs = get_fs();
461 int err;
462
463 set_fs(KERNEL_DS);
464 err = sys_ioctl(fd, cmd, (unsigned long) &kevent);
465 set_fs(old_fs);
466
467 if (!err) {
468 struct compat_dmx_event __user *up = compat_ptr(arg);
469
470 err = put_user(kevent.event, &up->event);
471 err |= put_user(kevent.timeStamp, &up->timeStamp);
472 err |= put_user(kevent.u.scrambling, &up->u.scrambling);
473 if (err)
474 err = -EFAULT;
475 }
476
477 return err;
478}
479
480struct compat_video_event {
481 int32_t type;
482 compat_time_t timestamp;
483 union {
484 video_size_t size;
485 unsigned int frame_rate;
486 } u;
487};
488
489static int do_video_get_event(unsigned int fd, unsigned int cmd, unsigned long arg)
490{
491 struct video_event kevent;
492 mm_segment_t old_fs = get_fs();
493 int err;
494
495 set_fs(KERNEL_DS);
496 err = sys_ioctl(fd, cmd, (unsigned long) &kevent);
497 set_fs(old_fs);
498
499 if (!err) {
500 struct compat_video_event __user *up = compat_ptr(arg);
501
502 err = put_user(kevent.type, &up->type);
503 err |= put_user(kevent.timestamp, &up->timestamp);
504 err |= put_user(kevent.u.size.w, &up->u.size.w);
505 err |= put_user(kevent.u.size.h, &up->u.size.h);
506 err |= put_user(kevent.u.size.aspect_ratio,
507 &up->u.size.aspect_ratio);
508 if (err)
509 err = -EFAULT;
510 }
511
512 return err;
513}
514
515struct compat_video_still_picture {
516 compat_uptr_t iFrame;
517 int32_t size;
518};
519
520static int do_video_stillpicture(unsigned int fd, unsigned int cmd, unsigned long arg)
521{
522 struct compat_video_still_picture __user *up;
523 struct video_still_picture __user *up_native;
524 compat_uptr_t fp;
525 int32_t size;
526 int err;
527
528 up = (struct compat_video_still_picture __user *) arg;
529 err = get_user(fp, &up->iFrame);
530 err |= get_user(size, &up->size);
531 if (err)
532 return -EFAULT;
533
534 up_native =
535 compat_alloc_user_space(sizeof(struct video_still_picture));
536
537 put_user(compat_ptr(fp), &up_native->iFrame);
538 put_user(size, &up_native->size);
539
540 err = sys_ioctl(fd, cmd, (unsigned long) up_native);
541
542 return err;
543}
544
545struct compat_video_spu_palette {
546 int length;
547 compat_uptr_t palette;
548};
549
550static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd, unsigned long arg)
551{
552 struct compat_video_spu_palette __user *up;
553 struct video_spu_palette __user *up_native;
554 compat_uptr_t palp;
555 int length, err;
556
557 up = (struct compat_video_spu_palette __user *) arg;
558 err = get_user(palp, &up->palette);
559 err |= get_user(length, &up->length);
560
561 up_native = compat_alloc_user_space(sizeof(struct video_spu_palette));
562 put_user(compat_ptr(palp), &up_native->palette);
563 put_user(length, &up_native->length);
564
565 err = sys_ioctl(fd, cmd, (unsigned long) up_native);
566
567 return err;
568}
569
416#ifdef CONFIG_NET 570#ifdef CONFIG_NET
417static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg) 571static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg)
418{ 572{
@@ -2854,6 +3008,15 @@ HANDLE_IOCTL(EXT2_IOC32_GETFLAGS, do_ext2_ioctl)
2854HANDLE_IOCTL(EXT2_IOC32_SETFLAGS, do_ext2_ioctl) 3008HANDLE_IOCTL(EXT2_IOC32_SETFLAGS, do_ext2_ioctl)
2855HANDLE_IOCTL(EXT2_IOC32_GETVERSION, do_ext2_ioctl) 3009HANDLE_IOCTL(EXT2_IOC32_GETVERSION, do_ext2_ioctl)
2856HANDLE_IOCTL(EXT2_IOC32_SETVERSION, do_ext2_ioctl) 3010HANDLE_IOCTL(EXT2_IOC32_SETVERSION, do_ext2_ioctl)
3011HANDLE_IOCTL(EXT3_IOC32_GETVERSION, do_ext3_ioctl)
3012HANDLE_IOCTL(EXT3_IOC32_SETVERSION, do_ext3_ioctl)
3013HANDLE_IOCTL(EXT3_IOC32_GETRSVSZ, do_ext3_ioctl)
3014HANDLE_IOCTL(EXT3_IOC32_SETRSVSZ, do_ext3_ioctl)
3015HANDLE_IOCTL(EXT3_IOC32_GROUP_EXTEND, do_ext3_ioctl)
3016COMPATIBLE_IOCTL(EXT3_IOC_GROUP_ADD)
3017#ifdef CONFIG_JBD_DEBUG
3018HANDLE_IOCTL(EXT3_IOC32_WAIT_FOR_READONLY, do_ext3_ioctl)
3019#endif
2857HANDLE_IOCTL(VIDIOCGTUNER32, do_video_ioctl) 3020HANDLE_IOCTL(VIDIOCGTUNER32, do_video_ioctl)
2858HANDLE_IOCTL(VIDIOCSTUNER32, do_video_ioctl) 3021HANDLE_IOCTL(VIDIOCSTUNER32, do_video_ioctl)
2859HANDLE_IOCTL(VIDIOCGWIN32, do_video_ioctl) 3022HANDLE_IOCTL(VIDIOCGWIN32, do_video_ioctl)
@@ -2954,5 +3117,11 @@ HANDLE_IOCTL(NCP_IOC_GETPRIVATEDATA_32, do_ncp_getprivatedata)
2954HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata) 3117HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata)
2955#endif 3118#endif
2956 3119
3120/* dvb */
3121HANDLE_IOCTL(DMX_GET_EVENT, do_dmx_get_event)
3122HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event)
3123HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture)
3124HANDLE_IOCTL(VIDEO_SET_SPU_PALETTE, do_video_set_spu_palette)
3125
2957#undef DECLARES 3126#undef DECLARES
2958#endif 3127#endif