summaryrefslogtreecommitdiffstats
path: root/hw/scsi-disk.c
diff options
context:
space:
mode:
authorMarkus Armbruster2011-09-06 18:58:45 +0200
committerKevin Wolf2011-09-12 15:17:20 +0200
commitfdec4404ddfaf9e121bef84eac1303a8a0e47d75 (patch)
treeea7637b6abf1510c1ff22baf1b495536f71a5b40 /hw/scsi-disk.c
parentscsi-disk: Track tray locked state (diff)
downloadqemu-fdec4404ddfaf9e121bef84eac1303a8a0e47d75.tar.gz
qemu-fdec4404ddfaf9e121bef84eac1303a8a0e47d75.tar.xz
qemu-fdec4404ddfaf9e121bef84eac1303a8a0e47d75.zip
block: Leave enforcing tray lock to device models
The device model knows best when to accept the guest's eject command. No need to detour through the block layer. bdrv_eject() can't fail anymore. Make it void. 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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index e7358e3c4d..65783a73e6 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -830,6 +830,9 @@ static void scsi_disk_emulate_start_stop(SCSIDiskReq *r)
bool loej = req->cmd.buf[4] & 2; /* load on start, eject on !start */
if (s->qdev.type == TYPE_ROM && loej) {
+ if (!start && s->tray_locked) {
+ return;
+ }
bdrv_eject(s->bs, !start);
s->tray_open = !start;
}