aboutsummaryrefslogtreecommitdiff
path: root/qemu-option.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-02-10 19:52:18 +0100
committerMarkus Armbruster <armbru@redhat.com>2010-03-16 17:45:34 +0100
commit8212c64f0e1b32300b7ec4e79885a0caf6f521a6 (patch)
tree2faf279be4942f2c30b535f508cf51ee88a82844 /qemu-option.c
parent01e7f18869c9ee4c84793f4a39ec1f5f4128a0aa (diff)
downloadqemu-8212c64f0e1b32300b7ec4e79885a0caf6f521a6.zip
qemu-8212c64f0e1b32300b7ec4e79885a0caf6f521a6.tar.gz
qemu-8212c64f0e1b32300b7ec4e79885a0caf6f521a6.tar.bz2
qemu-option: Move the implied first name into QemuOptsList
We sometimes permit omitting the first option name, for example -device foo is short for -device driver=foo. The name to use ("driver" in the example) is passed as argument to qemu_opts_parse(). For each QemuOptsList, we use at most one such name. Move the name into QemuOptsList, and pass whether to permit the abbreviation. This ensures continued consistency, and simplifies the commit after next in this series.
Diffstat (limited to 'qemu-option.c')
-rw-r--r--qemu-option.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/qemu-option.c b/qemu-option.c
index 24bb19b..dc340b8 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -753,12 +753,17 @@ int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname
return 0;
}
-QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, const char *firstname)
+QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params,
+ int permit_abbrev)
{
+ const char *firstname;
char value[1024], *id = NULL;
const char *p;
QemuOpts *opts;
+ assert(!permit_abbrev || list->implied_opt_name);
+ firstname = permit_abbrev ? list->implied_opt_name : NULL;
+
if (strncmp(params, "id=", 3) == 0) {
get_opt_value(value, sizeof(value), params+3);
id = qemu_strdup(value);