Patchwork [QEMU,1/3] vl.c: extract qemu_machine_init() function

login
register
mail settings
Submitter Eduardo Habkost
Date July 25, 2012, 6:18 p.m.
Message ID <1343240323-7402-2-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/173239/
State New
Headers show

Comments

Eduardo Habkost - July 25, 2012, 6:18 p.m.
Other code directly related to the board init function may be moved
there.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/boards.h |    7 +++++++
 vl.c        |   14 +++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
Eric Blake - July 25, 2012, 10:18 p.m.
On 07/25/2012 12:18 PM, Eduardo Habkost wrote:
> Other code directly related to the board init function may be moved
> there.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  hw/boards.h |    7 +++++++
>  vl.c        |   14 +++++++++++++-
>  2 files changed, 20 insertions(+), 1 deletion(-)
> 

>  
> -    machine->init(ram_size, boot_devices,
> +    qemu_machine_init(machine, ram_size, boot_devices,
>                    kernel_filename, kernel_cmdline, initrd_filename, cpu_model);

Doesn't this next line also need an indentation adjustment?
Eduardo Habkost - July 30, 2012, 4:19 p.m.
On Wed, Jul 25, 2012 at 04:18:01PM -0600, Eric Blake wrote:
> On 07/25/2012 12:18 PM, Eduardo Habkost wrote:
> > Other code directly related to the board init function may be moved
> > there.
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> >  hw/boards.h |    7 +++++++
> >  vl.c        |   14 +++++++++++++-
> >  2 files changed, 20 insertions(+), 1 deletion(-)
> > 
> 
> >  
> > -    machine->init(ram_size, boot_devices,
> > +    qemu_machine_init(machine, ram_size, boot_devices,
> >                    kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
> 
> Doesn't this next line also need an indentation adjustment?

Yes. I will fix it in the next version.

Patch

diff --git a/hw/boards.h b/hw/boards.h
index 59c01d0..f20f5ab 100644
--- a/hw/boards.h
+++ b/hw/boards.h
@@ -34,6 +34,13 @@  typedef struct QEMUMachine {
 
 int qemu_register_machine(QEMUMachine *m);
 QEMUMachine *find_default_machine(void);
+void qemu_machine_init(QEMUMachine *machine,
+                       ram_addr_t ram_size,
+                       const char *boot_devices,
+                       const char *kernel_filename,
+                       const char *kernel_cmdline,
+                       const char *initrd_filename,
+                       const char *cpu_model);
 
 extern QEMUMachine *current_machine;
 
diff --git a/vl.c b/vl.c
index 8904db1..34cc145 100644
--- a/vl.c
+++ b/vl.c
@@ -1209,6 +1209,18 @@  QEMUMachine *find_default_machine(void)
     return NULL;
 }
 
+void qemu_machine_init(QEMUMachine *machine,
+                       ram_addr_t ram_size,
+                       const char *boot_devices,
+                       const char *kernel_filename,
+                       const char *kernel_cmdline,
+                       const char *initrd_filename,
+                       const char *cpu_model)
+{
+    machine->init(ram_size, boot_devices,
+                  kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
+}
+
 /***********************************************************/
 /* main execution loop */
 
@@ -3517,7 +3529,7 @@  int main(int argc, char **argv, char **envp)
 
     qdev_machine_init();
 
-    machine->init(ram_size, boot_devices,
+    qemu_machine_init(machine, ram_size, boot_devices,
                   kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
 
     cpu_synchronize_all_post_init();