diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2010-08-20 13:52:00 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-08-22 17:11:06 -0500 |
commit | dfe795e71fcbf4f766353f2e76fe227b342fc605 (patch) | |
tree | 06ba414859b3f32551d7c8fd1aa066fdd12db56c | |
parent | 916452df46d7c1cec1357d3ec033f540db069156 (diff) |
QemuOpts: allow new option groups be registered at runtime.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | qemu-config.c | 18 | ||||
-rw-r--r-- | qemu-config.h | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/qemu-config.c b/qemu-config.c index 730ffd9be3..e84e15e375 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -340,7 +340,7 @@ QemuOptsList qemu_cpudef_opts = { }, }; -static QemuOptsList *vm_config_groups[] = { +static QemuOptsList *vm_config_groups[32] = { &qemu_drive_opts, &qemu_chardev_opts, &qemu_device_opts, @@ -372,6 +372,22 @@ QemuOptsList *qemu_find_opts(const char *group) return find_list(vm_config_groups, group); } +void qemu_add_opts(QemuOptsList *list) +{ + int entries, i; + + entries = ARRAY_SIZE(vm_config_groups); + entries--; /* keep list NULL terminated */ + for (i = 0; i < entries; i++) { + if (vm_config_groups[i] == NULL) { + vm_config_groups[i] = list; + return; + } + } + fprintf(stderr, "ran out of space in vm_config_groups"); + abort(); +} + int qemu_set_option(const char *str) { char group[64], id[64], arg[64]; diff --git a/qemu-config.h b/qemu-config.h index dca69d454b..bf9bcc2714 100644 --- a/qemu-config.h +++ b/qemu-config.h @@ -16,6 +16,7 @@ extern QemuOptsList qemu_mon_opts; extern QemuOptsList qemu_cpudef_opts; QemuOptsList *qemu_find_opts(const char *group); +void qemu_add_opts(QemuOptsList *list); int qemu_set_option(const char *str); int qemu_global_option(const char *str); void qemu_add_globals(void); |