sim-card
/
qemu
Archived
10
0
Fork 0

qemu-option: Add support for merged QemuOptsLists

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 <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
This commit is contained in:
Peter Maydell 2012-02-08 05:41:37 +00:00 committed by Andrzej Zaborowski
parent a84fac1426
commit da93318a9f
2 changed files with 7 additions and 1 deletions

View File

@ -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) {

View File

@ -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[];
};