Received: from eggs.gnu.org ([208.118.235.92]:40570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOZOd-0001cl-5G for qemu-devel@nongnu.org; Wed, 17 Oct 2012 15:35:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOZOY-0001Z1-Sz for qemu-devel@nongnu.org; Wed, 17 Oct 2012 15:35:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62269) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOZOY-0001Ys-Km for qemu-devel@nongnu.org; Wed, 17 Oct 2012 15:35:10 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9HJZAVc014677 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 17 Oct 2012 15:35:10 -0400 From: Luiz Capitulino Date: Wed, 17 Oct 2012 16:35:51 -0300 Message-Id: <1350502556-4885-4-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1350502556-4885-1-git-send-email-lcapitulino@redhat.com> References: <1350502556-4885-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 3/8] block: bdrv_img_create(): move parameter list printing to qemu-img List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, armbru@redhat.com Today, bdrv_img_create() prints the parameter list used to create the new image to stdout, like this: Formatting '/tmp/a', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off As the transaction QMP command calls bdrv_img_create(), this message is also printed when using QMP. This commit moves the printing of the parameter list to qemu-img instead. This way we avoid printing it in QMP and from whatever bdrv_img_create() usage we might have in the future. Signed-off-by: Luiz Capitulino --- block.c | 4 ---- qemu-img.c | 13 ++++++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/block.c b/block.c index 254a5c2..bdb53af 100644 --- a/block.c +++ b/block.c @@ -4411,10 +4411,6 @@ int bdrv_img_create(const char *filename, const char *fmt, } } - printf("Formatting '%s', fmt=%s ", filename, fmt); - print_option_parameters(param); - puts(""); - ret = bdrv_create(drv, filename, param); if (ret < 0) { diff --git a/qemu-img.c b/qemu-img.c index b841012..e482443 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -301,6 +301,7 @@ static int img_create(int argc, char **argv) const char *filename; const char *base_filename = NULL; char *options = NULL; + QEMUOptionParameter *params = NULL; for(;;) { c = getopt(argc, argv, "F:b:f:he6o:"); @@ -362,7 +363,17 @@ static int img_create(int argc, char **argv) } ret = bdrv_img_create(filename, fmt, base_filename, base_fmt, - options, img_size, BDRV_O_FLAGS, NULL); + options, img_size, BDRV_O_FLAGS, ¶ms); + if (ret < 0) { + goto out; + } + + assert(params); + printf("Formatting '%s', fmt=%s ", filename, fmt); + print_option_parameters(params); + free_option_parameters(params); + puts(""); + out: if (ret) { return 1; -- 1.7.12.315.g682ce8b