qemu-e2k/include
Daniel P. Berrange 603476c25c qdict: implement a qdict_crumple method for un-flattening a dict
The qdict_flatten() method will take a dict whose elements are
further nested dicts/lists and flatten them by concatenating
keys.

The qdict_crumple() method aims to do the reverse, taking a flat
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.

If the keys are a mixture of numeric and non-numeric, or the
numeric keys are not in strictly ascending order, an error will
be reported.

As an example, a flat dict containing

 {
   'foo.0.bar': 'one',
   'foo.0.wizz': '1',
   'foo.1.bar': 'two',
   'foo.1.wizz': '2'
 }

will get turned into a dict with one element 'foo' whose
value is a list. The list elements will each in turn be
dicts.

 {
   'foo': [
     { 'bar': 'one', 'wizz': '1' },
     { 'bar': 'two', 'wizz': '2' }
   ],
 }

If the key is intended to contain a literal '.', then it must
be escaped as '..'. ie a flat dict

  {
     'foo..bar': 'wizz',
     'bar.foo..bar': 'eek',
     'bar.hello': 'world'
  }

Will end up as

  {
     'foo.bar': 'wizz',
     'bar': {
        'foo.bar': 'eek',
        'hello': 'world'
     }
  }

The intent of this function is that it allows a set of QemuOpts
to be turned into a nested data structure that mirrors the nesting
used when the same object is defined over QMP.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1475246744-29302-3-git-send-email-berrange@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Parameter recursive dropped along with its tests; whitespace style
touched up]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-10-25 17:56:14 +02:00
..
block block: More operations for meta dirty bitmap 2016-10-24 17:56:07 +02:00
crypto crypto: add CTR mode support 2016-10-19 10:09:24 +01:00
disas disas: Fix ATTRIBUTE_UNUSED define clash with ALSA headers 2016-07-19 16:40:39 +01:00
exec x86 and CPU queue, 2016-10-24 2016-10-25 10:25:27 +01:00
fpu fpu: add mechanism to check for invalid long double formats 2016-09-15 12:43:18 +01:00
hw x86 and CPU queue, 2016-10-24 2016-10-25 10:25:27 +01:00
io Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
libdecnumber Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
migration migrate: move max-bandwidth and downtime-limit to migrate_set_parameter 2016-10-13 17:23:53 +02:00
monitor monitor: fix crash when leaving qemu with spice audio 2016-08-08 14:16:11 +02:00
net Remove unused function declarations 2016-09-15 15:32:22 +03:00
qapi qdict: implement a qdict_crumple method for un-flattening a dict 2016-10-25 17:56:14 +02:00
qemu hbitmap: serialization 2016-10-24 17:56:07 +02:00
qom exec: call cpu_exec_exit() from a CPU unrealize common function 2016-10-24 17:29:16 -02:00
standard-headers linux-headers: update 2016-09-05 15:15:16 +02:00
sysemu Increase MAX_CPUMASK_BITS from 255 to 288 2016-10-24 17:29:15 -02:00
ui spice/gl: render DisplaySurface via opengl 2016-09-28 12:49:36 +02:00
elf.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
glib-compat.h glib-compat: add g_(s)list_free_full() 2016-09-08 17:57:32 +04:00
qemu-common.h cpu: Support a target CPU having a variable page size 2016-10-24 16:26:49 +01:00
qemu-io.h qemu-io: Use BlockBackend 2015-02-16 15:07:19 +00:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00
trace.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00