[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 29/29] hmp: add info memdev
From: |
Hu Tao |
Subject: |
[Qemu-devel] [PATCH v4 29/29] hmp: add info memdev |
Date: |
Mon, 9 Jun 2014 18:25:34 +0800 |
This is the hmp counterpart of qmp query-memdev.
Signed-off-by: Hu Tao <address@hidden>
---
hmp.c | 36 ++++++++++++++++++++++++++++++++++++
hmp.h | 1 +
monitor.c | 7 +++++++
3 files changed, 44 insertions(+)
diff --git a/hmp.c b/hmp.c
index ccc35d4..4e80e24 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"
@@ -1676,3 +1678,37 @@ 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;
+ int i = 0;
+
+
+ while (m) {
+ ov = string_output_visitor_new(false);
+ 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: %" PRId64 "\n", m->value->size);
+ monitor_printf(mon, " merge: %s\n",
+ m->value->merge ? "true" : "false");
+ monitor_printf(mon, " dump: %s\n",
+ m->value->dump ? "true" : "false");
+ monitor_printf(mon, " prealloc: %s\n",
+ m->value->prealloc ? "true" : "false");
+ monitor_printf(mon, " policy: %s\n",
+ HostMemPolicy_lookup[m->value->policy]);
+ monitor_printf(mon, " host nodes: %s\n",
+ string_output_get_string(ov));
+
+ string_output_visitor_cleanup(ov);
+ m = m->next;
+ i++;
+ }
+
+ monitor_printf(mon, "\n");
+}
diff --git a/hmp.h b/hmp.h
index aba59e9..17a91d3 100644
--- a/hmp.h
+++ b/hmp.h
@@ -103,5 +103,6 @@ void chardev_add_completion(ReadLineState *rs, int nb_args,
const char *str);
void set_link_completion(ReadLineState *rs, int nb_args, const char *str);
void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str);
void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str);
+void hmp_info_memdev(Monitor *mon, const QDict *qdict);
#endif
diff --git a/monitor.c b/monitor.c
index a2a4466..c270fd8 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2959,6 +2959,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.9.3
- [Qemu-devel] [PATCH v4 27/29] qom: introduce object_property_get_enum and object_property_get_uint16List, (continued)
- [Qemu-devel] [PATCH v4 27/29] qom: introduce object_property_get_enum and object_property_get_uint16List, Hu Tao, 2014/06/09
- Re: [Qemu-devel] [PATCH v4 00/29] NUMA series and hostmem improvements, Michael S. Tsirkin, 2014/06/09
- Re: [Qemu-devel] [PATCH v4 00/29] NUMA series and hostmem improvements, Michael S. Tsirkin, 2014/06/09
- Re: [Qemu-devel] [PATCH v4 00/29] NUMA series and hostmem improvements, Hu Tao, 2014/06/09
- Re: [Qemu-devel] [PATCH v4 00/29] NUMA series and hostmem improvements, Hu Tao, 2014/06/10
- Re: [Qemu-devel] [PATCH v4 00/29] NUMA series and hostmem improvements, Michael S. Tsirkin, 2014/06/10
- Re: [Qemu-devel] [PATCH v4 00/29] NUMA series and hostmem improvements, Hu Tao, 2014/06/10
- Re: [Qemu-devel] [PATCH v4 00/29] NUMA series and hostmem improvements, Hu Tao, 2014/06/10
- Re: [Qemu-devel] [PATCH v4 00/29] NUMA series and hostmem improvements, Michael S. Tsirkin, 2014/06/10
- Re: [Qemu-devel] [PATCH v4 00/29] NUMA series and hostmem improvements, Hu Tao, 2014/06/10
[Qemu-devel] [PATCH v4 29/29] hmp: add info memdev,
Hu Tao <=
[Qemu-devel] [PATCH v4 28/29] qmp: add query-memdev, Hu Tao, 2014/06/09
- Re: [Qemu-devel] [PATCH v4 28/29] qmp: add query-memdev, Igor Mammedov, 2014/06/09
- Re: [Qemu-devel] [PATCH v4 28/29] qmp: add query-memdev, Paolo Bonzini, 2014/06/09
- Re: [Qemu-devel] [PATCH v4 28/29] qmp: add query-memdev, Igor Mammedov, 2014/06/09
- Re: [Qemu-devel] [PATCH v4 28/29] qmp: add query-memdev, Paolo Bonzini, 2014/06/09
- Re: [Qemu-devel] [PATCH v4 28/29] qmp: add query-memdev, Igor Mammedov, 2014/06/09
- Re: [Qemu-devel] [PATCH v4 28/29] qmp: add query-memdev, Eric Blake, 2014/06/09
Re: [Qemu-devel] [PATCH v4 28/29] qmp: add query-memdev, Eric Blake, 2014/06/09