[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [v19 07/25] gluster.c: replace QEMUOptionParameter with Qem
From: |
Chunyan Liu |
Subject: |
[Qemu-devel] [v19 07/25] gluster.c: replace QEMUOptionParameter with QemuOpts |
Date: |
Mon, 20 Jan 2014 22:19:50 +0800 |
gluster.c: replace QEMUOptionParameter with QemuOpts
Signed-off-by: Dong Xu Wang <address@hidden>
Signed-off-by: Chunyan Liu <address@hidden>
---
block/gluster.c | 44 ++++++++++++++++++++++----------------------
1 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/block/gluster.c b/block/gluster.c
index 563d497..163ca58 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -357,7 +357,7 @@ out:
}
static int qemu_gluster_create(const char *filename,
- QEMUOptionParameter *options, Error **errp)
+ QemuOpts *opts, Error **errp)
{
struct glfs *glfs;
struct glfs_fd *fd;
@@ -371,12 +371,8 @@ static int qemu_gluster_create(const char *filename,
goto out;
}
- while (options && options->name) {
- if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
- total_size = options->value.n / BDRV_SECTOR_SIZE;
- }
- options++;
- }
+ total_size =
+ qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) / BDRV_SECTOR_SIZE;
fd = glfs_creat(glfs, gconf->image,
O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR);
@@ -598,13 +594,17 @@ static int qemu_gluster_has_zero_init(BlockDriverState
*bs)
return 0;
}
-static QEMUOptionParameter qemu_gluster_create_options[] = {
- {
- .name = BLOCK_OPT_SIZE,
- .type = OPT_SIZE,
- .help = "Virtual disk size"
- },
- { NULL }
+static QemuOptsList qemu_gluster_create_opts = {
+ .name = "qemu-gluster-create-opts",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_gluster_create_opts.head),
+ .desc = {
+ {
+ .name = BLOCK_OPT_SIZE,
+ .type = QEMU_OPT_SIZE,
+ .help = "Virtual disk size"
+ },
+ { /* end of list */ }
+ }
};
static BlockDriver bdrv_gluster = {
@@ -614,7 +614,7 @@ static BlockDriver bdrv_gluster = {
.bdrv_needs_filename = true,
.bdrv_file_open = qemu_gluster_open,
.bdrv_close = qemu_gluster_close,
- .bdrv_create = qemu_gluster_create,
+ .bdrv_create2 = qemu_gluster_create,
.bdrv_getlength = qemu_gluster_getlength,
.bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
.bdrv_truncate = qemu_gluster_truncate,
@@ -625,7 +625,7 @@ static BlockDriver bdrv_gluster = {
#ifdef CONFIG_GLUSTERFS_DISCARD
.bdrv_aio_discard = qemu_gluster_aio_discard,
#endif
- .create_options = qemu_gluster_create_options,
+ .create_opts = &qemu_gluster_create_opts,
};
static BlockDriver bdrv_gluster_tcp = {
@@ -635,7 +635,7 @@ static BlockDriver bdrv_gluster_tcp = {
.bdrv_needs_filename = true,
.bdrv_file_open = qemu_gluster_open,
.bdrv_close = qemu_gluster_close,
- .bdrv_create = qemu_gluster_create,
+ .bdrv_create2 = qemu_gluster_create,
.bdrv_getlength = qemu_gluster_getlength,
.bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
.bdrv_truncate = qemu_gluster_truncate,
@@ -646,7 +646,7 @@ static BlockDriver bdrv_gluster_tcp = {
#ifdef CONFIG_GLUSTERFS_DISCARD
.bdrv_aio_discard = qemu_gluster_aio_discard,
#endif
- .create_options = qemu_gluster_create_options,
+ .create_opts = &qemu_gluster_create_opts,
};
static BlockDriver bdrv_gluster_unix = {
@@ -656,7 +656,7 @@ static BlockDriver bdrv_gluster_unix = {
.bdrv_needs_filename = true,
.bdrv_file_open = qemu_gluster_open,
.bdrv_close = qemu_gluster_close,
- .bdrv_create = qemu_gluster_create,
+ .bdrv_create2 = qemu_gluster_create,
.bdrv_getlength = qemu_gluster_getlength,
.bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
.bdrv_truncate = qemu_gluster_truncate,
@@ -667,7 +667,7 @@ static BlockDriver bdrv_gluster_unix = {
#ifdef CONFIG_GLUSTERFS_DISCARD
.bdrv_aio_discard = qemu_gluster_aio_discard,
#endif
- .create_options = qemu_gluster_create_options,
+ .create_opts = &qemu_gluster_create_opts,
};
static BlockDriver bdrv_gluster_rdma = {
@@ -677,7 +677,7 @@ static BlockDriver bdrv_gluster_rdma = {
.bdrv_needs_filename = true,
.bdrv_file_open = qemu_gluster_open,
.bdrv_close = qemu_gluster_close,
- .bdrv_create = qemu_gluster_create,
+ .bdrv_create2 = qemu_gluster_create,
.bdrv_getlength = qemu_gluster_getlength,
.bdrv_get_allocated_file_size = qemu_gluster_allocated_file_size,
.bdrv_truncate = qemu_gluster_truncate,
@@ -688,7 +688,7 @@ static BlockDriver bdrv_gluster_rdma = {
#ifdef CONFIG_GLUSTERFS_DISCARD
.bdrv_aio_discard = qemu_gluster_aio_discard,
#endif
- .create_options = qemu_gluster_create_options,
+ .create_opts = &qemu_gluster_create_opts,
};
static void bdrv_gluster_init(void)
--
1.6.0.2
- [Qemu-devel] [v19 02/25] qapi: output def_value_str when query command line options, (continued)
- [Qemu-devel] [v19 02/25] qapi: output def_value_str when query command line options, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 03/25] improve some functions in qemu-option.c, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 06/25] cow.c: replace QEMUOptionParameter with QemuOpts, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 04/25] add some QemuOpts functions for replace work, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 05/25] change block layer to support both QemuOpts and QEMUOptionParameter, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 07/25] gluster.c: replace QEMUOptionParameter with QemuOpts,
Chunyan Liu <=
- [Qemu-devel] [v19 08/25] iscsi.c: replace QEMUOptionParamter with QemuOpts, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 09/25] qcow.c: replace QEMUOptionParamter with QemuOpts, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 10/25] qcow2.c: replace QEMUOptionParameter with QemuOpts in create, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 11/25] qcow2.c: replace QEMUOptionParameter with QemuOpts in amend options, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 15/25] rbd.c: replace QEMUOptionParameter with QemuOpts, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 12/25] qed.c: replace QEMUOptionParameter with QemuOpts, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 13/25] raw-posix.c: replace QEMUOptionParameter with QemuOpts, Chunyan Liu, 2014/01/20
- [Qemu-devel] [v19 16/25] sheepdog.c: replace QEMUOptionParameter with QemuOpts, Chunyan Liu, 2014/01/20