diff mbox

[2/3] hw/null-machine: Convert null machine to QOM

Message ID 1394552156-18901-3-git-send-email-marcel.a@redhat.com
State New
Headers show

Commit Message

Marcel Apfelbaum March 11, 2014, 3:35 p.m. UTC
Needed by some tests.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
---
 hw/core/null-machine.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Eric Blake March 11, 2014, 3:47 p.m. UTC | #1
On 03/11/2014 09:35 AM, Marcel Apfelbaum wrote:
> Needed by some tests.
> 
> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> ---
>  hw/core/null-machine.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 

> -static void register_machines(void)
> +static const TypeInfo none_machine_type_info = {
> +    .name = "none-machine",
> +    .parent = TYPE_MACHINE,
> +    .class_data = (void *)&machine_none

Why do you need a cast to (void*) in C?
Marcel Apfelbaum March 11, 2014, 3:50 p.m. UTC | #2
On Tue, 2014-03-11 at 09:47 -0600, Eric Blake wrote:
> On 03/11/2014 09:35 AM, Marcel Apfelbaum wrote:
> > Needed by some tests.
> > 
> > Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> > ---
> >  hw/core/null-machine.c | 13 +++++++++----
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> > 
> 
> > -static void register_machines(void)
> > +static const TypeInfo none_machine_type_info = {
> > +    .name = "none-machine",
> > +    .parent = TYPE_MACHINE,
> > +    .class_data = (void *)&machine_none
> 
> Why do you need a cast to (void*) in C?
I'll take care of this, thanks!
Marcel

>
diff mbox

Patch

diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c
index d813c08..5ec02cf 100644
--- a/hw/core/null-machine.c
+++ b/hw/core/null-machine.c
@@ -26,10 +26,15 @@  static QEMUMachine machine_none = {
     .max_cpus = 0,
 };
 
-static void register_machines(void)
+static const TypeInfo none_machine_type_info = {
+    .name = "none-machine",
+    .parent = TYPE_MACHINE,
+    .class_data = (void *)&machine_none
+};
+
+static void none_machine_register_type(void)
 {
-    qemu_register_machine(&machine_none);
+    type_register_static(&none_machine_type_info);
 }
 
-machine_init(register_machines);
-
+type_init(none_machine_register_type)