[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/5] block: bdrv_eject(): Add tray_changed parameter
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 3/5] block: bdrv_eject(): Add tray_changed parameter |
Date: |
Tue, 7 Feb 2012 16:09:47 -0200 |
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 <address@hidden>
---
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(-)
diff --git a/block.c b/block.c
index 4042ada..77ace49 100644
--- a/block.c
+++ b/block.c
@@ -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;
diff --git a/block.h b/block.h
index ce8c5ed..1d4cb94 100644
--- a/block.h
+++ b/block.h
@@ -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);
diff --git a/block/raw.c b/block/raw.c
index 1cdac0c..8343df4 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -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)
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 0adb27b..d2e2a84 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -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;
}
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 0856385..baac6c8 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -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;
}
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 94f6af6..9dad9c1 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -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;
--
1.7.9.111.gf3fb0.dirty
- [Qemu-devel] [RFC 0/5]: QMP: Introduce GUEST_MEDIUM_EJECT & BLOCK_MEDIUM_CHANGED, Luiz Capitulino, 2012/02/07
- [Qemu-devel] [PATCH 2/5] block: bdrv_eject(): Make eject_flag a real bool, Luiz Capitulino, 2012/02/07
- [Qemu-devel] [PATCH 3/5] block: bdrv_eject(): Add tray_changed parameter,
Luiz Capitulino <=
- [Qemu-devel] [PATCH 5/5] qmp: add the BLOCK_MEDIUM_CHANGED event, Luiz Capitulino, 2012/02/07
- [Qemu-devel] [PATCH 4/5] qmp: add the GUEST_MEDIUM_EJECTED event, Luiz Capitulino, 2012/02/07
- [Qemu-devel] [PATCH 1/5] block: Rename bdrv_mon_event() & BlockMonEventAction, Luiz Capitulino, 2012/02/07
- Re: [Qemu-devel] [RFC 0/5]: QMP: Introduce GUEST_MEDIUM_EJECT & BLOCK_MEDIUM_CHANGED, Markus Armbruster, 2012/02/09
- Re: [Qemu-devel] [RFC 0/5]: QMP: Introduce GUEST_MEDIUM_EJECT & BLOCK_MEDIUM_CHANGED, Paolo Bonzini, 2012/02/10