qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 1/4] qmp: add query-memdev


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 1/4] qmp: add query-memdev
Date: Mon, 16 Jun 2014 11:38:18 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

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 <address@hidden>
> ---
>  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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]