Commit 9dd0d811 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-01-24' into staging



QAPI patches for 2019-01-24

# gpg: Signature made Thu 24 Jan 2019 14:25:19 GMT
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2019-01-24:
  json: Fix % handling when not interpolating
  qmp: Add examples to qom list, get, and set commands
  qapi: Eliminate indirection through qmp_event_get_func_emit()
  qapi: Belatedly update docs for commit 9c2f56e9

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 87f6a866 bbc0586c
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -1369,8 +1369,8 @@ Example:
    void qapi_event_send_my_event(void);

    typedef enum example_QAPIEvent {
        EXAMPLE_QAPI_EVENT_MY_EVENT = 0,
        EXAMPLE_QAPI_EVENT__MAX = 1,
        EXAMPLE_QAPI_EVENT_MY_EVENT,
        EXAMPLE_QAPI_EVENT__MAX,
    } example_QAPIEvent;

    #define example_QAPIEvent_str(val) \
@@ -1385,16 +1385,10 @@ Example:
    void qapi_event_send_my_event(void)
    {
        QDict *qmp;
        QMPEventFuncEmit emit;

        emit = qmp_event_get_func_emit();
        if (!emit) {
            return;
        }

        qmp = qmp_event_build_dict("MY_EVENT");

        emit(EXAMPLE_QAPI_EVENT_MY_EVENT, qmp);
        example_qapi_event_emit(EXAMPLE_QAPI_EVENT_MY_EVENT, qmp);

        qobject_unref(qmp);
    }
+0 −6
Original line number Diff line number Diff line
@@ -14,11 +14,5 @@
#ifndef QMP_EVENT_H
#define QMP_EVENT_H

typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict);

void qmp_event_set_func_emit(QMPEventFuncEmit emit);

QMPEventFuncEmit qmp_event_get_func_emit(void);

QDict *qmp_event_build_dict(const char *event_name);
#endif
+1 −3
Original line number Diff line number Diff line
@@ -590,8 +590,7 @@ monitor_qapi_event_queue_no_reenter(QAPIEvent event, QDict *qdict)
    qemu_mutex_unlock(&monitor_lock);
}

static void
monitor_qapi_event_queue(QAPIEvent event, QDict *qdict)
void qapi_event_emit(QAPIEvent event, QDict *qdict)
{
    /*
     * monitor_qapi_event_queue_no_reenter() is not reentrant: it
@@ -704,7 +703,6 @@ static void monitor_qapi_event_init(void)
{
    monitor_qapi_event_state = g_hash_table_new(qapi_event_throttle_hash,
                                                qapi_event_throttle_equal);
    qmp_event_set_func_emit(monitor_qapi_event_queue);
}

static void handle_hmp_command(Monitor *mon, const char *cmdline);
+36 −0
Original line number Diff line number Diff line
@@ -1380,6 +1380,16 @@
#          object.
#
# Since: 1.2
#
# Example:
#
# -> { "execute": "qom-list",
#      "arguments": { "path": "/chardevs" } }
# <- { "return": [ { "name": "type", "type": "string" },
#                  { "name": "parallel0", "type": "child<chardev-vc>" },
#                  { "name": "serial0", "type": "child<chardev-vc>" },
#                  { "name": "mon0", "type": "child<chardev-stdio>" } ] }
#
##
{ 'command': 'qom-list',
  'data': { 'path': 'str' },
@@ -1417,6 +1427,23 @@
#          returned as #int.
#
# Since: 1.2
#
# Example:
#
# 1. Use absolute path
#
# -> { "execute": "qom-get",
#      "arguments": { "path": "/machine/unattached/device[0]",
#                     "property": "hotplugged" } }
# <- { "return": false }
#
# 2. Use partial path
#
# -> { "execute": "qom-get",
#      "arguments": { "path": "unattached/sysbus",
#                     "property": "type" } }
# <- { "return": "System" }
#
##
{ 'command': 'qom-get',
  'data': { 'path': 'str', 'property': 'str' },
@@ -1436,6 +1463,15 @@
#         for a description of type mapping.
#
# Since: 1.2
#
# Example:
#
# -> { "execute": "qom-set",
#      "arguments": { "path": "/machine",
#                     "property": "graphics",
#                     "value": false } }
# <- { "return": {} }
#
##
{ 'command': 'qom-set',
  'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
+0 −12
Original line number Diff line number Diff line
@@ -19,18 +19,6 @@
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qjson.h"

static QMPEventFuncEmit qmp_emit;

void qmp_event_set_func_emit(QMPEventFuncEmit emit)
{
    qmp_emit = emit;
}

QMPEventFuncEmit qmp_event_get_func_emit(void)
{
    return qmp_emit;
}

static void timestamp_put(QDict *qdict)
{
    int err;
Loading