[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxl: info: Display build_id of the hypervisor.
commit 83f79477b4b14ce7ba21272c2ffd647e1d59f243 Author: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> AuthorDate: Thu Jan 14 21:38:24 2016 -0500 Commit: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> CommitDate: Fri Apr 29 03:59:20 2016 -0400 libxl: info: Display build_id of the hypervisor. If the hypervisor is built with we will display it. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl.h | 6 ++++++ 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 eec899d..c39d745 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -5353,6 +5353,38 @@ libxl_numainfo *libxl_get_numainfo(libxl_ctx *ctx, int *nr) return ret; } +static const int libxl__xc_version_wrap(libxl__gc *gc, libxl_version_info *info, + xen_build_id_t *build) +{ + int r; + + r = xc_version(CTX->xch, XENVER_build_id, build); + switch (r) { + case -EPERM: + case -ENODATA: + case 0: + info->build_id = libxl__strdup(NOGC, ""); + break; + + case -ENOBUFS: + break; + + default: + if (r > 0) { + unsigned int i; + + info->build_id = libxl__zalloc(NOGC, (r * 2) + 1); + + for (i = 0; i < r ; i++) + snprintf(&info->build_id[i * 2], 3, "%02hhx", build->buf[i]); + + r = 0; + } + break; + } + return r; +} + const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx) { GC_INIT(ctx); @@ -5363,8 +5395,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 r; libxl_version_info *info = &ctx->version_info; if (info->xen_version_extra != NULL) @@ -5397,6 +5431,16 @@ 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); + r = libxl__xc_version_wrap(gc, info, &u.build_id); + if (r == -ENOBUFS) { + xen_build_id_t *build_id; + + build_id = libxl__zalloc(gc, info->pagesize); + build_id->len = info->pagesize - sizeof(*build_id); + r = libxl__xc_version_wrap(gc, info, build_id); + if (r) LOGEV(ERROR, r, "getting build_id"); + } out: GC_FREE; return info; diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 8ff5f31..2c0f868 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -247,6 +247,12 @@ #define LIBXL_HAVE_APIC_ASSIST 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 c3161f3..9840f3b 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -365,6 +365,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 dfb1b01..03ab644 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -5923,6 +5923,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; } -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |