yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
958e1b
From 7e3dcd5daa2a5e7350bf3dadacdd6dcd1a2460fc Mon Sep 17 00:00:00 2001
958e1b
From: Jeffrey Cody <jcody@redhat.com>
958e1b
Date: Tue, 16 Sep 2014 20:11:45 +0200
958e1b
Subject: [PATCH 07/20] block: Use correct width in format strings
958e1b
958e1b
Message-id: <a14914e8c76780fe8aa97cf44825a0e7167b9208.1410897407.git.jcody@redhat.com>
958e1b
Patchwork-id: 61211
958e1b
O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 06/15] block: Use correct width in format strings
958e1b
Bugzilla: 1098086
958e1b
RH-Acked-by: Fam Zheng <famz@redhat.com>
958e1b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
958e1b
958e1b
From: Max Reitz <mreitz@redhat.com>
958e1b
958e1b
Instead of blindly relying on a normal integer having a width of 32 bits
958e1b
(which is a pretty good assumption, but we should not rely on it if
958e1b
there is no need), use the correct format string macros.
958e1b
958e1b
This does not touch DEBUG output.
958e1b
958e1b
Signed-off-by: Max Reitz <mreitz@redhat.com>
958e1b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
958e1b
(cherry picked from commit 521b2b5df0ccad764cf95164c6e428f855067a6f)
958e1b
958e1b
Conflicts:
958e1b
	block/vdi.c
958e1b
958e1b
Signed-off-by: Jeff Cody <jcody@redhat.com>
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 block/cow.c      |    2 +-
958e1b
 block/dmg.c      |    8 ++++----
958e1b
 block/qcow.c     |    3 ++-
958e1b
 block/qcow2.c    |   12 +++++++-----
958e1b
 block/sheepdog.c |    6 +++---
958e1b
 block/vdi.c      |   21 +++++++++++----------
958e1b
 6 files changed, 28 insertions(+), 24 deletions(-)
958e1b
958e1b
diff --git a/block/cow.c b/block/cow.c
958e1b
index 651bdff..c75668b 100644
958e1b
--- a/block/cow.c
958e1b
+++ b/block/cow.c
958e1b
@@ -82,7 +82,7 @@ static int cow_open(BlockDriverState *bs, QDict *options, int flags,
958e1b
     if (be32_to_cpu(cow_header.version) != COW_VERSION) {
958e1b
         char version[64];
958e1b
         snprintf(version, sizeof(version),
958e1b
-               "COW version %d", cow_header.version);
958e1b
+               "COW version %" PRIu32, cow_header.version);
958e1b
         error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
958e1b
             bs->device_name, "cow", version);
958e1b
         ret = -ENOTSUP;
958e1b
diff --git a/block/dmg.c b/block/dmg.c
958e1b
index 856402e..1e153cd 100644
958e1b
--- a/block/dmg.c
958e1b
+++ b/block/dmg.c
958e1b
@@ -248,8 +248,8 @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags,
958e1b
                 offset += 8;
958e1b
 
