aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2025-05-31 20:15:49 +0300
committerKevin Wolf <kwolf@redhat.com>2025-07-15 20:49:01 +0200
commitd1dcf1422440d9aa207d34e62e7a6b067b87f242 (patch)
treefa77a024be3448eeddcb8dd98d6cb51b5a77d5eb
parenta03cd2982d84c6901f3583e31ef12ac7fd170052 (diff)
downloadqemu-d1dcf1422440d9aa207d34e62e7a6b067b87f242.zip
qemu-d1dcf1422440d9aa207d34e62e7a6b067b87f242.tar.gz
qemu-d1dcf1422440d9aa207d34e62e7a6b067b87f242.tar.bz2
qemu-img: check: refresh options/--help
Add missing long options and --help output, reorder options for consistency. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20250531171609.197078-8-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--qemu-img.c60
1 files changed, 41 insertions, 19 deletions
diff --git a/qemu-img.c b/qemu-img.c
index b60b4d3..d310f0d 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -805,31 +805,57 @@ static int img_check(const img_cmd_t *ccmd, int argc, char **argv)
static const struct option long_options[] = {
{"help", no_argument, 0, 'h'},
{"format", required_argument, 0, 'f'},
+ {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS},
+ {"cache", required_argument, 0, 'T'},
{"repair", required_argument, 0, 'r'},
+ {"force-share", no_argument, 0, 'U'},
{"output", required_argument, 0, OPTION_OUTPUT},
+ {"quiet", no_argument, 0, 'q'},
{"object", required_argument, 0, OPTION_OBJECT},
- {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS},
- {"force-share", no_argument, 0, 'U'},
{0, 0, 0, 0}
};
- c = getopt_long(argc, argv, ":hf:r:T:qU",
+ c = getopt_long(argc, argv, "hf:T:r:Uq",
long_options, &option_index);
if (c == -1) {
break;
}
switch(c) {
- case ':':
- missing_argument(argv[optind - 1]);
- break;
- case '?':
- unrecognized_option(argv[optind - 1]);
- break;
case 'h':
- help();
+ cmd_help(ccmd, "[-f FMT | --image-opts] [-T CACHE_MODE] [-r leaks|all]\n"
+" [-U] [--output human|json] [-q] [--object OBJDEF] FILE\n"
+,
+" -f, --format FMT\n"
+" specifies the format of the image explicitly (default: probing is used)\n"
+" --image-opts\n"
+" treat FILE as an option string (key=value,..), not a file name\n"
+" (incompatible with -f|--format)\n"
+" -T, --cache CACHE_MODE\n" /* why not -t ? */
+" cache mode (default: " BDRV_DEFAULT_CACHE ")\n"
+" -r, --repair leaks|all\n"
+" repair errors of the given category in the image (image will be\n"
+" opened in read-write mode, incompatible with -U|--force-share)\n"
+" -U, --force-share\n"
+" open image in shared mode for concurrent access\n"
+" --output human|json\n"
+" output format (default: human)\n"
+" -q, --quiet\n"
+" quiet mode (produce only error messages if any)\n"
+" --object OBJDEF\n"
+" defines QEMU user-creatable object\n"
+" FILE\n"
+" name of the image file, or an option string (key=value,..)\n"
+" with --image-opts, to operate on\n"
+);
break;
case 'f':
fmt = optarg;
break;
+ case OPTION_IMAGE_OPTS:
+ image_opts = true;
+ break;
+ case 'T':
+ cache = optarg;
+ break;
case 'r':
flags |= BDRV_O_RDWR;
@@ -842,24 +868,20 @@ static int img_check(const img_cmd_t *ccmd, int argc, char **argv)
"(expecting 'leaks' or 'all'): %s", optarg);
}
break;
+ case 'U':
+ force_share = true;
+ break;
case OPTION_OUTPUT:
output_format = parse_output_format(argv[0], optarg);
break;
- case 'T':
- cache = optarg;
- break;
case 'q':
quiet = true;
break;
- case 'U':
- force_share = true;
- break;
case OPTION_OBJECT:
user_creatable_process_cmdline(optarg);
break;
- case OPTION_IMAGE_OPTS:
- image_opts = true;
- break;
+ default:
+ tryhelp(argv[0]);
}
}
if (optind != argc - 1) {