From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: JBeulich@suse.com, mpohlack@amazon.de, andrew.cooper3@citrix.com,
ian.campbell@citrix.com, wei.liu2@citrix.com,
ian.jackson@eu.citrix.com, xen-devel@lists.xenproject.org,
dgdegra@tycho.nsa.gov
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH v2 3/3] libxl: info: Display build_id of the hypervisor.
Date: Fri, 6 Nov 2015 14:36:17 -0500 [thread overview]
Message-ID: <1446838577-7563-4-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1446838577-7563-1-git-send-email-konrad.wilk@oracle.com>
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/
---
tools/libxl/libxl.c | 24 ++++++++++++++++++++++++
tools/libxl/libxl.h | 5 +++++
tools/libxl/libxl_types.idl | 1 +
tools/libxl/xl_cmdimpl.c | 1 +
4 files changed, 31 insertions(+)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 854e957..f30f8c4 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -5251,6 +5251,7 @@ libxl_numainfo *libxl_get_numainfo(libxl_ctx *ctx, int *nr)
const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
{
+ GC_INIT(ctx);
union {
xen_extraversion_t xen_extra;
xen_compile_info_t xen_cc;
@@ -5258,8 +5259,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;
libxl_version_info *info = &ctx->version_info;
if (info->xen_version_extra != NULL)
@@ -5292,6 +5295,27 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
xc_version(ctx->xch, XENVER_commandline, &u.xen_commandline);
info->commandline = strdup(u.xen_commandline);
+ u.build_id.len = sizeof(u) - sizeof(u.build_id);
+ ret = xc_version(ctx->xch, XENVER_build_id, &u.build_id);
+ switch ( ret ) {
+ case -EPERM:
+ case -ENODATA:
+ case 0:
+ info->build_id = strdup("");
+ break;
+ 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", u.build_id.buf[i]);
+ } else
+ LOGEV(ERROR, ret, "getting build_id");
+ break;
+ }
+ GC_FREE;
return info;
}
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 168fedd..3e2ebd1 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -212,6 +212,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 4d78f86..5b57824 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -353,6 +353,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 03442e1..287a356 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5544,6 +5544,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
prev parent reply other threads:[~2015-11-06 19:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 19:36 [PATCH v2] Add build-id to XENVER hypercall Konrad Rzeszutek Wilk
2015-11-06 19:36 ` [PATCH v2 1/3] xsm/xen_version: Add XSM for the xen_version hypercall Konrad Rzeszutek Wilk
2015-11-10 12:29 ` Jan Beulich
2016-01-06 17:41 ` Konrad Rzeszutek Wilk
2016-01-07 7:35 ` Jan Beulich
2016-01-08 17:31 ` Konrad Rzeszutek Wilk
2016-01-11 9:02 ` Jan Beulich
2016-01-11 16:01 ` Konrad Rzeszutek Wilk
2016-01-11 16:17 ` Jan Beulich
2016-01-12 16:37 ` Konrad Rzeszutek Wilk
2016-01-12 16:42 ` Jan Beulich
2015-11-10 19:51 ` Daniel De Graaf
2015-11-16 19:02 ` Konrad Rzeszutek Wilk
2016-01-06 17:49 ` Konrad Rzeszutek Wilk
2015-11-06 19:36 ` [PATCH v2 2/3] XENVER_build_id: Provide ld-embedded build-ids Konrad Rzeszutek Wilk
2015-11-09 17:26 ` Ross Lagerwall
2015-11-10 16:49 ` Jan Beulich
2016-01-06 17:27 ` Konrad Rzeszutek Wilk
2016-01-07 7:42 ` Jan Beulich
2015-11-06 19:36 ` Konrad Rzeszutek Wilk [this message]
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=1446838577-7563-4-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=mpohlack@amazon.de \
--cc=wei.liu2@citrix.com \
--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 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).