@@ -3560,7 +3560,7 @@ int bdrv_media_changed(BlockDriverState *bs)
/**
* If eject_flag is TRUE, eject the media. Otherwise, close the tray
*/
-void bdrv_eject(BlockDriverState *bs, bool eject_flag)
+void bdrv_eject(BlockDriverState *bs, bool eject_flag, bool tray_changed)
{
BlockDriver *drv = bs->drv;
@@ -257,7 +257,7 @@ int bdrv_enable_write_cache(BlockDriverState *bs);
int bdrv_is_inserted(BlockDriverState *bs);
int bdrv_media_changed(BlockDriverState *bs);
void bdrv_lock_medium(BlockDriverState *bs, bool locked);
-void bdrv_eject(BlockDriverState *bs, bool eject_flag);
+void bdrv_eject(BlockDriverState *bs, bool eject_flag, bool tray_changed);
void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size);
BlockDriverState *bdrv_find(const char *name);
BlockDriverState *bdrv_next(BlockDriverState *bs);
@@ -63,7 +63,7 @@ static int raw_media_changed(BlockDriverState *bs)
static void raw_eject(BlockDriverState *bs, bool eject_flag)
{
- bdrv_eject(bs->file, eject_flag);
+ bdrv_eject(bs->file, eject_flag, false);
}
static void raw_lock_medium(BlockDriverState *bs, bool locked)
@@ -883,7 +883,7 @@ static void cmd_start_stop_unit(IDEState *s, uint8_t* buf)
ide_atapi_cmd_error(s, sense, ASC_MEDIA_REMOVAL_PREVENTED);
return;
}
- bdrv_eject(s->bs, !start);
+ bdrv_eject(s->bs, !start, s->tray_open != !start);
s->tray_open = !start;
}
@@ -2081,7 +2081,7 @@ static int ide_tray_state_post_load(void *opaque, int version_id)
{
IDEState *s = opaque;
- bdrv_eject(s->bs, s->tray_open);
+ bdrv_eject(s->bs, s->tray_open, false);
bdrv_lock_medium(s->bs, s->tray_locked);
return 0;
}
@@ -1050,7 +1050,7 @@ static int scsi_disk_emulate_start_stop(SCSIDiskReq *r)
: SENSE_CODE(NOT_READY_REMOVAL_PREVENTED));
return -1;
}
- bdrv_eject(s->qdev.conf.bs, !start);
+ bdrv_eject(s->qdev.conf.bs, !start, s->tray_open != !start);
s->tray_open = !start;
}
return 0;
It's true if the tray has changed its state. This is going to be used by the next commit. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- block.c | 2 +- block.h | 2 +- block/raw.c | 2 +- hw/ide/atapi.c | 2 +- hw/ide/core.c | 2 +- hw/scsi-disk.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)