From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O1z47-0006Sy-ER for qemu-devel@nongnu.org; Wed, 14 Apr 2010 05:39:23 -0400 Received: from [140.186.70.92] (port=49546 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1z45-0006SW-Ez for qemu-devel@nongnu.org; Wed, 14 Apr 2010 05:39:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O1z42-0004pH-W1 for qemu-devel@nongnu.org; Wed, 14 Apr 2010 05:39:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41803) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1ww7-00070d-3S for qemu-devel@nongnu.org; Wed, 14 Apr 2010 03:23:00 -0400 Message-ID: <4BC56D2B.3040606@redhat.com> Date: Wed, 14 Apr 2010 09:22:19 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1271083756-31269-1-git-send-email-kwolf@redhat.com> <20100413182033.GA6756@lst.de> In-Reply-To: <20100413182033.GA6756@lst.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] block: Split bdrv_open List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org Am 13.04.2010 20:20, schrieb Christoph Hellwig: > On Mon, Apr 12, 2010 at 04:49:16PM +0200, Kevin Wolf wrote: >> bdrv_open contains quite some code that is only useful for opening images (as >> opposed to opening files by a protocol), for example snapshots. >> >> This patch splits the code so that we have bdrv_open_file() for files (uses >> protocols), bdrv_open() for images (uses format drivers) and bdrv_do_open() for >> the code common for opening both images and files. >> >> Signed-off-by: Kevin Wolf >> --- >> This patch applies on top of Christoph's RFC for the format/protocol split > > I like this a lot. A few comments: > > - why is bdrv_do_open below it's users in the code? I really hate > forward declarations of functions and they can usually be easily > avoided. Ok, I'll move it. > - a "do" a function name is not very meaningfull - what about > bdrv_open_common instead? Heh, did exactly this yesterday because I felt the same. It's just not pushed yet. > - doesn't the backing device handling only apply to image formats, too? Hm, probably yes. At least currently no protocol uses it. We could add an assert(bs->backing_hd == NULL) to bdrv_file_open to make clear that backing files are not wanted for protocols. Kevin