aboutsummaryrefslogtreecommitdiff
path: root/block/vmdk.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 /block/vmdk.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 'block/vmdk.c')
-rw-r--r--block/vmdk.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index a98da086a7..96ef1b534e 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -697,6 +697,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
int64_t flat_offset;
char extent_path[PATH_MAX];
BlockDriverState *extent_file;
+ Error *local_err = NULL;
while (*p) {
/* parse extent line:
@@ -726,8 +727,11 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
path_combine(extent_path, sizeof(extent_path),
desc_file_path, fname);
- ret = bdrv_file_open(&extent_file, extent_path, NULL, bs->open_flags);
+ ret = bdrv_file_open(&extent_file, extent_path, NULL, bs->open_flags,
+ &local_err);
if (ret) {
+ qerror_report_err(local_err);
+ error_free(local_err);
return ret;
}
@@ -1591,6 +1595,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
"ddb.geometry.heads = \"%d\"\n"
"ddb.geometry.sectors = \"63\"\n"
"ddb.adapterType = \"%s\"\n";
+ Error *local_err = NULL;
if (filename_decompose(filename, path, prefix, postfix, PATH_MAX)) {
return -EINVAL;
@@ -1653,8 +1658,10 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
}
if (backing_file) {
BlockDriverState *bs = bdrv_new("");
- ret = bdrv_open(bs, backing_file, NULL, 0, NULL);
+ ret = bdrv_open(bs, backing_file, NULL, 0, NULL, &local_err);
if (ret != 0) {
+ qerror_report_err(local_err);
+ error_free(local_err);
bdrv_unref(bs);
return ret;
}