diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/ide/core.c | 6 | ||||
-rw-r--r-- | hw/scsi-disk.c | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c index b33f84e1af..0403ad24c2 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1795,8 +1795,14 @@ void ide_bus_reset(IDEBus *bus) bus->dma->ops->reset(bus->dma); } +static bool ide_cd_is_medium_locked(void *opaque) +{ + return ((IDEState *)opaque)->tray_locked; +} + static const BlockDevOps ide_cd_block_ops = { .change_media_cb = ide_cd_change_cb, + .is_medium_locked = ide_cd_is_medium_locked, }; int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind, diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 65783a73e6..42682d0865 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1165,6 +1165,15 @@ static void scsi_destroy(SCSIDevice *dev) blockdev_mark_auto_del(s->qdev.conf.bs); } +static bool scsi_cd_is_medium_locked(void *opaque) +{ + return ((SCSIDiskState *)opaque)->tray_locked; +} + +static const BlockDevOps scsi_cd_block_ops = { + .is_medium_locked = scsi_cd_is_medium_locked, +}; + static int scsi_initfn(SCSIDevice *dev, uint8_t scsi_type) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev); @@ -1199,6 +1208,7 @@ static int scsi_initfn(SCSIDevice *dev, uint8_t scsi_type) } if (scsi_type == TYPE_ROM) { + bdrv_set_dev_ops(s->bs, &scsi_cd_block_ops, s); s->qdev.blocksize = 2048; } else if (scsi_type == TYPE_DISK) { s->qdev.blocksize = s->qdev.conf.logical_block_size; |