[PATCH 31/32] monitor: Loosen coupling between misc.c and monitor.c slightly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
---
 monitor/misc.c                       | 8 +-------
 monitor/monitor.c                    | 2 +-
 storage-daemon/qemu-storage-daemon.c | 4 ++--
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/monitor/misc.c b/monitor/misc.c
index 9ddf32da97..99317a8ff4 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -135,7 +135,7 @@ compare_mon_cmd(const void *a, const void *b)
             ((const HMPCommand *)b)->name);
 }
 
-static void sortcmdlist(void)
+static void __attribute__((__constructor__)) sortcmdlist(void)
 {
     qsort(hmp_cmds, ARRAY_SIZE(hmp_cmds) - 1,
           sizeof(*hmp_cmds),
@@ -176,9 +176,3 @@ void monitor_register_hmp_info_hrt(const char *name,
     }
     g_assert_not_reached();
 }
-
-void monitor_init_globals(void)
-{
-    monitor_init_globals_core();
-    sortcmdlist();
-}
diff --git a/monitor/monitor.c b/monitor/monitor.c
index 0a990633d8..ca233ab80f 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -719,7 +719,7 @@ static void monitor_qapi_event_init(void)
                                                 qapi_event_throttle_equal);
 }
 
-void monitor_init_globals_core(void)
+void monitor_init_globals(void)
 {
     monitor_qapi_event_init();
     qemu_mutex_init(&monitor_lock);
diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
index da19498c66..0e9354faa6 100644
--- a/storage-daemon/qemu-storage-daemon.c
+++ b/storage-daemon/qemu-storage-daemon.c
@@ -299,7 +299,7 @@ static void process_options(int argc, char *argv[], bool pre_init_pass)
         case OPTION_DAEMONIZE:
             if (os_set_daemonize(true) < 0) {
                 /*
-                 * --daemonize is parsed before monitor_init_globals_core(), so
+                 * --daemonize is parsed before monitor_init_globals(), so
                  * error_report() does not work yet
                  */
                 fprintf(stderr, "--daemonize not supported in this build\n");
@@ -411,7 +411,7 @@ int main(int argc, char *argv[])
     qemu_add_opts(&qemu_trace_opts);
     qcrypto_init(&error_fatal);
     bdrv_init();
-    monitor_init_globals_core();
+    monitor_init_globals();
     init_qmp_commands();
 
     if (!trace_init_backends()) {
-- 
2.39.0




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux