[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/24] block: Use error code EMEDIUMTYPE for wrong f
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 14/24] block: Use error code EMEDIUMTYPE for wrong format in some block drivers |
Date: |
Fri, 25 Jan 2013 19:45:50 +0100 |
From: Stefan Weil <address@hidden>
This improves error reports for bochs, cow, qcow, qcow2, qed and vmdk
when a file with the wrong format is selected.
Signed-off-by: Stefan Weil <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/bochs.c | 2 +-
block/cow.c | 2 +-
block/qcow.c | 2 +-
block/qcow2.c | 2 +-
block/qed.c | 2 +-
block/vmdk.c | 4 ++--
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/block/bochs.c b/block/bochs.c
index 1b1d9cd..3737583 100644
--- a/block/bochs.c
+++ b/block/bochs.c
@@ -126,7 +126,7 @@ static int bochs_open(BlockDriverState *bs, int flags)
strcmp(bochs.subtype, GROWING_TYPE) ||
((le32_to_cpu(bochs.version) != HEADER_VERSION) &&
(le32_to_cpu(bochs.version) != HEADER_V1))) {
- goto fail;
+ return -EMEDIUMTYPE;
}
if (le32_to_cpu(bochs.version) == HEADER_V1) {
diff --git a/block/cow.c b/block/cow.c
index a33ce95..4baf904 100644
--- a/block/cow.c
+++ b/block/cow.c
@@ -73,7 +73,7 @@ static int cow_open(BlockDriverState *bs, int flags)
}
if (be32_to_cpu(cow_header.magic) != COW_MAGIC) {
- ret = -EINVAL;
+ ret = -EMEDIUMTYPE;
goto fail;
}
diff --git a/block/qcow.c b/block/qcow.c
index 4276610..a7135ee 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -112,7 +112,7 @@ static int qcow_open(BlockDriverState *bs, int flags)
be64_to_cpus(&header.l1_table_offset);
if (header.magic != QCOW_MAGIC) {
- ret = -EINVAL;
+ ret = -EMEDIUMTYPE;
goto fail;
}
if (header.version != QCOW_VERSION) {
diff --git a/block/qcow2.c b/block/qcow2.c
index f6abff6..7610e56 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -311,7 +311,7 @@ static int qcow2_open(BlockDriverState *bs, int flags)
be32_to_cpus(&header.nb_snapshots);
if (header.magic != QCOW_MAGIC) {
- ret = -EINVAL;
+ ret = -EMEDIUMTYPE;
goto fail;
}
if (header.version < 2 || header.version > 3) {
diff --git a/block/qed.c b/block/qed.c
index cf85d8f..b8515e5 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -390,7 +390,7 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags)
qed_header_le_to_cpu(&le_header, &s->header);
if (s->header.magic != QED_MAGIC) {
- return -EINVAL;
+ return -EMEDIUMTYPE;
}
if (s->header.features & ~QED_FEATURE_MASK) {
/* image uses unsupported feature bits */
diff --git a/block/vmdk.c b/block/vmdk.c
index 19298c2..8333afb 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -616,7 +616,7 @@ static int vmdk_open_sparse(BlockDriverState *bs,
return vmdk_open_vmdk4(bs, file, flags);
break;
default:
- return -EINVAL;
+ return -EMEDIUMTYPE;
break;
}
}
@@ -718,7 +718,7 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int
flags,
}
buf[2047] = '\0';
if (vmdk_parse_description(buf, "createType", ct, sizeof(ct))) {
- return -EINVAL;
+ return -EMEDIUMTYPE;
}
if (strcmp(ct, "monolithicFlat") &&
strcmp(ct, "twoGbMaxExtentSparse") &&
--
1.7.6.5
- [Qemu-devel] [PATCH 05/24] mirror: perform COW if the cluster size is bigger than the granularity, (continued)
- [Qemu-devel] [PATCH 05/24] mirror: perform COW if the cluster size is bigger than the granularity, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 04/24] block: make round_to_clusters public, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 07/24] block: allow customizing the granularity of the dirty bitmap, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 06/24] block: return count of dirty sectors, not chunks, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 09/24] mirror: switch mirror_iteration to AIO, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 08/24] mirror: allow customizing the granularity, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 10/24] mirror: add buf-size argument to drive-mirror, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 11/24] mirror: support more than one in-flight AIO operation, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 13/24] block: Add special error code for wrong format, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 12/24] mirror: support arbitrarily-sized iterations, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 14/24] block: Use error code EMEDIUMTYPE for wrong format in some block drivers,
Kevin Wolf <=
- [Qemu-devel] [PATCH 18/24] mirror: do nothing on zero-sized disk, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 19/24] hbitmap: add assertion on hbitmap_iter_init, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 17/24] block/vdi: Check for bad signature, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 15/24] block/vdi: Improve debug output for signature, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 16/24] block/vdi: Improved return values from vdi_open, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 23/24] block: Create proper size file for disk mirror, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 20/24] ahci: Remove unused AHCIDevice fields, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 22/24] ahci: Add migration support, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 24/24] ide: Add fall through annotations, Kevin Wolf, 2013/01/25
- [Qemu-devel] [PATCH 21/24] ahci: Change data types in preparation for migration, Kevin Wolf, 2013/01/25