diff options
author | Max Reitz <mreitz@redhat.com> | 2013-09-05 14:26:05 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-09-12 10:12:48 +0200 |
commit | d5124c00d80b4d948509f2c7f6b54228d9981f75 (patch) | |
tree | 522995c8e7db4cc07ff1b4265ffeb78105f0f2b7 /block | |
parent | 015a1036a74ad29bb6916754911ce25587ff4db3 (diff) |
bdrv: Use "Error" for creating images
Add an Error ** parameter to BlockDriver.bdrv_create to allow more
specific error messages.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/cow.c | 3 | ||||
-rw-r--r-- | block/gluster.c | 2 | ||||
-rw-r--r-- | block/iscsi.c | 3 | ||||
-rw-r--r-- | block/qcow.c | 3 | ||||
-rw-r--r-- | block/qcow2.c | 3 | ||||
-rw-r--r-- | block/qed.c | 3 | ||||
-rw-r--r-- | block/raw-posix.c | 6 | ||||
-rw-r--r-- | block/raw-win32.c | 3 | ||||
-rw-r--r-- | block/raw_bsd.c | 3 | ||||
-rw-r--r-- | block/rbd.c | 3 | ||||
-rw-r--r-- | block/sheepdog.c | 3 | ||||
-rw-r--r-- | block/ssh.c | 3 | ||||
-rw-r--r-- | block/vdi.c | 3 | ||||
-rw-r--r-- | block/vmdk.c | 3 | ||||
-rw-r--r-- | block/vpc.c | 3 |
15 files changed, 31 insertions, 16 deletions
diff --git a/block/cow.c b/block/cow.c index 3ae1b5cdc9..e252c95601 100644 --- a/block/cow.c +++ b/block/cow.c @@ -295,7 +295,8 @@ static void cow_close(BlockDriverState *bs) { } -static int cow_create(const char *filename, QEMUOptionParameter *options) +static int cow_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { struct cow_header_v2 cow_header; struct stat st; diff --git a/block/gluster.c b/block/gluster.c index 6c7b000db6..256de10ed3 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -357,7 +357,7 @@ out: } static int qemu_gluster_create(const char *filename, - QEMUOptionParameter *options) + QEMUOptionParameter *options, Error **errp) { struct glfs *glfs; struct glfs_fd *fd; diff --git a/block/iscsi.c b/block/iscsi.c index 5f26e7379c..997b122141 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1238,7 +1238,8 @@ static int iscsi_has_zero_init(BlockDriverState *bs) return 0; } -static int iscsi_create(const char *filename, QEMUOptionParameter *options) +static int iscsi_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { int ret = 0; int64_t total_size = 0; diff --git a/block/qcow.c b/block/qcow.c index 2a1c9c9e87..0911edff6c 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -659,7 +659,8 @@ static void qcow_close(BlockDriverState *bs) error_free(s->migration_blocker); } -static int qcow_create(const char *filename, QEMUOptionParameter *options) +static int qcow_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { int header_size, backing_filename_len, l1_size, shift, i; QCowHeader header; diff --git a/block/qcow2.c b/block/qcow2.c index eda085cfd8..43edc5bd2a 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1468,7 +1468,8 @@ out: return ret; } -static int qcow2_create(const char *filename, QEMUOptionParameter *options) +static int qcow2_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { const char *backing_file = NULL; const char *backing_fmt = NULL; diff --git a/block/qed.c b/block/qed.c index 69e1834ff6..250fa89b0f 100644 --- a/block/qed.c +++ b/block/qed.c @@ -604,7 +604,8 @@ out: return ret; } -static int bdrv_qed_create(const char *filename, QEMUOptionParameter *options) +static int bdrv_qed_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { uint64_t image_size = 0; uint32_t cluster_size = QED_DEFAULT_CLUSTER_SIZE; diff --git a/block/raw-posix.c b/block/raw-posix.c index dcdf45c4ac..3ee5b62509 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1041,7 +1041,8 @@ static int64_t raw_get_allocated_file_size(BlockDriverState *bs) return (int64_t)st.st_blocks * 512; } -static int raw_create(const char *filename, QEMUOptionParameter *options) +static int raw_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { int fd; int result = 0; @@ -1506,7 +1507,8 @@ static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs, cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV); } -static int hdev_create(const char *filename, QEMUOptionParameter *options) +static int hdev_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { int fd; int ret = 0; diff --git a/block/raw-win32.c b/block/raw-win32.c index 80551b957c..1e7651be61 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -422,7 +422,8 @@ static int64_t raw_get_allocated_file_size(BlockDriverState *bs) return st.st_size; } -static int raw_create(const char *filename, QEMUOptionParameter *options) +static int raw_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { int fd; int64_t total_size = 0; diff --git a/block/raw_bsd.c b/block/raw_bsd.c index 2418f580cc..7d75ad282f 100644 --- a/block/raw_bsd.c +++ b/block/raw_bsd.c @@ -130,7 +130,8 @@ static int raw_has_zero_init(BlockDriverState *bs) return bdrv_has_zero_init(bs->file); } -static int raw_create(const char *filename, QEMUOptionParameter *options) +static int raw_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { return bdrv_create_file(filename, options); } diff --git a/block/rbd.c b/block/rbd.c index b77f73ca89..11086c35c4 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -287,7 +287,8 @@ static int qemu_rbd_set_conf(rados_t cluster, const char *conf) return ret; } -static int qemu_rbd_create(const char *filename, QEMUOptionParameter *options) +static int qemu_rbd_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { int64_t bytes = 0; int64_t objsize; diff --git a/block/sheepdog.c b/block/sheepdog.c index 1cfc6aedd5..a93a32a2ae 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1438,7 +1438,8 @@ out: return ret; } -static int sd_create(const char *filename, QEMUOptionParameter *options) +static int sd_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { int ret = 0; uint32_t vid = 0, base_vid = 0; diff --git a/block/ssh.c b/block/ssh.c index 23cd1f07e5..aa63c9d20e 100644 --- a/block/ssh.c +++ b/block/ssh.c @@ -651,7 +651,8 @@ static QEMUOptionParameter ssh_create_options[] = { { NULL } }; -static int ssh_create(const char *filename, QEMUOptionParameter *options) +static int ssh_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { int r, ret; Error *local_err = NULL; diff --git a/block/vdi.c b/block/vdi.c index dedbafb539..dcbc27c9cb 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -645,7 +645,8 @@ static int vdi_co_write(BlockDriverState *bs, return ret; } -static int vdi_create(const char *filename, QEMUOptionParameter *options) +static int vdi_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { int fd; int result = 0; diff --git a/block/vmdk.c b/block/vmdk.c index d60bf0cdf8..a98da086a7 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1552,7 +1552,8 @@ static int filename_decompose(const char *filename, char *path, char *prefix, return VMDK_OK; } -static int vmdk_create(const char *filename, QEMUOptionParameter *options) +static int vmdk_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { int fd, idx = 0; char desc[BUF_SIZE]; diff --git a/block/vpc.c b/block/vpc.c index ed00370bad..db61274332 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -684,7 +684,8 @@ static int create_fixed_disk(int fd, uint8_t *buf, int64_t total_size) return ret; } -static int vpc_create(const char *filename, QEMUOptionParameter *options) +static int vpc_create(const char *filename, QEMUOptionParameter *options, + Error **errp) { uint8_t buf[1024]; struct vhd_footer *footer = (struct vhd_footer *) buf; |