diff mbox series

[RFC,3/9] rename MachineInitPhase enumeration constants

Message ID 20210513082549.114275-4-mirela.grujic@greensocs.com
State New
Headers show
Series Initial support for machine creation via QMP | expand

Commit Message

Mirela Grujic May 13, 2021, 8:25 a.m. UTC
This renaming is a second phase in getting the code ready for
defining MachineInitPhase in qapi (enumeration constants are
going to be generated and prefixed with a name derived from
the enumeration type, i.e. MACHINE_INIT_PHASE_.

Signed-off-by: Mirela Grujic <mirela.grujic@greensocs.com>
---
 include/hw/qdev-core.h | 10 +++++-----
 hw/core/machine.c      |  4 ++--
 hw/core/qdev.c         |  4 ++--
 softmmu/vl.c           | 20 ++++++++++----------
 4 files changed, 19 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 5e3c6d4482..dc2f63478b 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -813,30 +813,30 @@  bool qdev_should_hide_device(QemuOpts *opts);
 
 typedef enum MachineInitPhase {
     /* current_machine is NULL.  */
-    PHASE_NO_MACHINE,
+    MACHINE_INIT_PHASE_NO_MACHINE,
 
     /* current_machine is not NULL, but current_machine->accel is NULL.  */
-    PHASE_MACHINE_CREATED,
+    MACHINE_INIT_PHASE_MACHINE_CREATED,
 
     /*
      * current_machine->accel is not NULL, but the machine properties have
      * not been validated and machine_class->init has not yet been called.
      */
-    PHASE_ACCEL_CREATED,
+    MACHINE_INIT_PHASE_ACCEL_CREATED,
 
     /*
      * machine_class->init has been called, thus creating any embedded
      * devices and validating machine properties.  Devices created at
      * this time are considered to be cold-plugged.
      */
-    PHASE_MACHINE_INITIALIZED,
+    MACHINE_INIT_PHASE_INITIALIZED,
 
     /*
      * QEMU is ready to start CPUs and devices created at this time
      * are considered to be hot-plugged.  The monitor is not restricted
      * to "preconfig" commands.
      */
-    PHASE_MACHINE_READY,
+    MACHINE_INIT_PHASE_READY,
 } MachineInitPhase;
 
 extern bool phase_check(MachineInitPhase phase);
diff --git a/hw/core/machine.c b/hw/core/machine.c
index eba046924d..16ce88407c 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1230,7 +1230,7 @@  void machine_run_board_init(MachineState *machine)
     }
 
     machine_class->init(machine);
-    phase_advance(PHASE_MACHINE_INITIALIZED);
+    phase_advance(MACHINE_INIT_PHASE_INITIALIZED);
 }
 
 static NotifierList machine_init_done_notifiers =
@@ -1262,7 +1262,7 @@  void qdev_machine_creation_done(void)
      * ok, initial machine setup is done, starting from now we can
      * only create hotpluggable devices
      */
-    phase_advance(PHASE_MACHINE_READY);
+    phase_advance(MACHINE_INIT_PHASE_READY);
     qdev_assert_realized_properly();
 
     /* TODO: once all bus devices are qdevified, this should be done
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 71906170f9..350f2acf74 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -1157,12 +1157,12 @@  MachineInitPhase phase_get(void)
 
 bool machine_is_initialized(void)
 {
-    return machine_phase >= PHASE_MACHINE_INITIALIZED;
+    return machine_phase >= MACHINE_INIT_PHASE_INITIALIZED;
 }
 
 bool machine_is_ready(void)
 {
-    return machine_phase >= PHASE_MACHINE_READY;
+    return machine_phase >= MACHINE_INIT_PHASE_READY;
 }
 
 static const TypeInfo device_type_info = {
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 3af9743ceb..88f504aff9 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2510,7 +2510,7 @@  static void qemu_init_board(void)
     /* process plugin before CPUs are created, but once -smp has been parsed */
     qemu_plugin_load_list(&plugin_list, &error_fatal);
 
-    /* From here on we enter MACHINE_PHASE_INITIALIZED.  */
+    /* From here on we enter MACHINE_INIT_PHASE_INITIALIZED.  */
     machine_run_board_init(current_machine);
 
     drive_check_orphaned();
@@ -2582,7 +2582,7 @@  static void qemu_machine_enter_phase(MachineInitPhase target_phase,
                                      Error **errp)
 {
     /* target phases before initialization are not handled here */
-    if (target_phase < PHASE_MACHINE_INITIALIZED) {
+    if (target_phase < MACHINE_INIT_PHASE_INITIALIZED) {
         error_setg(errp, "Target machine phase too early to enter this way");
         return;
     }
@@ -2597,14 +2597,14 @@  static void qemu_machine_enter_phase(MachineInitPhase target_phase,
      * if machine has not yet passed 'initialized' phase and according to the
      * target_phase it should
      */
-    if (target_phase >= PHASE_MACHINE_INITIALIZED &&
-        phase_get() < PHASE_MACHINE_INITIALIZED) {
+    if (target_phase >= MACHINE_INIT_PHASE_INITIALIZED &&
+        phase_get() < MACHINE_INIT_PHASE_INITIALIZED) {
         qemu_init_board();
         qemu_create_cli_devices();
     }
 
-    if (target_phase >= PHASE_MACHINE_READY &&
-        phase_get() < PHASE_MACHINE_READY) {
+    if (target_phase >= MACHINE_INIT_PHASE_READY &&
+        phase_get() < MACHINE_INIT_PHASE_READY) {
         qemu_machine_creation_done();
 
         if (loadvm) {
@@ -2641,7 +2641,7 @@  void qmp_x_exit_preconfig(Error **errp)
         return;
     }
 
-    qemu_machine_enter_phase(PHASE_MACHINE_READY, errp);
+    qemu_machine_enter_phase(MACHINE_INIT_PHASE_READY, errp);
 }
 
 void qemu_init(int argc, char **argv, char **envp)
@@ -3580,14 +3580,14 @@  void qemu_init(int argc, char **argv, char **envp)
     qemu_create_early_backends();
 
     qemu_apply_machine_options();
-    phase_advance(PHASE_MACHINE_CREATED);
+    phase_advance(MACHINE_INIT_PHASE_MACHINE_CREATED);
 
     /*
      * Note: uses machine properties such as kernel-irqchip, must run
      * after machine_set_property().
      */
     configure_accelerators(argv[0]);
-    phase_advance(PHASE_ACCEL_CREATED);
+    phase_advance(MACHINE_INIT_PHASE_ACCEL_CREATED);
 
     /*
      * Beware, QOM objects created before this point miss global and
@@ -3637,7 +3637,7 @@  void qemu_init(int argc, char **argv, char **envp)
     }
 
     if (!preconfig_requested) {
-        qemu_machine_enter_phase(PHASE_MACHINE_READY, &error_fatal);
+        qemu_machine_enter_phase(MACHINE_INIT_PHASE_READY, &error_fatal);
     }
     qemu_init_displays();
     accel_setup_post(current_machine);