aboutsummaryrefslogtreecommitdiff
path: root/qemu-io.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2013-09-05 14:45:29 +0200
committerKevin Wolf <kwolf@redhat.com>2013-09-12 10:12:48 +0200
commit34b5d2c68eb4082c288e70fb99c61af8f7b96fde (patch)
tree7c4c1e4e248a8e044dd891b0e54de1fcc03d7434 /qemu-io.c
parentd5124c00d80b4d948509f2c7f6b54228d9981f75 (diff)
block: Error parameter for open functions
Add an Error ** parameter to bdrv_open, bdrv_file_open and associated functions to allow more specific error messages. Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/qemu-io.c b/qemu-io.c
index 71f4ff1302..f4b8efcceb 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -46,21 +46,27 @@ static const cmdinfo_t close_cmd = {
static int openfile(char *name, int flags, int growable)
{
+ Error *local_err = NULL;
+
if (qemuio_bs) {
fprintf(stderr, "file open already, try 'help close'\n");
return 1;
}
if (growable) {
- if (bdrv_file_open(&qemuio_bs, name, NULL, flags)) {
- fprintf(stderr, "%s: can't open device %s\n", progname, name);
+ if (bdrv_file_open(&qemuio_bs, name, NULL, flags, &local_err)) {
+ fprintf(stderr, "%s: can't open device %s: %s\n", progname, name,
+ error_get_pretty(local_err));
+ error_free(local_err);
return 1;
}
} else {
qemuio_bs = bdrv_new("hda");
- if (bdrv_open(qemuio_bs, name, NULL, flags, NULL) < 0) {
- fprintf(stderr, "%s: can't open device %s\n", progname, name);
+ if (bdrv_open(qemuio_bs, name, NULL, flags, NULL, &local_err) < 0) {
+ fprintf(stderr, "%s: can't open device %s: %s\n", progname, name,
+ error_get_pretty(local_err));
+ error_free(local_err);
bdrv_unref(qemuio_bs);
qemuio_bs = NULL;
return 1;