* [Qemu-devel] [PATCH] hw/block/xen: use proper format string for printing sectors
@ 2019-01-16 12:13 Alex Bennée
2019-01-16 12:19 ` Paul Durrant
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Alex Bennée @ 2019-01-16 12:13 UTC (permalink / raw)
To: peter.maydell
Cc: qemu-devel, Alex Bennée, Stefano Stabellini, Anthony Perard,
Paul Durrant, Kevin Wolf, Max Reitz, open list:X86,
open list:Block layer core
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,
blk_getlength(conf->blk) /
conf->logical_block_size);
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/block/xen: use proper format string for printing sectors
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 18:03 ` Andrew Cooper
2019-01-21 17:19 ` Peter Maydell
2 siblings, 0 replies; 13+ messages in thread
From: Paul Durrant @ 2019-01-16 12:19 UTC (permalink / raw)
To: 'Alex Bennée', peter.maydell
Cc: qemu-devel, Stefano Stabellini, Anthony Perard, Kevin Wolf,
Max Reitz, open list:X86, open list:Block layer core,
'Philippe Mathieu-Daudé'
> -----Original Message-----
> From: Alex Bennée [mailto:alex.bennee@linaro.org]
> Sent: 16 January 2019 12:14
> To: peter.maydell@linaro.org
> Cc: qemu-devel@nongnu.org; Alex Bennée <alex.bennee@linaro.org>; Stefano
> Stabellini <sstabellini@kernel.org>; Anthony Perard
> <anthony.perard@citrix.com>; Paul Durrant <Paul.Durrant@citrix.com>; Kevin
> Wolf <kwolf@redhat.com>; Max Reitz <mreitz@redhat.com>; open list:X86
> <xen-devel@lists.xenproject.org>; open list:Block layer core <qemu-
> block@nongnu.org>
> Subject: [PATCH] hw/block/xen: use proper format string for printing
> sectors
>
> 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>
This does the same thing as "xen: Fix format string" from Philippe, but this variant is better...
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> ---
> 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,
> blk_getlength(conf->blk) /
> conf->logical_block_size);
>
> --
> 2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] hw/block/xen: use proper format string for printing sectors
@ 2019-01-16 12:19 ` Paul Durrant
0 siblings, 0 replies; 13+ messages in thread
From: Paul Durrant @ 2019-01-16 12:19 UTC (permalink / raw)
To: 'Alex Bennée', peter.maydell
Cc: Kevin Wolf, Stefano Stabellini, open list:Block layer core,
qemu-devel, Max Reitz, Anthony Perard, open list:X86,
'Philippe Mathieu-Daudé'
> -----Original Message-----
> From: Alex Bennée [mailto:alex.bennee@linaro.org]
> Sent: 16 January 2019 12:14
> To: peter.maydell@linaro.org
> Cc: qemu-devel@nongnu.org; Alex Bennée <alex.bennee@linaro.org>; Stefano
> Stabellini <sstabellini@kernel.org>; Anthony Perard
> <anthony.perard@citrix.com>; Paul Durrant <Paul.Durrant@citrix.com>; Kevin
> Wolf <kwolf@redhat.com>; Max Reitz <mreitz@redhat.com>; open list:X86
> <xen-devel@lists.xenproject.org>; open list:Block layer core <qemu-
> block@nongnu.org>
> Subject: [PATCH] hw/block/xen: use proper format string for printing
> sectors
>
> 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>
This does the same thing as "xen: Fix format string" from Philippe, but this variant is better...
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> ---
> 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,
> blk_getlength(conf->blk) /
> conf->logical_block_size);
>
> --
> 2.17.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/block/xen: use proper format string for printing sectors
2019-01-16 12:19 ` Paul Durrant
(?)
@ 2019-01-16 13:04 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-16 13:04 UTC (permalink / raw)
To: Paul Durrant, 'Alex Bennée', peter.maydell
Cc: qemu-devel, Stefano Stabellini, Anthony Perard, Kevin Wolf,
Max Reitz, open list:X86, open list:Block layer core
On 1/16/19 1:19 PM, Paul Durrant wrote:
>> -----Original Message-----
>> From: Alex Bennée [mailto:alex.bennee@linaro.org]
>> Sent: 16 January 2019 12:14
>> To: peter.maydell@linaro.org
>> Cc: qemu-devel@nongnu.org; Alex Bennée <alex.bennee@linaro.org>; Stefano
>> Stabellini <sstabellini@kernel.org>; Anthony Perard
>> <anthony.perard@citrix.com>; Paul Durrant <Paul.Durrant@citrix.com>; Kevin
>> Wolf <kwolf@redhat.com>; Max Reitz <mreitz@redhat.com>; open list:X86
>> <xen-devel@lists.xenproject.org>; open list:Block layer core <qemu-
>> block@nongnu.org>
>> Subject: [PATCH] hw/block/xen: use proper format string for printing
>> sectors
>>
>> 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>
>
> This does the same thing as "xen: Fix format string" from Philippe, but this variant is better...
OK.
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
>
>> ---
>> 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,
>> blk_getlength(conf->blk) /
>> conf->logical_block_size);
>>
>> --
>> 2.17.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] hw/block/xen: use proper format string for printing sectors
2019-01-16 12:19 ` Paul Durrant
(?)
(?)
@ 2019-01-16 13:04 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-16 13:04 UTC (permalink / raw)
To: Paul Durrant, 'Alex Bennée', peter.maydell
Cc: Kevin Wolf, Stefano Stabellini, open list:Block layer core,
qemu-devel, Max Reitz, Anthony Perard, open list:X86
On 1/16/19 1:19 PM, Paul Durrant wrote:
>> -----Original Message-----
>> From: Alex Bennée [mailto:alex.bennee@linaro.org]
>> Sent: 16 January 2019 12:14
>> To: peter.maydell@linaro.org
>> Cc: qemu-devel@nongnu.org; Alex Bennée <alex.bennee@linaro.org>; Stefano
>> Stabellini <sstabellini@kernel.org>; Anthony Perard
>> <anthony.perard@citrix.com>; Paul Durrant <Paul.Durrant@citrix.com>; Kevin
>> Wolf <kwolf@redhat.com>; Max Reitz <mreitz@redhat.com>; open list:X86
>> <xen-devel@lists.xenproject.org>; open list:Block layer core <qemu-
>> block@nongnu.org>
>> Subject: [PATCH] hw/block/xen: use proper format string for printing
>> sectors
>>
>> 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>
>
> This does the same thing as "xen: Fix format string" from Philippe, but this variant is better...
OK.
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
>
>> ---
>> 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,
>> blk_getlength(conf->blk) /
>> conf->logical_block_size);
>>
>> --
>> 2.17.1
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [Xen-devel] [PATCH] hw/block/xen: use proper format string for printing sectors
2019-01-16 12:13 [Qemu-devel] [PATCH] hw/block/xen: use proper format string for printing sectors Alex Bennée
@ 2019-01-16 18:03 ` Andrew Cooper
2019-01-16 18:03 ` Andrew Cooper
2019-01-21 17:19 ` Peter Maydell
2 siblings, 0 replies; 13+ messages in thread
From: Andrew Cooper @ 2019-01-16 18:03 UTC (permalink / raw)
To: Alex Bennée, peter.maydell
Cc: Kevin Wolf, Stefano Stabellini, open list:Block layer core,
qemu-devel, Max Reitz, Paul Durrant, Anthony Perard,
open list:X86
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.
~Andrew
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] hw/block/xen: use proper format string for printing sectors
@ 2019-01-16 18:03 ` Andrew Cooper
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Cooper @ 2019-01-16 18:03 UTC (permalink / raw)
To: Alex Bennée, peter.maydell
Cc: Kevin Wolf, Stefano Stabellini, open list:Block layer core,
qemu-devel, Max Reitz, Paul Durrant, Anthony Perard,
open list:X86
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.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [Xen-devel] [PATCH] hw/block/xen: use proper format string for printing sectors
2019-01-16 18:03 ` Andrew Cooper
(?)
(?)
@ 2019-01-17 8:21 ` Alex Bennée
2019-01-17 9:02 ` Paul Durrant
-1 siblings, 1 reply; 13+ messages in thread
From: Alex Bennée @ 2019-01-17 8:21 UTC (permalink / raw)
To: Andrew Cooper
Cc: peter.maydell, Kevin Wolf, Stefano Stabellini,
open list:Block layer core, qemu-devel, Max Reitz, Paul Durrant,
Anthony Perard, open list:X86
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.
>
> ~Andrew
--
Alex Bennée
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] hw/block/xen: use proper format string for printing sectors
2019-01-16 18:03 ` Andrew Cooper
(?)
@ 2019-01-17 8:21 ` Alex Bennée
-1 siblings, 0 replies; 13+ messages in thread
From: Alex Bennée @ 2019-01-17 8:21 UTC (permalink / raw)
To: Andrew Cooper
Cc: Kevin Wolf, peter.maydell, Stefano Stabellini,
open list:Block layer core, qemu-devel, Max Reitz, Paul Durrant,
Anthony Perard, open list:X86
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.
>
> ~Andrew
--
Alex Bennée
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [Xen-devel] [PATCH] hw/block/xen: use proper format string for printing sectors
2019-01-17 8:21 ` [Qemu-devel] [Xen-devel] " Alex Bennée
@ 2019-01-17 9:02 ` Paul Durrant
0 siblings, 0 replies; 13+ messages in thread
From: Paul Durrant @ 2019-01-17 9:02 UTC (permalink / raw)
To: 'Alex Bennée', Andrew Cooper
Cc: peter.maydell, Kevin Wolf, Stefano Stabellini,
open list:Block layer core, qemu-devel, Max Reitz,
Anthony Perard, open list:X86
> -----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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] hw/block/xen: use proper format string for printing sectors
@ 2019-01-17 9:02 ` Paul Durrant
0 siblings, 0 replies; 13+ messages in thread
From: Paul Durrant @ 2019-01-17 9:02 UTC (permalink / raw)
To: 'Alex Bennée', Andrew Cooper
Cc: Kevin Wolf, peter.maydell, Stefano Stabellini,
open list:Block layer core, qemu-devel, Max Reitz,
Anthony Perard, open list:X86
> -----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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/block/xen: use proper format string for printing sectors
2019-01-16 12:13 [Qemu-devel] [PATCH] hw/block/xen: use proper format string for printing sectors Alex Bennée
@ 2019-01-21 17:19 ` Peter Maydell
2019-01-16 18:03 ` Andrew Cooper
2019-01-21 17:19 ` Peter Maydell
2 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2019-01-21 17:19 UTC (permalink / raw)
To: Alex Bennée
Cc: QEMU Developers, Stefano Stabellini, Anthony Perard,
Paul Durrant, Kevin Wolf, Max Reitz, open list:X86,
open list:Block layer core
On Wed, 16 Jan 2019 at 12:13, Alex Bennée <alex.bennee@linaro.org> 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,
> blk_getlength(conf->blk) /
> conf->logical_block_size);
>
Applied to master as a build fix, thanks.
-- PMM
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] hw/block/xen: use proper format string for printing sectors
@ 2019-01-21 17:19 ` Peter Maydell
0 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2019-01-21 17:19 UTC (permalink / raw)
To: Alex Bennée
Cc: Kevin Wolf, Stefano Stabellini, open list:Block layer core,
QEMU Developers, Max Reitz, Paul Durrant, Anthony Perard,
open list:X86
On Wed, 16 Jan 2019 at 12:13, Alex Bennée <alex.bennee@linaro.org> 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,
> blk_getlength(conf->blk) /
> conf->logical_block_size);
>
Applied to master as a build fix, thanks.
-- PMM
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-01-21 17:19 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-01-17 9:02 ` Paul Durrant
2019-01-21 17:19 ` [Qemu-devel] " Peter Maydell
2019-01-21 17:19 ` Peter Maydell
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.