" options are: 'none', 'writeback' (default, except for convert), 'writethrough',\n"
" 'directsync' and 'unsafe' (default for convert)\n"
" 'size' is the disk image size in bytes. Optional suffixes\n"
- " 'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' (gigabyte, 1024M)\n"
- " and T (terabyte, 1024G) are supported. 'b' is ignored.\n"
+ " 'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' (gigabyte, 1024M),\n"
+ " 'T' (terabyte, 1024G), 'P' (petabyte, 1024T) and 'E' (exabyte, 1024P) are\n"
+ " supported. 'b' is ignored.\n"
" 'output_filename' is the destination disk image filename\n"
" 'output_fmt' is the destination format\n"
" 'options' is a comma separated list of format specific options in a\n"
exit(1);
}
-static int qprintf(bool quiet, const char *fmt, ...)
+static int GCC_FMT_ATTR(2, 3) qprintf(bool quiet, const char *fmt, ...)
{
int ret = 0;
if (!quiet) {
return 1;
}
- proto_drv = bdrv_find_protocol(filename);
+ proto_drv = bdrv_find_protocol(filename, true);
if (!proto_drv) {
error_report("Unknown protocol '%s'", filename);
return 1;
error_report("Image size must be less than 8 EiB!");
} else {
error_report("Invalid image size specified! You may use k, M, "
- "G or T suffixes for ");
- error_report("kilobytes, megabytes, gigabytes and terabytes.");
+ "G, T, P or E suffixes for ");
+ error_report("kilobytes, megabytes, gigabytes, terabytes, "
+ "petabytes and exabytes.");
}
return 1;
}
img_size = (uint64_t)sval;
}
+ if (optind != argc) {
+ help();
+ }
if (options && is_help_option(options)) {
return print_block_option_help(filename, fmt);
break;
}
}
- if (optind >= argc) {
+ if (optind != argc - 1) {
help();
}
filename = argv[optind++];
break;
}
}
- if (optind >= argc) {
+ if (optind != argc - 1) {
help();
}
filename = argv[optind++];
}
- if (optind > argc - 2) {
+ if (optind != argc - 2) {
help();
}
filename1 = argv[optind++];
goto out;
}
- proto_drv = bdrv_find_protocol(out_filename);
+ proto_drv = bdrv_find_protocol(out_filename, true);
if (!proto_drv) {
error_report("Unknown protocol '%s'", out_filename);
ret = -1;
ImageInfoList *head = NULL;
ImageInfoList **last = &head;
GHashTable *filenames;
+ Error *err = NULL;
filenames = g_hash_table_new_full(g_str_hash, str_equal_func, NULL, NULL);
goto err;
}
- info = g_new0(ImageInfo, 1);
- bdrv_collect_image_info(bs, info, filename);
- bdrv_collect_snapshots(bs, info);
+ bdrv_query_image_info(bs, &info, &err);
+ if (error_is_set(&err)) {
+ error_report("%s", error_get_pretty(err));
+ error_free(err);
+ goto err;
+ }
elem = g_new0(ImageInfoList, 1);
elem->value = info;
break;
}
}
- if (optind >= argc) {
+ if (optind != argc - 1) {
help();
}
filename = argv[optind++];
}
}
- if (optind >= argc) {
+ if (optind != argc - 1) {
help();
}
filename = argv[optind++];
progress = 0;
}
- if ((optind >= argc) || (!unsafe && !out_baseimg)) {
+ if ((optind != argc - 1) || (!unsafe && !out_baseimg)) {
help();
}
filename = argv[optind++];
break;
}
}
- if (optind >= argc) {
+ if (optind != argc - 1) {
help();
}
filename = argv[optind++];
const img_cmd_t *cmd;
const char *cmdname;
+#ifdef CONFIG_POSIX
+ signal(SIGPIPE, SIG_IGN);
+#endif
+
error_set_progname(argv[0]);
qemu_init_main_loop();