From: Markus Armbruster <armbru@redhat.com>
To: Jason Wang <jasowang@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>,
Luigi Rizzo <rizzo@iet.unipi.it>,
yc-core@yandex-team.ru, Paolo Bonzini <pbonzini@redhat.com>,
Alexey Kirillov <lekiravi@yandex-team.ru>,
Samuel Thibault <samuel.thibault@ens-lyon.org>,
Giuseppe Lettieri <g.lettieri@iet.unipi.it>
Subject: Re: [PATCH v5 3/4] hmp: Use QMP query-netdev in hmp_info_network
Date: Tue, 15 Dec 2020 09:39:57 +0100 [thread overview]
Message-ID: <87o8ivmpia.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <3e019e9d-2649-5df8-8f9c-8d76eb2615a5@redhat.com> (Jason Wang's message of "Mon, 7 Dec 2020 13:52:14 +0800")
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.
next prev parent reply other threads:[~2020-12-15 8:40 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 [this message]
2020-12-16 5:58 ` Jason Wang
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=87o8ivmpia.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=g.lettieri@iet.unipi.it \
--cc=jasowang@redhat.com \
--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 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.