Do the directly migration from QemuOptionParameter to QemuOpts on
raw-win32 block driver.

Signed-off-by: Leandro Dorileo <l...@dorileo.org>
---
 block/raw-win32.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/block/raw-win32.c b/block/raw-win32.c
index 48cb2c2..4cca514 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -475,21 +475,14 @@ static int64_t 
raw_get_allocated_file_size(BlockDriverState *bs)
     return st.st_size;
 }
 
-static int raw_create(const char *filename, QEMUOptionParameter *options,
-                      Error **errp)
+static int raw_create(const char *filename, QemuOpts *options, Error **errp)
 {
     int fd;
     int64_t total_size = 0;
 
     strstart(filename, "file:", &filename);
 
-    /* Read out options */
-    while (options && options->name) {
-        if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
-            total_size = options->value.n / 512;
-        }
-        options++;
-    }
+    total_size = qemu_opt_get_size(options, BLOCK_OPT_SIZE, 0);
 
     fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
                    0644);
@@ -503,13 +496,17 @@ static int raw_create(const char *filename, 
QEMUOptionParameter *options,
     return 0;
 }
 
-static QEMUOptionParameter raw_create_options[] = {
-    {
-        .name = BLOCK_OPT_SIZE,
-        .type = OPT_SIZE,
-        .help = "Virtual disk size"
+static QemuOptsList raw_create_options = {
+    .name = "raw_create_options",
+    .head = QTAILQ_HEAD_INITIALIZER(raw_create_options.head),
+    .desc = {
+        {
+            .name = BLOCK_OPT_SIZE,
+            .type = QEMU_OPT_SIZE,
+            .help = "Virtual disk size"
+        },
+        { NULL }
     },
-    { NULL }
 };
 
 static BlockDriver bdrv_file = {
@@ -532,7 +529,7 @@ static BlockDriver bdrv_file = {
     .bdrv_get_allocated_file_size
                         = raw_get_allocated_file_size,
 
-    .create_options = raw_create_options,
+    .create_options = &raw_create_options,
 };
 
 /***********************************************/
-- 
1.9.0


Reply via email to