On 06/16/2014 04:05 AM, Hu Tao wrote: > Add qmp command query-memdev to query for information > of memory devices > > Signed-off-by: Hu Tao <hu...@cn.fujitsu.com> > --- > numa.c | 84 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > qapi-schema.json | 40 +++++++++++++++++++++++++++ > qmp-commands.hx | 38 +++++++++++++++++++++++++ > 3 files changed, 162 insertions(+) > > diff --git a/numa.c b/numa.c > index 8ba5a38..bcbafd2 100644 > --- a/numa.c > +++ b/numa.c > @@ -34,6 +34,7 @@ > #include "qapi/qmp/qerror.h" > #include "hw/boards.h" > #include "sysemu/hostmem.h" > +#include "qmp-commands.h" > > QemuOptsList qemu_numa_opts = { > .name = "numa", > @@ -280,3 +281,86 @@ void memory_region_allocate_system_memory(MemoryRegion > *mr, Object *owner, > addr += size; > } > } > + > +static int query_memdev(Object *obj, void *opaque) > +{ > + MemdevList **list = opaque; > + Error *err = NULL;
This variable is usually named local_err. > + > + if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) { > + MemdevList *m = g_malloc0(sizeof(*m)); > + > + m->value = g_malloc0(sizeof(*m->value)); > + > + m->value->size = object_property_get_int(obj, "size", > + &err); > + if (err) { > + goto error; > + } Is this error ever likely, or would it represent a programming error, in which case passing &error_abort would avoid the need to check for failure afterwords. Similarly for all the other properties. > +query-memdev > +------------ > + > +Show memory devices information. Makes sense, but took me a couple reads. Might be better as: Show information on memory devices. > + > + > +Example (1): What is the "(1)" for? I'd just drop it (probably copy-and-paste from another command that actually had more than one example) -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature