[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 14/20] qemu-img: Move quiet into ImgConvertState
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 14/20] qemu-img: Move quiet into ImgConvertState |
Date: |
Fri, 14 Jun 2019 15:40:15 +0200 |
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
qemu-img.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index da14aea46a..e15e617256 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1581,6 +1581,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;
@@ -2012,7 +2013,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;
@@ -2120,7 +2121,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;
@@ -2209,7 +2210,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);
@@ -2220,7 +2221,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;
@@ -2383,7 +2384,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.
@@ -2391,7 +2392,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.21.0
- [Qemu-devel] [PULL 06/20] event_match: always match on None value, (continued)
- [Qemu-devel] [PULL 06/20] event_match: always match on None value, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 03/20] QEMUMachine: add events_wait method, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 09/20] hw/block/fdc: floppy command FIFO memory initialization, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 08/20] iotests: Fix intermittent failure in 219, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 05/20] iotests: add iotest 256 for testing blockdev-backup across iothread contexts, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 07/20] iotests: Filter 175's allocation information, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 10/20] iotests: restrict 254 to support only qcow2, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 11/20] qemu-img: Fix options leakage in img_rebase(), Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 12/20] qapi/block-core: Overlays are not snapshots, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 13/20] blockdev: Overlays are not snapshots, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 14/20] qemu-img: Move quiet into ImgConvertState,
Max Reitz <=
- [Qemu-devel] [PULL 15/20] qemu-img: Add salvaging mode to convert, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 16/20] blkdebug: Add @iotype error option, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 18/20] blkdebug: Inject errors on .bdrv_co_block_status(), Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 19/20] iotests: Test qemu-img convert --salvage, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 17/20] blkdebug: Add "none" event, Max Reitz, 2019/06/14
- [Qemu-devel] [PULL 20/20] iotests: Test qemu-img convert -C --salvage, Max Reitz, 2019/06/14
- Re: [Qemu-devel] [PULL 00/20] Block patches, Peter Maydell, 2019/06/14