From patchwork Tue Feb 5 18:54:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 218321 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 06B742C02C6 for ; Wed, 6 Feb 2013 05:57:06 +1100 (EST) Received: from localhost ([::1]:47792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2nhY-0002mZ-0E for incoming@patchwork.ozlabs.org; Tue, 05 Feb 2013 13:57:04 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2nh8-0002M1-Iq for qemu-devel@nongnu.org; Tue, 05 Feb 2013 13:56:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U2nh2-0004Zi-8C for qemu-devel@nongnu.org; Tue, 05 Feb 2013 13:56:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15819) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2nh1-0004ZS-Vy for qemu-devel@nongnu.org; Tue, 05 Feb 2013 13:56:32 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r15IuVGc003255 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 5 Feb 2013 13:56:31 -0500 Received: from localhost (ovpn-112-26.ams2.redhat.com [10.36.112.26]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r15IuUCv016885; Tue, 5 Feb 2013 13:56:30 -0500 From: Stefan Hajnoczi To: Date: Tue, 5 Feb 2013 19:54:09 +0100 Message-Id: <1360090451-26543-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1360090451-26543-1-git-send-email-stefanha@redhat.com> References: <1360090451-26543-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , fsimonce@redhat.com, Stefan Hajnoczi , crobinso@redhat.com Subject: [Qemu-devel] [PATCH 3/5] qemu-img: avoid excessive BlockFragInfo line length 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 The qemu-img check printf() statement that shows BlockFragInfo results is poorly formatted. Introduce a local variable to shorten the lines and restore proper indentation. The next patch adds a field to BlockFragInfo so it is beneficial to straighten out this code before modifying it. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- qemu-img.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 85d3740..167d65f 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -389,6 +389,7 @@ static int img_check(int argc, char **argv) const char *filename, *fmt; BlockDriverState *bs; BdrvCheckResult result; + BlockFragInfo *bfi = &result.bfi; int fix = 0; int flags = BDRV_O_FLAGS | BDRV_O_CHECK; @@ -468,11 +469,12 @@ static int img_check(int argc, char **argv) } } - if (result.bfi.total_clusters != 0 && result.bfi.allocated_clusters != 0) { - printf("%" PRId64 "/%" PRId64 "= %0.2f%% allocated, %0.2f%% fragmented\n", - result.bfi.allocated_clusters, result.bfi.total_clusters, - result.bfi.allocated_clusters * 100.0 / result.bfi.total_clusters, - result.bfi.fragmented_clusters * 100.0 / result.bfi.allocated_clusters); + if (bfi->total_clusters != 0 && bfi->allocated_clusters != 0) { + printf("%" PRId64 "/%" PRId64 "= %0.2f%% allocated, " + "%0.2f%% fragmented\n", + bfi->allocated_clusters, bfi->total_clusters, + bfi->allocated_clusters * 100.0 / bfi->total_clusters, + bfi->fragmented_clusters * 100.0 / bfi->allocated_clusters); } bdrv_delete(bs);