[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH STABLE 0.14 6/9] qcow2: Report error for version > 2
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH STABLE 0.14 6/9] qcow2: Report error for version > 2 |
Date: |
Fri, 11 Feb 2011 15:21:31 +0100 |
The qcow2 driver is now declared responsible for any QCOW image that has
version 2 or greater (before this, version 3 would be detected as raw).
For everything newer than version 2, an error is reported.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Anthony Liguori <address@hidden>
(cherry picked from commit e8cdcec123facf0ed273d941caeeeb9b08f14955)
---
block/qcow2.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 551b3c2..75b8bec 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -28,6 +28,7 @@
#include "aes.h"
#include "block/qcow2.h"
#include "qemu-error.h"
+#include "qerror.h"
/*
Differences with QCOW:
@@ -59,7 +60,7 @@ static int qcow2_probe(const uint8_t *buf, int buf_size,
const char *filename)
if (buf_size >= sizeof(QCowHeader) &&
be32_to_cpu(cow_header->magic) == QCOW_MAGIC &&
- be32_to_cpu(cow_header->version) == QCOW_VERSION)
+ be32_to_cpu(cow_header->version) >= QCOW_VERSION)
return 100;
else
return 0;
@@ -163,10 +164,18 @@ static int qcow2_open(BlockDriverState *bs, int flags)
be64_to_cpus(&header.snapshots_offset);
be32_to_cpus(&header.nb_snapshots);
- if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) {
+ if (header.magic != QCOW_MAGIC) {
ret = -EINVAL;
goto fail;
}
+ if (header.version != QCOW_VERSION) {
+ char version[64];
+ snprintf(version, sizeof(version), "QCOW version %d", header.version);
+ qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
+ bs->device_name, "qcow2", version);
+ ret = -ENOTSUP;
+ goto fail;
+ }
if (header.cluster_bits < MIN_CLUSTER_BITS ||
header.cluster_bits > MAX_CLUSTER_BITS) {
ret = -EINVAL;
--
1.7.2.3
- [Qemu-devel] [PULL STABLE 0.14 0/9] Block patches for stable-0.14, Kevin Wolf, 2011/02/11
- [Qemu-devel] [PATCH STABLE 0.14 1/9] Change snapshot_blkdev hmp to use correct argument type for device, Kevin Wolf, 2011/02/11
- [Qemu-devel] [PATCH STABLE 0.14 2/9] QCOW2: bug fix - read base image beyond its size, Kevin Wolf, 2011/02/11
- [Qemu-devel] [PATCH STABLE 0.14 3/9] qcow2: Fix error handling for immediate backing file read failure, Kevin Wolf, 2011/02/11
- [Qemu-devel] [PATCH STABLE 0.14 4/9] qcow2: Fix error handling for reading compressed clusters, Kevin Wolf, 2011/02/11
- [Qemu-devel] [PATCH STABLE 0.14 5/9] qerror: Add QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, Kevin Wolf, 2011/02/11
- [Qemu-devel] [PATCH STABLE 0.14 6/9] qcow2: Report error for version > 2,
Kevin Wolf <=
- [Qemu-devel] [PATCH STABLE 0.14 8/9] qemu-img: Improve error messages for failed bdrv_open, Kevin Wolf, 2011/02/11
- [Qemu-devel] [PATCH STABLE 0.14 7/9] qed: Report error for unsupported features, Kevin Wolf, 2011/02/11
- [Qemu-devel] [PATCH STABLE 0.14 9/9] qcow2: Fix order in L2 table COW, Kevin Wolf, 2011/02/11
- [Qemu-devel] Re: [PULL STABLE 0.14 0/9] Block patches for stable-0.14, Justin M. Forbes, 2011/02/11