From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWoQb-0003Be-D3 for qemu-devel@nongnu.org; Fri, 19 Feb 2016 12:01:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWoQY-00065p-Mt for qemu-devel@nongnu.org; Fri, 19 Feb 2016 12:01:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59180) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWoQX-00065I-Ot for qemu-devel@nongnu.org; Fri, 19 Feb 2016 12:01:10 -0500 References: <1455900463-16007-1-git-send-email-berrange@redhat.com> <1455900463-16007-2-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <56C74A53.20608@redhat.com> Date: Fri, 19 Feb 2016 10:01:07 -0700 MIME-Version: 1.0 In-Reply-To: <1455900463-16007-2-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="k81XL9kj32jJgTSCnWAbH1PNNTXafIWes" Subject: Re: [Qemu-devel] [PATCH v1 01/10] qdict: implement a qdict_crumple method for un-flattening a dict List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Paolo Bonzini , Markus Armbruster , =?UTF-8?Q?Andreas_F=c3=a4rber?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --k81XL9kj32jJgTSCnWAbH1PNNTXafIWes Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/19/2016 09:47 AM, Daniel P. Berrange wrote: > The qdict_flatten() method will take a dict whose elements are > further nested dicts/lists and flatten them by concatenating > keys. >=20 > The qdict_crumple() method aims todo the reverse, taking a flat s/todo/to do/ > qdict, and turning it into a set of nested dicts/lists. It will > apply nesting based on the key name, with a '.' indicating a > new level in the hierarchy. If the keys in the nested structure > are all numeric, it will create a list, otherwise it will create > a dict. >=20 Interesting idea. I haven't closely reviewed the patch yet, but do have a comment on the commit message: >=20 > If the key is intended to contain a literal '.', then it must > be escaped as '..'. ie a flat dict Hmm. We forbid the use of '.' inside QAPI key names in most places, but have an exception that downstream extensions use '.'. So, I guess the only place you'd really use this is trying to target a downstream-extension key name: >=20 > { > 'foo..bar': 'wizz', > 'bar.foo..bar': 'eek', as in '__com..example_bar': 'eek' to set the downstream key-name of '__com.example_bar'. I'm not sure the special casing of '.' is worth it, particularly since qdict_flatten() doesn't have it in the reverse direction. > The intent of this function is that it allows a set of QemuOpts > to be turned into a nested data structure that mirrors the nested > used when the same object is defined over QMP. >=20 > Signed-off-by: Daniel P. Berrange > --- I hope to offer a more detailed review next week (I'm trying to get some of my own patches polished today). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --k81XL9kj32jJgTSCnWAbH1PNNTXafIWes 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/ iQEcBAEBCAAGBQJWx0pTAAoJEKeha0olJ0Nq5kMH/2wPmh6s9fMhSVnCtAVSClAj /s/CPxHf65uq7GxmqOUZY1CfAXT4rNWhIr78joHgvrWjnopklbxPpMYHao6YAqjk rJjtODCkYfGZB2Ea0Y7chR5IizwX2FB7TZB/8Wbs4fZFXOp7sO/t8ZaDh0nHQ25u Ola0TyJdsMNRi7m+tgXyGTuCGRq97736HCzVm//uuiDl+jHnf5vQVDzqjcC7/JX9 kj5UGnGSeqeDp5GRWNREPX/wyT+axOZGrkh86GaTg39I6HFSfEG3RjXeC4sG61Hc x8+WcwAVrxXn5pTmZgPAcMqJwSA3BtjcSu5JNecaInM8HJW/h9QJ6Eky9zMfaFM= =5kWM -----END PGP SIGNATURE----- --k81XL9kj32jJgTSCnWAbH1PNNTXafIWes--