We already track it in BlockDriverState. Just like tray open/close state, we should track it in the device models instead, because it's device state.
Signed-off-by: Markus Armbruster <arm...@redhat.com> --- hw/ide/atapi.c | 1 + hw/ide/internal.h | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 08e1a7a..8634e6b 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -820,6 +820,7 @@ static void cmd_test_unit_ready(IDEState *s, uint8_t *buf) static void cmd_prevent_allow_medium_removal(IDEState *s, uint8_t* buf) { + s->tray_locked = buf[4] & 1; bdrv_set_locked(s->bs, buf[4] & 1); ide_atapi_cmd_ok(s); } diff --git a/hw/ide/internal.h b/hw/ide/internal.h index 5cf95c0..12f80de 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -441,6 +441,7 @@ struct IDEState { uint8_t sense_key; uint8_t asc; bool tray_open; + bool tray_locked; uint8_t cdrom_changed; int packet_transfer_size; int elementary_transfer_size; -- 1.7.2.3