* [Qemu-devel] Question about block driver @ 2015-04-30 9:11 Wen Congyang 2015-04-30 9:33 ` Kevin Wolf 0 siblings, 1 reply; 5+ messages in thread From: Wen Congyang @ 2015-04-30 9:11 UTC (permalink / raw) To: qemu-devl, Fam Zheng, Stefan Hajnoczi Hi, all Some drivers use bdrv_open, while the other dirvers use bdrv_file_open(). What is the difference between bdrv_open() and bdrv_file_open()? Thanks Wen Congyang ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] Question about block driver 2015-04-30 9:11 [Qemu-devel] Question about block driver Wen Congyang @ 2015-04-30 9:33 ` Kevin Wolf 2015-04-30 9:43 ` Wen Congyang 0 siblings, 1 reply; 5+ messages in thread From: Kevin Wolf @ 2015-04-30 9:33 UTC (permalink / raw) To: Wen Congyang; +Cc: qemu-block, Fam Zheng, qemu-devl, Stefan Hajnoczi [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. Kevin ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] Question about block driver 2015-04-30 9:33 ` Kevin Wolf @ 2015-04-30 9:43 ` Wen Congyang 2015-04-30 9:52 ` Kevin Wolf 0 siblings, 1 reply; 5+ messages in thread From: Wen Congyang @ 2015-04-30 9:43 UTC (permalink / raw) To: Kevin Wolf; +Cc: qemu-block, 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 > . > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] Question about block driver 2015-04-30 9:43 ` Wen Congyang @ 2015-04-30 9:52 ` Kevin Wolf 2015-04-30 15:46 ` Stefan Hajnoczi 0 siblings, 1 reply; 5+ messages in thread From: Kevin Wolf @ 2015-04-30 9:52 UTC (permalink / raw) To: Wen Congyang; +Cc: qemu-block, 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] Question about block driver 2015-04-30 9:52 ` Kevin Wolf @ 2015-04-30 15:46 ` Stefan Hajnoczi 0 siblings, 0 replies; 5+ messages in thread From: Stefan Hajnoczi @ 2015-04-30 15:46 UTC (permalink / raw) To: Kevin Wolf; +Cc: qemu-block, Fam Zheng, qemu-devl [-- Attachment #1: Type: text/plain, Size: 1283 bytes --] On Thu, Apr 30, 2015 at 11:52:01AM +0200, Kevin Wolf wrote: > 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. Some extra context about this statement: .bdrv_file_open() block drivers (aka "protocols") operate directly on a POSIX file descriptor, a socket, GlusterFS API, etc so they usually have no need for bs->file. Stefan [-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-30 15:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-04-30 9:11 [Qemu-devel] Question about block driver Wen Congyang 2015-04-30 9:33 ` Kevin Wolf 2015-04-30 9:43 ` Wen Congyang 2015-04-30 9:52 ` Kevin Wolf 2015-04-30 15:46 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).