All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	xen-devel@lists.xenproject.org, wei.liu2@citrix.com,
	ian.jackson@eu.citrix.com, jbeulich@suse.com,
	andrew.cooper3@citrix.com, mpohlack@amazon.de,
	dgdegra@tycho.nsa.gov
Subject: Re: [PATCH v1 4/4] libxl: info: Display build_id of the hypervisor.
Date: Fri, 9 Oct 2015 14:16:39 +0100	[thread overview]
Message-ID: <1444396599.1410.395.camel@citrix.com> (raw)
In-Reply-To: <1444359390-14153-5-git-send-email-konrad.wilk@oracle.com>

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.

  parent reply	other threads:[~2015-10-09 13:17 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09  2:56 [PATCH v1] Add build-id to XENVER hypercall Konrad Rzeszutek Wilk
2015-10-09  2:56 ` [PATCH v1 1/4] xsm/libxl/xen_version: Add XSM for some of the xen_version commands Konrad Rzeszutek Wilk
2015-10-09  9:31   ` Ian Campbell
2015-10-30 10:24     ` Martin Pohlack
2015-10-09 12:20   ` Andrew Cooper
2015-10-30 10:24   ` Martin Pohlack
2015-10-09  2:56 ` [PATCH v1 2/4] xen-version: Add third parameter (len) to the do_version hypercall Konrad Rzeszutek Wilk
2015-10-09  8:25   ` Jan Beulich
2015-10-09 12:29     ` Andrew Cooper
2015-10-09 12:46       ` Ian Campbell
2015-10-09 12:58         ` Andrew Cooper
2015-10-09 14:38         ` Jan Beulich
2015-10-09 14:48           ` Ian Campbell
2015-10-28 17:55           ` Konrad Rzeszutek Wilk
2015-10-28 18:34             ` Andrew Cooper
2015-10-28 18:58               ` Konrad Rzeszutek Wilk
2015-10-29  9:06               ` Jan Beulich
2015-10-09  2:56 ` [PATCH v1 3/4] XENVER_build_id: Provide ld-embedded build-ids Konrad Rzeszutek Wilk
2015-10-09  9:35   ` Ian Campbell
2015-10-09 11:40   ` Martin Pohlack
2015-10-09 12:47   ` Andrew Cooper
2015-10-09 15:18   ` Jan Beulich
2016-01-06 18:07     ` Konrad Rzeszutek Wilk
2015-10-09  2:56 ` [PATCH v1 4/4] libxl: info: Display build_id of the hypervisor Konrad Rzeszutek Wilk
2015-10-09  9:36   ` Ian Campbell
2015-10-09 12:59   ` Andrew Cooper
2015-10-09 13:06     ` Ian Campbell
2015-10-09 13:11       ` Andrew Cooper
2015-10-09 13:14       ` Ian Campbell
2015-10-09 13:16   ` Ian Campbell [this message]
2015-10-09  8:17 ` [PATCH v1] Add build-id to XENVER hypercall Jan Beulich
2015-10-09 12:15   ` Andrew Cooper
2015-10-09 13:25     ` Konrad Rzeszutek Wilk
2015-10-09 15:14       ` Jan Beulich
2015-10-28 15:42         ` Konrad Rzeszutek Wilk
2015-10-28 19:00           ` Konrad Rzeszutek Wilk
2015-10-29  8:55             ` Jan Beulich
2015-10-29 19:47               ` Konrad Rzeszutek Wilk
2015-10-30  8:11                 ` Jan Beulich
2015-10-09 14:32     ` Jan Beulich

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=1444396599.1410.395.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=konrad.wilk@oracle.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 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.