mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
monitor: unify global init
There are many places where the monitor initializes its globals: - monitor_init_qmp_commands() at the very beginning - single function to init monitor_lock - in the first entry of monitor_init() using "is_first_init" Unify them a bit. monitor_lock is not used before monitor_init() (as confirmed by code analysis and gdb watchpoints); so we are safe delaying what was a constructor-time initialization of the mutex into the later first call to monitor_init(). Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180309090006.10018-8-peterx@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
7
vl.c
7
vl.c
@@ -3066,7 +3066,6 @@ int main(int argc, char **argv, char **envp)
|
||||
qemu_init_exec_dir(argv[0]);
|
||||
|
||||
module_call_init(MODULE_INIT_QOM);
|
||||
monitor_init_qmp_commands();
|
||||
|
||||
qemu_add_opts(&qemu_drive_opts);
|
||||
qemu_add_drive_opts(&qemu_legacy_drive_opts);
|
||||
@@ -4537,6 +4536,12 @@ int main(int argc, char **argv, char **envp)
|
||||
default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
|
||||
default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
|
||||
|
||||
/*
|
||||
* Note: qtest_enabled() (which is used in monitor_qapi_event_init())
|
||||
* depends on configure_accelerator() above.
|
||||
*/
|
||||
monitor_init_globals();
|
||||
|
||||
if (qemu_opts_foreach(qemu_find_opts("mon"),
|
||||
mon_init_func, NULL, NULL)) {
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user