From: Max Reitz <mreitz@redhat.com> To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>, Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>, Eric Blake <eblake@redhat.com>, Kevin Wolf <kwolf@redhat.com>, "Denis V . Lunev" <den@openvz.org> Subject: [Qemu-devel] [PATCH v3 1/7] qemu-img: Move quiet into ImgConvertState Date: Sat, 13 Apr 2019 18:53:37 +0200 [thread overview] Message-ID: <20190413165343.9018-2-mreitz@redhat.com> (raw) In-Reply-To: <20190413165343.9018-1-mreitz@redhat.com> 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 <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> --- 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 = NULL; char *options = NULL; Error *local_err = NULL; - bool writethrough, src_writethrough, quiet = false, image_opts = false, + bool writethrough, src_writethrough, image_opts = false, skip_create = false, progress = false, tgt_image_opts = false; int64_t ret = -EINVAL; bool force_share = false; @@ -2113,7 +2114,7 @@ static int img_convert(int argc, char **argv) src_cache = optarg; break; case 'q': - quiet = true; + s.quiet = true; break; case 'n': skip_create = true; @@ -2202,7 +2203,7 @@ static int img_convert(int argc, char **argv) } /* Initialize before goto out */ - if (quiet) { + if (s.quiet) { progress = false; } qemu_progress_init(progress, 1.0); @@ -2213,7 +2214,7 @@ static int img_convert(int argc, char **argv) for (bs_i = 0; bs_i < s.src_num; bs_i++) { s.src[bs_i] = 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 = -1; @@ -2376,7 +2377,7 @@ static int img_convert(int argc, char **argv) if (skip_create) { s.target = 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 = img_open_file(out_filename, open_opts, out_fmt, - flags, writethrough, quiet, false); + flags, writethrough, s.quiet, false); open_opts = NULL; /* blk_new_open will have freed it */ } if (!s.target) { -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Max Reitz <mreitz@redhat.com> To: qemu-block@nongnu.org Cc: Kevin Wolf <kwolf@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>, qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>, "Denis V . Lunev" <den@openvz.org>, Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> Subject: [Qemu-devel] [PATCH v3 1/7] qemu-img: Move quiet into ImgConvertState Date: Sat, 13 Apr 2019 18:53:37 +0200 [thread overview] Message-ID: <20190413165343.9018-2-mreitz@redhat.com> (raw) Message-ID: <20190413165337.UWbPaY3aJh8Zz_xT6yoO-uoB8aCJFOV_p9-RYkJ4HUU@z> (raw) In-Reply-To: <20190413165343.9018-1-mreitz@redhat.com> 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 <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> --- 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 = NULL; char *options = NULL; Error *local_err = NULL; - bool writethrough, src_writethrough, quiet = false, image_opts = false, + bool writethrough, src_writethrough, image_opts = false, skip_create = false, progress = false, tgt_image_opts = false; int64_t ret = -EINVAL; bool force_share = false; @@ -2113,7 +2114,7 @@ static int img_convert(int argc, char **argv) src_cache = optarg; break; case 'q': - quiet = true; + s.quiet = true; break; case 'n': skip_create = true; @@ -2202,7 +2203,7 @@ static int img_convert(int argc, char **argv) } /* Initialize before goto out */ - if (quiet) { + if (s.quiet) { progress = false; } qemu_progress_init(progress, 1.0); @@ -2213,7 +2214,7 @@ static int img_convert(int argc, char **argv) for (bs_i = 0; bs_i < s.src_num; bs_i++) { s.src[bs_i] = 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 = -1; @@ -2376,7 +2377,7 @@ static int img_convert(int argc, char **argv) if (skip_create) { s.target = 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 = img_open_file(out_filename, open_opts, out_fmt, - flags, writethrough, quiet, false); + flags, writethrough, s.quiet, false); open_opts = NULL; /* blk_new_open will have freed it */ } if (!s.target) { -- 2.20.1
next prev parent reply other threads:[~2019-04-13 16:53 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-13 16:53 [Qemu-devel] [PATCH v3 0/7] qemu-img: Add salvaging mode to convert Max Reitz 2019-04-13 16:53 ` Max Reitz 2019-04-13 16:53 ` Max Reitz [this message] 2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 1/7] qemu-img: Move quiet into ImgConvertState Max Reitz 2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 2/7] qemu-img: Add salvaging mode to convert Max Reitz 2019-04-13 16:53 ` Max Reitz 2019-04-16 6:40 ` Vladimir Sementsov-Ogievskiy 2019-04-16 6:40 ` Vladimir Sementsov-Ogievskiy 2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 3/7] blkdebug: Add @iotype error option Max Reitz 2019-04-13 16:53 ` Max Reitz 2019-04-16 7:18 ` Vladimir Sementsov-Ogievskiy 2019-04-16 7:18 ` Vladimir Sementsov-Ogievskiy 2019-04-17 16:36 ` Max Reitz 2019-04-17 16:36 ` Max Reitz 2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 4/7] blkdebug: Add "none" event Max Reitz 2019-04-13 16:53 ` Max Reitz 2019-04-16 7:21 ` Vladimir Sementsov-Ogievskiy 2019-04-16 7:21 ` Vladimir Sementsov-Ogievskiy 2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 5/7] blkdebug: Inject errors on .bdrv_co_block_status() Max Reitz 2019-04-13 16:53 ` Max Reitz 2019-04-16 7:23 ` Vladimir Sementsov-Ogievskiy 2019-04-16 7:23 ` Vladimir Sementsov-Ogievskiy 2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 6/7] iotests: Test qemu-img convert --salvage Max Reitz 2019-04-13 16:53 ` Max Reitz 2019-04-16 8:02 ` Vladimir Sementsov-Ogievskiy 2019-04-16 8:02 ` Vladimir Sementsov-Ogievskiy 2019-04-17 16:42 ` Max Reitz 2019-04-17 16:42 ` Max Reitz 2019-04-24 15:21 ` Thomas Huth 2019-04-24 15:21 ` Thomas Huth 2019-04-13 16:53 ` [Qemu-devel] [PATCH v3 7/7] iotests: Test qemu-img convert -C --salvage Max Reitz 2019-04-13 16:53 ` Max Reitz 2019-04-16 8:13 ` Vladimir Sementsov-Ogievskiy 2019-04-16 8:13 ` Vladimir Sementsov-Ogievskiy 2019-04-17 16:43 ` Max Reitz 2019-04-17 16:43 ` Max Reitz
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190413165343.9018-2-mreitz@redhat.com \ --to=mreitz@redhat.com \ --cc=andrey.shinkevich@virtuozzo.com \ --cc=den@openvz.org \ --cc=eblake@redhat.com \ --cc=kwolf@redhat.com \ --cc=qemu-block@nongnu.org \ --cc=qemu-devel@nongnu.org \ --cc=vsementsov@virtuozzo.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.