qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] function to execute qmp commands


From: Markus Armbruster
Subject: Re: [Qemu-devel] function to execute qmp commands
Date: Tue, 01 Sep 2015 08:19:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]