From: Wei Liu <wei.liu2@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
andrew.cooper3@citrix.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
xen-devel@lists.xen.org, mpohlack@amazon.de,
ross.lagerwall@citrix.com, jinsong.liu@alibaba-inc.com,
xen-devel@lists.xenproject.org, sasha.levin@citrix.com
Subject: Re: [PATCH v3 14/23] libxl: info: Display build_id of the hypervisor.
Date: Mon, 15 Feb 2016 12:45:30 +0000 [thread overview]
Message-ID: <20160215124530.GJ8818@citrix.com> (raw)
In-Reply-To: <1455300361-13092-15-git-send-email-konrad.wilk@oracle.com>
On Fri, Feb 12, 2016 at 01:05:52PM -0500, Konrad Rzeszutek Wilk wrote:
> If the hypervisor is built with we will display it.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> v2: Include HAVE_*, use libxl_zalloc, s/rc/ret/
> v3: Retry with different size if 1020 is not enough.
> ---
> tools/libxl/libxl.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> tools/libxl/libxl.h | 5 +++++
> tools/libxl/libxl_types.idl | 1 +
> tools/libxl/xl_cmdimpl.c | 1 +
> 4 files changed, 52 insertions(+)
>
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 2d18b8d..4efd8dd 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -5256,6 +5256,38 @@ libxl_numainfo *libxl_get_numainfo(libxl_ctx *ctx, int *nr)
> return ret;
> }
>
> +static const int libxl_get_build_id(libxl_ctx *ctx, libxl_version_info *info,
> + xen_build_id_t *build)
Is this supposed to be a public API? If not, please make it
libxl__get_build_id(libxl__gc *gc, ...)
.
Asking because it only gets used in libxl_get_version_info.
> +{
> + GC_INIT(ctx);
> + int ret;
> +
> + ret = xc_version(ctx->xch, XENVER_build_id, build);
> + switch ( ret ) {
> + case -EPERM:
> + case -ENODATA:
> + case 0:
> + info->build_id = libxl__strdup(NOGC, "");
> + break;
> + case -ENOBUFS:
> + GC_FREE;
> + return -ENOBUFS;
The error code should be libxl error ERROR_*.
> + default:
> + if (ret > 0) {
> + unsigned int i;
> +
> + info->build_id = libxl__zalloc(NOGC, (ret * 2) + 1);
> +
> + for (i = 0; i < ret ; i++)
> + snprintf(&info->build_id[i * 2], 3, "%02hhx", build->buf[i]);
> + } else
> + LOGEV(ERROR, ret, "getting build_id");
> + break;
> + }
> + GC_FREE;
> + return 0;
Please use goto out style error handling.
See CODING_STYLE and existing functions for reference.
> +}
> +
> const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
> {
> GC_INIT(ctx);
> @@ -5266,8 +5298,10 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
> xen_capabilities_info_t xen_caps;
> xen_platform_parameters_t p_parms;
> xen_commandline_t xen_commandline;
> + xen_build_id_t build_id;
> } u;
> long xen_version;
> + int ret;
Normally this is called rc. See CODING_STYLE.
> libxl_version_info *info = &ctx->version_info;
>
> if (info->xen_version_extra != NULL)
> @@ -5300,6 +5334,17 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
> xc_version(ctx->xch, XENVER_commandline, &u.xen_commandline);
> info->commandline = libxl__strdup(NOGC, u.xen_commandline);
>
> + u.build_id.len = sizeof(u) - sizeof(u.build_id);
> + ret = libxl_get_build_id(ctx, info, &u.build_id);
> + if ( ret == -ENOBUFS ) {
No space in after "(" and before ")".
> + xen_build_id_t *build_id;
> +
> + build_id = libxl__zalloc(gc, info->pagesize);
> + build_id->len = info->pagesize - sizeof(*build_id);
> + ret = libxl_get_build_id(ctx, info, build_id);
> + if ( ret )
> + LOGEV(ERROR, ret, "getting build_id");
> + }
> out:
> GC_FREE;
> return info;
> diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
> index fa87f53..b713407 100644
> --- a/tools/libxl/libxl.h
> +++ b/tools/libxl/libxl.h
> @@ -218,6 +218,11 @@
> #define LIBXL_HAVE_SOFT_RESET 1
>
> /*
> + * LIBXL_HAVE_BUILD_ID means that libxl_version_info has the extra
> + * field for the hypervisor build_id.
> + */
> +#define LIBXL_HAVE_BUILD_ID 1
> +/*
> * libxl ABI compatibility
> *
> * The only guarantee which libxl makes regarding ABI compatibility
> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> index 9ad7eba..92bf620 100644
> --- a/tools/libxl/libxl_types.idl
> +++ b/tools/libxl/libxl_types.idl
> @@ -356,6 +356,7 @@ libxl_version_info = Struct("version_info", [
> ("virt_start", uint64),
> ("pagesize", integer),
> ("commandline", string),
> + ("build_id", string),
> ], dir=DIR_OUT)
>
> libxl_domain_create_info = Struct("domain_create_info",[
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index d07ccb2..9bdc42a 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -5552,6 +5552,7 @@ static void output_xeninfo(void)
> printf("cc_compile_by : %s\n", info->compile_by);
> printf("cc_compile_domain : %s\n", info->compile_domain);
> printf("cc_compile_date : %s\n", info->compile_date);
> + printf("build_id : %s\n", info->build_id);
>
> return;
> }
> --
> 2.1.0
>
next prev parent reply other threads:[~2016-02-15 12:45 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-12 18:05 [PATCH v3] xSplice v1 implementation and design Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 01/23] xen/xsplice: Hypervisor implementation of XEN_XSPLICE_op (v10) Konrad Rzeszutek Wilk
2016-02-12 20:11 ` Andrew Cooper
2016-02-12 20:40 ` Konrad Rzeszutek Wilk
2016-02-12 20:53 ` Andrew Cooper
2016-02-15 8:16 ` Jan Beulich
2016-02-19 19:36 ` Konrad Rzeszutek Wilk
2016-02-19 19:43 ` Andrew Cooper
2016-02-12 18:05 ` [PATCH v3 02/23] libxc: Implementation of XEN_XSPLICE_op in libxc (v5) Konrad Rzeszutek Wilk
2016-02-15 12:35 ` Wei Liu
2016-02-19 20:04 ` Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 03/23] xen-xsplice: Tool to manipulate xsplice payloads (v4) Konrad Rzeszutek Wilk
2016-02-15 12:59 ` Wei Liu
2016-02-19 20:46 ` Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 04/23] elf: Add relocation types to elfstructs.h Konrad Rzeszutek Wilk
2016-02-12 20:13 ` Andrew Cooper
2016-02-15 8:34 ` Jan Beulich
2016-02-19 21:05 ` Konrad Rzeszutek Wilk
2016-02-22 10:17 ` Jan Beulich
2016-02-22 15:19 ` Ross Lagerwall
2016-02-12 18:05 ` [PATCH v3 05/23] xsplice: Add helper elf routines (v4) Konrad Rzeszutek Wilk
2016-02-12 20:24 ` Andrew Cooper
2016-02-12 20:47 ` Konrad Rzeszutek Wilk
2016-02-12 20:52 ` Andrew Cooper
2016-02-12 18:05 ` [PATCH v3 06/23] xsplice: Implement payload loading (v4) Konrad Rzeszutek Wilk
2016-02-12 20:48 ` Andrew Cooper
2016-02-19 22:03 ` Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 07/23] xsplice: Implement support for applying/reverting/replacing patches. (v5) Konrad Rzeszutek Wilk
2016-02-16 19:11 ` Andrew Cooper
2016-02-17 8:58 ` Ross Lagerwall
2016-02-17 10:50 ` Jan Beulich
2016-02-19 9:30 ` Ross Lagerwall
2016-02-23 20:41 ` Konrad Rzeszutek Wilk
2016-02-23 20:53 ` Konrad Rzeszutek Wilk
2016-02-23 20:57 ` Konrad Rzeszutek Wilk
2016-02-23 21:10 ` Andrew Cooper
2016-02-24 9:31 ` Jan Beulich
2016-02-22 15:00 ` Ross Lagerwall
2016-02-22 17:06 ` Ross Lagerwall
2016-02-23 20:47 ` Konrad Rzeszutek Wilk
2016-02-23 20:43 ` Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 08/23] x86/xen_hello_world.xsplice: Test payload for patching 'xen_extra_version'. (v2) Konrad Rzeszutek Wilk
2016-02-16 11:31 ` Ross Lagerwall
2016-02-12 18:05 ` [PATCH v3 09/23] xsplice: Add support for bug frames. (v4) Konrad Rzeszutek Wilk
2016-02-16 19:35 ` Andrew Cooper
2016-02-24 16:22 ` Konrad Rzeszutek Wilk
2016-02-24 16:30 ` Andrew Cooper
2016-02-24 16:26 ` Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 10/23] xsplice: Add support for exception tables. (v2) Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 11/23] xsplice: Add support for alternatives Konrad Rzeszutek Wilk
2016-02-16 19:41 ` Andrew Cooper
2016-02-12 18:05 ` [PATCH v3 12/23] xsm/xen_version: Add XSM for the xen_version hypercall (v8) Konrad Rzeszutek Wilk
2016-02-12 21:52 ` Daniel De Graaf
2016-02-12 18:05 ` [PATCH v3 13/23] XENVER_build_id: Provide ld-embedded build-ids (v10) Konrad Rzeszutek Wilk
2016-02-12 21:52 ` Daniel De Graaf
2016-02-16 20:09 ` Andrew Cooper
2016-02-16 20:22 ` Konrad Rzeszutek Wilk
2016-02-16 20:26 ` Andrew Cooper
2016-02-16 20:40 ` Konrad Rzeszutek Wilk
2016-02-24 18:52 ` Konrad Rzeszutek Wilk
2016-02-24 19:13 ` Andrew Cooper
2016-02-24 20:54 ` Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 14/23] libxl: info: Display build_id of the hypervisor Konrad Rzeszutek Wilk
2016-02-15 12:45 ` Wei Liu [this message]
2016-02-12 18:05 ` [PATCH v3 15/23] xsplice: Print build_id in keyhandler Konrad Rzeszutek Wilk
2016-02-16 20:13 ` Andrew Cooper
2016-02-12 18:05 ` [PATCH v3 16/23] xsplice: basic build-id dependency checking Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 17/23] xsplice: Print dependency and payloads build_id in the keyhandler Konrad Rzeszutek Wilk
2016-02-16 20:20 ` Andrew Cooper
2016-02-17 11:10 ` Jan Beulich
2016-02-24 21:54 ` Konrad Rzeszutek Wilk
2016-02-25 8:47 ` Jan Beulich
2016-02-12 18:05 ` [PATCH v3 18/23] xsplice: Prevent duplicate payloads to be loaded Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 19/23] xsplice, symbols: Implement symbol name resolution on address. (v2) Konrad Rzeszutek Wilk
2016-02-22 14:57 ` Ross Lagerwall
2016-02-12 18:05 ` [PATCH v3 20/23] x86, xsplice: Print payload's symbol name and module in backtraces Konrad Rzeszutek Wilk
2016-02-12 18:05 ` [PATCH v3 21/23] xsplice: Add support for shadow variables Konrad Rzeszutek Wilk
2016-03-07 7:40 ` Martin Pohlack
2016-03-15 18:02 ` Konrad Rzeszutek Wilk
2016-03-07 18:52 ` Martin Pohlack
2016-02-12 18:06 ` [PATCH v3 22/23] xsplice: Add hooks functions and other macros Konrad Rzeszutek Wilk
2016-02-12 18:06 ` [PATCH v3 23/23] xsplice, hello_world: Use the XSPLICE_[UN|]LOAD_HOOK hooks for two functions Konrad Rzeszutek Wilk
2016-02-12 21:57 ` [PATCH v3] xSplice v1 implementation and design Konrad Rzeszutek Wilk
2016-02-12 21:57 ` [PATCH v3 MISSING/23] xsplice: Design document (v7) Konrad Rzeszutek Wilk
2016-02-18 16:20 ` Jan Beulich
2016-02-19 18:36 ` Konrad Rzeszutek Wilk
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=20160215124530.GJ8818@citrix.com \
--to=wei.liu2@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jinsong.liu@alibaba-inc.com \
--cc=konrad.wilk@oracle.com \
--cc=mpohlack@amazon.de \
--cc=ross.lagerwall@citrix.com \
--cc=sasha.levin@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
--cc=xen-devel@lists.xenproject.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.