From: Anthony PERARD <anthony.perard@citrix.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: xen-devel@lists.xen.org, "Juergen Gross" <jgross@suse.com>,
"Julien Grall" <julien@xen.org>,
osstest-admin@xenproject.org,
"Vincent Guittot" <vincent.guittot@linaro.org>,
stratos-dev@op-lists.linaro.org,
"Alex Bennée" <alex.bennee@linaro.org>,
"Stefano Stabellini" <stefano.stabellini@xilinx.com>,
"Mathieu Poirier" <mathieu.poirier@linaro.com>,
"Mike Holmes" <mike.holmes@linaro.org>,
"Oleksandr Tyshchenko" <olekstysh@gmail.com>,
"Wei Liu" <wl@xen.org>
Subject: Re: [PATCH] libxl: virtio: Fix build error for 32-bit platforms
Date: Thu, 15 Dec 2022 13:48:41 +0000 [thread overview]
Message-ID: <Y5slue6ujqmCscJd@perard.uk.xensource.com> (raw)
In-Reply-To: <d4cf6539ff179e7ade820feadd8088f33da49196.1671111056.git.viresh.kumar@linaro.org>
On Thu, Dec 15, 2022 at 07:01:40PM +0530, Viresh Kumar wrote:
> The field 'base' in 'struct libxl_device_virtio' is defined as uint64,
> while we are printing it with '%lu', which is 32bit only 32-bit
> platforms. And so generates a error like:
>
> libxl_internal.h:4388:51: error: format '%lu' expects argument of type 'long
> unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned
> int'} [-Werror=format=]
>
> Fix the same by using PRIx64 instead.
>
> Now that the base name is available in hexadecimal format, prefix it
> with '0x' as well, which strtoul() also depends upon since base passed
> is 0.
>
> Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device")
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> Couldn't test on 32-bit platforms yet, but works fine for 64 bit one.
>
> tools/libs/light/libxl_virtio.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/libs/light/libxl_virtio.c b/tools/libs/light/libxl_virtio.c
> index 6a38def2faf5..2217bda8a253 100644
> --- a/tools/libs/light/libxl_virtio.c
> +++ b/tools/libs/light/libxl_virtio.c
> @@ -45,12 +45,12 @@ static int libxl__set_xenstore_virtio(libxl__gc *gc, uint32_t domid,
> const char *transport = libxl_virtio_transport_to_string(virtio->transport);
>
> flexarray_append_pair(back, "irq", GCSPRINTF("%u", virtio->irq));
> - flexarray_append_pair(back, "base", GCSPRINTF("%lu", virtio->base));
> + flexarray_append_pair(back, "base", GCSPRINTF("0x%"PRIx64, virtio->base));
There is also PRIu64 that exist, which would be perfect to replace %u.
Could we use that instead?
I'd rather not have to think about which base is used for numbers in
xenstore. I can't find any hexadecimal numbers in xenstore for a simple
guest at the moment, so probably best to avoid adding one. And using
hexadecimal isn't needed to fix the build.
Thanks,
--
Anthony PERARD
next prev parent reply other threads:[~2022-12-15 13:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 1:41 [xen-unstable-smoke test] 175226: regressions - FAIL osstest service owner
2022-12-15 8:34 ` Julien Grall
2022-12-15 8:55 ` Michal Orzel
2022-12-15 13:31 ` [PATCH] libxl: virtio: Fix build error for 32-bit platforms Viresh Kumar
2022-12-15 13:48 ` Anthony PERARD [this message]
2022-12-15 15:11 ` Jan Beulich
2022-12-15 16:58 ` Andrew Cooper
2022-12-15 17:33 ` Anthony PERARD
2022-12-15 18:03 ` Andrew Cooper
2022-12-16 5:01 ` Viresh Kumar
2022-12-15 15:13 ` Jan Beulich
2022-12-15 19:01 ` Andrew Cooper
2022-12-15 13:33 ` [xen-unstable-smoke test] 175226: regressions - FAIL Viresh Kumar
2022-12-15 13:58 ` Anthony PERARD
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=Y5slue6ujqmCscJd@perard.uk.xensource.com \
--to=anthony.perard@citrix.com \
--cc=alex.bennee@linaro.org \
--cc=jgross@suse.com \
--cc=julien@xen.org \
--cc=mathieu.poirier@linaro.com \
--cc=mike.holmes@linaro.org \
--cc=olekstysh@gmail.com \
--cc=osstest-admin@xenproject.org \
--cc=stefano.stabellini@xilinx.com \
--cc=stratos-dev@op-lists.linaro.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xen.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.