This is v2 of the series I sent out last week. These are the changes I
made based on the feedback I got:
- Fixed typo and Marc's email address in the python script
- Moved registration of iscsi_opts into vl.c

What I didn't do:
- Remove copy-pasted loops

There was a bit of discussion about how to remove the need for the copy-
paste loops that are in block.c. I attempted to solve it by using
g_module_sym to load the BlockDriver struct directly at the time the
module gets loaded and returning it so that the loops were not
necessary. I accomplished this by adding a field to the struct which,
for a given format/protocol configuration, had the name of the
corresponding BlockDriver struct. Having the name allowed me to load the
symbol right out of the loaded module. However, it turns out that, at
least as far as I can tell, g_module_sym can't load the BlockDriver
structs in this way because they are declared static.

I tested the attempt to remove the copy-pasted loops by using the
qemu-iotests on it with ssh (which is modularized). The errors I got
were along the lines of:

can't open device ssh://[address removed]: Unknown protocol 'ssh'
Failed to find driver in module

To test my theory (I haven't had much luck finding reliable
documentation about this) that it was because they were static, I
changed the definition of the bdrv_ssh BlockDriver to not be static.
Unfortunately I still got errors, but I believe the drivers got loaded.
The errors were not the same, rather these ones were complaining about
the host key not matching the one in known_hosts. I've had this issue
while trying to set up ssh with qemu in the past, so I'm not quite as
worried about it (although I'd love to hear a fix), and more importantly
there aren't any messages about the driver not being found.

That hopefully explains some of the issues, and why I'm submitting this
with the duplicated loops still intact. If there are other ideas for
dealing with this my ears are open, but this is what I have for now.

Colin Lord (1):
  blockdev: prepare iSCSI block driver for dynamic loading

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 +++++++++++++++++++++++---
 block/iscsi.c                   |  36 -----------
 include/qemu/module.h           |   3 +
 scripts/modules/module_block.py | 134 ++++++++++++++++++++++++++++++++++++++++
 util/module.c                   |  37 +++--------
 vl.c                            |  36 +++++++++++
 8 files changed, 269 insertions(+), 75 deletions(-)
 create mode 100644 scripts/modules/module_block.py

-- 
2.5.5


Reply via email to