qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 19/26] ssh: migrate ssh driver QemuOptionParameter u


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

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

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




reply via email to

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