Received: from eggs.gnu.org ([2001:4830:134:3::10]:44183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSvWh-0004Bd-CS for qemu-devel@nongnu.org; Wed, 26 Mar 2014 17:38:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSvWc-0006Kl-HM for qemu-devel@nongnu.org; Wed, 26 Mar 2014 17:38:23 -0400 Received: from v220110690675601.yourvserver.net ([37.221.199.173]:39672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSvWc-0006Kc-C2 for qemu-devel@nongnu.org; Wed, 26 Mar 2014 17:38:18 -0400 From: Stefan Weil Date: Wed, 26 Mar 2014 22:38:04 +0100 Message-Id: <1395869885-27751-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH 1/2] vdi: Fix error message and two more small code improvements List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Weil , Stefan Hajnoczi * 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 Cc: Stefan Hajnoczi Signed-off-by: Stefan Weil --- block/vdi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 ", " -- 1.7.10.4