From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvjUa-00033H-R2 for qemu-devel@nongnu.org; Tue, 02 Dec 2014 04:11:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XvjUV-0004ci-O2 for qemu-devel@nongnu.org; Tue, 02 Dec 2014 04:11:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvjUV-0004cZ-Gx for qemu-devel@nongnu.org; Tue, 02 Dec 2014 04:11:27 -0500 Message-ID: <547D8233.7040600@redhat.com> Date: Tue, 02 Dec 2014 10:11:15 +0100 From: Max Reitz MIME-Version: 1.0 References: <1417099720-16428-1-git-send-email-mreitz@redhat.com> <1417099720-16428-2-git-send-email-mreitz@redhat.com> <547C9058.5050708@redhat.com> In-Reply-To: <547C9058.5050708@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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: Eric Blake , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Lieven , Markus Armbruster , Stefan Hajnoczi On 2014-12-01 at 16:59, Eric Blake wrote: > On 11/27/2014 07:48 AM, Max Reitz wrote: >> 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 > s/occured/occurred/ > >> 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(-) > Reviewed-by: Eric Blake > >> +++ b/block/qcow2.c >> @@ -2847,7 +2847,7 @@ static QemuOptsList qcow2_create_opts = { >> } >> }; >> >> -static BlockDriver bdrv_qcow2 = { >> +BlockDriver *bdrv_qcow2 = &(BlockDriver){ > Do we want any use of 'const', to avoid accidental manipulation of the > pointer and/or pointed-to contents? Sounds good at first, but for instance qemu_opts_create() (which is often called with bdrv_qcow2->create_opts and the like) don't take a const pointer. We could fix all those functions, but trying to fix the const-ness of the block layer sounds like really tedious work to me... Also, bdrv_find_format() returns a non-const pointer so it's at least not more broken than it was before. Max