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) | |
download | qemu-d5124c00d80b4d948509f2c7f6b54228d9981f75.zip qemu-d5124c00d80b4d948509f2c7f6b54228d9981f75.tar.gz qemu-d5124c00d80b4d948509f2c7f6b54228d9981f75.tar.bz2 |
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 3ae1b5c..e252c95 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 6c7b000..256de10 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 5f26e73..997b122 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 2a1c9c9..0911edf 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 eda085c..43edc5b 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 69e1834..250fa89 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 dcdf45c..3ee5b62 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 80551b9..1e7651b 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 2418f58..7d75ad2 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 b77f73c..11086c3 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 1cfc6ae..a93a32a 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 23cd1f0..aa63c9d 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 dedbafb..dcbc27c 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 d60bf0c..a98da08 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 ed00370..db61274 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; |