mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
qemu-img: Print available options with -o ?
This patch adds a small help text to each of the options in the block drivers which can be displayed by using qemu-img create -f fmt -o ? Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
f425c27872
commit
db08adf526
10 changed files with 110 additions and 19 deletions
18
qemu-img.c
18
qemu-img.c
|
@ -281,15 +281,17 @@ static int img_create(int argc, char **argv)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (optind >= argc)
|
||||
help();
|
||||
filename = argv[optind++];
|
||||
|
||||
/* Find driver and parse its options */
|
||||
drv = bdrv_find_format(fmt);
|
||||
if (!drv)
|
||||
error("Unknown file format '%s'", fmt);
|
||||
|
||||
if (options && !strcmp(options, "?")) {
|
||||
print_option_help(drv->create_options);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (options) {
|
||||
param = parse_option_parameters(options, drv->create_options, param);
|
||||
if (param == NULL) {
|
||||
|
@ -299,6 +301,11 @@ static int img_create(int argc, char **argv)
|
|||
param = parse_option_parameters("", drv->create_options, param);
|
||||
}
|
||||
|
||||
/* Get the filename */
|
||||
if (optind >= argc)
|
||||
help();
|
||||
filename = argv[optind++];
|
||||
|
||||
/* Add size to parameters */
|
||||
if (optind < argc) {
|
||||
set_option_parameter(param, BLOCK_OPT_SIZE, argv[optind++]);
|
||||
|
@ -596,6 +603,11 @@ static int img_convert(int argc, char **argv)
|
|||
if (!drv)
|
||||
error("Unknown file format '%s'", out_fmt);
|
||||
|
||||
if (options && !strcmp(options, "?")) {
|
||||
print_option_help(drv->create_options);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (options) {
|
||||
param = parse_option_parameters(options, drv->create_options, param);
|
||||
if (param == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue