diff mbox

[1/2] vdi: Fix error message and two more small code improvements

Message ID 1395869885-27751-1-git-send-email-sw@weilnetz.de
State New
Headers show

Commit Message

Stefan Weil March 26, 2014, 9:38 p.m. UTC
* Fix wrong error message (copy+paste bug from commit
  5b7aa9b56d1bfc79916262f380c3fc7961becb50).

* Replace the default cluster size of 1 * MiB by DEFAULT_CLUSTER_SIZE.

* Don't check for the default cluster size if we support other sizes, too.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 block/vdi.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/block/vdi.c b/block/vdi.c
index ac9a025..b832905 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -420,11 +420,13 @@  static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
                    header.sector_size, SECTOR_SIZE);
         ret = -ENOTSUP;
         goto fail;
-    } else if (header.block_size != 1 * MiB) {
-        error_setg(errp, "unsupported VDI image (sector size %u is not %u)",
-                   header.block_size, 1 * MiB);
+#if !defined(CONFIG_VDI_BLOCK_SIZE)
+    } else if (header.block_size != DEFAULT_CLUSTER_SIZE) {
+        error_setg(errp, "unsupported VDI image (block size %u is not %u)",
+                   header.block_size, DEFAULT_CLUSTER_SIZE);
         ret = -ENOTSUP;
         goto fail;
+#endif
     } else if (header.disk_size >
                (uint64_t)header.blocks_in_image * header.block_size) {
         error_setg(errp, "unsupported VDI image (disk size %" PRIu64 ", "