[Top][All Lists]
[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
- [Qemu-devel] [PATCH 1/9] qemu-config: fix -writeconfig when using qemu_opt_set_bool, (continued)
- [Qemu-devel] [PATCH 1/9] qemu-config: fix -writeconfig when using qemu_opt_set_bool, Anthony Liguori, 2012/03/19
- [Qemu-devel] [PATCH 2/9] qemu-config: friends don't let friends use sscanf, Anthony Liguori, 2012/03/19
- [Qemu-devel] [PATCH 4/9] vl: mark system configuration options in qemu-options.hx, Anthony Liguori, 2012/03/19
- [Qemu-devel] [PATCH 3/9] vl: refactor command line parsing to allow options to be set via config, Anthony Liguori, 2012/03/19
- [Qemu-devel] [PATCH 7/9] qmp: expose a command to query capabilities of config parser, Anthony Liguori, 2012/03/19
[Qemu-devel] [PATCH 9/9] Add a management tool writer's guide, Anthony Liguori, 2012/03/19
[Qemu-devel] [PATCH 6/9] vl: parse all options via QemuOpts,
Anthony Liguori <=
[Qemu-devel] [PATCH 8/9] vl: add -query-capabilities, Anthony Liguori, 2012/03/19
Re: [Qemu-devel] [RFC PATCH 0/9] qemu capabilities reporting and config changes, Paolo Bonzini, 2012/03/19