From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQn7M-0002JG-E1 for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:15:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQn7G-00085J-3D for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:15:24 -0400 Received: from mail-yh0-f51.google.com ([209.85.213.51]:33946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQn7F-00085E-Uw for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:15:18 -0400 Received: by mail-yh0-f51.google.com with SMTP id f10so1697370yha.38 for ; Thu, 20 Mar 2014 17:15:17 -0700 (PDT) From: Leandro Dorileo Date: Thu, 20 Mar 2014 21:13:31 -0300 Message-Id: <1395360813-2833-25-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 24/26] vvfat: migrate vvfat 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 vvfat block driver. Signed-off-by: Leandro Dorileo --- block/vvfat.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/block/vvfat.c b/block/vvfat.c index f966ea5..7aefba3 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2907,7 +2907,7 @@ static BlockDriver vvfat_write_target = { static int enable_write_target(BDRVVVFATState *s) { BlockDriver *bdrv_qcow; - QEMUOptionParameter *options; + QemuOpts *options; Error *local_err = NULL; int ret; int size = sector2cluster(s, s->sector_count); @@ -2918,13 +2918,26 @@ static int enable_write_target(BDRVVVFATState *s) s->qcow_filename = g_malloc(1024); ret = get_tmp_filename(s->qcow_filename, 1024); if (ret < 0) { - goto err; + goto err_opt; } bdrv_qcow = bdrv_find_format("qcow"); - options = parse_option_parameters("", bdrv_qcow->create_options, NULL); - set_option_parameter_int(options, BLOCK_OPT_SIZE, s->sector_count * 512); - set_option_parameter(options, BLOCK_OPT_BACKING_FILE, "fat:"); + + options = qemu_opts_create(bdrv_qcow->create_options, NULL, 0, + &error_abort); + if (!options) { + goto err_opt; + } + + ret = qemu_opt_set_number(options, BLOCK_OPT_SIZE, s->sector_count * 512); + if (ret < 0) { + goto err; + } + + ret = qemu_opt_set(options, BLOCK_OPT_BACKING_FILE, "fat:"); + if (ret < 0) { + goto err; + } ret = bdrv_create(bdrv_qcow, s->qcow_filename, options, &local_err); if (ret < 0) { @@ -2951,10 +2964,13 @@ static int enable_write_target(BDRVVVFATState *s) s->bs->backing_hd->drv = &vvfat_write_target; s->bs->backing_hd->opaque = g_malloc(sizeof(void*)); *(void**)s->bs->backing_hd->opaque = s; + qemu_opts_del(options); return 0; err: + qemu_opts_del(options); +err_opt: g_free(s->qcow_filename); s->qcow_filename = NULL; return ret; -- 1.9.0