From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ynl8g-0004Rj-D8 for qemu-devel@nongnu.org; Thu, 30 Apr 2015 05:52:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ynl8a-0004UD-AU for qemu-devel@nongnu.org; Thu, 30 Apr 2015 05:52:14 -0400 Date: Thu, 30 Apr 2015 11:52:01 +0200 From: Kevin Wolf Message-ID: <20150430095201.GB3368@noname.redhat.com> References: <5541F1B3.6040501@cn.fujitsu.com> <20150430093310.GA3368@noname.redhat.com> <5541F934.8010100@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5541F934.8010100@cn.fujitsu.com> Subject: Re: [Qemu-devel] Question about block driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang Cc: qemu-block@nongnu.org, Fam Zheng , qemu-devl , Stefan Hajnoczi Am 30.04.2015 um 11:43 hat Wen Congyang geschrieben: > 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? Yes, that's how it works, even though I don't think a driver exists that opens bs->file by itself. Kevin