qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org, Fam Zheng <famz@redhat.com>,
	qemu-devl <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Question about block driver
Date: Thu, 30 Apr 2015 16:46:26 +0100	[thread overview]
Message-ID: <20150430154626.GB26469@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <20150430095201.GB3368@noname.redhat.com>

[-- 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 --]

      reply	other threads:[~2015-04-30 15:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150430154626.GB26469@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).