[gsoc] Virtio block device driver
Stéphanie Ouillon
stephanie at minet.net
Thu Jun 2 12:35:15 PDT 2011
Hello,
I was actually using an older code. Now I updated my code, and it's
okay. Thanks for the help.
Stéphanie
Le 02/06/11 06:26, Tim Bisson a écrit :
On 5/31/11 1:05 PM, Stéphanie Ouillon wrote:
Hello,
I modified some parts of the code of the virtio block device driver
that has been already ported from NetBSD.
The code is available here : github.com/arroway/virtio_DragonFlyBSD
The initially ported block device driver is available in the block/
direectory : it was working on its own.
What I did is that I modified it so that it could work with a more
general interface, virtio.c
Can you clarify what you mean by make it "work with a more general
interface, virtio.c"? The block driver as it was, would use virtio.c.
For example, virtio_negotiate_features() is in virtio.c and is called
from virtio-blk.c
I'm referring to the last code written for the virtio-block:
http://gitorious.org/virtio-drivers/virtio-drivers/trees/master
First the virtio module is called, and it detects or not a virtio
device. Then, according to the type of the virtio device ( here, a
block device ), it calls the virtio_blk module.
I've got some problems to attach my virtio device with virtio_blk.
Here is what I did, as I told my mentor Pratyush Kshirsagar :
Some functions were defined twice : in virtio_blk.c and in virtio.c.
In virtio.c, their prototypes accepted a virtio_softc * structure,
but in virtio_blk.c, they wanted a virtio_blk_softc * structure.
Now, I only use the functions in virtio.c ( I deleted the
corresponding functions in virtio_blk.c to keep ony the functions
that were specific to the block device ).
So I changed the definition of virtio_blk_softc * structure in
virtio_blk.c. Now it looks like this :
(like in the netbsd code)
*struct virtio_blk_softc {*
device_t sc_dev;
*struct virtio_softc *sc_virtio;*
struct virtqueue sc_vq[1];
struct virtio_blk_req *sc_reqs;
int sc_readonly;
uint32_t sc_features;
int maxxfersize;
/ //added : what for ?/
bus_dma_segment_t sc_reqs_segs[1];
/ //I don't use it at the moment ( virtio_blk_attach() )/
/ kmutex_t sc_lock;/
/// Block stuff : for testing/ /with /devstat
cdev_t cdev;
struct devstat stats;
struct disk disk;
*};*
I think you might be using an older version of the virtio block code?
In the gitorious tree I pointed to earlier, there is a pointer to
virtio_softc in virtio_blk_softc.
Thanks,
Tim
More information about the Kernel
mailing list