qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 23/26] vpc: migrate vpc driver QemuOptionParameter u


From: Leandro Dorileo
Subject: [Qemu-devel] [PATCH 23/26] vpc: migrate vpc driver QemuOptionParameter usage
Date: Thu, 20 Mar 2014 21:13:30 -0300

Do the directly migration from QemuOptionParameter to QemuOpts on
vpc block driver.

Signed-off-by: Leandro Dorileo <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]