[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 088/106] hmp: add info memdev
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 088/106] hmp: add info memdev |
Date: |
Wed, 18 Jun 2014 19:21:31 +0300 |
From: Hu Tao <address@hidden>
This is the hmp counterpart of qmp query-memdev.
Signed-off-by: Hu Tao <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
MST: fix build on 32 bit
---
hmp.h | 1 +
hmp.c | 36 ++++++++++++++++++++++++++++++++++++
monitor.c | 7 +++++++
3 files changed, 44 insertions(+)
diff --git a/hmp.h b/hmp.h
index 2d9b0a2..4fd3c4a 100644
--- a/hmp.h
+++ b/hmp.h
@@ -93,6 +93,7 @@ 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);
void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
diff --git a/hmp.c b/hmp.c
index ccc35d4..41006f5 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/monitor.c b/monitor.c
index ca17e42..afbb2d7 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2964,6 +2964,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,
},
};
--
MST
- [Qemu-devel] [PULL v2 075/106] numa: add -numa node, memdev= option, (continued)
- [Qemu-devel] [PULL v2 075/106] numa: add -numa node, memdev= option, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 079/106] pc: pass MachineState to pc_memory_init, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 080/106] backend:hostmem: replace hostmemory with host_memory, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 082/106] hostmem: add file-based HostMemoryBackend, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 083/106] hostmem: add merge and dump properties, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 084/106] hostmem: allow preallocation of any memory region, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 085/106] hostmem: add property to map memory with MAP_SHARED, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 086/106] hostmem: add properties for NUMA memory policy, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 087/106] qmp: add query-memdev, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 089/106] tests: fix memory leak in test of string input visitor, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 088/106] hmp: add info memdev,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 090/106] qapi: make string input visitor parse int list, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 091/106] qapi: make string output visitor parse int list, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 093/106] qdev: reorganize error reporting in bus_set_realized, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 092/106] qapi: fix build on glib < 2.28, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 094/106] qdev: recursively unrealize devices when unrealizing bus, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 096/106] pc: acpi: do not hardcode preprocessor, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 095/106] qmp: clean out whitespace, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 097/106] numa: handle mmaped memory allocation failure correctly, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 099/106] acpi: introduce TYPE_ACPI_DEVICE_IF interface, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 098/106] qmp: add query-memory-devices command, Michael S. Tsirkin, 2014/06/18