Alan Cox wrote:
> > No. videodev.o allows only one process to open the device. Any chance
> > [ ... ]
> Change it but keep a flag so the videode enforces it for legacy drivers for 2.4
My plan is to simply pass down the struct file* instead of struct
video_device* (except for open). The driver can simply hook per
filedescriptor data into file->private_data then (or just the driver data
if it doesn't want allow multiple opens and therefore doesn't need per-fd
data). This requires changes of the driver callbacks, i.e. we need a second
set of hooks (called open2/close2/... for example), depending on the flag
the old/new ones are called by videodev.c.
Right now there is...
| int (*open)(struct video_device *, int mode);
Needs a additional struct file*.
| void (*close)(struct video_device *);
| int (*ioctl)(struct video_device *, unsigned int , void *);
| int (*mmap)(struct video_device *, const char *, unsigned long);
Replace struct video_device* with struct file*.
| long (*read)(struct video_device *, char *, unsigned long, int noblock);
| long (*write)(struct video_device *, const char *, unsigned long, int noblock);
Replace struct video_device* with struct file*, remove noblock (the driver
can check file->flags). Maybe check out kiobuf (havn't looked at it yet),
let videodev.c allocate kiobufs and pass them down to the driver.
| unsigned int (*poll)(struct video_device *, struct file *, poll_table *);
This could stay as-is, althrouth the struct video_device isn't required
any more...
Another minor problem is that allowing multiple opens implies some minor
API changes. Right now a application can do anything once it has opened
(i.e. allocated) the device. With multiple opens allowed only a few ioctls
(basically VIDIOG*) work all the time, other ones might return -EBUSY if
another application uses the driver in parallel. Should I care? Maybe
allow apps to open the driver with O_EXCL like the floppy driver does?
Gerd
--
Protecting the children is a good way to get a lot of adults who cant
stand up for themselves. -- seen in some sig on /.
--
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.