aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-blk.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio-blk.c')
-rw-r--r--hw/virtio-blk.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 5036b5b024..c278d2ef0a 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -414,29 +414,27 @@ static int virtio_blk_load(QEMUFile *f, void *opaque, int version_id)
return 0;
}
-VirtIODevice *virtio_blk_init(DeviceState *dev)
+VirtIODevice *virtio_blk_init(DeviceState *dev, DriveInfo *dinfo)
{
VirtIOBlock *s;
int cylinders, heads, secs;
static int virtio_blk_id;
- BlockDriverState *bs;
char *ps;
s = (VirtIOBlock *)virtio_common_init("virtio-blk", VIRTIO_ID_BLOCK,
sizeof(struct virtio_blk_config),
sizeof(VirtIOBlock));
- bs = qdev_init_bdrv(dev, IF_VIRTIO);
s->vdev.get_config = virtio_blk_update_config;
s->vdev.get_features = virtio_blk_get_features;
s->vdev.reset = virtio_blk_reset;
- s->bs = bs;
+ s->bs = dinfo->bdrv;
s->rq = NULL;
- if (strlen(ps = (char *)drive_get_serial(bs)))
+ if (strlen(ps = (char *)drive_get_serial(s->bs)))
strncpy(s->serial_str, ps, sizeof(s->serial_str));
else
snprintf(s->serial_str, sizeof(s->serial_str), "0");
- bs->private = dev;
+ s->bs->private = dev;
bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs);
bdrv_set_geometry_hint(s->bs, cylinders, heads, secs);