diff options
author | Markus Armbruster <armbru@redhat.com> | 2011-09-06 18:58:46 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-09-12 15:17:20 +0200 |
commit | f107639a6ff0c8d02f6a2dfdfce3a9d9f1e2eb27 (patch) | |
tree | 0c5368f533034b7e1adbd02be5dcff6367cf3a94 /hw/scsi-disk.c | |
parent | fdec4404ddfaf9e121bef84eac1303a8a0e47d75 (diff) |
block: Drop medium lock tracking, ask device models instead
Requires new BlockDevOps member is_medium_locked(). Implement for IDE
and SCSI CD-ROMs.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/scsi-disk.c')
-rw-r--r-- | hw/scsi-disk.c | 10 |
1 files changed, 10 insertions, 0 deletions
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; |