summaryrefslogtreecommitdiffstats
path: root/hw/ide/core.c
diff options
context:
space:
mode:
authorMarkus Armbruster2011-08-03 15:07:41 +0200
committerKevin Wolf2011-09-06 11:23:51 +0200
commit0e49de5232f47c9e58adb82c28d4f42be933d891 (patch)
treec0204e2cf08f38a843060372a4165d89ca38de61 /hw/ide/core.c
parentblock: Attach non-qdev devices as well (diff)
downloadqemu-0e49de5232f47c9e58adb82c28d4f42be933d891.tar.gz
qemu-0e49de5232f47c9e58adb82c28d4f42be933d891.tar.xz
qemu-0e49de5232f47c9e58adb82c28d4f42be933d891.zip
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/ide/core.c')
-rw-r--r--hw/ide/core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 428f033876..26a9c5ba14 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1742,6 +1742,10 @@ void ide_bus_reset(IDEBus *bus)
bus->dma->ops->reset(bus->dma);
}
+static const BlockDevOps ide_cd_block_ops = {
+ .change_cb = cdrom_change_cb,
+};
+
int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
const char *version, const char *serial)
{
@@ -1776,7 +1780,7 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
s->smart_errors = 0;
s->smart_selftest_count = 0;
if (kind == IDE_CD) {
- bdrv_set_change_cb(bs, cdrom_change_cb, s);
+ bdrv_set_dev_ops(bs, &ide_cd_block_ops, s);
bs->buffer_alignment = 2048;
} else {
if (!bdrv_is_inserted(s->bs)) {