From nobody Fri Dec 19 06:31:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543859656068364.6238067964605; Mon, 3 Dec 2018 09:54:16 -0800 (PST) Received: from localhost ([::1]:51226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTsQ9-0007dW-QY for importer@patchew.org; Mon, 03 Dec 2018 12:54:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTsOQ-0006Ef-In for qemu-devel@nongnu.org; Mon, 03 Dec 2018 12:52:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTsOO-0007L7-LW for qemu-devel@nongnu.org; Mon, 03 Dec 2018 12:52:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42366) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTsOJ-0007HB-05; Mon, 03 Dec 2018 12:52:19 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A846308FC52; Mon, 3 Dec 2018 17:52:17 +0000 (UTC) Received: from localhost (unknown [10.36.118.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C89DA5D6B3; Mon, 3 Dec 2018 17:52:16 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 3 Dec 2018 18:52:06 +0100 Message-Id: <20181203175211.8230-2-mreitz@redhat.com> In-Reply-To: <20181203175211.8230-1-mreitz@redhat.com> References: <20181203175211.8230-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 03 Dec 2018 17:52:17 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-next 1/6] qemu-img: Move quiet into ImgConvertState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Move img_convert()'s quiet flag into the ImgConvertState so it is accessible by nested functions. -q dictates that it suppresses anything but errors, so if those functions want to emit warnings, they need to query this flag first. (There currently are no such warnings, but there will be as of the next patch.) Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- qemu-img.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index ad04f59565..1582ef63f3 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1569,6 +1569,7 @@ typedef struct ImgConvertState { int64_t target_backing_sectors; /* negative if unknown */ bool wr_in_order; bool copy_range; + bool quiet; int min_sparse; int alignment; size_t cluster_sectors; @@ -2008,7 +2009,7 @@ static int img_convert(int argc, char **argv) QDict *open_opts =3D NULL; char *options =3D NULL; Error *local_err =3D NULL; - bool writethrough, src_writethrough, quiet =3D false, image_opts =3D f= alse, + bool writethrough, src_writethrough, image_opts =3D false, skip_create =3D false, progress =3D false, tgt_image_opts =3D fal= se; int64_t ret =3D -EINVAL; bool force_share =3D false; @@ -2116,7 +2117,7 @@ static int img_convert(int argc, char **argv) src_cache =3D optarg; break; case 'q': - quiet =3D true; + s.quiet =3D true; break; case 'n': skip_create =3D true; @@ -2205,7 +2206,7 @@ static int img_convert(int argc, char **argv) } =20 /* Initialize before goto out */ - if (quiet) { + if (s.quiet) { progress =3D false; } qemu_progress_init(progress, 1.0); @@ -2216,7 +2217,7 @@ static int img_convert(int argc, char **argv) =20 for (bs_i =3D 0; bs_i < s.src_num; bs_i++) { s.src[bs_i] =3D img_open(image_opts, argv[optind + bs_i], - fmt, src_flags, src_writethrough, quiet, + fmt, src_flags, src_writethrough, s.quiet, force_share); if (!s.src[bs_i]) { ret =3D -1; @@ -2379,7 +2380,7 @@ static int img_convert(int argc, char **argv) =20 if (skip_create) { s.target =3D img_open(tgt_image_opts, out_filename, out_fmt, - flags, writethrough, quiet, false); + flags, writethrough, s.quiet, false); } else { /* TODO ultimately we should allow --target-image-opts * to be used even when -n is not given. @@ -2387,7 +2388,7 @@ static int img_convert(int argc, char **argv) * to allow filenames in option syntax */ s.target =3D img_open_file(out_filename, open_opts, out_fmt, - flags, writethrough, quiet, false); + flags, writethrough, s.quiet, false); open_opts =3D NULL; /* blk_new_open will have freed it */ } if (!s.target) { --=20 2.19.2