[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/4] qemu-option: Add support for merged QemuOptsLis
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH 1/4] qemu-option: Add support for merged QemuOptsLists |
Date: |
Wed, 8 Feb 2012 05:41:37 +0000 |
Add support for option lists which are merged together, so that
"-listname foo=bar -listname bar=baz" is equivalent to "-listname
foo=bar,bar=baz" rather than generating two separate lists of options.
Signed-off-by: Peter Maydell <address@hidden>
---
qemu-option.c | 7 ++++++-
qemu-option.h | 1 +
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/qemu-option.c b/qemu-option.c
index 4626ccf..35cd609 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -741,13 +741,18 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char
*id, int fail_if_exist
}
opts = qemu_opts_find(list, id);
if (opts != NULL) {
- if (fail_if_exists) {
+ if (fail_if_exists && !list->merge_lists) {
qerror_report(QERR_DUPLICATE_ID, id, list->name);
return NULL;
} else {
return opts;
}
}
+ } else if (list->merge_lists) {
+ opts = qemu_opts_find(list, NULL);
+ if (opts) {
+ return opts;
+ }
}
opts = g_malloc0(sizeof(*opts));
if (id) {
diff --git a/qemu-option.h b/qemu-option.h
index e6f61e6..3ca00c3 100644
--- a/qemu-option.h
+++ b/qemu-option.h
@@ -100,6 +100,7 @@ typedef struct QemuOptDesc {
struct QemuOptsList {
const char *name;
const char *implied_opt_name;
+ bool merge_lists; /* Merge multiple uses of option into a single list? */
QTAILQ_HEAD(, QemuOpts) head;
QemuOptDesc desc[];
};
--
1.7.5.4
- [Qemu-devel] [PATCH 0/4] arm: add device tree support (via machine opts), Peter Maydell, 2012/02/08
- [Qemu-devel] [PATCH 1/4] qemu-option: Add support for merged QemuOptsLists,
Peter Maydell <=
- [Qemu-devel] [PATCH 2/4] Make -machine/-enable-kvm options merge into a single list, Peter Maydell, 2012/02/08
- [Qemu-devel] [PATCH 3/4] Make kernel, initrd and append be machine_opts, Peter Maydell, 2012/02/08
- [Qemu-devel] [PATCH 4/4] arm: add device tree support, Peter Maydell, 2012/02/08
- Re: [Qemu-devel] [PATCH 0/4] arm: add device tree support (via machine opts), Peter Crosthwaite, 2012/02/08