hw/block/xen: use proper format string for printing sectors
PATCH 1/1 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.
--- hw/block/xen-block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/xen-block.c +1 -1
@@ -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);
Signature · 1 line
2.17.1
Quoted 13 lines
-----Original Message-----
From: Alex Bennée [mailto:[email protected]]
Sent: 16 January 2019 12:14
To: [email protected]
Cc: [email protected]; Alex Bennée <[email protected]>; Stefano Stabellini <[email protected]>; Anthony Perard <[email protected]>; Paul Durrant <[email protected]>; Kevin Wolf <[email protected]>; Max Reitz <[email protected]>; open list:X86 <[email protected]>; open list:Block layer core <qemu- [email protected]>
Subject: [PATCH] hw/block/xen: use proper format string for printing sectors
Quoted 5 lines
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 <[email protected]>
This does the same thing as "xen: Fix format string" from Philippe, but this variant is better...
Quoted 19 lines
--- hw/block/xen-block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/xen-block.c +1
-2@@ -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); --
Quoted 1 line
2.17.1
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Philippe Mathieu-Daudé
Reviewed-byQuoted 13 lines · Paul Durrant
Quoted 13 lines
-----Original Message-----
From: Alex Bennée [mailto:[email protected]]
Sent: 16 January 2019 12:14
To: [email protected]
Cc: [email protected]; Alex Bennée <[email protected]>; Stefano Stabellini <[email protected]>; Anthony Perard <[email protected]>; Paul Durrant <[email protected]>; Kevin Wolf <[email protected]>; Max Reitz <[email protected]>; open list:X86 <[email protected]>; open list:Block layer core <qemu- [email protected]>
Subject: [PATCH] hw/block/xen: use proper format string for printing sectors
Quoted 7 lines
Quoted 5 lines
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 <[email protected]>This does the same thing as "xen: Fix format string" from Philippe, but this variant is better...
OK.
Quoted 21 lines
Reviewed-by Paul Durrant <[email protected]>Quoted 18 lines
--- hw/block/xen-block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/xen-block.c +1
-1@@ -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);
Quoted 3 lines
Quoted 2 lines
--
2.17.1
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Philippe Mathieu-Daudé
Reviewed-byQuoted 13 lines · Paul Durrant
Quoted 13 lines
-----Original Message-----
From: Alex Bennée [mailto:[email protected]]
Sent: 16 January 2019 12:14
To: [email protected]
Cc: [email protected]; Alex Bennée <[email protected]>; Stefano Stabellini <[email protected]>; Anthony Perard <[email protected]>; Paul Durrant <[email protected]>; Kevin Wolf <[email protected]>; Max Reitz <[email protected]>; open list:X86 <[email protected]>; open list:Block layer core <qemu- [email protected]>
Subject: [PATCH] hw/block/xen: use proper format string for printing sectors
Quoted 7 lines
Quoted 5 lines
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 <[email protected]>This does the same thing as "xen: Fix format string" from Philippe, but this variant is better...
OK.
Quoted 24 lines
Reviewed-by Paul Durrant <[email protected]>Quoted 20 lines
--- hw/block/xen-block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/xen-block.c +1
-2@@ -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
Quoted 14 lines · Alex Bennée
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 <[email protected]>--- hw/block/xen-block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/xen-block.c +0
-0
hw/block/xen-block.c static void xen_block_realize(XenDevice *xendev, Error **errp) · line 218
Quoted 5 lines
hw/block/xen-block.c +1
-1@@ -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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 16 lines · Andrew Cooper
Quoted 15 lines · Alex Bennée
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 <[email protected]>--- hw/block/xen-block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/xen-block.c +0
-0@@ -215,7 +215,7 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
Quoted 8 lines
hw/block/xen-block.c static void xen_block_realize(XenDevice *xendev, Error **errp) · line 218
Quoted 4 lines
hw/block/xen-block.c +1
-1xen_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.
Quoted 2 lines
~Andrew
--
Alex Bennée
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 16 lines · Andrew Cooper
Quoted 15 lines · Alex Bennée
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 <[email protected]>--- hw/block/xen-block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/xen-block.c +0
-0@@ -215,7 +215,7 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
Quoted 8 lines
hw/block/xen-block.c static void xen_block_realize(XenDevice *xendev, Error **errp) · line 218
Quoted 4 lines
hw/block/xen-block.c +1
-1xen_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.
Quoted 2 lines
~Andrew
--
Alex Bennée
Quoted 40 lines
-----Original Message-----
From: Alex Bennée [mailto:[email protected]]
Sent: 17 January 2019 08:21
To: Andrew Cooper <[email protected]>
Cc: [email protected]; Kevin Wolf <[email protected]>; Stefano Stabellini <[email protected]>; open list:Block layer core <qemu- [email protected]>; [email protected]; Max Reitz <[email protected]>; Paul Durrant <[email protected]>; Anthony Perard <[email protected]>; open list:X86 <xen- [email protected]>
Subject: Re: [Xen-devel] [PATCH] hw/block/xen: use proper format string for printing sectorsQuoted 10 lines · Andrew Cooper
Quoted 9 lines · Alex Bennée
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 <[email protected]>--- hw/block/xen-block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 5 lines
hw/block/xen-block.c static void xen_block_realize(XenDevice *xendev,
Quoted 5 lines
hw/block/xen-block.c +0
-0@@ -215,7 +215,7 @@ static void xen_block_realize(XenDevice *xendev,Error **errp)
Quoted 8 lines
hw/block/xen-block.c static void xen_block_realize(XenDevice *xendev, Error **errp) · line 218
Quoted 5 lines
hw/block/xen-block.c +1
-1xen_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.
Quoted 8 lines
Quoted 1 line
You've changed the signed-ness of what gets printed.
I was deliberate as:
int64_tblk_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
Quoted 7 lines
Quoted 3 lines
~Andrew
--
Alex Bennée
Quoted 15 lines · Alex Bennée
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 <[email protected]>--- hw/block/xen-block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/xen-block.c +0
-0
hw/block/xen-block.c static void xen_block_realize(XenDevice *xendev, Error **errp) · line 221
Quoted 8 lines
hw/block/xen-block.c +1
-1@@ -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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel