All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Max Reitz <mreitz@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v1 6/6] block: convert to use qapi_stringify_ImageInfoSpecific
Date: Tue, 7 Jun 2016 10:59:49 -0600	[thread overview]
Message-ID: <5756FD85.7060905@redhat.com> (raw)
In-Reply-To: <1465294275-8733-7-git-send-email-berrange@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1979 bytes --]

On 06/07/2016 04:11 AM, Daniel P. Berrange wrote:
> When 'qemu-img info' prints out format specific information,
> it first converts the QAPI object into a JSON based QObject
> data structure. Unfortunately structs have to be turned into
> dicts, which looses all information about field ordering,

s/looses/loses/

> so the data printed appears in a semi-random order.
> 
> Convert this to use the qapi_stringify_ImageInfoSpecific()
> which uses a visitor to directly pretty-print the objects
> without the intermediate QObject conversion, and thus will
> maintain struct field ordering.
> 

The idea makes sense. I'm not sure we want to go all the way to
qapi_stringify_ImageInfoSpecific(), vs. just having a nice accessor
macro that takes care of type-punning through a common actor (the way I
did it in my series for QAPI_CLONE()).

> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  block/qapi.c | 101 ++---------------------------------------------------------
>  1 file changed, 3 insertions(+), 98 deletions(-)
> 

> @@ -599,107 +598,13 @@ void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
>      }
>  }
>  
> -static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
> -                       QDict *dict);
> -static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
> -                       QList *list);
> -
> -static void dump_qobject(fprintf_function func_fprintf, void *f,
> -                         int comp_indent, QObject *obj)
> -{
> -    switch (qobject_type(obj)) {
> -        case QTYPE_QINT: {
> -            QInt *value = qobject_to_qint(obj);
> -            func_fprintf(f, "%" PRId64, qint_get_int(value));
> -            break;

It's also nice that we're moving some of this code into a more
general-purpose visitor.

-- 
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: 604 bytes --]

  reply	other threads:[~2016-06-07 17:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 10:11 [Qemu-devel] [PATCH v1 0/6] Report format specific info for LUKS block driver Daniel P. Berrange
2016-06-07 10:11 ` [Qemu-devel] [PATCH v1 1/6] crypto: add support for querying parameters for block encryption Daniel P. Berrange
2016-06-07 14:17   ` Eric Blake
2016-06-07 10:11 ` [Qemu-devel] [PATCH v1 2/6] block: export LUKS specific data to qemu-img info Daniel P. Berrange
2016-06-07 15:36   ` Eric Blake
2016-06-07 15:51     ` Daniel P. Berrange
2016-06-07 16:11       ` Eric Blake
2016-06-07 10:11 ` [Qemu-devel] [PATCH v1 3/6] qapi: assert that visitor impls have required callbacks Daniel P. Berrange
2016-06-07 15:40   ` Eric Blake
2016-06-07 15:46     ` Daniel P. Berrange
2016-06-07 10:11 ` [Qemu-devel] [PATCH v1 4/6] qapi: add a text output visitor for pretty printing types Daniel P. Berrange
2016-06-07 16:09   ` Eric Blake
2016-06-07 16:20     ` Daniel P. Berrange
2016-06-07 16:40       ` Eric Blake
2016-06-07 16:45         ` Daniel P. Berrange
2016-06-07 10:11 ` [Qemu-devel] [PATCH v1 5/6] qapi: generate a qapi_stringify_TYPENAME method for all types Daniel P. Berrange
2016-06-07 16:23   ` Eric Blake
2016-06-07 10:11 ` [Qemu-devel] [PATCH v1 6/6] block: convert to use qapi_stringify_ImageInfoSpecific Daniel P. Berrange
2016-06-07 16:59   ` Eric Blake [this message]
2016-06-07 12:04 ` [Qemu-devel] [PATCH v1 0/6] Report format specific info for LUKS block driver Eric Blake
2016-06-07 14:35   ` Daniel P. Berrange
2016-06-14 13:56 ` Max Reitz
2016-06-14 14:05   ` Daniel P. Berrange

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=5756FD85.7060905@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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.