From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xvl3M-0001qS-Uj for qemu-devel@nongnu.org; Tue, 02 Dec 2014 05:51:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xvl3H-0006u0-Rl for qemu-devel@nongnu.org; Tue, 02 Dec 2014 05:51:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xvl3H-0006tv-Hw for qemu-devel@nongnu.org; Tue, 02 Dec 2014 05:51:27 -0500 Date: Tue, 2 Dec 2014 11:51:14 +0100 From: Kevin Wolf Message-ID: <20141202105114.GF7283@noname.str.redhat.com> References: <1417099720-16428-1-git-send-email-mreitz@redhat.com> <1417099720-16428-2-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1417099720-16428-2-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 01/13] block: Make essential BlockDriver objects public List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Peter Lieven , qemu-devel@nongnu.org, Stefan Hajnoczi , Markus Armbruster 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-stable@nongnu.org > Signed-off-by: Max Reitz > --- > 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_ 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