[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] hw/block/xen: use proper format string for printing sectors



> -----Original Message-----
> From: Alex Bennée [mailto:alex.bennee@xxxxxxxxxx]
> Sent: 17 January 2019 08:21
> To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
> Cc: peter.maydell@xxxxxxxxxx; Kevin Wolf <kwolf@xxxxxxxxxx>; Stefano
> Stabellini <sstabellini@xxxxxxxxxx>; open list:Block layer core <qemu-
> block@xxxxxxxxxx>; qemu-devel@xxxxxxxxxx; Max Reitz <mreitz@xxxxxxxxxx>;
> Paul Durrant <Paul.Durrant@xxxxxxxxxx>; Anthony Perard
> <anthony.perard@xxxxxxxxxx>; open list:X86 <xen-
> devel@xxxxxxxxxxxxxxxxxxxx>
> Subject: Re: [Xen-devel] [PATCH] hw/block/xen: use proper format string
> for printing sectors
> 
> 
> Andrew Cooper <andrew.cooper3@xxxxxxxxxx> 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@xxxxxxxxxx>
> >> ---
> >>  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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.