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