From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "Jeff Cody" <jcody@redhat.com>,
qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
"Benoît Canet" <benoit@irqsave.net>
Subject: Re: [Qemu-devel] [PATCH v2 1/8] block: Change BDS parameter of bdrv_open() to **
Date: Wed, 12 Feb 2014 01:10:47 +0100 [thread overview]
Message-ID: <52FABC07.1040108@redhat.com> (raw)
In-Reply-To: <20140210124250.GC2832@dhcp-200-207.str.redhat.com>
On 10.02.2014 13:42, Kevin Wolf wrote:
> Am 08.02.2014 um 18:39 hat Max Reitz geschrieben:
>> Make bdrv_open() take a pointer to a BDS pointer, similarly to
>> bdrv_file_open(). If a pointer to a NULL pointer is given, bdrv_open()
>> will create a new BDS with an empty name; if the BDS pointer is not
>> NULL, that existing BDS will be reused (in the same way as bdrv_open()
>> already did).
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>> block.c | 64 +++++++++++++++++++++++++++++++--------------------
>> block/blkdebug.c | 1 +
>> block/blkverify.c | 2 ++
>> block/qcow2.c | 14 +++++++----
>> block/vmdk.c | 5 ++--
>> block/vvfat.c | 6 ++---
>> blockdev.c | 20 ++++++++--------
>> hw/block/xen_disk.c | 2 +-
>> include/block/block.h | 2 +-
>> qemu-img.c | 10 ++++----
>> qemu-io.c | 2 +-
>> qemu-nbd.c | 2 +-
>> 12 files changed, 72 insertions(+), 58 deletions(-)
>> @@ -1160,6 +1158,10 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
>> * BlockdevRef.
>> *
>> * The BlockdevRef will be removed from the options QDict.
>> + *
>> + * As with bdrv_open(), if *pbs is NULL, a new BDS will be created with a
>> + * pointer to it stored there. If it is not NULL, the referenced BDS will
>> + * be reused.
>> */
>> int bdrv_open_image(BlockDriverState **pbs, const char *filename,
>> QDict *options, const char *bdref_key, int flags,
> There are no callers that make use of *pbs != NULL. Are you planning to
> add such users? Otherwise, we could just assert() it here instead of
> documenting behaviour that is never used.
No, currently, there aren't. Since we're planning to eventually adjust
everything to give a pointer to a NULL pointer to these functions (i.e.,
nobody except bdrv_open() uses bdrv_new()), adding an assert() in order
to prevent anyone from "exploiting" this in a way which would
technically be fine but actually not what we want (i.e., reusing an
already existing BDS), is fine with me. I'll add it and adjust the comment.
Max
next prev parent reply other threads:[~2014-02-12 0:08 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-08 17:39 [Qemu-devel] [PATCH v2 0/8] block: Integrate bdrv_file_open() into bdrv_open() Max Reitz
2014-02-08 17:39 ` [Qemu-devel] [PATCH v2 1/8] block: Change BDS parameter of bdrv_open() to ** Max Reitz
2014-02-10 12:42 ` Kevin Wolf
2014-02-12 0:10 ` Max Reitz [this message]
2014-02-10 13:17 ` Benoît Canet
2014-02-12 0:15 ` Max Reitz
2014-02-08 17:39 ` [Qemu-devel] [PATCH v2 2/8] block: Add reference parameter to bdrv_open() Max Reitz
2014-02-10 13:30 ` Benoît Canet
2014-02-12 0:17 ` Max Reitz
2014-02-08 17:39 ` [Qemu-devel] [PATCH v2 3/8] block: Make bdrv_file_open() static Max Reitz
2014-02-10 13:40 ` Benoît Canet
2014-02-08 17:39 ` [Qemu-devel] [PATCH v2 4/8] block: Reuse reference handling from bdrv_open() Max Reitz
2014-02-10 13:42 ` Benoît Canet
2014-02-08 17:39 ` [Qemu-devel] [PATCH v2 5/8] block: Remove bdrv_new() from bdrv_file_open() Max Reitz
2014-02-10 13:49 ` Benoît Canet
2014-02-08 17:39 ` [Qemu-devel] [PATCH v2 6/8] block: Handle bs->options in bdrv_open() only Max Reitz
2014-02-10 16:23 ` Benoît Canet
2014-02-10 16:23 ` Benoît Canet
2014-02-08 17:39 ` [Qemu-devel] [PATCH v2 7/8] block: Reuse success path from bdrv_open() Max Reitz
2014-02-10 14:56 ` Kevin Wolf
2014-02-12 0:26 ` Max Reitz
2014-02-10 16:28 ` Benoît Canet
2014-02-08 17:39 ` [Qemu-devel] [PATCH v2 8/8] block: Remove bdrv_open_image()'s force_raw option Max Reitz
2014-02-10 16:31 ` Benoît Canet
2014-02-10 15:01 ` [Qemu-devel] [PATCH v2 0/8] block: Integrate bdrv_file_open() into bdrv_open() Kevin Wolf
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=52FABC07.1040108@redhat.com \
--to=mreitz@redhat.com \
--cc=benoit@irqsave.net \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).