diff options
author | Markus Armbruster <armbru@redhat.com> | 2011-08-03 15:07:41 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-09-06 11:23:51 +0200 |
commit | 0e49de5232f47c9e58adb82c28d4f42be933d891 (patch) | |
tree | c0204e2cf08f38a843060372a4165d89ca38de61 /hw/virtio-blk.c | |
parent | fa879d62eb51253d00b6920ce1d1d9d261370a49 (diff) |
block: Generalize change_cb() to BlockDevOps
So we can more easily add device model callbacks.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/virtio-blk.c')
-rw-r--r-- | hw/virtio-blk.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 2a8ccd0aa9..c10afa9962 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -552,6 +552,10 @@ static void virtio_blk_change_cb(void *opaque, int reason) } } +static const BlockDevOps virtio_block_ops = { + .change_cb = virtio_blk_change_cb, +}; + VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf, char **serial) { @@ -598,7 +602,7 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf, register_savevm(dev, "virtio-blk", virtio_blk_id++, 2, virtio_blk_save, virtio_blk_load, s); bdrv_set_removable(s->bs, 0); - bdrv_set_change_cb(s->bs, virtio_blk_change_cb, s); + bdrv_set_dev_ops(s->bs, &virtio_block_ops, s); s->bs->buffer_alignment = conf->logical_block_size; add_boot_device_path(conf->bootindex, dev, "/disk@0,0"); |