Revision 4ac8aacd
b/qemu-img.c | ||
---|---|---|
188 | 188 |
} |
189 | 189 |
#endif |
190 | 190 |
|
191 |
static int print_block_option_help(const char *filename, const char *fmt) |
|
192 |
{ |
|
193 |
BlockDriver *drv, *proto_drv; |
|
194 |
QEMUOptionParameter *create_options = NULL; |
|
195 |
|
|
196 |
/* Find driver and parse its options */ |
|
197 |
drv = bdrv_find_format(fmt); |
|
198 |
if (!drv) { |
|
199 |
error("Unknown file format '%s'", fmt); |
|
200 |
return 1; |
|
201 |
} |
|
202 |
|
|
203 |
proto_drv = bdrv_find_protocol(filename); |
|
204 |
if (!proto_drv) { |
|
205 |
error("Unknown protocol '%s'", filename); |
|
206 |
return 1; |
|
207 |
} |
|
208 |
|
|
209 |
create_options = append_option_parameters(create_options, |
|
210 |
drv->create_options); |
|
211 |
create_options = append_option_parameters(create_options, |
|
212 |
proto_drv->create_options); |
|
213 |
print_option_help(create_options); |
|
214 |
free_option_parameters(create_options); |
|
215 |
return 0; |
|
216 |
} |
|
217 |
|
|
191 | 218 |
static BlockDriverState *bdrv_new_open(const char *filename, |
192 | 219 |
const char *fmt, |
193 | 220 |
int flags) |
... | ... | |
310 | 337 |
help(); |
311 | 338 |
filename = argv[optind++]; |
312 | 339 |
|
340 |
if (options && !strcmp(options, "?")) { |
|
341 |
ret = print_block_option_help(filename, fmt); |
|
342 |
goto out; |
|
343 |
} |
|
344 |
|
|
313 | 345 |
/* Find driver and parse its options */ |
314 | 346 |
drv = bdrv_find_format(fmt); |
315 | 347 |
if (!drv) { |
... | ... | |
328 | 360 |
create_options = append_option_parameters(create_options, |
329 | 361 |
proto_drv->create_options); |
330 | 362 |
|
331 |
if (options && !strcmp(options, "?")) { |
|
332 |
print_option_help(create_options); |
|
333 |
goto out; |
|
334 |
} |
|
335 |
|
|
336 | 363 |
/* Create parameter list with default values */ |
337 | 364 |
param = parse_option_parameters("", create_options, param); |
338 | 365 |
set_option_parameter_int(param, BLOCK_OPT_SIZE, -1); |
... | ... | |
694 | 721 |
|
695 | 722 |
out_filename = argv[argc - 1]; |
696 | 723 |
|
724 |
if (options && !strcmp(options, "?")) { |
|
725 |
ret = print_block_option_help(out_filename, out_fmt); |
|
726 |
goto out; |
|
727 |
} |
|
728 |
|
|
697 | 729 |
if (bs_n > 1 && out_baseimg) { |
698 | 730 |
error("-B makes no sense when concatenating multiple input images"); |
699 | 731 |
ret = -1; |
... | ... | |
746 | 778 |
drv->create_options); |
747 | 779 |
create_options = append_option_parameters(create_options, |
748 | 780 |
proto_drv->create_options); |
749 |
if (options && !strcmp(options, "?")) { |
|
750 |
print_option_help(create_options); |
|
751 |
goto out; |
|
752 |
} |
|
753 | 781 |
|
754 | 782 |
if (options) { |
755 | 783 |
param = parse_option_parameters(options, create_options, param); |
Also available in: Unified diff