From: Stefan Weil <weil@mail.berlios.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Subject: [Qemu-devel] [PATCH] Add new function qemu_register_machines
Date: Thu, 21 May 2009 20:26:06 +0200 [thread overview]
Message-ID: <4A159CBE.9020606@mail.berlios.de> (raw)
Add new function qemu_register_machines.
The patch removes the unused prototype register_machines
and adds a new function which makes registration of
more than one machine a little easier.
The new function is applied to the machines in hw/spitz.c
(where a static keyword for akitapda_machine was missing),
but it can also be applied to several other QEMU source files.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
hw/boards.h | 2 +-
hw/spitz.c | 48 ++++++++++++++++++++++--------------------------
vl.c | 9 +++++++++
3 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/hw/boards.h b/hw/boards.h
index 3144017..f0e6932 100644
--- a/hw/boards.h
+++ b/hw/boards.h
@@ -20,7 +20,7 @@ typedef struct QEMUMachine {
} QEMUMachine;
int qemu_register_machine(QEMUMachine *m);
-void register_machines(void);
+int qemu_register_machines(QEMUMachine *machine, size_t number);
extern QEMUMachine *current_machine;
diff --git a/hw/spitz.c b/hw/spitz.c
index dd16780..dd3a57e 100644
--- a/hw/spitz.c
+++ b/hw/spitz.c
@@ -1044,36 +1044,32 @@ static void terrier_init(ram_addr_t ram_size,
kernel_cmdline, initrd_filename, cpu_model, terrier,
0x33f);
}
-QEMUMachine akitapda_machine = {
- .name = "akita",
- .desc = "Akita PDA (PXA270)",
- .init = akita_init,
-};
-
-static QEMUMachine spitzpda_machine = {
- .name = "spitz",
- .desc = "Spitz PDA (PXA270)",
- .init = spitz_init,
-};
-
-static QEMUMachine borzoipda_machine = {
- .name = "borzoi",
- .desc = "Borzoi PDA (PXA270)",
- .init = borzoi_init,
-};
-
-static QEMUMachine terrierpda_machine = {
- .name = "terrier",
- .desc = "Terrier PDA (PXA270)",
- .init = terrier_init,
+static QEMUMachine spitz_machines[] = {
+ {
+ .name = "akita",
+ .desc = "Akita PDA (PXA270)",
+ .init = akita_init,
+ },
+ {
+ .name = "spitz",
+ .desc = "Spitz PDA (PXA270)",
+ .init = spitz_init,
+ },
+ {
+ .name = "borzoi",
+ .desc = "Borzoi PDA (PXA270)",
+ .init = borzoi_init,
+ },
+ {
+ .name = "terrier",
+ .desc = "Terrier PDA (PXA270)",
+ .init = terrier_init,
+ }
};
static void spitz_machine_init(void)
{
- qemu_register_machine(&akitapda_machine);
- qemu_register_machine(&spitzpda_machine);
- qemu_register_machine(&borzoipda_machine);
- qemu_register_machine(&terrierpda_machine);
+ qemu_register_machines(spitz_machines, ARRAY_SIZE(spitz_machines));
}
machine_init(spitz_machine_init);
diff --git a/vl.c b/vl.c
index 68c8514..d07a1b6 100644
--- a/vl.c
+++ b/vl.c
@@ -3488,6 +3488,15 @@ int qemu_register_machine(QEMUMachine *m)
return 0;
}
+int qemu_register_machines(QEMUMachine *machine, size_t number)
+{
+ size_t i;
+ for (i = 0; i < number; i++) {
+ qemu_register_machine(&machine[i]);
+ }
+ return 0;
+}
+
static QEMUMachine *find_machine(const char *name)
{
QEMUMachine *m;
--
1.5.6.5
next reply other threads:[~2009-05-21 18:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-21 18:26 Stefan Weil [this message]
2009-05-21 19:03 ` [Qemu-devel] [PATCH] Add new function qemu_register_machines Anthony Liguori
2009-05-21 19:28 ` Stefan Weil
2009-05-21 20:13 ` [Qemu-devel] " Jan Kiszka
2009-05-21 20:19 ` Stefan Weil
2009-05-21 20:27 ` Jan Kiszka
2009-05-21 20:30 ` Anthony Liguori
2009-05-21 22:33 ` [Qemu-devel] " Paul Brook
2009-05-22 10:08 ` Stefan Weil
2009-05-22 11:59 ` Paul Brook
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=4A159CBE.9020606@mail.berlios.de \
--to=weil@mail.berlios.de \
--cc=aliguori@us.ibm.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).