From patchwork Fri Feb 1 21:51:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 217600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CE12D2C029D for ; Sat, 2 Feb 2013 09:00:29 +1100 (EST) Received: from localhost ([::1]:49445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1Oeq-0004fq-2D for incoming@patchwork.ozlabs.org; Fri, 01 Feb 2013 17:00:28 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1Oai-0000EY-L3 for qemu-devel@nongnu.org; Fri, 01 Feb 2013 17:00:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1OWO-00081X-N2 for qemu-devel@nongnu.org; Fri, 01 Feb 2013 16:56:12 -0500 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:54295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1OWO-00081K-Fw for qemu-devel@nongnu.org; Fri, 01 Feb 2013 16:51:44 -0500 Received: from localhost (v220110690675601.yourvserver.net.local [127.0.0.1]) by v220110690675601.yourvserver.net (Postfix) with ESMTP id D9FEB728004C; Fri, 1 Feb 2013 22:51:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at weilnetz.de Received: from v220110690675601.yourvserver.net ([127.0.0.1]) by localhost (v220110690675601.yourvserver.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XxnVY-KWYFO5; Fri, 1 Feb 2013 22:51:43 +0100 (CET) Received: by v220110690675601.yourvserver.net (Postfix, from userid 1000) id D5C277280057; Fri, 1 Feb 2013 22:51:40 +0100 (CET) From: Stefan Weil To: Kevin Wolf , Stefan Hajnoczi , qemu-devel@nongnu.org Date: Fri, 1 Feb 2013 22:51:33 +0100 Message-Id: <1359755494-28012-7-git-send-email-sw@weilnetz.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359755494-28012-1-git-send-email-sw@weilnetz.de> References: <1359755494-28012-1-git-send-email-sw@weilnetz.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 78.47.199.172 Cc: Stefan Weil , jcody@redhat.com Subject: [Qemu-devel] [PATCH 6/7] block/vpc: Remove workaround for geometry calculation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org QEMU now gets the correct size for VHD images, so this workaround is no longer needed. Signed-off-by: Stefan Weil --- block/vpc.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/block/vpc.c b/block/vpc.c index 799b1c9..e8968c2 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -681,7 +681,7 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options) uint8_t buf[1024]; struct vhd_footer *footer = (struct vhd_footer *) buf; QEMUOptionParameter *disk_type_param; - int fd, i; + int fd; uint16_t cyls = 0; uint8_t heads = 0; uint8_t secs_per_cyl = 0; @@ -718,16 +718,11 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options) * qemu-img convert doesn't truncate images, but rather rounds up. */ total_sectors = total_size / BDRV_SECTOR_SIZE; - for (i = 0; total_sectors > (int64_t)cyls * heads * secs_per_cyl; i++) { - if (calculate_geometry(total_sectors + i, &cyls, &heads, - &secs_per_cyl)) { - ret = -EFBIG; - goto fail; - } + if (calculate_geometry(total_sectors, &cyls, &heads, &secs_per_cyl)) { + ret = -EFBIG; + goto fail; } - total_sectors = (int64_t) cyls * heads * secs_per_cyl; - /* Prepare the Hard Disk Footer */ memset(buf, 0, 1024);