From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 3/6] block/qapi: Human-readable ImageInfoSpecific dump
Date: Mon, 30 Sep 2013 10:18:23 -0600 [thread overview]
Message-ID: <5249A44F.2050802@redhat.com> (raw)
In-Reply-To: <1379938162-14005-4-git-send-email-mreitz@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]
On 09/23/2013 06:09 AM, Max Reitz wrote:
> Add a function for generically dumping the ImageInfoSpecific information
> in a human-readable format to block/qapi.c.
>
> Use this function in bdrv_image_info_dump and qemu-io-cmds.c:info_f to
> allow qemu-img info resp. qemu-io -c info to print that format specific
> information.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> block/qapi.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++
> include/block/qapi.h | 2 +
> qemu-io-cmds.c | 9 ++++
> 3 files changed, 132 insertions(+)
>
> +
> +static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
> + QDict *dict)
> +{
> + const QDictEntry *entry;
> +
> + for (entry = qdict_first(dict); entry; entry = qdict_next(dict, entry)) {
> + qtype_code type = qobject_type(entry->value);
> + bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST);
> + const char *format = composite ? "%*s%s:\n" : "%*s%s: ";
> + char key[strlen(entry->key) + 1];
> + int i;
> +
> + /* replace dashes with spaces in key (variable) names */
> + for (i = 0; entry->key[i]; i++) {
> + key[i] = entry->key[i] == '-' ? ' ' : entry->key[i];
I wonder if this should replace underscores, too. For now, this
function is only being used on types that happen to use - in key names,
but it seems generic enough that we may want to use it on older types
that followed older conventions. But I won't force a respin for just
that (if someone DOES reuse this function in the future, they can tweak
underscores at that time, if you don't do it now).
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
next prev parent reply other threads:[~2013-09-30 16:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-23 12:09 [Qemu-devel] [PATCH v5 0/6] Provide additional info through qemu-img info Max Reitz
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 1/6] qapi: Add ImageInfoSpecific type Max Reitz
2013-09-30 16:04 ` Eric Blake
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 2/6] block: Add bdrv_get_specific_info Max Reitz
2013-09-30 16:09 ` Eric Blake
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 3/6] block/qapi: Human-readable ImageInfoSpecific dump Max Reitz
2013-09-30 16:18 ` Eric Blake [this message]
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 4/6] qcow2: Add support for ImageInfoSpecific Max Reitz
2013-09-30 16:25 ` Eric Blake
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 5/6] qemu-iotests: Discard specific info in _img_info Max Reitz
2013-09-30 17:14 ` Eric Blake
2013-10-01 8:25 ` Max Reitz
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 6/6] qemu-iotests: Additional info from qemu-img info Max Reitz
2013-09-30 17:19 ` Eric Blake
2013-10-01 9:19 ` Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5249A44F.2050802@redhat.com \
--to=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.