diff options
author | Max Reitz <mreitz@redhat.com> | 2013-09-06 17:14:26 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-09-12 10:12:48 +0200 |
commit | cc84d90ff54c025190dbe49ec5fea1268217c5f2 (patch) | |
tree | 44541b52ece4f55b5678087f83f3eb6cd91774aa /block | |
parent | 34b5d2c68eb4082c288e70fb99c61af8f7b96fde (diff) |
block: Error parameter for create functions
Add an Error ** parameter to bdrv_create and its associated functions to
allow more specific error messages.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/cow.c | 4 | ||||
-rw-r--r-- | block/qcow.c | 4 | ||||
-rw-r--r-- | block/qcow2.c | 2 | ||||
-rw-r--r-- | block/qed.c | 4 | ||||
-rw-r--r-- | block/raw_bsd.c | 10 | ||||
-rw-r--r-- | block/vvfat.c | 4 |
6 files changed, 22 insertions, 6 deletions
diff --git a/block/cow.c b/block/cow.c index 3a93ed9966..909c3e7182 100644 --- a/block/cow.c +++ b/block/cow.c @@ -316,8 +316,10 @@ static int cow_create(const char *filename, QEMUOptionParameter *options, options++; } - ret = bdrv_create_file(filename, options); + ret = bdrv_create_file(filename, options, &local_err); if (ret < 0) { + qerror_report_err(local_err); + error_free(local_err); return ret; } diff --git a/block/qcow.c b/block/qcow.c index 396636f7b4..c470e05f60 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -684,8 +684,10 @@ static int qcow_create(const char *filename, QEMUOptionParameter *options, options++; } - ret = bdrv_create_file(filename, options); + ret = bdrv_create_file(filename, options, &local_err); if (ret < 0) { + qerror_report_err(local_err); + error_free(local_err); return ret; } diff --git a/block/qcow2.c b/block/qcow2.c index dabfe8d08b..b257347c3a 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1365,7 +1365,7 @@ static int qcow2_create2(const char *filename, int64_t total_size, uint8_t* refcount_table; int ret; - ret = bdrv_create_file(filename, options); + ret = bdrv_create_file(filename, options, NULL); if (ret < 0) { return ret; } diff --git a/block/qed.c b/block/qed.c index f17094cb92..6c0cba04f3 100644 --- a/block/qed.c +++ b/block/qed.c @@ -555,8 +555,10 @@ static int qed_create(const char *filename, uint32_t cluster_size, int ret = 0; BlockDriverState *bs = NULL; - ret = bdrv_create_file(filename, NULL); + ret = bdrv_create_file(filename, NULL, &local_err); if (ret < 0) { + qerror_report_err(local_err); + error_free(local_err); return ret; } diff --git a/block/raw_bsd.c b/block/raw_bsd.c index 7d75ad282f..d4ace6020b 100644 --- a/block/raw_bsd.c +++ b/block/raw_bsd.c @@ -133,7 +133,15 @@ static int raw_has_zero_init(BlockDriverState *bs) static int raw_create(const char *filename, QEMUOptionParameter *options, Error **errp) { - return bdrv_create_file(filename, options); + Error *local_err = NULL; + int ret; + + ret = bdrv_create_file(filename, options, &local_err); + if (error_is_set(&local_err)) { + qerror_report_err(local_err); + error_free(local_err); + } + return ret; } static int raw_open(BlockDriverState *bs, QDict *options, int flags, diff --git a/block/vvfat.c b/block/vvfat.c index 788d0630fd..3ddaa0bcce 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2928,8 +2928,10 @@ static int enable_write_target(BDRVVVFATState *s) set_option_parameter_int(options, BLOCK_OPT_SIZE, s->sector_count * 512); set_option_parameter(options, BLOCK_OPT_BACKING_FILE, "fat:"); - ret = bdrv_create(bdrv_qcow, s->qcow_filename, options); + ret = bdrv_create(bdrv_qcow, s->qcow_filename, options, &local_err); if (ret < 0) { + qerror_report_err(local_err); + error_free(local_err); goto err; } |