All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: stefano.stabellini@eu.citrix.com, ian.jackson@eu.ctrix.com,
	xen-devel@lists.xen.org
Subject: Re: [PATCH v2 1/5] libxl: introduce libxl__device_model_xs_path
Date: Thu, 19 Mar 2015 17:01:13 +0000	[thread overview]
Message-ID: <1426784473.21742.81.camel@citrix.com> (raw)
In-Reply-To: <1426771086-9026-2-git-send-email-wei.liu2@citrix.com>

On Thu, 2015-03-19 at 13:18 +0000, Wei Liu wrote:
> Introduce this helper to return xenstore path for device model to avoid
> handcoded paths.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
>  tools/libxl/libxl_internal.c | 22 ++++++++++++++++++++++
>  tools/libxl/libxl_internal.h |  3 +++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
> index ddc68ab..8877288 100644
> --- a/tools/libxl/libxl_internal.c
> +++ b/tools/libxl/libxl_internal.c
> @@ -555,6 +555,28 @@ void libxl__update_domain_configuration(libxl__gc *gc,
>      dst->b_info.video_memkb = src->b_info.video_memkb;
>  }
>  
> +char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
> +                                  uint32_t domid, const char *format,  ...)
> +{
> +    char *s, *fmt;
> +    va_list ap;
> +    int ret;
> +
> +    fmt = GCSPRINTF("/local/domain/%u/device-model/%u%s", dm_domid,
> +                    domid, format);
> +
> +    va_start(ap, format);
> +    ret = vsnprintf(NULL, 0, fmt, ap);
> +    va_end(ap);
> +
> +    s = libxl__zalloc(gc, ret + 1);
> +    va_start(ap, format);
> +    ret = vsnprintf(s, ret + 1, fmt, ap);
> +    va_end(ap);

Please could you refactor the existing libxl__sprintf into a
libxl__vsprintf (i.e. which takes a va_list, and uses va_copy for the
two calls to vsnprintf). Then implement your new helper in terms of the
libxl__vsprintf.

> +
> +    return s;
> +}
> +
>  /*
>   * Local variables:
>   * mode: C
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 934465a..9ef2ec6 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -1794,6 +1794,9 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s);
>  _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid);
>    /* Return the system-wide default device model */
>  _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc);
> +_hidden char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
> +                                          uint32_t domid,
> +                                          const char *format,  ...);
>  
>  /* Check how executes hotplug script currently */
>  int libxl__hotplug_settings(libxl__gc *gc, xs_transaction_t t);

  reply	other threads:[~2015-03-19 17:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 13:18 [PATCH v2 0/5] Fix QEMU startup protocol Wei Liu
2015-03-19 13:18 ` [PATCH v2 1/5] libxl: introduce libxl__device_model_xs_path Wei Liu
2015-03-19 17:01   ` Ian Campbell [this message]
2015-03-19 13:18 ` [PATCH v2 2/5] libxl: remove device model path in libxl__device_model_destroy Wei Liu
2015-03-19 17:02   ` Ian Campbell
2015-03-19 13:18 ` [PATCH v2 3/5] libxl: use LIBXL_TOOLSTACK_DOMID Wei Liu
2015-03-19 17:03   ` Ian Campbell
2015-03-19 13:18 ` [PATCH v2 4/5] libxl: use new QEMU xenstore protocol Wei Liu
2015-03-19 17:06   ` Ian Campbell
2015-03-19 13:18 ` [PATCH v2 5/5] Revert "x86/hvm: wait for at least one ioreq server to be enabled" Wei Liu
2015-03-19 17:07   ` Ian Campbell

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=1426784473.21742.81.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.ctrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.