[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/23] qemu-img: make -l (list) the default for "snapshot" subcom
From: |
Michael Tokarev |
Subject: |
[PATCH 12/23] qemu-img: make -l (list) the default for "snapshot" subcommand |
Date: |
Sat, 10 Feb 2024 00:22:33 +0300 |
also remove bdrv_oflags handling (only list can use RO mode)
---
qemu-img.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 1e09b78d00..d9dfff2f07 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3541,7 +3541,7 @@ static int img_snapshot(const img_cmd_t *ccmd, int argc,
char **argv)
BlockDriverState *bs;
QEMUSnapshotInfo sn;
char *filename, *fmt = NULL, *snapshot_name = NULL;
- int c, ret = 0, bdrv_oflags;
+ int c, ret = 0;
int action = 0;
bool quiet = false;
Error *err = NULL;
@@ -3549,7 +3549,6 @@ static int img_snapshot(const img_cmd_t *ccmd, int argc,
char **argv)
bool force_share = false;
int64_t rt;
- bdrv_oflags = BDRV_O_RDWR;
/* Parse commandline parameters */
for(;;) {
static const struct option long_options[] = {
@@ -3583,7 +3582,6 @@ static int img_snapshot(const img_cmd_t *ccmd, int argc,
char **argv)
return 0;
}
action = SNAPSHOT_LIST;
- bdrv_oflags &= ~BDRV_O_RDWR; /* no need for RW */
break;
case 'a':
if (action) {
@@ -3629,9 +3627,14 @@ static int img_snapshot(const img_cmd_t *ccmd, int argc,
char **argv)
}
filename = argv[optind++];
+ if (!action) {
+ action = SNAPSHOT_LIST;
+ }
+
/* Open the image */
- blk = img_open(image_opts, filename, fmt, bdrv_oflags, false, quiet,
- force_share);
+ blk = img_open(image_opts, filename, fmt,
+ action == SNAPSHOT_LIST ? 0 : BDRV_O_RDWR,
+ false, quiet, force_share);
if (!blk) {
return 1;
}
--
2.39.2
- [PATCH 10/23] qemu-img: refresh options/--help for "map" command, (continued)
- [PATCH 10/23] qemu-img: refresh options/--help for "map" command, Michael Tokarev, 2024/02/09
- [PATCH 11/23] qemu-img: allow specifying -f fmt for snapshot subcommand, Michael Tokarev, 2024/02/09
- [PATCH 13/23] qemu-img: refresh options/--help for "snapshot" command, Michael Tokarev, 2024/02/09
- [PATCH 14/23] qemu-img: refresh options/--help for "rebase" command, Michael Tokarev, 2024/02/09
- [PATCH 15/23] qemu-img: resize: do not always eat last argument, Michael Tokarev, 2024/02/09
- [PATCH 16/23] qemu-img: refresh options/--help for "resize" command, Michael Tokarev, 2024/02/09
- [PATCH 12/23] qemu-img: make -l (list) the default for "snapshot" subcommand,
Michael Tokarev <=
- [PATCH 17/23] qemu-img: refresh options/--help for "amend" command, Michael Tokarev, 2024/02/09
- [PATCH 18/23] qemu-img: refresh options/--help for "bench" command, Michael Tokarev, 2024/02/09
- [PATCH 19/23] qemu-img: refresh options/--help for "bitmap" command, Michael Tokarev, 2024/02/09
- [PATCH 20/23] qemu-img: refresh options/--help for "dd" command, Michael Tokarev, 2024/02/09
- [PATCH 21/23] qemu-img: refresh options/--help for "measure" command, Michael Tokarev, 2024/02/09
- [PATCH 22/23] qemu-img: implement short --help, remove global help() function, Michael Tokarev, 2024/02/09