aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorLei Li <lilei@linux.vnet.ibm.com>2013-01-25 00:03:21 +0800
committerLuiz Capitulino <lcapitulino@redhat.com>2013-01-25 11:46:50 -0200
commit49b6d7220bce42e6c06e0dbb61969a997868491f (patch)
tree4c70d8cd393f2cd86e53fcaa671a78f659d6c6c5 /hmp.c
parent1f590cf9455c571799d1bfc0777255fa0796d4da (diff)
QAPI: Introduce memchar-read QMP command
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hmp.c b/hmp.c
index cd614e8720..7e259c2b56 100644
--- a/hmp.c
+++ b/hmp.c
@@ -675,6 +675,27 @@ void hmp_memchar_write(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &errp);
}
+void hmp_memchar_read(Monitor *mon, const QDict *qdict)
+{
+ uint32_t size = qdict_get_int(qdict, "size");
+ const char *chardev = qdict_get_str(qdict, "device");
+ MemCharRead *meminfo;
+ Error *errp = NULL;
+
+ meminfo = qmp_memchar_read(chardev, size, false, 0, &errp);
+ if (errp) {
+ monitor_printf(mon, "%s\n", error_get_pretty(errp));
+ error_free(errp);
+ return;
+ }
+
+ if (meminfo->count > 0) {
+ monitor_printf(mon, "%s\n", meminfo->data);
+ }
+
+ qapi_free_MemCharRead(meminfo);
+}
+
static void hmp_cont_cb(void *opaque, int err)
{
if (!err) {