qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 11/34] block: Allow references for


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 11/34] block: Allow references for backing files
Date: Tue, 12 May 2015 08:46:48 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 05/08/2015 11:21 AM, Kevin Wolf wrote:
> For bs->file, using references to existing BDSes has been possible for a
> while already. This patch enables the same for bs->backing_hd.
> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  block.c               | 42 ++++++++++++++++++++++++------------------
>  block/mirror.c        |  2 +-
>  include/block/block.h |  3 ++-
>  3 files changed, 27 insertions(+), 20 deletions(-)
> 
> diff --git a/block.c b/block.c
> index e93bf63..95dc51e 100644
> --- a/block.c
> +++ b/block.c
> @@ -1109,30 +1109,41 @@ out:
>  /*
>   * Opens the backing file for a BlockDriverState if not yet open
>   *
> - * options is a QDict of options to pass to the block drivers, or NULL for an
> - * empty set of options. The reference to the QDict is transferred to this
> - * function (even on failure), so if the caller intends to reuse the 
> dictionary,
> - * it needs to use QINCREF() before calling bdrv_file_open.
> + * bdrev_key specifies the key for the image's BlockdevRef in the options 
> QDict.

s/bdrev/bdref/

> + * That QDict has to be flattened; therefore, if the BlockdevRef is a QDict
> + * itself, all options starting with "${bdref_key}." are considered part of 
> the
> + * BlockdevRef.
> + *

>  
>      bs->open_flags &= ~BDRV_O_NO_BACKING;
> -    if (qdict_haskey(options, "file.filename")) {
> +
> +    bdref_key_dot = g_strdup_printf("%s.", bdref_key);
> +    qdict_extract_subqdict(parent_options, &options, bdref_key_dot);
> +    g_free(bdref_key_dot);

I wonder if we have a pattern like this frequently enough to make a
wrapper that concatenates the argument for us, instead of having every
caller have to form a temporary concatenation string.  But not something
that affects this patch.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]