958e1b
                 if (s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) {
958e1b
-                    error_report("sector count %" PRIu64 " for chunk %u is "
958e1b
-                                 "larger than max (%u)",
958e1b
+                    error_report("sector count %" PRIu64 " for chunk %" PRIu32
958e1b
+                                 " is larger than max (%u)",
958e1b
                                  s->sectorcounts[i], i, DMG_SECTORCOUNTS_MAX);
958e1b
                     ret = -EINVAL;
958e1b
                     goto fail;
958e1b
@@ -269,8 +269,8 @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags,
958e1b
                 offset += 8;
958e1b
 
958e1b
                 if (s->lengths[i] > DMG_LENGTHS_MAX) {
958e1b
-                    error_report("length %" PRIu64 " for chunk %u is larger "
958e1b
-                                 "than max (%u)",
958e1b
+                    error_report("length %" PRIu64 " for chunk %" PRIu32
958e1b
+                                 " is larger than max (%u)",
958e1b
                                  s->lengths[i], i, DMG_LENGTHS_MAX);
958e1b
                     ret = -EINVAL;
958e1b
                     goto fail;
958e1b
diff --git a/block/qcow.c b/block/qcow.c
958e1b
index a5f601f..be5d3e9 100644
958e1b
--- a/block/qcow.c
958e1b
+++ b/block/qcow.c
958e1b
@@ -121,7 +121,8 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
958e1b
     }
958e1b
     if (header.version != QCOW_VERSION) {
958e1b
         char version[64];
958e1b
-        snprintf(version, sizeof(version), "QCOW version %d", header.version);
958e1b
+        snprintf(version, sizeof(version), "QCOW version %" PRIu32,
958e1b
+                 header.version);
958e1b
         error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
958e1b
                   bs->device_name, "qcow", version);
958e1b
         ret = -ENOTSUP;
958e1b
diff --git a/block/qcow2.c b/block/qcow2.c
958e1b
index 0878d88..a679355 100644
958e1b
--- a/block/qcow2.c
958e1b
+++ b/block/qcow2.c
958e1b
@@ -124,8 +124,9 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
958e1b
 
958e1b
         case QCOW2_EXT_MAGIC_BACKING_FORMAT:
958e1b
             if (ext.len >= sizeof(bs->backing_format)) {
958e1b
-                error_setg(errp, "ERROR: ext_backing_format: len=%u too large"
958e1b
-                           " (>=%zu)", ext.len, sizeof(bs->backing_format));
958e1b
+                error_setg(errp, "ERROR: ext_backing_format: len=%" PRIu32
958e1b
+                           " too large (>=%zu)", ext.len,
958e1b
+                           sizeof(bs->backing_format));
958e1b
                 return 2;
958e1b
             }
958e1b
             ret = bdrv_pread(bs->file, offset, bs->backing_format, ext.len);
958e1b
@@ -480,7 +481,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
958e1b
         goto fail;
958e1b
     }
958e1b
     if (header.version < 2 || header.version > 3) {
958e1b
-        report_unsupported(bs, errp, "QCOW version %d", header.version);
958e1b
+        report_unsupported(bs, errp, "QCOW version %" PRIu32, header.version);
958e1b
         ret = -ENOTSUP;
958e1b
         goto fail;
958e1b
     }
958e1b
@@ -490,7 +491,8 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
958e1b
     /* Initialise cluster size */
958e1b
     if (header.cluster_bits < MIN_CLUSTER_BITS ||
958e1b
         header.cluster_bits > MAX_CLUSTER_BITS) {
958e1b
-        error_setg(errp, "Unsupported cluster size: 2^%i", header.cluster_bits);
958e1b
+        error_setg(errp, "Unsupported cluster size: 2^%" PRIu32,
958e1b
+                   header.cluster_bits);
958e1b
         ret = -EINVAL;
958e1b
         goto fail;
958e1b
     }
958e1b
@@ -587,7 +589,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
958e1b
     s->refcount_order = header.refcount_order;
958e1b
 
958e1b
     if (header.crypt_method > QCOW_CRYPT_AES) {
958e1b
-        error_setg(errp, "Unsupported encryption method: %i",
958e1b
+        error_setg(errp, "Unsupported encryption method: %" PRIu32,
958e1b
                    header.crypt_method);
958e1b
         ret = -EINVAL;
958e1b
         goto fail;
958e1b
diff --git a/block/sheepdog.c b/block/sheepdog.c
958e1b
index b3a2ae8..f29b4e7 100644
958e1b
--- a/block/sheepdog.c
958e1b
+++ b/block/sheepdog.c
958e1b
@@ -995,7 +995,7 @@ static int find_vdi_name(BDRVSheepdogState *s, const char *filename,
958e1b
     }
958e1b
 
958e1b
     if (rsp->result != SD_RES_SUCCESS) {
958e1b
-        error_report("cannot get vdi info, %s, %s %d %s",
958e1b
+        error_report("cannot get vdi info, %s, %s %" PRIu32 " %s",
958e1b
                      sd_strerror(rsp->result), filename, snapid, tag);
958e1b
         if (rsp->result == SD_RES_NO_VDI) {
958e1b
             ret = -ENOENT;
958e1b
@@ -2175,8 +2175,8 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
958e1b
             sn_tab[found].vm_state_size = inode.vm_state_size;
958e1b
             sn_tab[found].vm_clock_nsec = inode.vm_clock_nsec;
958e1b
 
958e1b
-            snprintf(sn_tab[found].id_str, sizeof(sn_tab[found].id_str), "%u",
958e1b
-                     inode.snap_id);
958e1b
+            snprintf(sn_tab[found].id_str, sizeof(sn_tab[found].id_str),
958e1b
+                     "%" PRIu32, inode.snap_id);
958e1b
             pstrcpy(sn_tab[found].name,
958e1b
                     MIN(sizeof(sn_tab[found].name), sizeof(inode.tag)),
958e1b
                     inode.tag);
958e1b
diff --git a/block/vdi.c b/block/vdi.c
958e1b
index 0f8b294..fecfa14 100644
958e1b
--- a/block/vdi.c
958e1b
+++ b/block/vdi.c
958e1b
@@ -408,34 +408,35 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
958e1b
     }
958e1b
 
958e1b
     if (header.signature != VDI_SIGNATURE) {
958e1b
-        error_setg(errp, "Image not in VDI format (bad signature %08x)", header.signature);
958e1b
+        error_setg(errp, "Image not in VDI format (bad signature %08" PRIx32
958e1b
+                   ")", header.signature);
958e1b
         ret = -EINVAL;
958e1b
         goto fail;
958e1b
     } else if (header.version != VDI_VERSION_1_1) {
958e1b
-        error_setg(errp, "unsupported VDI image (version %u.%u)",
958e1b
-                   header.version >> 16, header.version & 0xffff);
958e1b
+        error_setg(errp, "unsupported VDI image (version %" PRIu32 ".%" PRIu32
958e1b
+                   ")", header.version >> 16, header.version & 0xffff);
958e1b
         ret = -ENOTSUP;
958e1b
         goto fail;
958e1b
     } else if (header.offset_bmap % SECTOR_SIZE != 0) {
958e1b
         /* We only support block maps which start on a sector boundary. */
958e1b
         error_setg(errp, "unsupported VDI image (unaligned block map offset "
958e1b
-                   "0x%x)", header.offset_bmap);
958e1b
+                   "0x%" PRIx32 ")", header.offset_bmap);
958e1b
         ret = -ENOTSUP;
958e1b
         goto fail;
958e1b
     } else if (header.offset_data % SECTOR_SIZE != 0) {
958e1b
         /* We only support data blocks which start on a sector boundary. */
958e1b
-        error_setg(errp, "unsupported VDI image (unaligned data offset 0x%x)",
958e1b
-                   header.offset_data);
958e1b
+        error_setg(errp, "unsupported VDI image (unaligned data offset 0x%"
958e1b
+                   PRIx32 ")", header.offset_data);
958e1b
         ret = -ENOTSUP;
958e1b
         goto fail;
958e1b
     } else if (header.sector_size != SECTOR_SIZE) {
958e1b
-        error_setg(errp, "unsupported VDI image (sector size %u is not %u)",
958e1b
-                   header.sector_size, SECTOR_SIZE);
958e1b
+        error_setg(errp, "unsupported VDI image (sector size %" PRIu32
958e1b
+                   " is not %u)", header.sector_size, SECTOR_SIZE);
958e1b
         ret = -ENOTSUP;
958e1b
         goto fail;
958e1b
     } else if (header.block_size != DEFAULT_CLUSTER_SIZE) {
958e1b
-        error_setg(errp, "unsupported VDI image (sector size %u is not %u)",
958e1b
-                   header.block_size, DEFAULT_CLUSTER_SIZE);
958e1b
+        error_setg(errp, "unsupported VDI image (block size %" PRIu32
958e1b
+                   " is not %u)", header.block_size, DEFAULT_CLUSTER_SIZE);
958e1b
         ret = -ENOTSUP;
958e1b
         goto fail;
958e1b
     } else if (header.disk_size >
958e1b
-- 
958e1b
1.7.1
958e1b