xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH v2 1/3] libxl: introduce libxl__qmp_query_cpus
Date: Mon, 13 Jun 2016 17:52:14 +0100	[thread overview]
Message-ID: <20160613165214.GF5666@perard.uk.xensource.com> (raw)
In-Reply-To: <1465396126-27426-2-git-send-email-wei.liu2@citrix.com>

On Wed, Jun 08, 2016 at 03:28:44PM +0100, Wei Liu wrote:
> diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
> index 3eb279a..23eac92 100644
> --- a/tools/libxl/libxl_qmp.c
> +++ b/tools/libxl/libxl_qmp.c
> @@ -979,6 +979,43 @@ int libxl__qmp_cpu_add(libxl__gc *gc, int domid, int idx)
>      return qmp_run_command(gc, domid, "cpu-add", args, NULL, NULL);
>  }
>  
> +static int query_cpus_callback(libxl__qmp_handler *qmp,
> +                               const libxl__json_object *response,
> +                               void *opaque)
> +{
> +    libxl_bitmap *map = opaque;
> +    unsigned int i;
> +    const libxl__json_object *cpu = NULL;
> +    int rc;
> +    GC_INIT(qmp->ctx);
> +
> +    libxl_bitmap_set_none(map);
> +    for (i = 0; (cpu = libxl__json_array_get(response, i)); i++) {
> +        unsigned int idx;
> +        const libxl__json_object *o;
> +
> +        o = libxl__json_map_get("CPU", cpu, JSON_INTEGER);
> +        if (!o) {
> +            LOG(ERROR, "Failed to retreive CPU index.");

rc is still uninitialised at this point.

Also, s/retreive/retrieve/.

> +            goto out;
> +        }
> +
> +        idx = libxl__json_object_get_integer(o);
> +        libxl_bitmap_set(map, idx);
> +    }
> +
> +    rc = 0;
> +out:
> +    GC_FREE;
> +    return rc;
> +}

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-06-13 16:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 14:28 [PATCH v2 0/3] libxl: libxl: update available vcpus map in retrieve configuration function Wei Liu
2016-06-08 14:28 ` [PATCH v2 1/3] libxl: introduce libxl__qmp_query_cpus Wei Liu
2016-06-09  0:12   ` Dario Faggioli
2016-06-13 16:52   ` Anthony PERARD [this message]
2016-06-13 18:17     ` Wei Liu
2016-06-08 14:28 ` [PATCH v2 2/3] libxl: update vcpus bitmap in retrieved guest config Wei Liu
2016-06-09  0:11   ` Dario Faggioli
2016-06-13 17:39   ` Anthony PERARD
2016-06-13 18:21     ` Wei Liu
2016-06-14 10:47       ` Anthony PERARD
2016-06-14 10:50         ` Wei Liu
2016-06-14 10:58           ` Anthony PERARD
2016-06-14 11:00             ` Wei Liu
2016-06-14 16:27               ` Ian Jackson
2016-06-14 13:20             ` Anthony PERARD
2016-06-08 14:28 ` [PATCH v2 3/3] libxl: only issue cpu-add call to QEMU for not present CPU Wei Liu
2016-06-08 15:01   ` Jan Beulich
2016-06-13 17:47   ` Anthony PERARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160613165214.GF5666@perard.uk.xensource.com \
    --to=anthony.perard@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [PATCH v2 1/3] libxl: introduce libxl__qmp_query_cpus' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).