From nobody Mon Feb 9 07:55:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555174562; cv=none; d=zoho.com; s=zohoarc; b=RSHJ5rR1MypHXuzsOzqeAe2wY6sjl8V4GBUbmj0SKAJbhjoAkECx/RkkNO6EjzUfDsFwREtHYwFTybTUy5WSGppb8sPqknM/B+mEZeEqWOZed9PySVxeV7ga1DusnMuDNh/vKrw5H3gKIr7mCVhfDiTb3adtH2FSP5uoNS9Ui9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555174562; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=EIXWufkR5OXH0mTZKCprrpFQLSfY8JdxeB0p5GiPqxU=; b=mnIEALOiVA85rzA3xlMjkAXoPjI4GCxF+5qWkHMbvJTfKTENL+P0WL6hx6AaOAUZryu1g4Lq0UB3ccFKBOMqZIFP7Km5pYSIuPnfSnY8LLjvftrO50nRKrgoT+UhNl7EuWt+7k6AZ1btHsjcbyZNxI44RlJB1iQ1j/wCvo0kQWw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555174562934411.81897832599645; Sat, 13 Apr 2019 09:56:02 -0700 (PDT) Received: from localhost ([127.0.0.1]:53843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFLwT-0008FU-H1 for importer@patchew.org; Sat, 13 Apr 2019 12:55:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFLua-00074M-Mw for qemu-devel@nongnu.org; Sat, 13 Apr 2019 12:53:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFLuZ-0002fx-M1 for qemu-devel@nongnu.org; Sat, 13 Apr 2019 12:53:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40572) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hFLuX-0002cP-5H; Sat, 13 Apr 2019 12:53:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7271FC05D266; Sat, 13 Apr 2019 16:53:48 +0000 (UTC) Received: from localhost (ovpn-204-66.brq.redhat.com [10.40.204.66]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 099BF60C18; Sat, 13 Apr 2019 16:53:47 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Sat, 13 Apr 2019 18:53:37 +0200 Message-Id: <20190413165343.9018-2-mreitz@redhat.com> In-Reply-To: <20190413165343.9018-1-mreitz@redhat.com> References: <20190413165343.9018-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 13 Apr 2019 16:53:48 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 1/7] 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 , Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org, Max Reitz , "Denis V . Lunev" , Andrey Shinkevich 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 Reviewed-by: Vladimir Sementsov-Ogievskiy --- qemu-img.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index aa6f81f1ea..c53666aa41 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; @@ -2005,7 +2006,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; @@ -2113,7 +2114,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; @@ -2202,7 +2203,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); @@ -2213,7 +2214,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; @@ -2376,7 +2377,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. @@ -2384,7 +2385,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.20.1