From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQv5Y-0002PU-TL for qemu-devel@nongnu.org; Fri, 21 Mar 2014 04:46:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQv5U-0002rg-0L for qemu-devel@nongnu.org; Fri, 21 Mar 2014 04:46:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQuuh-0007Gf-E4 for qemu-devel@nongnu.org; Fri, 21 Mar 2014 04:34:51 -0400 Date: Fri, 21 Mar 2014 08:32:20 +0000 From: "Richard W.M. Jones" Message-ID: <20140321083219.GX1346@redhat.com> References: <1395360813-2833-1-git-send-email-l@dorileo.org> <1395360813-2833-20-git-send-email-l@dorileo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1395360813-2833-20-git-send-email-l@dorileo.org> Subject: Re: [Qemu-devel] [PATCH 19/26] ssh: migrate ssh driver QemuOptionParameter usage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leandro Dorileo Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Liu Yuan , Jeff Cody , Markus Armbruster , Peter Lieven , qemu-devel@nongnu.org, Luiz Capitulino , Ronnie Sahlberg , Josh Durgin , Anthony Liguori , Paolo Bonzini , Stefan Weil , Max Reitz , MORITA Kazutaka , Benoit Canet On Thu, Mar 20, 2014 at 09:13:26PM -0300, Leandro Dorileo wrote: > Do the directly migration from QemuOptionParameter to QemuOpts on > ssh block driver. > > Signed-off-by: Leandro Dorileo > --- > block/ssh.c | 29 +++++++++++++---------------- > 1 file changed, 13 insertions(+), 16 deletions(-) > > diff --git a/block/ssh.c b/block/ssh.c > index aa63c9d..b55c518 100644 > --- a/block/ssh.c > +++ b/block/ssh.c > @@ -642,17 +642,20 @@ static int ssh_file_open(BlockDriverState *bs, QDict *options, int bdrv_flags, > return ret; > } > > -static QEMUOptionParameter ssh_create_options[] = { > - { > - .name = BLOCK_OPT_SIZE, > - .type = OPT_SIZE, > - .help = "Virtual disk size" > +static QemuOptsList ssh_create_options = { > + .name = "ssh_create_options", > + .head = QTAILQ_HEAD_INITIALIZER(ssh_create_options.head), > + .desc = { > + { > + .name = BLOCK_OPT_SIZE, > + .type = QEMU_OPT_SIZE, > + .help = "Virtual disk size" > + }, > + { NULL } > }, > - { NULL } > }; > > -static int ssh_create(const char *filename, QEMUOptionParameter *options, > - Error **errp) > +static int ssh_create(const char *filename, QemuOpts *options, Error **errp) > { > int r, ret; > Error *local_err = NULL; > @@ -664,13 +667,7 @@ static int ssh_create(const char *filename, QEMUOptionParameter *options, > > ssh_state_init(&s); > > - /* Get desired file size. */ > - while (options && options->name) { > - if (!strcmp(options->name, BLOCK_OPT_SIZE)) { > - total_size = options->value.n; > - } > - options++; > - } > + total_size = qemu_opt_get_size(options, BLOCK_OPT_SIZE, 0); > DPRINTF("total_size=%" PRIi64, total_size); > > uri_options = qdict_new(); > @@ -1051,7 +1048,7 @@ static BlockDriver bdrv_ssh = { > .bdrv_co_writev = ssh_co_writev, > .bdrv_getlength = ssh_getlength, > .bdrv_co_flush_to_disk = ssh_co_flush, > - .create_options = ssh_create_options, > + .create_options = &ssh_create_options, > }; > > static void bdrv_ssh_init(void) > -- > 1.9.0 Looks good to me, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top