Received: from eggs.gnu.org ([2001:4830:134:3::10]:42106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZose-00032G-47 for qemu-devel@nongnu.org; Wed, 09 Sep 2015 19:34:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZosZ-0004PB-U4 for qemu-devel@nongnu.org; Wed, 09 Sep 2015 19:34:20 -0400 Received: from mail-qg0-x231.google.com ([2607:f8b0:400d:c04::231]:35370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZosZ-0004P7-PL for qemu-devel@nongnu.org; Wed, 09 Sep 2015 19:34:15 -0400 Received: by qgt47 with SMTP id 47so22233976qgt.2 for ; Wed, 09 Sep 2015 16:34:15 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <55F0B1C9.8070204@redhat.com> Date: Wed, 9 Sep 2015 19:34:12 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <2B86F391-FA17-49B1-BB80-23570170FEC5@gmail.com> 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> <55F0B1C9.8070204@redhat.com> 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: Eric Blake Cc: Peter Maydell , Markus Armbruster , qemu-devel qemu-devel On Sep 9, 2015, at 6:25 PM, Eric Blake wrote: > On 09/09/2015 03:37 PM, Programmingkid wrote: >=20 >>=20 >> Thank you very much for caring. I appreciate all the help I can = receive. I so like my idea of >> sending a command to QEMU as if the user typed it himself. It is so = easy 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 >=20 > Even emulating typing into the QMP interface is a non-starter. Just > call the same functions that QMP would eventually call. That is a lot easier said than done.=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 = QObject 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 = far: >>=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 >=20 > If you type the QMP command: >=20 > { "execute": "query-command-line-options", "arguments": { "option": > "quit" } } >=20 > then that will result in calling: >=20 > Error *err; > qmp_query_command_line_options(true, "quit", &err); >=20 > which will set err (because '-quit' is not a command line option). >=20 > But if you are worried about constructing a QDict (which is a subset = of > QObject), you are probably trying to call the wrong interface. That may be so. I need to do the equivalent of "device_add" and = "device_del".=20 You have any ideas how to do it in C?=20 > 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. I just wish it was as easy as qmp("{ \"execute\" : \" = \"}");=20 If you know a way to execute a qmp command by using a function that = takes a string,=20 please let me know. Thanks for the help.=