From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/3] QemuOpts: allow new option groups be registered at runtime.
Date: Fri, 20 Aug 2010 13:52:00 +0200 [thread overview]
Message-ID: <1282305122-29097-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1282305122-29097-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
qemu-config.c | 18 +++++++++++++++++-
qemu-config.h | 1 +
2 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/qemu-config.c b/qemu-config.c
index 95abe61..68880c2 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -342,7 +342,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,
@@ -374,6 +374,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 dca69d4..bf9bcc2 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);
--
1.7.1
next prev parent reply other threads:[~2010-08-20 11:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-20 11:51 [Qemu-devel] [PATCH 0/3] QemuOpts: add groups at runtime Gerd Hoffmann
2010-08-20 11:52 ` Gerd Hoffmann [this message]
2010-08-20 11:52 ` [Qemu-devel] [PATCH 2/3] QemuOpts: make most qemu_*_opts static Gerd Hoffmann
2010-08-20 11:52 ` [Qemu-devel] [PATCH 3/3] compile -fsdev and -virtfs cmd line options unconditionally Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282305122-29097-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).