diff options
author | Max Reitz <mreitz@redhat.com> | 2015-02-05 13:58:12 -0500 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2015-02-16 15:07:18 +0000 |
commit | b65a5e12a4136b20f9d06675d597b52d64ac903c (patch) | |
tree | 1862586786ade94a6852bdd63ea1cfbb8d164037 /qemu-img.c | |
parent | ca49a4fdb39d7b00b20e8500cba11aedc87755bd (diff) |
block: Add Error parameter to bdrv_find_protocol()
The argument given to bdrv_find_protocol() is just a file name, which
makes it difficult for the caller to reconstruct what protocol
bdrv_find_protocol() was hoping to find. This patch adds an Error
parameter to that function to solve this issue.
Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1423162705-32065-4-git-send-email-mreitz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r-- | qemu-img.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/qemu-img.c b/qemu-img.c index 26ec3c16aa..87905463be 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -261,6 +261,7 @@ static int print_block_option_help(const char *filename, const char *fmt) { BlockDriver *drv, *proto_drv; QemuOptsList *create_opts = NULL; + Error *local_err = NULL; /* Find driver and parse its options */ drv = bdrv_find_format(fmt); @@ -271,9 +272,10 @@ static int print_block_option_help(const char *filename, const char *fmt) create_opts = qemu_opts_append(create_opts, drv->create_opts); if (filename) { - proto_drv = bdrv_find_protocol(filename, true); + proto_drv = bdrv_find_protocol(filename, true, &local_err); if (!proto_drv) { - error_report("Unknown protocol '%s'", filename); + qerror_report_err(local_err); + error_free(local_err); qemu_opts_free(create_opts); return 1; } @@ -1524,9 +1526,10 @@ static int img_convert(int argc, char **argv) goto out; } - proto_drv = bdrv_find_protocol(out_filename, true); + proto_drv = bdrv_find_protocol(out_filename, true, &local_err); if (!proto_drv) { - error_report("Unknown protocol '%s'", out_filename); + qerror_report_err(local_err); + error_free(local_err); ret = -1; goto out; } |