aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2025-05-31 20:16:06 +0300
committerKevin Wolf <kwolf@redhat.com>2025-07-15 20:49:01 +0200
commit892b0abf971f1b7ce8b363616ec42cc6248096cf (patch)
tree8a33075dc4e6cc0240eb439472401d93467bece9
parent0668a468d2c1ee6783f53fb4ef6abc6d8f9f26b8 (diff)
downloadqemu-892b0abf971f1b7ce8b363616ec42cc6248096cf.zip
qemu-892b0abf971f1b7ce8b363616ec42cc6248096cf.tar.gz
qemu-892b0abf971f1b7ce8b363616ec42cc6248096cf.tar.bz2
qemu-img: dd: 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-25-mjt@tls.msk.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--qemu-img.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/qemu-img.c b/qemu-img.c
index d7f69c4..35c3d9a 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -5538,31 +5538,54 @@ static int img_dd(const img_cmd_t *ccmd, int argc, char **argv)
};
const struct option long_options[] = {
{ "help", no_argument, 0, 'h'},
- { "object", required_argument, 0, OPTION_OBJECT},
+ { "format", required_argument, 0, 'f'},
{ "image-opts", no_argument, 0, OPTION_IMAGE_OPTS},
+ { "output-format", required_argument, 0, 'O'},
{ "force-share", no_argument, 0, 'U'},
+ { "object", required_argument, 0, OPTION_OBJECT},
{ 0, 0, 0, 0 }
};
- while ((c = getopt_long(argc, argv, ":hf:O:U", long_options, NULL))) {
+ while ((c = getopt_long(argc, argv, "hf:O:U", long_options, NULL))) {
if (c == EOF) {
break;
}
switch (c) {
- case 'O':
- out_fmt = optarg;
+ case 'h':
+ cmd_help(ccmd, "[-f FMT|--image-opts] [-O OUTPUT_FMT] [-U]\n"
+" [--object OBJDEF] [bs=BLOCK_SIZE] [count=BLOCKS] if=INPUT of=OUTPUT\n"
+,
+" -f, --format FMT\n"
+" specify format for INPUT explicitly (default: probing is used)\n"
+" --image-opts\n"
+" treat INPUT as an option string (key=value,..), not a file name\n"
+" (incompatible with -f|--format)\n"
+" -O, --output-format OUTPUT_FMT\n"
+" format of the OUTPUT (default: raw)\n"
+" -U, --force-share\n"
+" open images in shared mode for concurrent access\n"
+" --object OBJDEF\n"
+" defines QEMU user-creatable object\n"
+" bs=BLOCK_SIZE[bKMGTP]\n"
+" size of the I/O block, with optional multiplier suffix (powers of 1024)\n"
+" (default: 512)\n"
+" count=COUNT\n"
+" number of blocks to convert (default whole INPUT)\n"
+" if=INPUT\n"
+" name of the file, or option string (key=value,..)\n"
+" with --image-opts, to use for input\n"
+" of=OUTPUT\n"
+" output file name to create (will be overridden if alrady exists)\n"
+);
break;
case 'f':
fmt = optarg;
break;
- case ':':
- missing_argument(argv[optind - 1]);
- break;
- case '?':
- unrecognized_option(argv[optind - 1]);
+ case OPTION_IMAGE_OPTS:
+ image_opts = true;
break;
- case 'h':
- help();
+ case 'O':
+ out_fmt = optarg;
break;
case 'U':
force_share = true;
@@ -5570,9 +5593,8 @@ static int img_dd(const img_cmd_t *ccmd, int argc, char **argv)
case OPTION_OBJECT:
user_creatable_process_cmdline(optarg);
break;
- case OPTION_IMAGE_OPTS:
- image_opts = true;
- break;
+ default:
+ tryhelp(argv[0]);
}
}