Message ID | 1394552156-18901-3-git-send-email-marcel.a@redhat.com |
---|---|
State | New |
Headers | show |
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?
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 --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)
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(-)