Message ID | AANLkTilSuir7Sd-ee_HCvsViF9xrHgcohL0cVV1gZLak@mail.gmail.com |
---|---|
State | New |
Headers | show |
Am 14.06.2010 20:55, schrieb Blue Swirl: > Fix a warning from OpenBSD gcc (3.3.5 (propolice)): > /src/qemu/block.c: In function `bdrv_info_stats_bs': > /src/qemu/block.c:1548: warning: long long int format, long unsigned > int arg (arg 6) > > There may be also truncation effects. > > Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Thanks, applied to the block branch. But why is this even needed? wr_highest_sector is already uint64_t, so wouldn't you expect the result to be uint64_t, too? Kevin
Kevin Wolf <kwolf@redhat.com> writes: > Am 14.06.2010 20:55, schrieb Blue Swirl: >> Fix a warning from OpenBSD gcc (3.3.5 (propolice)): >> /src/qemu/block.c: In function `bdrv_info_stats_bs': >> /src/qemu/block.c:1548: warning: long long int format, long unsigned >> int arg (arg 6) >> >> There may be also truncation effects. >> >> Signed-off-by: Blue Swirl <blauwirbel@gmail.com> > > Thanks, applied to the block branch. > > But why is this even needed? wr_highest_sector is already uint64_t, so > wouldn't you expect the result to be uint64_t, too? Makes me wonder. To what's uint64_t typedef'ed on this machine? And to what does PRId64 expand?
Am 14.06.2010 um 20:55 schrieb Blue Swirl <blauwirbel@gmail.com>: > Fix a warning from OpenBSD gcc (3.3.5 (propolice)): > /src/qemu/block.c: In function `bdrv_info_stats_bs': > /src/qemu/block.c:1548: warning: long long int format, long unsigned > int arg (arg 6) > > There may be also truncation effects. > > Signed-off-by: Blue Swirl <blauwirbel@gmail.com> > --- > Alternatively 'ULL' prefix could be appended to BDRV_SECTOR_SIZE > definition but that may have other side effects. ... Which are probably wanted. If there are more truncations, we want to catch them early, no? Alex >
Am 15.06.2010 11:52, schrieb Alexander Graf: > > Am 14.06.2010 um 20:55 schrieb Blue Swirl <blauwirbel@gmail.com>: > >> Fix a warning from OpenBSD gcc (3.3.5 (propolice)): >> /src/qemu/block.c: In function `bdrv_info_stats_bs': >> /src/qemu/block.c:1548: warning: long long int format, long unsigned >> int arg (arg 6) >> >> There may be also truncation effects. >> >> Signed-off-by: Blue Swirl <blauwirbel@gmail.com> >> --- >> Alternatively 'ULL' prefix could be appended to BDRV_SECTOR_SIZE >> definition but that may have other side effects. > > ... Which are probably wanted. If there are more truncations, we want > to catch them early, no? Actually, it's there: #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS) That compiler warning doesn't make any sense to me. Kevin
diff --git a/block.c b/block.c index cacf11b..a7ab0b4 100644 --- a/block.c +++ b/block.c @@ -1545,7 +1545,8 @@ static QObject* bdrv_info_stats_bs(BlockDriverState *bs) "} }", bs->rd_bytes, bs->wr_bytes, bs->rd_ops, bs->wr_ops, - bs->wr_highest_sector * (long)BDRV_SECTOR_SIZE); + bs->wr_highest_sector * + (uint64_t)BDRV_SECTOR_SIZE); dict = qobject_to_qdict(res); if (*bs->device_name) {
Fix a warning from OpenBSD gcc (3.3.5 (propolice)): /src/qemu/block.c: In function `bdrv_info_stats_bs': /src/qemu/block.c:1548: warning: long long int format, long unsigned int arg (arg 6) There may be also truncation effects. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> --- Alternatively 'ULL' prefix could be appended to BDRV_SECTOR_SIZE definition but that may have other side effects. block.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)