From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsBSN-0001J7-Ew for qemu-devel@nongnu.org; Tue, 12 May 2015 10:46:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsBSM-0005Rn-Ad for qemu-devel@nongnu.org; Tue, 12 May 2015 10:46:51 -0400 Message-ID: <55521258.8070008@redhat.com> Date: Tue, 12 May 2015 08:46:48 -0600 From: Eric Blake MIME-Version: 1.0 References: <1431105726-3682-1-git-send-email-kwolf@redhat.com> <1431105726-3682-12-git-send-email-kwolf@redhat.com> In-Reply-To: <1431105726-3682-12-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="PHU6qEAQ6ffdBpj4De51ULctUgr86GUf5" Subject: Re: [Qemu-devel] [PATCH 11/34] block: Allow references for backing files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: mreitz@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --PHU6qEAQ6ffdBpj4De51ULctUgr86GUf5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Kevin Wolf > --- > block.c | 42 ++++++++++++++++++++++++------------------ > block/mirror.c | 2 +- > include/block/block.h | 3 ++- > 3 files changed, 27 insertions(+), 20 deletions(-) >=20 > 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 d= ictionary, > - * it needs to use QINCREF() before calling bdrv_file_open. > + * bdrev_key specifies the key for the image's BlockdevRef in the opti= ons 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 pa= rt of the > + * BlockdevRef. > + * > =20 > bs->open_flags &=3D ~BDRV_O_NO_BACKING; > - if (qdict_haskey(options, "file.filename")) { > + > + bdref_key_dot =3D 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --PHU6qEAQ6ffdBpj4De51ULctUgr86GUf5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVUhJYAAoJEKeha0olJ0Nq/bUH/RoFqQD8rvJV201Krpf/dmvg aWbjYP2SNNJg+4jE/+4V3gkBJ+M3mEqvahP8Ntvyg+nbjAMlVv+xsR9wf9jQSCaK SOFlOfRE+LZxDgtPI72aoMv24icuqvVRDImiG05M56WSBgvFm/GG8GvohMq8v5V8 LJ5S7lnYItgURgPyzaIDzjtCSXP6GFJTTyyBCmmXotPJ/8uBNwlbxcEmEN30Wxod OTwtJCFX6G5YhDe5AaMraUeYTx6IJWtfuu1KbqAZ7tz2At4sMIr6XEmX3GMZuQO0 JQWb1avRb0Oe01pqbsR+qOErkxqR+lmhWdHo8cyEIYlgPAUhbleY0EL071wwtOw= =rrAK -----END PGP SIGNATURE----- --PHU6qEAQ6ffdBpj4De51ULctUgr86GUf5--