From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkUCR-0000Ef-Tc for qemu-devel@nongnu.org; Mon, 17 Dec 2012 01:33:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkU8w-0006SE-0T for qemu-devel@nongnu.org; Mon, 17 Dec 2012 01:29:15 -0500 Received: from mail-we0-f173.google.com ([74.125.82.173]:63472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkU8v-0006S4-Og for qemu-devel@nongnu.org; Mon, 17 Dec 2012 01:25:37 -0500 Received: by mail-we0-f173.google.com with SMTP id z2so2622062wey.4 for ; Sun, 16 Dec 2012 22:25:36 -0800 (PST) MIME-Version: 1.0 Sender: donald.open@gmail.com In-Reply-To: References: <1355493891-22624-1-git-send-email-wdongxu@linux.vnet.ibm.com> <1355493891-22624-4-git-send-email-wdongxu@linux.vnet.ibm.com> From: Dong Xu Wang Date: Mon, 17 Dec 2012 14:24:56 +0800 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [PATCH V8 3/4] Use QemuOpts support in block layer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: Kevin Wolf , qemu-devel On Mon, Dec 17, 2012 at 1:44 PM, Bharata B Rao wrote: > On Fri, Dec 14, 2012 at 7:34 PM, Dong Xu Wang > 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. >