On 09/09/2015 09:08 PM, Programmingkid wrote:
> What does the function qmp_device_add() have a ret_data argument if it isn't 
> used? This function is located in qdev-monitor.c.

[meta-comment - can you teach your mailer to wrap long lines? It's a
pain to reply to something that scrolls off the screen]

Because the function is installed as a command handler callback, and all
command handler callbacks must have the same signature (QDict *, QObject
**, Error **).

Most qapi-fied commands install a generated handler named
qmp_marshal_*() with the requisite signature, that then parses the QDict
* into a nicer breakdown of C parameters to the real handler, then
collect the returned struct back into the QObject for return.  So if you
want to know how to manipulate QDict/QObject directly, look at the
generated qmp-marshal.c for inspiration.

Meanwhile, device_add has not yet been fully qapi-fied.

I'm about to post a series that completes the qapi-fication of
netdev_add, which is somewhat similar to device_add; if you want to look
at that for ideas of what is involved, be my guest (netdev_add had an
incomplete qapi-fication in qapi-schema.json; device_add isn't even
listed there yet so it is even further behind).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to