From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQn71-00027R-N9 for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:15:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQn6v-0007jk-NA for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:15:03 -0400 Received: from mail-yk0-f171.google.com ([209.85.160.171]:38288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQn6v-0007jd-IC for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:14:57 -0400 Received: by mail-yk0-f171.google.com with SMTP id q9so4379271ykb.2 for ; Thu, 20 Mar 2014 17:14:57 -0700 (PDT) From: Leandro Dorileo Date: Thu, 20 Mar 2014 21:13:26 -0300 Message-Id: <1395360813-2833-20-git-send-email-l@dorileo.org> In-Reply-To: <1395360813-2833-1-git-send-email-l@dorileo.org> References: <1395360813-2833-1-git-send-email-l@dorileo.org> Subject: [Qemu-devel] [PATCH 19/26] ssh: migrate ssh driver QemuOptionParameter usage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Liu Yuan , Jeff Cody , Markus Armbruster , Peter Lieven , "Richard W.M. Jones" , Luiz Capitulino , Leandro Dorileo , Ronnie Sahlberg , Josh Durgin , Anthony Liguori , Paolo Bonzini , Stefan Weil , Max Reitz , MORITA Kazutaka , Benoit Canet 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