On 09/09/2015 03:37 PM, Programmingkid wrote: >>>>>> On 2 September 2015 at 01:56, Programmingkid >>>>>> <[email protected]> wrote:
It's okay to trim your reply, to make it easier for others to quickly
skip to the relevant part of your emails.
>
> 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
> 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.
Even emulating typing into the QMP interface is a non-starter. Just
call the same functions that QMP would eventually call.
>
> 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.
>
> That leaves QMP. I am trying to figure it out. This is my attempt so far:
>
> Error **errp;
> char *commandBuffer;
> commandBuffer = g_strdup_printf("{ \"execute\": \"quit\" }");
> qmp_query_command_line_options(false, commandBuffer, errp);
> printf("Program should quit now\n");
>
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.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
