[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] function to execute qmp commands
From: |
Programmingkid |
Subject: |
Re: [Qemu-devel] function to execute qmp commands |
Date: |
Tue, 1 Sep 2015 10:09:39 -0400 |
On Sep 1, 2015, at 2:19 AM, Markus Armbruster wrote:
> Programmingkid <address@hidden> writes:
>
>> Is there a function that can execute a qmp command in QEMU?
>
> Sure you want to do that, and not call the C interface instead? Let me
> explain how QMP works:
>
> * QMP core: receive JSON, parse, find handler function (defined in
> qmp-commands.hx), call it
>
> * The handler function is of type
>
> void (*)(QDict *params, QObject **ret_data, Error **errp);
>
> It's normally an function generated from QAPI schema that unmarshals
> the arguments, calls the real function, and marshals result on success
> or forwards the error on failure.
>
> The point of this marshalling business is to have a real function with
> a nice C interface rather than this QDict / QObject stuff.
>
> * QMP core: format and send reply.
>
> Handler function example: query-command-line-options
>
> qmp-commands.hx points to
> qmp_marshal_input_query_command_line_options(), which calls
> qmp_query_command_line_options(). The latter looks like this:
>
> CommandLineOptionInfoList *
> qmp_query_command_line_options(bool has_option,
> const char *option,
> Error **errp)
>
> That's the function you want to call from C.
Thank you very much for the help.