[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v19 11/11] hmp: add info memdev
From: |
Hu Tao |
Subject: |
[Qemu-devel] [PATCH v19 11/11] hmp: add info memdev |
Date: |
Tue, 4 Mar 2014 15:28:25 +0800 |
This is the hmp counterpart of qmp query-memdev.
Signed-off-by: Hu Tao <address@hidden>
---
hmp.c | 27 +++++++++++++++++++++++++++
hmp.h | 1 +
monitor.c | 7 +++++++
3 files changed, 35 insertions(+)
diff --git a/hmp.c b/hmp.c
index e3ddd46..3bbe5ff 100644
--- a/hmp.c
+++ b/hmp.c
@@ -22,6 +22,8 @@
#include "qemu/sockets.h"
#include "monitor/monitor.h"
#include "qapi/opts-visitor.h"
+#include "qapi/string-output-visitor.h"
+#include "qapi-visit.h"
#include "ui/console.h"
#include "block/qapi.h"
#include "qemu-io.h"
@@ -1644,3 +1646,28 @@ void hmp_object_del(Monitor *mon, const QDict *qdict)
qmp_object_del(id, &err);
hmp_handle_error(mon, &err);
}
+
+void hmp_info_memdev(Monitor *mon, const QDict *qdict)
+{
+ Error *err = NULL;
+ MemdevList *memdev_list = qmp_query_memdev(&err);
+ MemdevList *m = memdev_list;
+ StringOutputVisitor *ov = string_output_visitor_new(false);
+ int i = 0;
+
+
+ while (m) {
+ visit_type_uint16List(string_output_get_visitor(ov),
+ &m->value->host_nodes, NULL, NULL);
+ monitor_printf(mon, "memory device %d\n", i);
+ monitor_printf(mon, " size: %ld\n", m->value->size);
+ monitor_printf(mon, " policy: %s\n", m->value->policy);
+ monitor_printf(mon, " host nodes: %s\n",
string_output_get_string(ov));
+
+ m = m->next;
+ i++;
+ }
+
+ monitor_printf(mon, "\n");
+ string_output_visitor_cleanup(ov);
+}
diff --git a/hmp.h b/hmp.h
index ed58f0e..b6f5d02 100644
--- a/hmp.h
+++ b/hmp.h
@@ -92,5 +92,6 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict);
void hmp_cpu_add(Monitor *mon, const QDict *qdict);
void hmp_object_add(Monitor *mon, const QDict *qdict);
void hmp_object_del(Monitor *mon, const QDict *qdict);
+void hmp_info_memdev(Monitor *mon, const QDict *qdict);
#endif
diff --git a/monitor.c b/monitor.c
index d7f1ade..fec4836 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2949,6 +2949,13 @@ static mon_cmd_t info_cmds[] = {
.mhandler.cmd = hmp_info_tpm,
},
{
+ .name = "memdev",
+ .args_type = "",
+ .params = "",
+ .help = "show the memory device",
+ .mhandler.cmd = hmp_info_memdev,
+ },
+ {
.name = NULL,
},
};
--
1.8.5.2.229.g4448466
- [Qemu-devel] [PATCH v19 00/11] Add support for binding guest numa nodes to host numa nodes, Hu Tao, 2014/03/04
- [Qemu-devel] [PATCH v19 05/11] numa: add -numa node, memdev= option, Hu Tao, 2014/03/04
- [Qemu-devel] [PATCH v19 11/11] hmp: add info memdev,
Hu Tao <=
- [Qemu-devel] [PATCH v19 02/11] add memdev backend infrastructure, Hu Tao, 2014/03/04
- [Qemu-devel] [PATCH v19 01/11] object_add: allow completion handler to get canonical path, Hu Tao, 2014/03/04
- [Qemu-devel] [PATCH v19 08/11] Add Linux libnuma detection, Hu Tao, 2014/03/04
- [Qemu-devel] [PATCH v19 03/11] pc: pass QEMUMachineInitArgs to pc_memory_init, Hu Tao, 2014/03/04
- [Qemu-devel] [PATCH v19 06/11] qapi: make string input visitor parse int list, Hu Tao, 2014/03/04
- [Qemu-devel] [PATCH v19 09/11] hostmem backend: implement memory policy, Hu Tao, 2014/03/04
- [Qemu-devel] [PATCH v19 10/11] qmp: add query-memdev, Hu Tao, 2014/03/04
- [Qemu-devel] [PATCH v19 04/11] numa: introduce memory_region_allocate_system_memory, Hu Tao, 2014/03/04
- [Qemu-devel] [PATCH v19 07/11] qapi: make string output visitor parse int list, Hu Tao, 2014/03/04