2008/8/26 Adam Hamsik <haaaad%gmail.com@localhost>:
I think that it is not possible to VOP_OPEN block device more than
once,
but you can open raw devices as many times as you want.
In my device-mapper driver I created
struct pdev {
struct vnode pdev_vnode;
. . .
};
Which is in SLIST shared between all dm devices in system. When dm
device
is created I VOP_OPEN selected disk device and add it's vnode to
pdev SLIST.
When another dm device with same disk is created I search SLIST
list for
vnode
return it. You can look at this code at haad-dm branch in
sys/dev/dm/dm_pdev.c.
You probably need to do the same in ld0, or you can use device-
mapper to do
it
for you and only write own target.
Thanks for the suggestion, but this won't work with the ld(4) driver
where
it uses the d_strategy method of bdevsw extensively.