[DVB]: Add compat ioctl handling.
Based upon a patch by Guido Guenther <agx@sigxcpu.org>. Some of these ioctls had embedded time_t objects or pointers, so needed translation. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7b5603e056
commit
6e87abd0b8
|
@ -121,6 +121,11 @@
|
|||
|
||||
#include <linux/hiddev.h>
|
||||
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/dmx.h>
|
||||
#include <linux/dvb/frontend.h>
|
||||
#include <linux/dvb/video.h>
|
||||
|
||||
#undef INCLUDES
|
||||
#endif
|
||||
|
||||
|
@ -413,6 +418,128 @@ out:
|
|||
return err;
|
||||
}
|
||||
|
||||
struct compat_dmx_event {
|
||||
dmx_event_t event;
|
||||
compat_time_t timeStamp;
|
||||
union
|
||||
{
|
||||
dmx_scrambling_status_t scrambling;
|
||||
} u;
|
||||
};
|
||||
|
||||
static int do_dmx_get_event(unsigned int fd, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct dmx_event kevent;
|
||||
mm_segment_t old_fs = get_fs();
|
||||
int err;
|
||||
|
||||
set_fs(KERNEL_DS);
|
||||
err = sys_ioctl(fd, cmd, (unsigned long) &kevent);
|
||||
set_fs(old_fs);
|
||||
|
||||
if (!err) {
|
||||
struct compat_dmx_event __user *up = compat_ptr(arg);
|
||||
|
||||
err = put_user(kevent.event, &up->event);
|
||||
err |= put_user(kevent.timeStamp, &up->timeStamp);
|
||||
err |= put_user(kevent.u.scrambling, &up->u.scrambling);
|
||||
if (err)
|
||||
err = -EFAULT;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
struct compat_video_event {
|
||||
int32_t type;
|
||||
compat_time_t timestamp;
|
||||
union {
|
||||
video_size_t size;
|
||||
unsigned int frame_rate;
|
||||
} u;
|
||||
};
|
||||
|
||||
static int do_video_get_event(unsigned int fd, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct video_event kevent;
|
||||
mm_segment_t old_fs = get_fs();
|
||||
int err;
|
||||
|
||||
set_fs(KERNEL_DS);
|
||||
err = sys_ioctl(fd, cmd, (unsigned long) &kevent);
|
||||
set_fs(old_fs);
|
||||
|
||||
if (!err) {
|
||||
struct compat_video_event __user *up = compat_ptr(arg);
|
||||
|
||||
err = put_user(kevent.type, &up->type);
|
||||
err |= put_user(kevent.timestamp, &up->timestamp);
|
||||
err |= put_user(kevent.u.size.w, &up->u.size.w);
|
||||
err |= put_user(kevent.u.size.h, &up->u.size.h);
|
||||
err |= put_user(kevent.u.size.aspect_ratio,
|
||||
&up->u.size.aspect_ratio);
|
||||
if (err)
|
||||
err = -EFAULT;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
struct compat_video_still_picture {
|
||||
compat_uptr_t iFrame;
|
||||
int32_t size;
|
||||
};
|
||||
|
||||
static int do_video_stillpicture(unsigned int fd, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct compat_video_still_picture __user *up;
|
||||
struct video_still_picture __user *up_native;
|
||||
compat_uptr_t fp;
|
||||
int32_t size;
|
||||
int err;
|
||||
|
||||
up = (struct compat_video_still_picture __user *) arg;
|
||||
err = get_user(fp, &up->iFrame);
|
||||
err |= get_user(size, &up->size);
|
||||
if (err)
|
||||
return -EFAULT;
|
||||
|
||||
up_native =
|
||||
compat_alloc_user_space(sizeof(struct video_still_picture));
|
||||
|
||||
put_user(compat_ptr(fp), &up_native->iFrame);
|
||||
put_user(size, &up_native->size);
|
||||
|
||||
err = sys_ioctl(fd, cmd, (unsigned long) up_native);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
struct compat_video_spu_palette {
|
||||
int length;
|
||||
compat_uptr_t palette;
|
||||
};
|
||||
|
||||
static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct compat_video_spu_palette __user *up;
|
||||
struct video_spu_palette __user *up_native;
|
||||
compat_uptr_t palp;
|
||||
int length, err;
|
||||
|
||||
up = (struct compat_video_spu_palette __user *) arg;
|
||||
err = get_user(palp, &up->palette);
|
||||
err |= get_user(length, &up->length);
|
||||
|
||||
up_native = compat_alloc_user_space(sizeof(struct video_spu_palette));
|
||||
put_user(compat_ptr(palp), &up_native->palette);
|
||||
put_user(length, &up_native->length);
|
||||
|
||||
err = sys_ioctl(fd, cmd, (unsigned long) up_native);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
|
@ -2954,5 +3081,11 @@ HANDLE_IOCTL(NCP_IOC_GETPRIVATEDATA_32, do_ncp_getprivatedata)
|
|||
HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata)
|
||||
#endif
|
||||
|
||||
/* dvb */
|
||||
HANDLE_IOCTL(DMX_GET_EVENT, do_dmx_get_event)
|
||||
HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event)
|
||||
HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture)
|
||||
HANDLE_IOCTL(VIDEO_SET_SPU_PALETTE, do_video_set_spu_palette)
|
||||
|
||||
#undef DECLARES
|
||||
#endif
|
||||
|
|
|
@ -795,3 +795,70 @@ COMPATIBLE_IOCTL(HIDIOCGFLAG)
|
|||
COMPATIBLE_IOCTL(HIDIOCSFLAG)
|
||||
COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX)
|
||||
COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO)
|
||||
/* dvb */
|
||||
COMPATIBLE_IOCTL(AUDIO_STOP)
|
||||
COMPATIBLE_IOCTL(AUDIO_PLAY)
|
||||
COMPATIBLE_IOCTL(AUDIO_PAUSE)
|
||||
COMPATIBLE_IOCTL(AUDIO_CONTINUE)
|
||||
COMPATIBLE_IOCTL(AUDIO_SELECT_SOURCE)
|
||||
COMPATIBLE_IOCTL(AUDIO_SET_MUTE)
|
||||
COMPATIBLE_IOCTL(AUDIO_SET_AV_SYNC)
|
||||
COMPATIBLE_IOCTL(AUDIO_SET_BYPASS_MODE)
|
||||
COMPATIBLE_IOCTL(AUDIO_CHANNEL_SELECT)
|
||||
COMPATIBLE_IOCTL(AUDIO_GET_STATUS)
|
||||
COMPATIBLE_IOCTL(AUDIO_GET_CAPABILITIES)
|
||||
COMPATIBLE_IOCTL(AUDIO_CLEAR_BUFFER)
|
||||
COMPATIBLE_IOCTL(AUDIO_SET_ID)
|
||||
COMPATIBLE_IOCTL(AUDIO_SET_MIXER)
|
||||
COMPATIBLE_IOCTL(AUDIO_SET_STREAMTYPE)
|
||||
COMPATIBLE_IOCTL(AUDIO_SET_EXT_ID)
|
||||
COMPATIBLE_IOCTL(AUDIO_SET_ATTRIBUTES)
|
||||
COMPATIBLE_IOCTL(AUDIO_SET_KARAOKE)
|
||||
COMPATIBLE_IOCTL(DMX_START)
|
||||
COMPATIBLE_IOCTL(DMX_STOP)
|
||||
COMPATIBLE_IOCTL(DMX_SET_FILTER)
|
||||
COMPATIBLE_IOCTL(DMX_SET_PES_FILTER)
|
||||
COMPATIBLE_IOCTL(DMX_SET_BUFFER_SIZE)
|
||||
COMPATIBLE_IOCTL(DMX_GET_PES_PIDS)
|
||||
COMPATIBLE_IOCTL(DMX_GET_CAPS)
|
||||
COMPATIBLE_IOCTL(DMX_SET_SOURCE)
|
||||
COMPATIBLE_IOCTL(DMX_GET_STC)
|
||||
COMPATIBLE_IOCTL(FE_GET_INFO)
|
||||
COMPATIBLE_IOCTL(FE_DISEQC_RESET_OVERLOAD)
|
||||
COMPATIBLE_IOCTL(FE_DISEQC_SEND_MASTER_CMD)
|
||||
COMPATIBLE_IOCTL(FE_DISEQC_RECV_SLAVE_REPLY)
|
||||
COMPATIBLE_IOCTL(FE_DISEQC_SEND_BURST)
|
||||
COMPATIBLE_IOCTL(FE_SET_TONE)
|
||||
COMPATIBLE_IOCTL(FE_SET_VOLTAGE)
|
||||
COMPATIBLE_IOCTL(FE_ENABLE_HIGH_LNB_VOLTAGE)
|
||||
COMPATIBLE_IOCTL(FE_READ_STATUS)
|
||||
COMPATIBLE_IOCTL(FE_READ_BER)
|
||||
COMPATIBLE_IOCTL(FE_READ_SIGNAL_STRENGTH)
|
||||
COMPATIBLE_IOCTL(FE_READ_SNR)
|
||||
COMPATIBLE_IOCTL(FE_READ_UNCORRECTED_BLOCKS)
|
||||
COMPATIBLE_IOCTL(FE_SET_FRONTEND)
|
||||
COMPATIBLE_IOCTL(FE_GET_FRONTEND)
|
||||
COMPATIBLE_IOCTL(FE_GET_EVENT)
|
||||
COMPATIBLE_IOCTL(FE_DISHNETWORK_SEND_LEGACY_CMD)
|
||||
COMPATIBLE_IOCTL(VIDEO_STOP)
|
||||
COMPATIBLE_IOCTL(VIDEO_PLAY)
|
||||
COMPATIBLE_IOCTL(VIDEO_FREEZE)
|
||||
COMPATIBLE_IOCTL(VIDEO_CONTINUE)
|
||||
COMPATIBLE_IOCTL(VIDEO_SELECT_SOURCE)
|
||||
COMPATIBLE_IOCTL(VIDEO_SET_BLANK)
|
||||
COMPATIBLE_IOCTL(VIDEO_GET_STATUS)
|
||||
COMPATIBLE_IOCTL(VIDEO_SET_DISPLAY_FORMAT)
|
||||
COMPATIBLE_IOCTL(VIDEO_FAST_FORWARD)
|
||||
COMPATIBLE_IOCTL(VIDEO_SLOWMOTION)
|
||||
COMPATIBLE_IOCTL(VIDEO_GET_CAPABILITIES)
|
||||
COMPATIBLE_IOCTL(VIDEO_CLEAR_BUFFER)
|
||||
COMPATIBLE_IOCTL(VIDEO_SET_ID)
|
||||
COMPATIBLE_IOCTL(VIDEO_SET_STREAMTYPE)
|
||||
COMPATIBLE_IOCTL(VIDEO_SET_FORMAT)
|
||||
COMPATIBLE_IOCTL(VIDEO_SET_SYSTEM)
|
||||
COMPATIBLE_IOCTL(VIDEO_SET_HIGHLIGHT)
|
||||
COMPATIBLE_IOCTL(VIDEO_SET_SPU)
|
||||
COMPATIBLE_IOCTL(VIDEO_GET_NAVI)
|
||||
COMPATIBLE_IOCTL(VIDEO_SET_ATTRIBUTES)
|
||||
COMPATIBLE_IOCTL(VIDEO_GET_SIZE)
|
||||
COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE)
|
||||
|
|
Loading…
Reference in New Issue