From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MMK8L-0005TG-Tf for qemu-devel@nongnu.org; Thu, 02 Jul 2009 07:07:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MMK8H-0005RH-4m for qemu-devel@nongnu.org; Thu, 02 Jul 2009 07:07:17 -0400 Received: from [199.232.76.173] (port=52694 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MMK8G-0005RA-S5 for qemu-devel@nongnu.org; Thu, 02 Jul 2009 07:07:12 -0400 Received: from pop-scotia.atl.sa.earthlink.net ([207.69.195.65]:35675) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MMK8G-0006tQ-Fu for qemu-devel@nongnu.org; Thu, 02 Jul 2009 07:07:12 -0400 Message-ID: <4A4C94CF.1080002@earthlink.net> Date: Thu, 02 Jul 2009 07:06:55 -0400 From: Robert Reif MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] fix hw/scsi-disk.c compile errors References: <4A4BF3FB.90805@earthlink.net> <4A4C57DA.8010202@redhat.com> In-Reply-To: <4A4C57DA.8010202@redhat.com> Content-Type: multipart/mixed; boundary="------------070403070905060305040007" List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel This is a multi-part message in MIME format. --------------070403070905060305040007 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit 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. --------------070403070905060305040007 Content-Type: text/plain; name="scsi1.diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="scsi1.diff.txt" 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]); --------------070403070905060305040007--