From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZsfa-0002u7-T6 for qemu-devel@nongnu.org; Wed, 09 Sep 2015 23:37:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZsfX-0005CN-LB for qemu-devel@nongnu.org; Wed, 09 Sep 2015 23:37:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47039) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZsfX-0005Bb-FH for qemu-devel@nongnu.org; Wed, 09 Sep 2015 23:37:03 -0400 References: <0FB3A50B-7B60-4AB8-8BE0-DA40AC91692E@gmail.com> From: Eric Blake Message-ID: <55F0FADA.4010400@redhat.com> Date: Wed, 9 Sep 2015 21:36:58 -0600 MIME-Version: 1.0 In-Reply-To: <0FB3A50B-7B60-4AB8-8BE0-DA40AC91692E@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="n4RHSMInsQkOshmM6U0TM4hELfN7kaUpP" Subject: Re: [Qemu-devel] qmp_device_add() ret_data argument List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Programmingkid , Peter Maydell Cc: qemu-devel qemu-devel This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --n4RHSMInsQkOshmM6U0TM4hELfN7kaUpP Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --n4RHSMInsQkOshmM6U0TM4hELfN7kaUpP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV8PraAAoJEKeha0olJ0NqwccIAKbgvMGS1k5GSaArzJCmwvIY W83yZqOg24wdZICe39cq1qrPf/pVj+yetl3l5wJ2fBXy10S9AGKOMK97JXXNY4Rw McZ8ONSE6HUiz5BLtVbsjL/1LO/5QJV7BEZBnxapFQRZ2rzMIACqSs1Z0k1ayhU7 WwGP1B6aRLlrz2E6BN/EZSGWNGrWeXW8YbrJzTaixIsAIxKHRFFr8GhySJGvniOf HBeT/a5hRw+ruLlhEabCPlkdkR9GtYIHjT7xYku+O04ybLbm6q3ioRv2RwenVrjd GUuSTTtH5aTMxJw0XkpJ5KMGQu2zKK84adEbe+o3NYj+2e/buv3MJLZslNEtbqM= =wCK3 -----END PGP SIGNATURE----- --n4RHSMInsQkOshmM6U0TM4hELfN7kaUpP--