From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZnnx-0006Sn-Li for qemu-devel@nongnu.org; Wed, 09 Sep 2015 18:25:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZnns-00040o-9S for qemu-devel@nongnu.org; Wed, 09 Sep 2015 18:25:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZnnr-0003zZ-Vh for qemu-devel@nongnu.org; Wed, 09 Sep 2015 18:25:20 -0400 References: <65D87A2B-B94F-4236-A9BB-D0F0B7FCF96B@gmail.com> <26B5A68C-92C9-4528-BA17-4A282DCFF035@gmail.com> <87fv2og36d.fsf@blackfin.pond.sub.org> <9F6A7240-9CB8-41E2-AB87-B74CD7961191@gmail.com> <8737yocap6.fsf@blackfin.pond.sub.org> <16D5C709-5630-4919-BE13-6B1DB4B860F8@gmail.com> From: Eric Blake Message-ID: <55F0B1C9.8070204@redhat.com> Date: Wed, 9 Sep 2015 16:25:13 -0600 MIME-Version: 1.0 In-Reply-To: <16D5C709-5630-4919-BE13-6B1DB4B860F8@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="19sBpvIjHVqxgg4ugUDPXPRnoQdpeFwvJ" Subject: Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Programmingkid , Markus Armbruster Cc: Peter Maydell , qemu-devel qemu-devel This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --19sBpvIjHVqxgg4ugUDPXPRnoQdpeFwvJ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/09/2015 03:37 PM, Programmingkid wrote: >>>>>> On 2 September 2015 at 01:56, Programmingkid >>>>>> wrote: It's okay to trim your reply, to make it easier for others to quickly skip to the relevant part of your emails. >=20 > Thank you very much for caring. I appreciate all the help I can receive= =2E I so like my idea of > sending a command to QEMU as if the user typed it himself. It is so eas= y to maintain. So=20 > easy to use. So expandable. But given that two maintainers have told me= that I can't do this, > the idea has to be abandoned.=20 Even emulating typing into the QMP interface is a non-starter. Just call the same functions that QMP would eventually call. >=20 > The C interface idea sounds good, but trying to figure out how to make = any of the handler > functions work is very difficult. Just trying to make the QDict and QOb= ject variables is just > too much. It needs to be a lot easier than this. >=20 > That leaves QMP. I am trying to figure it out. This is my attempt so fa= r: >=20 > Error **errp; > char *commandBuffer; > commandBuffer =3D g_strdup_printf("{ \"execute\": \"quit\" }"); > qmp_query_command_line_options(false, commandBuffer, errp); > printf("Program should quit now\n"); >=20 If you type the QMP command: { "execute": "query-command-line-options", "arguments": { "option": "quit" } } then that will result in calling: Error *err; qmp_query_command_line_options(true, "quit", &err); which will set err (because '-quit' is not a command line option). But if you are worried about constructing a QDict (which is a subset of QObject), you are probably trying to call the wrong interface. In qmp-commands.hx, the command 'query-command-line-options' is tied to qmp_marshal_query_command_line_options (well, after Markus' latest patches are applied; in current qemu.git it is still named qmp_marshal_input_query_command_line_options). That is the generated function that takes QDict, and then calls into the much nicer interface of qmp_query_command_line_options() that has already broken out all the arguments into straight-forward parameters. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --19sBpvIjHVqxgg4ugUDPXPRnoQdpeFwvJ 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/ iQEcBAEBCAAGBQJV8LHKAAoJEKeha0olJ0NqEAgIAJvsjNzkVMO6BoaCoLDDigmW Qb6wQaHQhq6nNDIyZ9IqsjzTpndbJ1VYJOvtnukQd9l4OPvGrcVnh38lmK7tEBfh Jqi6Ex13bqN16gr0AbFciK2mQpldfvBzJbFbrtgN9jZkCoSXUWo8JbqW0+bbictW o2TP6uRvHvmeheSpVk9VuLB5EEUSHBfxrgth91EHsjlMeh4gnCYJD7sOJ9Y4f8fI RmdLE+Jg/3cPjirt+/Sy/C2QZ3DTFnJjUtSHWIZiqHaUKehZxvHnQJIs8H9jjCZz 9gx4RrJyyddD79SfpSEADi9sJSNFlIcrcf1Rihce+beciUij8S4l+ZnTRHwmF60= =YAM7 -----END PGP SIGNATURE----- --19sBpvIjHVqxgg4ugUDPXPRnoQdpeFwvJ--