Am 27.11.2014 um 15:48 hat Max Reitz geschrieben: > There are some block drivers which are essential to QEMU and may not be > removed: These are raw, file and qcow2 (as the default non-raw format). > Make their BlockDriver objects public so they can be directly referenced > throughout the block layer without needing to call bdrv_find_format() > and having to deal with an error at runtime, while the real problem > occured during linking (where raw, file or qcow2 were not linked into > qemu). > > Cc: qemu-sta...@nongnu.org > Signed-off-by: Max Reitz <mre...@redhat.com> > --- > block/qcow2.c | 4 ++-- > block/raw-posix.c | 4 ++-- > block/raw-win32.c | 4 ++-- > block/raw_bsd.c | 4 ++-- > include/block/block_int.h | 8 ++++++++ > 5 files changed, 16 insertions(+), 8 deletions(-) > > diff --git a/block/qcow2.c b/block/qcow2.c > index 8b9ffc4..0eeba36 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -2847,7 +2847,7 @@ static QemuOptsList qcow2_create_opts = { > } > }; > > -static BlockDriver bdrv_qcow2 = { > +BlockDriver *bdrv_qcow2 = &(BlockDriver){
As you correctly guessed, I like the looks of this syntax, but it leaves us with some bdrv_<format> objects being pointers, and most others still directly being the BlockDriver object. I think it would be better to define a public BlockDriver here and use &bdrv_qcow2 where necessary. Perhaps not a blocker, but in case you need to send a v3. Kevin