From: Jason Wang <jasowang@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
Thomas Huth <thuth@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Stefan Weil <sw@weilnetz.de>,
qemu-devel@nongnu.org, Vincenzo Maffione <v.maffione@gmail.com>,
yc-core@yandex-team.ru,
Samuel Thibault <samuel.thibault@ens-lyon.org>,
Alexey Kirillov <lekiravi@yandex-team.ru>,
Paolo Bonzini <pbonzini@redhat.com>,
Giuseppe Lettieri <g.lettieri@iet.unipi.it>,
Luigi Rizzo <rizzo@iet.unipi.it>
Subject: Re: [PATCH v5 3/4] hmp: Use QMP query-netdev in hmp_info_network
Date: Wed, 16 Dec 2020 00:58:02 -0500 (EST) [thread overview]
Message-ID: <92845450.36204439.1608098282759.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <87o8ivmpia.fsf@dusky.pond.sub.org>
----- Original Message -----
> Jason Wang <jasowang@redhat.com> writes:
>
> [...]
> > One more stupid question, instead of generating the string via hard
> > codes, is there any method (dict?) to iterate all the key/values
> > automatically?
>
> QAPI visitors.
>
> The lazy way: use the QObject output visitor to convert the QAPI type
> (here: NetdevInfo) to QObject, then qobject_to_json() to convert to
> JSON text.
>
> If you don't want JSON, replace qobject_to_json(). Perhaps you can
> create something that's generally useful for HMP, not just "info
> network". I'd pick keyval_parse() syntax.
>
> The detour through QObject creates and destroys a rather fat temporary
> data structure. Tolerable when the amount of data is small. An output
> visitor that directly creates the string is more efficient. Takes a bit
> more code, though. I intend to post one for JSON, to reduce QMP's
> malloc gluttony.
>
Thanks a lot for the answer.
Alexey, let's try what Markus suggested here.
next prev parent reply other threads:[~2020-12-16 5:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-08 23:59 [PATCH v5 0/4] Introducing QMP query-netdev command Alexey Kirillov
2020-11-08 23:59 ` [PATCH v5 1/4] qapi: net: Add " Alexey Kirillov
2020-11-08 23:59 ` [PATCH v5 2/4] tests: Add tests for " Alexey Kirillov
2020-11-08 23:59 ` [PATCH v5 3/4] hmp: Use QMP query-netdev in hmp_info_network Alexey Kirillov
2020-12-07 5:52 ` Jason Wang
2020-12-14 17:14 ` Alexey Kirillov
2020-12-15 4:16 ` Jason Wang
2020-12-15 8:39 ` Markus Armbruster
2020-12-16 5:58 ` Jason Wang [this message]
2020-12-16 9:16 ` Alexey Kirillov
2020-11-08 23:59 ` [PATCH v5 4/4] net: Do not use legacy info_str for backends Alexey Kirillov
2020-11-23 15:19 ` [PATCH v5 0/4] Introducing QMP query-netdev command Alexey Kirillov
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=92845450.36204439.1608098282759.JavaMail.zimbra@redhat.com \
--to=jasowang@redhat.com \
--cc=armbru@redhat.com \
--cc=g.lettieri@iet.unipi.it \
--cc=lekiravi@yandex-team.ru \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rizzo@iet.unipi.it \
--cc=samuel.thibault@ens-lyon.org \
--cc=sw@weilnetz.de \
--cc=thuth@redhat.com \
--cc=v.maffione@gmail.com \
--cc=yc-core@yandex-team.ru \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).