device cloning on open
toby.karyadi at gmail.com
Wed Apr 4 12:19:58 PDT 2007
Has there been any changes to device cloning support in DFBSD, specifically
related to this email:
I'm porting the kqemu module based on the FreeBSD version of it and it works
now but there can only be one qemu process using the /dev/kqemu device. I
guess I can just have a list of association between a process and the
module/device private data for each open() that's managed in the module.
It's not optimal but it will work until I figure out the best way to keep
per open data.
In FreeBSD >= 5 the per open data is associated to a clone of the device via
the si_drv1 field. A clone event handler also needs to be registered to do
the cloning - it's kind of convoluted.
In Linux and NetBSD, if I read the code right, the file pointer is passed in
to the various ops, read, ioctl, write, etc of the driver. I think this
makes more sense semantically. In Linux the file* is passed in, while in
NetBSD the module can decide call falloc and fdclone.
I'm not sure if I want to / can take on the task of adding the per open
vnode as suggested by Matt, but I'd be interested in hearing what people
have to say about this.
Thanks for all of the great work so far.
More information about the Kernel