From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQn7H-0002F5-To for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:15:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQn7B-00084b-TR for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:15:19 -0400 Received: from mail-yh0-f42.google.com ([209.85.213.42]:48624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQn7B-00084W-PI for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:15:13 -0400 Received: by mail-yh0-f42.google.com with SMTP id t59so1699289yho.15 for ; Thu, 20 Mar 2014 17:15:13 -0700 (PDT) From: Leandro Dorileo Date: Thu, 20 Mar 2014 21:13:30 -0300 Message-Id: <1395360813-2833-24-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 23/26] vpc: migrate vpc 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 vpc block driver. Signed-off-by: Leandro Dorileo --- block/vpc.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/block/vpc.c b/block/vpc.c index 82bf248..421b820 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -714,12 +714,11 @@ static int create_fixed_disk(int fd, uint8_t *buf, int64_t total_size) return ret; } -static int vpc_create(const char *filename, QEMUOptionParameter *options, - Error **errp) +static int vpc_create(const char *filename, QemuOpts *options, Error **errp) { uint8_t buf[1024]; VHDFooter *footer = (VHDFooter *) buf; - QEMUOptionParameter *disk_type_param; + const char *disk_type_param; int fd, i; uint16_t cyls = 0; uint8_t heads = 0; @@ -729,20 +728,17 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options, int disk_type; int ret = -EIO; - /* Read out options */ - total_size = get_option_parameter(options, BLOCK_OPT_SIZE)->value.n; + total_size = qemu_opt_get_size(options, BLOCK_OPT_SIZE, 0); + disk_type_param = qemu_opt_get(options, BLOCK_OPT_SUBFMT); - disk_type_param = get_option_parameter(options, BLOCK_OPT_SUBFMT); - if (disk_type_param && disk_type_param->value.s) { - if (!strcmp(disk_type_param->value.s, "dynamic")) { - disk_type = VHD_DYNAMIC; - } else if (!strcmp(disk_type_param->value.s, "fixed")) { - disk_type = VHD_FIXED; - } else { - return -EINVAL; - } - } else { + if (!disk_type_param) { disk_type = VHD_DYNAMIC; + } else if (!strcmp(disk_type_param, "dynamic")) { + disk_type = VHD_DYNAMIC; + } else if (!strcmp(disk_type_param, "fixed")) { + disk_type = VHD_FIXED; + } else { + return -EINVAL; } /* Create the file */ @@ -842,20 +838,24 @@ static void vpc_close(BlockDriverState *bs) error_free(s->migration_blocker); } -static QEMUOptionParameter vpc_create_options[] = { - { - .name = BLOCK_OPT_SIZE, - .type = OPT_SIZE, - .help = "Virtual disk size" - }, - { - .name = BLOCK_OPT_SUBFMT, - .type = OPT_STRING, - .help = +static QemuOptsList vpc_create_options = { + .name = "vpc_create_options", + .head = QTAILQ_HEAD_INITIALIZER(vpc_create_options.head), + .desc = { + { + .name = BLOCK_OPT_SIZE, + .type = QEMU_OPT_SIZE, + .help = "Virtual disk size" + }, + { + .name = BLOCK_OPT_SUBFMT, + .type = QEMU_OPT_STRING, + .help = "Type of virtual hard disk format. Supported formats are " "{dynamic (default) | fixed} " + }, + { NULL } }, - { NULL } }; static BlockDriver bdrv_vpc = { @@ -873,7 +873,7 @@ static BlockDriver bdrv_vpc = { .bdrv_get_info = vpc_get_info, - .create_options = vpc_create_options, + .create_options = &vpc_create_options, .bdrv_has_zero_init = vpc_has_zero_init, }; -- 1.9.0