Refactor qemu_init into actions performed during the precreate phase,
and actions performed when exiting precreate.  For now, always exit
the precreate phase immediately at init time.  Future patches will add
conditions that cause QEMU to linger in the precreate phase while running
the main loop.

Signed-off-by: Steve Sistare <steven.sist...@oracle.com>
---
 system/vl.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/system/vl.c b/system/vl.c
index d32203c..5f5e810 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -183,6 +183,7 @@ static bool list_data_dirs;
 static const char *qtest_chrdev;
 static const char *qtest_log;
 static AccelState *accel;
+static FILE *vmstate_dump_file;
 
 static int has_defaults = 1;
 static int default_audio = 1;
@@ -2731,6 +2732,8 @@ static bool qemu_machine_creation_done(Error **errp)
     return true;
 }
 
+static void qemu_exit_precreate(void);
+
 void qmp_x_exit_preconfig(Error **errp)
 {
     if (phase_check(PHASE_MACHINE_INITIALIZED)) {
@@ -2795,9 +2798,7 @@ void qemu_init(int argc, char **argv)
     QemuOptsList *olist;
     int optind;
     const char *optarg;
-    MachineClass *machine_class;
     bool userconfig = true;
-    FILE *vmstate_dump_file = NULL;
 
     qemu_add_opts(&qemu_drive_opts);
     qemu_add_drive_opts(&qemu_legacy_drive_opts);
@@ -3753,6 +3754,13 @@ void qemu_init(int argc, char **argv)
         }
     }
 
+    qemu_exit_precreate();
+}
+
+static void qemu_exit_precreate(void)
+{
+    MachineClass *machine_class;
+
     suspend_mux_open();
 
     qemu_disable_default_devices();
-- 
1.8.3.1


Reply via email to