This is a repost of some previous patches written by Marc MarĂ which were also reposted by Richard Jones a few months ago. The original series and reposted series are here:
https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg01995.html https://lists.nongnu.org/archive/html/qemu-devel/2016-04/msg01994.html I've tried to take some of the previous feedback and integrate it into this series. There are also a few things I haven't touched that were previously mentioned though: 1) Denis Lunev suggested having block_module_load_one return the loaded driver to reduce duplicated for loops in many of the functions in block.c. I'd be happy to do this but wasn't completely sure how error handling would happen in that case since currently the return value is an integer error code. Would I switch to using the error handling mechanisms provided in util/error.c? 2) In the past some debate was had about the design of the modules. I haven't made any changes in this regard because it didn't seem a conclusion had been reached. Some links for background: Fam Zheng suggested a simpler parser: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg02201.html Denis Lunev suggested a design more similar to Linux kernel modules: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg05331.html Richard Jones suggested reasons to keep things as is: https://lists.nongnu.org/archive/html/qemu-devel/2016-04/msg01994.html Marc Mari (2): blockdev: Add dynamic generation of module_block.h blockdev: Add dynamic module loading for block drivers .gitignore | 1 + Makefile | 11 +++- block.c | 86 +++++++++++++++++++++++--- include/qemu/module.h | 3 + scripts/modules/module_block.py | 134 ++++++++++++++++++++++++++++++++++++++++ util/module.c | 37 +++-------- 6 files changed, 233 insertions(+), 39 deletions(-) create mode 100644 scripts/modules/module_block.py -- 2.5.5