fix hw/scsi-disk.c compile errors
PATCH 1/1 fix hw/scsi-disk.c compile errors
This patch fixes 2 compile errors when debugging is enabled.
CC scsi-disk.o
cc1: warnings being treated as errors/home/reif/qemu/hw/scsi-disk.c: In function ‘scsi_send_command’:/home/reif/qemu/hw/scsi-disk.c:797: error: format ‘%d’ expects type ‘int’, but argument 2 has type ‘uint64_t’ /home/reif/qemu/hw/scsi-disk.c:899: error: format ‘%d’ expects type ‘int’, but argument 2 has type ‘uint64_t’
make: *** [scsi-disk.o] Error 1
hw/scsi-disk.c +2 -2
@@ -794,7 +794,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, is_write =1 ;break ;case 0x35 : -DPRINTF ("Synchronise cache (sector %d, count %d)\n" , lba, len); +DPRINTF ("Synchronise cache (sector %lld, count %d)\n" , lba, len);bdrv_flush (s->bdrv);break ;case 0x43 :
@@ -896,7 +896,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, r->iov.iov_len =16 ;break ;case 0x2f : -DPRINTF ("Verify (sector %d, count %d)\n" , lba, len); +DPRINTF ("Verify (sector %lld, count %d)\n" , lba, len);break ;default :DPRINTF ("Unknown SCSI command (%2.2x)\n" , buf[0 ]);
hw/scsi-disk.c static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, · line 797
Quoted 10 lines · Robert Reif
This patch fixes 2 compile errors when debugging is enabled.
CC scsi-disk.o
cc1: warnings being treated as errors/home/reif/qemu/hw/scsi-disk.c: In function ‘scsi_send_command’:/home/reif/qemu/hw/scsi-disk.c:797: error: format ‘%d’ expects type ‘int’, but argument 2 has type ‘uint64_t’hw/scsi-disk.c +1
-1-DPRINTF ("Synchronise cache (sector %d, count %d)\n" , lba, len); +DPRINTF ("Synchronise cache (sector %lld, count %d)\n" , lba, len);
Doesn't work. Well, it works on 32bit, but will fail on 64bit. Use the macros provided by inttypes.h instead, i.e.
"... (sector %" PRId64 ", count ...", lba
cheers,
Gerd
Quoted 9 lines · Gerd Hoffmann
Quoted 7 lines · Robert Reif
This patch fixes 2 compile errors when debugging is enabled.
CC scsi-disk.o
cc1: warnings being treated as errors/home/reif/qemu/hw/scsi-disk.c: In function ‘scsi_send_command’:/home/reif/qemu/hw/scsi-disk.c:797: error: format ‘%d’ expects type ‘int’, but argument 2 has type ‘uint64_t’
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +1
-1- DPRINTF("Synchronise cache (sector %d, count %d)\n", lba, len); + DPRINTF("Synchronise cache (sector %lld, count %d)\n", lba,len);
Doesn't work. Well, it works on 32bit, but will fail on 64bit. Use the macros provided by
inttypes.hinstead, i.e."... (sector %" PRId64 ", count ...", lba
Given the error, PRIu64 looks better.
-- Jamie
Quoted 9 lines · Gerd Hoffmann
Quoted 7 lines · Robert Reif
This patch fixes 2 compile errors when debugging is enabled.
CC scsi-disk.o
cc1: warnings being treated as errors/home/reif/qemu/hw/scsi-disk.c: In function ‘scsi_send_command’:/home/reif/qemu/hw/scsi-disk.c:797: error: format ‘%d’ expects type ‘int’, but argument 2 has type ‘uint64_t’
Quoted 10 lines
Quoted 1 line
- DPRINTF("Synchronise cache (sector %d, count %d)\n", lba,
len);
Quoted 1 line
+ DPRINTF("Synchronise cache (sector %lld, count %d)\n", lba,
len);
Doesn't work. Well, it works on 32bit, but will fail on 64bit. Use the macros provided by
inttypes.hinstead, i.e."... (sector %" PRId64 ", count ...", lba
Here is a revised patch that uses PRIu64 because lba is a uint64_t. This patch fixes the 2 %d that were giving an error and 2 %lld that were wrong.
hw/scsi-disk.c +4 -4
@@ -777,7 +777,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,case 0x08 :case 0x28 :case 0x88 : -DPRINTF ("Read (sector %lld, count %d)\n" , lba, len); +DPRINTF ("Read (sector %" PRIu64", count %d)\n" , lba, len);if (lba > s->max_lba) goto illegal_lba; r->sector = lba * s->cluster_size;
@@ -786,7 +786,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,case 0x0a :case 0x2a :case 0x8a : -DPRINTF ("Write (sector %lld, count %d)\n" , lba, len); +DPRINTF ("Write (sector %" PRIu64", count %d)\n" , lba, len);if (lba > s->max_lba) goto illegal_lba; r->sector = lba * s->cluster_size;
@@ -794,7 +794,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, is_write =1 ;break ;case 0x35 : -DPRINTF ("Synchronise cache (sector %d, count %d)\n" , lba, len); +DPRINTF ("Synchronise cache (sector %" PRIu64", count %d)\n" , lba, len);bdrv_flush (s->bdrv);break ;case 0x43 :
@@ -896,7 +896,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, r->iov.iov_len =16 ;break ;case 0x2f : -DPRINTF ("Verify (sector %d, count %d)\n" , lba, len); +DPRINTF ("Verify (sector %" PRIu64", count %d)\n" , lba, len);break ;default :DPRINTF ("Unknown SCSI command (%2.2x)\n" , buf[0 ]);
Quoted 15 lines · Robert Reif
Quoted 14 lines · Gerd Hoffmann
Quoted 9 lines · Robert Reif
This patch fixes 2 compile errors when debugging is enabled.
CC scsi-disk.o
cc1: warnings being treated as errors/home/reif/qemu/hw/scsi-disk.c: In function ‘scsi_send_command’:/home/reif/qemu/hw/scsi-disk.c:797: error: format ‘%d’ expects type ‘int’, but argument 2 has type ‘uint64_t’- DPRINTF("Synchronise cache (sector %d, count %d)\n", lba,
len);
Quoted 1 line
+ DPRINTF("Synchronise cache (sector %lld, count %d)\n",
lba, len);
Quoted 8 lines
Quoted 5 lines
Doesn't work. Well, it works on 32bit, but will fail on 64bit. Use the macros provided by
inttypes.hinstead, i.e."... (sector %" PRId64 ", count ...", lba
Here is a revised patch that uses PRIu64 because lba is a
uint64_t. This patch fixes the 2 %d that were giving an error and 2 %lld that were wrong.
Need to resend as a top level patch and included a SoB.
Regards,
Anthony Liguori