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/ide | |
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/ide')
-rw-r--r-- | hw/ide/core.c | 6 |
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)) { |