* [Qemu-devel] [PATCH] fix hw/scsi-disk.c compile errors @ 2009-07-01 23:40 Robert Reif 2009-07-02 6:46 ` Gerd Hoffmann 0 siblings, 1 reply; 5+ messages in thread From: Robert Reif @ 2009-07-01 23:40 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 483 bytes --] 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 Signed-off-by: Robert Reif <reif@earthlink.net> [-- Attachment #2: scsi.diff.txt --] [-- Type: text/plain, Size: 817 bytes --] diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index a0485db..95e484c 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -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]); ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] fix hw/scsi-disk.c compile errors 2009-07-01 23:40 [Qemu-devel] [PATCH] fix hw/scsi-disk.c compile errors Robert Reif @ 2009-07-02 6:46 ` Gerd Hoffmann 2009-07-02 8:53 ` Jamie Lokier 2009-07-02 11:06 ` Robert Reif 0 siblings, 2 replies; 5+ messages in thread From: Gerd Hoffmann @ 2009-07-02 6:46 UTC (permalink / raw) To: Robert Reif; +Cc: qemu-devel On 07/02/09 01:40, Robert Reif wrote: > 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); > + 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] fix hw/scsi-disk.c compile errors 2009-07-02 6:46 ` Gerd Hoffmann @ 2009-07-02 8:53 ` Jamie Lokier 2009-07-02 11:06 ` Robert Reif 1 sibling, 0 replies; 5+ messages in thread From: Jamie Lokier @ 2009-07-02 8:53 UTC (permalink / raw) To: Gerd Hoffmann; +Cc: qemu-devel, Robert Reif Gerd Hoffmann wrote: > On 07/02/09 01:40, Robert Reif wrote: > >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); > > + 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 Given the error, PRIu64 looks better. -- Jamie ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] fix hw/scsi-disk.c compile errors 2009-07-02 6:46 ` Gerd Hoffmann 2009-07-02 8:53 ` Jamie Lokier @ 2009-07-02 11:06 ` Robert Reif 2009-07-09 19:16 ` Anthony Liguori 1 sibling, 1 reply; 5+ messages in thread From: Robert Reif @ 2009-07-02 11:06 UTC (permalink / raw) To: Gerd Hoffmann; +Cc: qemu-devel [-- Attachment #1: Type: text/plain, Size: 859 bytes --] Gerd Hoffmann wrote: > On 07/02/09 01:40, Robert Reif wrote: >> 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); > > + 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 > > 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. [-- Attachment #2: scsi1.diff.txt --] [-- Type: text/plain, Size: 1567 bytes --] diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index a0485db..eb1ef7b 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -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]); ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] fix hw/scsi-disk.c compile errors 2009-07-02 11:06 ` Robert Reif @ 2009-07-09 19:16 ` Anthony Liguori 0 siblings, 0 replies; 5+ messages in thread From: Anthony Liguori @ 2009-07-09 19:16 UTC (permalink / raw) To: Robert Reif; +Cc: Gerd Hoffmann, qemu-devel Robert Reif wrote: > Gerd Hoffmann wrote: >> On 07/02/09 01:40, Robert Reif wrote: >>> 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); >> > + 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 >> >> > 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-09 19:17 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-07-01 23:40 [Qemu-devel] [PATCH] fix hw/scsi-disk.c compile errors Robert Reif 2009-07-02 6:46 ` Gerd Hoffmann 2009-07-02 8:53 ` Jamie Lokier 2009-07-02 11:06 ` Robert Reif 2009-07-09 19:16 ` Anthony Liguori
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).