From: Kevin Wolf <kwolf@redhat.com>
To: Anthony Liguori <aliguori@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
agl@linux.vnet.ibm.com, qemu-devel@nongnu.org,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] block: fix the use of protocols in backing files
Date: Thu, 04 Nov 2010 14:31:46 +0100 [thread overview]
Message-ID: <4CD2B5C2.1030704@redhat.com> (raw)
In-Reply-To: <4CD2B1C7.9090704@linux.vnet.ibm.com>
Am 04.11.2010 14:14, schrieb Anthony Liguori:
> On 11/04/2010 07:54 AM, Kevin Wolf wrote:
>> Am 27.10.2010 20:19, schrieb Anthony Liguori:
>>
>>> Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
>>>
>>> diff --git a/block.c b/block.c
>>> index 1a965b2..00b6f21 100644
>>> --- a/block.c
>>> +++ b/block.c
>>> @@ -603,10 +603,16 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
>>> BlockDriver *back_drv = NULL;
>>>
>>> bs->backing_hd = bdrv_new("");
>>> - path_combine(backing_filename, sizeof(backing_filename),
>>> - filename, bs->backing_file);
>>> - if (bs->backing_format[0] != '\0')
>>> - back_drv = bdrv_find_format(bs->backing_format);
>>> + back_drv = bdrv_find_protocol(bs->backing_file);
>>> + if (!back_drv) {
>>>
>> If no protocol is specified, bdrv_find_protocol doesn't return NULL but
>> the file: driver.
>>
>
> An ugly way to handle this would be to do if (strstr(bs->backing_file,
> ":") == NULL) instead.
Ugly indeed.
> A deeper refactoring could return NULL in bdrv_find_protocol and fixup
> the callers to default to file: if none are specified.
NULL is already used for errors, so we'd have to have something like
int bdrv_find_protocol(const char *filename, BlockDriver **drv)
in order to be able to distinguish "invalid protocol" from "no explicit
protocol". You could rename this function and retain a
bdrv_find_protocol with the old prototype as a wrapper that returns file
instead of NULL (there are several callers that expect this behaviour,
so probably it makes sense to have it in a central place).
Does that sound reasonable?
Kevin
prev parent reply other threads:[~2010-11-04 13:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 18:19 [Qemu-devel] [PATCH] block: fix the use of protocols in backing files Anthony Liguori
2010-10-27 19:22 ` malc
2010-10-27 19:42 ` Anthony Liguori
2010-10-28 8:30 ` Stefan Hajnoczi
2010-10-28 8:50 ` Kevin Wolf
2010-10-28 9:35 ` Daniel P. Berrange
2010-10-28 9:45 ` Stefan Hajnoczi
2010-10-28 9:49 ` Kevin Wolf
2010-10-28 9:51 ` Daniel P. Berrange
2010-10-28 14:10 ` Anthony Liguori
2010-11-04 12:54 ` Kevin Wolf
2010-11-04 13:14 ` Anthony Liguori
2010-11-04 13:31 ` Kevin Wolf [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=4CD2B5C2.1030704@redhat.com \
--to=kwolf@redhat.com \
--cc=agl@linux.vnet.ibm.com \
--cc=aliguori@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.