diff options
| author | Marc Mari <markmb@redhat.com> | 2016-08-12 09:27:03 -0400 |
|---|---|---|
| committer | Max Reitz <mreitz@redhat.com> | 2016-09-20 22:12:03 +0200 |
| commit | 88d88798b7efeb0be15b1a60e58b1f8ba4c2f700 (patch) | |
| tree | 13c971d74f4ee7ffe1829d038955c813b5f1fce0 /include/qemu/module.h | |
| parent | 0c0c1fd973013671ea63680fcd9802766c1d04fe (diff) | |
| download | focaccia-qemu-88d88798b7efeb0be15b1a60e58b1f8ba4c2f700.tar.gz focaccia-qemu-88d88798b7efeb0be15b1a60e58b1f8ba4c2f700.zip | |
blockdev: Add dynamic module loading for block drivers
Extend the current module interface to allow for block drivers to be loaded dynamically on request. The only block drivers that can be converted into modules are the drivers that don't perform any init operation except for registering themselves. In addition, only the protocol drivers are being modularized, as they are the only ones which see significant performance benefits. The format drivers do not generally link to external libraries, so modularizing them is of no benefit from a performance perspective. All the necessary module information is located in a new structure found in module_block.h This spoils the purpose of 5505e8b76f (block/dmg: make it modular). Before this patch, if module build is enabled, block-dmg.so is linked to libbz2, whereas the main binary is not. In downstream, theoretically, it means only the qemu-block-extra package depends on libbz2, while the main QEMU package needn't to. With this patch, we (temporarily) change the case so that the main QEMU depends on libbz2 again. Signed-off-by: Marc MarĂ <markmb@redhat.com> Signed-off-by: Colin Lord <clord@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1471008424-16465-4-git-send-email-clord@redhat.com Reviewed-by: Max Reitz <mreitz@redhat.com> [mreitz: Do a signed comparison against the length of block_driver_modules[], so it will not cause a compile error when empty] Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include/qemu/module.h')
| -rw-r--r-- | include/qemu/module.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/qemu/module.h b/include/qemu/module.h index 2370708445..dc2c9d4c4e 100644 --- a/include/qemu/module.h +++ b/include/qemu/module.h @@ -52,9 +52,12 @@ typedef enum { #define qapi_init(function) module_init(function, MODULE_INIT_QAPI) #define type_init(function) module_init(function, MODULE_INIT_QOM) +#define block_module_load_one(lib) module_load_one("block-", lib) + void register_module_init(void (*fn)(void), module_init_type type); void register_dso_module_init(void (*fn)(void), module_init_type type); void module_call_init(module_init_type type); +void module_load_one(const char *prefix, const char *lib_name); #endif |