|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v1 4/4] libxl: info: Display build_id of the hypervisor.
On Thu, 2015-10-08 at 22:56 -0400, Konrad Rzeszutek Wilk wrote:
> If the hypervisor is built with we will display it.
I think there is a word missing in this sentence. Perhaps "it" after
"with", or better "a build_id" or "blah blah feature enabled".
> @@ -5295,8 +5298,21 @@ 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);
>
> + rc = xc_version_len(ctx->xch, XENVER_build_id, &u.build_id,
> BUILD_ID_LEN);
Please see tools/libxl/CODING_STYLE. A variable called rc must only ever
contain libxl error codes (ERROR_*), which xc_version_len does not return.
"r" or "ret" is appropriate for the return value from a system call or
xc_*.
> + if (rc > 0) {
Do you intentionally silently ignore a failure here? I think at the very
least you should LOG all but the ones which are expected and which you have
deemed tolerable.
> + unsigned int i;
> +
> + info->build_id = (char *)malloc((rc * 2) + 1);
Lack of an error check here, but in any case libxl__zalloc(NOGC, ...)
instead, so it isn't needed anyway.
> +
> + for (i = 0; i < rc && (i + 1) * 2 < BUILD_ID_LEN; i++)
> + snprintf(&info->build_id[i * 2], 3, "%02hhx",
> u.build_id[i]);
> +
> + info->build_id[i*2]='\0';
You can drop after switching to libxl__zalloc, since the buffer starts out
zeroed.
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> index d6ef9a2..232749b 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),
A #define LIBXL_HAVE_* in libxl.h is required to signal the presence of
this new field.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |