mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
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>
This commit is contained in:
parent
fa879d62eb
commit
0e49de5232
6 changed files with 44 additions and 31 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue