diff options
| author | Dave Jones <davej@suse.de> | 2002-04-02 19:23:23 -0800 |
|---|---|---|
| committer | Dave Jones <davej@suse.de> | 2002-04-02 19:23:23 -0800 |
| commit | 97752344cd1bec65529adf587cda865810925e3e (patch) | |
| tree | 1b2738231d7dfe5be8040fefc7a501753c2bc033 /include | |
| parent | b1689a13951fee5a3e045bc5c6d71afaa5d16622 (diff) | |
[PATCH] videodev fixups / generic usercopy helper
Originally from Gerd...
I've just noticed that a hole left in the recent changes which should
allow the usb v4l drivers to unregister with open file handles. The
drivers itself handle it just fine, but video_generic_ioctl() will barf
when called on unregistered devices. Oops.
One way to fix this is to expect drivers call the helper function and
pass a pointer for the function doing the actual work, i.e. handle it
this way:
driver_ioctl(inode,file,cmd,userptr)
-> video_usercopy(inode,file,cmd,userptr,func)
copy_from_user(...)
-> func(inode,file,cmd,kernelptr);
copy_to_user(...)
Patch against 2.5.7-pre2 below. It updates videodev.[ch] and adapts
usbvideo.c to show how the driver changes will look like.
Note that this change makes the usercopy helper function a very generic
one, it probably could be used for other drivers to (as long as the API
has sane magic numbers based on _IO*(...) defines) as there is no
video4linux-related stuff in there any more. So we might think of
renaming it an moving it to some more central place (fs/ioctl.c maybe).
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/videodev.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 542e3ececef4..80966ed8e288 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -37,8 +37,6 @@ struct video_device * video_generic_ioctl() does the userspace copying of the * ioctl arguments */ struct file_operations *fops; - int (*kernel_ioctl)(struct inode *inode, struct file *file, - unsigned int cmd, void *arg); void *priv; /* Used to be 'private' but that upsets C++ */ /* for videodev.c intenal usage -- don't touch */ @@ -60,8 +58,10 @@ extern struct video_device* video_devdata(struct file*); extern int video_exclusive_open(struct inode *inode, struct file *file); extern int video_exclusive_release(struct inode *inode, struct file *file); -extern int video_generic_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg); +extern int video_usercopy(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg, + int (*func)(struct inode *inode, struct file *file, + unsigned int cmd, void *arg)); #endif /* __KERNEL__ */ #define VID_TYPE_CAPTURE 1 /* Can capture */ |
