All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Durrant <Paul.Durrant@citrix.com>
To: "'Alex Bennée'" <alex.bennee@linaro.org>,
	"Andrew Cooper" <Andrew.Cooper3@citrix.com>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	Kevin Wolf <kwolf@redhat.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	"open list:Block layer core" <qemu-block@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Max Reitz <mreitz@redhat.com>,
	Anthony Perard <anthony.perard@citrix.com>,
	"open list:X86" <xen-devel@lists.xenproject.org>
Subject: Re: [Qemu-devel] [Xen-devel] [PATCH] hw/block/xen: use proper format string for printing sectors
Date: Thu, 17 Jan 2019 09:02:26 +0000	[thread overview]
Message-ID: <7ca53707d96344d885bb91701b84b547@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <874la7zocp.fsf@linaro.org>

> -----Original Message-----
> From: Alex Bennée [mailto:alex.bennee@linaro.org]
> Sent: 17 January 2019 08:21
> To: Andrew Cooper <Andrew.Cooper3@citrix.com>
> Cc: peter.maydell@linaro.org; Kevin Wolf <kwolf@redhat.com>; Stefano
> Stabellini <sstabellini@kernel.org>; open list:Block layer core <qemu-
> block@nongnu.org>; qemu-devel@nongnu.org; Max Reitz <mreitz@redhat.com>;
> Paul Durrant <Paul.Durrant@citrix.com>; Anthony Perard
> <anthony.perard@citrix.com>; open list:X86 <xen-
> devel@lists.xenproject.org>
> Subject: Re: [Xen-devel] [PATCH] hw/block/xen: use proper format string
> for printing sectors
> 
> 
> Andrew Cooper <andrew.cooper3@citrix.com> writes:
> 
> > On 16/01/2019 12:13, Alex Bennée wrote:
> >> The %lu format string is different depending on the host architecture
> >> which causes builds like the debian-armhf-cross build to fail. Use the
> >> correct PRi64 format string.
> >>
> >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> >> ---
> >>  hw/block/xen-block.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
> >> index be28b63442..a636487b3e 100644
> >> --- a/hw/block/xen-block.c
> >> +++ b/hw/block/xen-block.c
> >> @@ -215,7 +215,7 @@ static void xen_block_realize(XenDevice *xendev,
> Error **errp)
> >>
> >>      xen_device_backend_printf(xendev, "sector-size", "%u",
> >>                                conf->logical_block_size);
> >> -    xen_device_backend_printf(xendev, "sectors", "%lu",
> >> +    xen_device_backend_printf(xendev, "sectors", "%"PRIi64,
> >
> > PRIu64.
> >
> > You've changed the signed-ness of what gets printed.
> 
> I was deliberate as:
>   int64_t blk_getlength(BlockBackend *blk);
> 
> although I have to admit a signed block length doesn't make much sense
> to me. At least it isn't going to overflow and will show-up if the block
> length is ever negative.

Yes, that's a much better failure mode than some weird huge number of sectors.

  Paul

> 
> >
> > ~Andrew
> 
> 
> --
> Alex Bennée

WARNING: multiple messages have this Message-ID (diff)
From: Paul Durrant <Paul.Durrant@citrix.com>
To: "'Alex Bennée'" <alex.bennee@linaro.org>,
	"Andrew Cooper" <Andrew.Cooper3@citrix.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	"peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	"open list:Block layer core" <qemu-block@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Max Reitz <mreitz@redhat.com>,
	Anthony Perard <anthony.perard@citrix.com>,
	"open list:X86" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] hw/block/xen: use proper format string for printing sectors
Date: Thu, 17 Jan 2019 09:02:26 +0000	[thread overview]
Message-ID: <7ca53707d96344d885bb91701b84b547@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <874la7zocp.fsf@linaro.org>

> -----Original Message-----
> From: Alex Bennée [mailto:alex.bennee@linaro.org]
> Sent: 17 January 2019 08:21
> To: Andrew Cooper <Andrew.Cooper3@citrix.com>
> Cc: peter.maydell@linaro.org; Kevin Wolf <kwolf@redhat.com>; Stefano
> Stabellini <sstabellini@kernel.org>; open list:Block layer core <qemu-
> block@nongnu.org>; qemu-devel@nongnu.org; Max Reitz <mreitz@redhat.com>;
> Paul Durrant <Paul.Durrant@citrix.com>; Anthony Perard
> <anthony.perard@citrix.com>; open list:X86 <xen-
> devel@lists.xenproject.org>
> Subject: Re: [Xen-devel] [PATCH] hw/block/xen: use proper format string
> for printing sectors
> 
> 
> Andrew Cooper <andrew.cooper3@citrix.com> writes:
> 
> > On 16/01/2019 12:13, Alex Bennée wrote:
> >> The %lu format string is different depending on the host architecture
> >> which causes builds like the debian-armhf-cross build to fail. Use the
> >> correct PRi64 format string.
> >>
> >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> >> ---
> >>  hw/block/xen-block.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
> >> index be28b63442..a636487b3e 100644
> >> --- a/hw/block/xen-block.c
> >> +++ b/hw/block/xen-block.c
> >> @@ -215,7 +215,7 @@ static void xen_block_realize(XenDevice *xendev,
> Error **errp)
> >>
> >>      xen_device_backend_printf(xendev, "sector-size", "%u",
> >>                                conf->logical_block_size);
> >> -    xen_device_backend_printf(xendev, "sectors", "%lu",
> >> +    xen_device_backend_printf(xendev, "sectors", "%"PRIi64,
> >
> > PRIu64.
> >
> > You've changed the signed-ness of what gets printed.
> 
> I was deliberate as:
>   int64_t blk_getlength(BlockBackend *blk);
> 
> although I have to admit a signed block length doesn't make much sense
> to me. At least it isn't going to overflow and will show-up if the block
> length is ever negative.

Yes, that's a much better failure mode than some weird huge number of sectors.

  Paul

> 
> >
> > ~Andrew
> 
> 
> --
> Alex Bennée
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-01-17  9:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 12:13 [Qemu-devel] [PATCH] hw/block/xen: use proper format string for printing sectors Alex Bennée
2019-01-16 12:19 ` Paul Durrant
2019-01-16 12:19   ` Paul Durrant
2019-01-16 13:04   ` [Qemu-devel] " Philippe Mathieu-Daudé
2019-01-16 13:04   ` Philippe Mathieu-Daudé
2019-01-16 18:03 ` [Qemu-devel] [Xen-devel] " Andrew Cooper
2019-01-16 18:03   ` Andrew Cooper
2019-01-17  8:21   ` Alex Bennée
2019-01-17  8:21   ` [Qemu-devel] [Xen-devel] " Alex Bennée
2019-01-17  9:02     ` Paul Durrant [this message]
2019-01-17  9:02       ` Paul Durrant
2019-01-21 17:19 ` [Qemu-devel] " Peter Maydell
2019-01-21 17:19   ` Peter Maydell

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=7ca53707d96344d885bb91701b84b547@AMSPEX02CL03.citrite.net \
    --to=paul.durrant@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=alex.bennee@linaro.org \
    --cc=anthony.perard@citrix.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --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.