From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnkwP-0002WK-Gp for qemu-devel@nongnu.org; Thu, 30 Apr 2015 05:39:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnkwO-0008AF-O1 for qemu-devel@nongnu.org; Thu, 30 Apr 2015 05:39:33 -0400 Message-ID: <5541F934.8010100@cn.fujitsu.com> Date: Thu, 30 Apr 2015 17:43:16 +0800 From: Wen Congyang MIME-Version: 1.0 References: <5541F1B3.6040501@cn.fujitsu.com> <20150430093310.GA3368@noname.redhat.com> In-Reply-To: <20150430093310.GA3368@noname.redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Question about block driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-block@nongnu.org, Fam Zheng , qemu-devl , Stefan Hajnoczi On 04/30/2015 05:33 PM, Kevin Wolf wrote: > [Cc: qemu-block] > > Am 30.04.2015 um 11:11 hat Wen Congyang geschrieben: >> Some drivers use bdrv_open, while the other dirvers use bdrv_file_open(). >> What is the difference between bdrv_open() and bdrv_file_open()? > > bdrv_file_open() is used by protocol drivers that don't need any other > driver to work (e.g. raw-posix), bdrv_open() is used by format drivers > that need a bs->file (e.g. raw or qcow2). > > They used to have different parameters originally, but nowadays that's > the only difference. So, if the driver wants to open bs->file itself, it should use bdrv_file_open(), and the driver wants bs->file has already been opened before its open, it should use bdrv_open(). Is it right? Thanks Wen Congyang > > Kevin > . >