> I would like to propose a third method, which may contain the best of
> both worlds (although it may also be hopelessly impractical):
> 
> 1) Retain only 1 registration method (Gerd's fops method).
> 2) Remove all v4l1 compatibility into a separate module.
> 3) Have the compatibility module register distinct devices for v4l1
> compatibily.

I still don't like the separate devices for v4l1/2.

> 2) v4l2 drivers must do their own userspace copying (probably a single
> helper function in videodev that v4l2 modules must call).

Hmm, I think we don't have to do that way.  The ioctl function (maybe
mmap too) in the compatibility module can be build in such a way that
a driver can hook these directly into his struct file_operations.

The ioctl function which does the real work (and no userspace copying)
can go into struct video_device.  Like this:

int generic_video_ioctl(struct inode *inode, struct file *file,
        unsigned int cmd, unsigned long arg)
{
        // videodev.c must export the get_vfl() lookup function
        struct video_device *vfl = get_vfl(inode);

        // copy from userspace

        err = vfl->kernel_ioctl(inode,file,cmd,copied_arg);
        if (err == -ENOIOCTLCMD)
                err = translate_ioctl(...)
        
        // copy to userspace

        return err;
}

Comes close to what videodevX.c does today.  And we can easily split
videodev.c and the compatibility/helper code into multiple modules.

  Gerd



_______________________________________________
Video4linux-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/video4linux-list

Reply via email to