summaryrefslogtreecommitdiff
path: root/v4l2-apps
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-03-03 20:21:02 -0800
committerTrent Piepho <xyzzy@speakeasy.org>2009-03-03 20:21:02 -0800
commit4f05fe5a173aafe4fd81efaa5a3288f2ab482ca1 (patch)
tree306b3dc58499be4cbadec2bd7a3d52a3945aa402 /v4l2-apps
parent8c12824c5ce383206aa9ff24ee1f8634783a5d80 (diff)
downloadmediapointer-dvb-s2-4f05fe5a173aafe4fd81efaa5a3288f2ab482ca1.tar.gz
mediapointer-dvb-s2-4f05fe5a173aafe4fd81efaa5a3288f2ab482ca1.tar.bz2
videodev: only copy needed part of RW ioctl's parameter
From: Trent Piepho <xyzzy@speakeasy.org> There are many RW ioctls() in v4l2 where userspace only supplies one or two of the first fields in the structure passed to the ioctl. The driver then fills in the rest of the fields. Instead of copying the entire structure from userspace to the kernel we only need to copy those fields that userspace is actually supposed to supply. What's more, the fields that are meant to be only be output from the driver can be zeroed out in the videodev code, in case the driver doesn't fill them all in. Many of the ioctl handlers in v4l2_ioctl do this already, but my patch does this at one common point and so all the memsets for each ioctl can be deleted. For VIDIOC_G_SLICED_VBI_CAP, which has one input field ('type') and other output-only fields, the input field is near the end of the structure instead of at the beginning. So there is still a memset in it's ioctl handler to zero out the beginning of the struct. There were a couple mistakes with the existing code: For VIDIOC_G_AUDIO the index field was preserved, but G_AUDIO is a read only ioctl so nothing is copied from userspace to preserve. For VIDIOC_G_FREQUENCY the tuner field was not preserved like it should have been. This would be a problem if there was any hardware with more than one tuner/modulator. For VIDIOC_ENUM_FRAMESIZES and VIDIOC_ENUM_FRAMEINTERVALS, none of the fields were preserved even though each ioctl has several field that are supposed to be inputs to the driver! Obviously these ioctls don't get used much. The index field is needed if the driver has multiple discrete sizes/rates and other fields can be used too, e.g. if the size depends on pixel format or frame rate depends on image size for example. Priority: normal Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Diffstat (limited to 'v4l2-apps')
0 files changed, 0 insertions, 0 deletions