Il 31/08/2014 22:38, Benoît Canet ha scritto: > The problem with QEMU block drivers is that they are using either coroutines > or QEMU custom AIO callbacks so reusing them without the block layer is > not doable.
Not really true. The QEMU block layer can be wrapped relatively easily in a GSource. This is how QEMU uses it, in fact. As to global state, each .so is only loaded once in an executable, so if TCMU loaded two QEMU plugins the .so would point to the block devices from each plugin. The problem is more the QMP interface, I think. > For the QEMU block layer as a whole it maintains some linked lists of block > devices > states or similar stuff as static global variables. > (See https://github.com/qemu/qemu/blob/master/block.c#L96) > > So having more than one instance of the block layer running is not doable. > > I am not aware of anyone successfull in turning it into a proper .so. There was libqemublock. I think it stopped just because the author turned to something else, not because there were particular problems with the design. Paolo > Extracting into a binary acting as an nbd target was done with qemu-nbd > though.