diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-02-28 22:26:49 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-03-07 16:07:46 +0100 |
commit | d454dbe0ee3ca7bee8a0bb185e4be0534b1d1544 (patch) | |
tree | 6e41717a936d97796bdf4d811eb2e22953d793f9 /util/Makefile.objs | |
parent | 112c94465520fc50eb8edb4800c4f45ec8bd6a70 (diff) |
keyval: New keyval_parse()
keyval_parse() parses KEY=VALUE,... into a QDict. Works like
qemu_opts_parse(), except:
* Returns a QDict instead of a QemuOpts (d'oh).
* Supports nesting, unlike QemuOpts: a KEY is split into key
fragments at '.' (dotted key convention; the block layer does
something similar on top of QemuOpts). The key fragments are QDict
keys, and the last one's value is updated to VALUE.
* Each key fragment may be up to 127 bytes long. qemu_opts_parse()
limits the entire key to 127 bytes.
* Overlong key fragments are rejected. qemu_opts_parse() silently
truncates them.
* Empty key fragments are rejected. qemu_opts_parse() happily
accepts empty keys.
* It does not store the returned value. qemu_opts_parse() stores it
in the QemuOptsList.
* It does not treat parameter "id" specially. qemu_opts_parse()
ignores all but the first "id", and fails when its value isn't
id_wellformed(), or duplicate (a QemuOpts with the same ID is
already stored). It also screws up when a value contains ",id=".
* Implied value is not supported. qemu_opts_parse() desugars "foo" to
"foo=on", and "nofoo" to "foo=off".
* An implied key's value can't be empty, and can't contain ','.
I intend to grow this into a saner replacement for QemuOpts. It'll
take time, though.
Note: keyval_parse() provides no way to do lists, and its key syntax
is incompatible with the __RFQDN_ prefix convention for downstream
extensions, because it blindly splits at '.', even in __RFQDN_. Both
issues will be addressed later in the series.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1488317230-26248-4-git-send-email-armbru@redhat.com>
Diffstat (limited to 'util/Makefile.objs')
-rw-r--r-- | util/Makefile.objs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/util/Makefile.objs b/util/Makefile.objs index bc629e2aa2..06366b5828 100644 --- a/util/Makefile.objs +++ b/util/Makefile.objs @@ -24,6 +24,7 @@ util-obj-y += error.o qemu-error.o util-obj-y += id.o util-obj-y += iov.o qemu-config.o qemu-sockets.o uri.o notify.o util-obj-y += qemu-option.o qemu-progress.o +util-obj-y += keyval.o util-obj-y += hexdump.o util-obj-y += crc32c.o util-obj-y += uuid.o |