aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-09-06 18:58:53 +0200
committerKevin Wolf <kwolf@redhat.com>2011-09-12 15:17:21 +0200
commite4def80b36231e161b91fa984cd0d73b45668f00 (patch)
tree655c55c6efac3d7a17e3a004ac9889ba32342415 /hw
parent9e6a4c9177bc95aa04438458d75442e80db9ad33 (diff)
block: Show whether the virtual tray is open in info block
Need to ask the device, so this requires new BlockDevOps member is_tray_open(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/ide/core.c6
-rw-r--r--hw/scsi-disk.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 716addcea3..8f719ee76c 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1795,6 +1795,11 @@ void ide_bus_reset(IDEBus *bus)
bus->dma->ops->reset(bus->dma);
}
+static bool ide_cd_is_tray_open(void *opaque)
+{
+ return ((IDEState *)opaque)->tray_open;
+}
+
static bool ide_cd_is_medium_locked(void *opaque)
{
return ((IDEState *)opaque)->tray_locked;
@@ -1802,6 +1807,7 @@ static bool ide_cd_is_medium_locked(void *opaque)
static const BlockDevOps ide_cd_block_ops = {
.change_media_cb = ide_cd_change_cb,
+ .is_tray_open = ide_cd_is_tray_open,
.is_medium_locked = ide_cd_is_medium_locked,
};
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 0f0cddc7ca..f48ca8b5d4 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1176,6 +1176,11 @@ static void scsi_cd_change_media_cb(void *opaque)
{
}
+static bool scsi_cd_is_tray_open(void *opaque)
+{
+ return ((SCSIDiskState *)opaque)->tray_open;
+}
+
static bool scsi_cd_is_medium_locked(void *opaque)
{
return ((SCSIDiskState *)opaque)->tray_locked;
@@ -1183,6 +1188,7 @@ static bool scsi_cd_is_medium_locked(void *opaque)
static const BlockDevOps scsi_cd_block_ops = {
.change_media_cb = scsi_cd_change_media_cb,
+ .is_tray_open = scsi_cd_is_tray_open,
.is_medium_locked = scsi_cd_is_medium_locked,
};