qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 6/9] vl: parse all options via QemuOpts


From: Anthony Liguori
Subject: [Qemu-devel] [PATCH 6/9] vl: parse all options via QemuOpts
Date: Mon, 19 Mar 2012 10:09:20 -0500

In order to have -writeconfig work as expected, we need to first store command
line options into a QemuOpts and then we can parse the QemuOpts just like any
other [system] section.

QemuOpts is careful to preserve order so the semantics of this should be
completely identical.

Signed-off-by: Anthony Liguori <address@hidden>
---
 vl.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/vl.c b/vl.c
index 5e86311..5337e58 100644
--- a/vl.c
+++ b/vl.c
@@ -3132,6 +3132,7 @@ static void qemu_parse_options(int argc, char **argv, 
QemuOptions *options)
 {
     int optind;
     const char *optarg;
+    QemuOpts *system_opts;
 
     /* first pass of option parsing */
     optind = 1;
@@ -3166,13 +3167,15 @@ static void qemu_parse_options(int argc, char **argv, 
QemuOptions *options)
         }
     }
 
+    system_opts = qemu_opts_create(qemu_find_opts("system"), NULL, 0);
+
     /* second pass of option parsing */
     optind = 1;
     for(;;) {
         if (optind >= argc)
             break;
         if (argv[optind][0] != '-') {
-           options->hda_opts = drive_add(IF_DEFAULT, 0, argv[optind++], 
HD_OPTS);
+            qemu_opt_set(system_opts, "hda", argv[optind++]);
         } else {
             const QEMUOption *popt;
 
@@ -3182,7 +3185,11 @@ static void qemu_parse_options(int argc, char **argv, 
QemuOptions *options)
                 exit(1);
             }
 
-            qemu_parse_option(popt->index, optarg, options);
+            if ((popt->flags & HAS_ARG)) {
+                qemu_opt_set(system_opts, popt->name, optarg);
+            } else {
+                qemu_opt_set_bool(system_opts, popt->name, true);
+            }
         }
     }
 
-- 
1.7.5.4




reply via email to

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