[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 09/10] QMP/HMP: eject: Use blockdev-tray-open
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [RFC 09/10] QMP/HMP: eject: Use blockdev-tray-open |
Date: |
Fri, 3 Jun 2011 16:04:01 -0300 |
This commit rewrites eject as a special case of the blockdev-tray-open
command. In other words, do_eject() just calls tray_open().
This brings the following behavior *changes* to both QMP and HMP:
1. Before this commit eject was capable of closing the BlockDriverState
associated with *any* device (ie. removable or not, by using '-f').
Now it's only capable of closing the BlockDriverState of removable
devices
2. Ejecting the host's cdrom now works
3. After the eject command is ran the tray is left open
Please, also note that the use of this command will emit the
BLOCK_TRAY_OPEN event in QMP.
Signed-off-by: Luiz Capitulino <address@hidden>
---
blockdev.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 14c8312..36c56fd 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -787,16 +787,8 @@ int do_tray_open(Monitor *mon, const QDict *qdict, QObject
**ret_data)
int do_eject(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
- BlockDriverState *bs;
- int force = qdict_get_try_bool(qdict, "force", 0);
- const char *filename = qdict_get_str(qdict, "device");
-
- bs = bdrv_find(filename);
- if (!bs) {
- qerror_report(QERR_DEVICE_NOT_FOUND, filename);
- return -1;
- }
- return eject_device(mon, bs, force);
+ return tray_open(qdict_get_str(qdict, "device"), 1,
+ qdict_get_try_bool(qdict, "force", 0));
}
int do_block_set_passwd(Monitor *mon, const QDict *qdict,
--
1.7.4.4
[Qemu-devel] [RFC 08/10] QMP: Introduce the BLOCK_TRAY_OPEN and BLOCK_TRAY_CLOSE events, Luiz Capitulino, 2011/06/03
[Qemu-devel] [RFC 09/10] QMP/HMP: eject: Use blockdev-tray-open,
Luiz Capitulino <=
[Qemu-devel] [RFC 10/10] QMP/HMP: change: Use QMP tray commands, Luiz Capitulino, 2011/06/03
Re: [Qemu-devel] [RFC 00/10]: QMP/HMP: Introduce tray handling commands, Markus Armbruster, 2011/06/06