aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-06-05 14:19:41 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-06-06 11:27:05 +0200
commit587da2c39c9ace168f4d01fa446a54ae998a2553 (patch)
tree28a0dd5ef30da6a5bab0b721469850eafcd14064 /hmp.c
parent02da386a2d7a020e80b0aed64769efa9dd42072a (diff)
Make qemu-io commands available in HMP
It was decided to not make this command available in QMP in order to make clear that this is not supposed to be a stable API and should be used only for testing and debugging purposes. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/hmp.c b/hmp.c
index 4fb76ec7a7..64e0baac16 100644
--- a/hmp.c
+++ b/hmp.c
@@ -22,6 +22,7 @@
#include "qemu/sockets.h"
#include "monitor/monitor.h"
#include "ui/console.h"
+#include "qemu-io.h"
static void hmp_handle_error(Monitor *mon, Error **errp)
{
@@ -1425,3 +1426,20 @@ void hmp_chardev_remove(Monitor *mon, const QDict *qdict)
qmp_chardev_remove(qdict_get_str(qdict, "id"), &local_err);
hmp_handle_error(mon, &local_err);
}
+
+void hmp_qemu_io(Monitor *mon, const QDict *qdict)
+{
+ BlockDriverState *bs;
+ const char* device = qdict_get_str(qdict, "device");
+ const char* command = qdict_get_str(qdict, "command");
+ Error *err = NULL;
+
+ bs = bdrv_find(device);
+ if (bs) {
+ qemuio_command(bs, command);
+ } else {
+ error_set(&err, QERR_DEVICE_NOT_FOUND, device);
+ }
+
+ hmp_handle_error(mon, &err);
+}