diff options
author | Hu Tao <hutao@cn.fujitsu.com> | 2014-05-14 17:43:35 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-06-19 18:44:21 +0300 |
commit | eb1539b2343f2040decab39ccb9dc50dda75001c (patch) | |
tree | 58dab92e5a6277f368df33fb82fb807f0d2d0696 /hmp.c | |
parent | 76b5d8507d08db18bc0bd3c75349b357a82ff1a2 (diff) | |
download | qemu-eb1539b2343f2040decab39ccb9dc50dda75001c.zip |
hmp: add info memdev
This is the hmp counterpart of qmp query-memdev.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
MST: fix build on 32 bit
Diffstat (limited to 'hmp.c')
-rw-r--r-- | hmp.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -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"); +} |