On Mon, Dec 17, 2012 at 1:44 PM, Bharata B Rao <bharata....@gmail.com> wrote: > On Fri, Dec 14, 2012 at 7:34 PM, Dong Xu Wang > <wdon...@linux.vnet.ibm.com> wrote: >> diff --git a/block/gluster.c b/block/gluster.c >> index 1c90174..daabb61 100644 >> --- a/block/gluster.c >> +++ b/block/gluster.c >> @@ -335,8 +335,7 @@ out: >> return ret; >> } >> >> -static int qemu_gluster_create(const char *filename, >> - QEMUOptionParameter *options) >> +static int qemu_gluster_create(const char *filename, QemuOpts* opts) >> { >> struct glfs *glfs; >> struct glfs_fd *fd; >> @@ -350,11 +349,9 @@ 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++; >> + if (opts) { >> + total_size = >> + qemu_opt_get_number(opts, BLOCK_OPT_SIZE, 0) / >> BDRV_SECTOR_SIZE; >> } >> >> fd = glfs_creat(glfs, gconf->image, >> @@ -544,13 +541,17 @@ static void qemu_gluster_close(BlockDriverState *bs) >> glfs_fini(s->glfs); >> } >> >> -static QEMUOptionParameter qemu_gluster_create_options[] = { >> - { >> - .name = BLOCK_OPT_SIZE, >> - .type = OPT_SIZE, >> - .help = "Virtual disk size" >> - }, >> - { NULL } >> +static QemuOptsList gluster_create_opts = { >> + .name = "gluster-create-opts", >> + .head = QTAILQ_HEAD_INITIALIZER(gluster_create_opts.head), >> + .desc = { >> + { >> + .name = BLOCK_OPT_SIZE, >> + .type = QEMU_OPT_NUMBER, >> + .help = "Virtual disk size" >> + }, >> + { /* end of list */ } >> + } >> }; >> >> static BlockDriver bdrv_gluster = { >> @@ -565,7 +566,7 @@ static BlockDriver bdrv_gluster = { >> .bdrv_aio_readv = qemu_gluster_aio_readv, >> .bdrv_aio_writev = qemu_gluster_aio_writev, >> .bdrv_aio_flush = qemu_gluster_aio_flush, >> - .create_options = qemu_gluster_create_options, >> + .create_options = &gluster_create_opts, > > While other elements have qemu_ prefix, create_options doesn't after > your change. > Okay, will rename in next version.
>> }; >> >> static BlockDriver bdrv_gluster_tcp = { >> @@ -580,7 +581,7 @@ static BlockDriver bdrv_gluster_tcp = { >> .bdrv_aio_readv = qemu_gluster_aio_readv, >> .bdrv_aio_writev = qemu_gluster_aio_writev, >> .bdrv_aio_flush = qemu_gluster_aio_flush, >> - .create_options = qemu_gluster_create_options, >> + .create_options = &gluster_create_opts, >> }; >> >> static BlockDriver bdrv_gluster_unix = { > > Missed doing the same change for bdrv_gluster_unix and bdrv_gluster_rdma ? > Yep, I miss them. Will add them in next verson. Thank you Bharata. > Regards, > Bharata. >