qemu/include
Markus Armbruster 0587568780 qmp: Dumb down how we run QMP command registration
The way we get QMP commands registered is high tech:

* qapi-commands.py generates qmp_init_marshal() that does the actual work

* it also generates the magic to register it as a MODULE_INIT_QAPI
  function, so it runs when someone calls
  module_call_init(MODULE_INIT_QAPI)

* main() calls module_call_init()

QEMU needs to register a few non-qapified commands.  Same high tech
works: monitor.c has its own qmp_init_marshal() along with the magic
to make it run in module_call_init(MODULE_INIT_QAPI).

QEMU also needs to unregister commands that are not wanted in this
build's configuration (commit 5032a16).  Simple enough:
qmp_unregister_commands_hack().  The difficulty is to make it run
after the generated qmp_init_marshal().  We can't simply run it in
monitor.c's qmp_init_marshal(), because the order in which the
registered functions run is indeterminate.  So qmp_init_marshal()
registers qmp_unregister_commands_hack() separately.  Since
registering *appends* to the list of registered functions, this will
make it run after all the functions that have been registered already.

I suspect it takes a long and expensive computer science education to
not find this silly.

Dumb it down as follows:

* Drop MODULE_INIT_QAPI entirely

* Give the generated qmp_init_marshal() external linkage.

* Call it instead of module_call_init(MODULE_INIT_QAPI)

* Except in QEMU proper, call new monitor_init_qmp_commands() that in
  turn calls the generated qmp_init_marshal(), registers the
  additional commands and unregisters the unwanted ones.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1488544368-30622-5-git-send-email-armbru@redhat.com>
2017-03-05 09:02:10 +01:00
..
block block: Add Error parameter to bdrv_append() 2017-02-28 20:47:51 +01:00
crypto crypto: add CTR mode support 2016-10-19 10:09:24 +01:00
disas Fix Thumb-1 BE32 execution and disassembly. 2017-02-07 18:29:59 +00:00
exec ppc patch queuye for 2017-03-03 2017-03-04 16:31:14 +00:00
fpu softfloat: Add float128_to_uint32_round_to_zero() 2017-02-22 11:28:28 +11:00
hw ppc patch queuye for 2017-03-03 2017-03-04 16:31:14 +00:00
io io: make qio_channel_yield aware of AioContexts 2017-02-21 11:14:07 +00:00
libdecnumber
migration postcopy: Use temporary for placing zero huge pages 2017-02-28 11:30:23 +00:00
monitor qmp: Dumb down how we run QMP command registration 2017-03-05 09:02:10 +01:00
net vhost-net: Notify the backend about the host MTU 2017-01-10 07:02:53 +02:00
qapi include: Fix typos found by codespell 2017-01-24 23:26:52 +03:00
qemu qmp: Dumb down how we run QMP command registration 2017-03-05 09:02:10 +01:00
qom Merge branch 'icount-update' into HEAD 2017-03-03 16:39:18 +01:00
standard-headers update Linux headers to 4.11 2017-02-28 16:18:49 +00:00
sysemu KVM: move SIG_IPI handling to kvm-all.c 2017-03-03 16:40:02 +01:00
ui gtk-egl: add scanout_disable support 2017-02-27 16:15:29 +01:00
elf.h nios2: Add usermode binaries emulation 2017-01-24 13:10:35 -08:00
glib-compat.h glib-compat: add g_test_add_data_func_full fallback 2017-03-01 00:09:28 +04:00
qemu-common.h Update copyright year 2017-02-28 09:03:39 +03:00
qemu-io.h hmp: Request permissions in qemu-io 2017-02-28 20:47:50 +01:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00