Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2015-1…
Browse files Browse the repository at this point in the history
…0-30' into staging

QMP and QObject patches

# gpg: Signature made Fri 30 Oct 2015 08:06:26 GMT using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-monitor-2015-10-30:
  docs: Document QMP event rate limiting
  monitor: Throttle event VSERPORT_CHANGE separately by "id"
  monitor: Turn monitor_qapi_event_state[] into a hash table
  glib: add compatibility interface for g_hash_table_add()
  monitor: Split MonitorQAPIEventConf off MonitorQAPIEventState
  monitor: Switch from timer_new() to timer_new_ns()
  monitor: Simplify event throttling
  monitor: Reduce casting of QAPI event QDict
  qstring: Make conversion from QObject * accept null
  qlist: Make conversion from QObject * accept null
  qfloat qint: Make conversion from QObject * accept null
  qdict: Make conversion from QObject * accept null
  qbool: Make conversion from QObject * accept null
  qobject: Drop QObject_HEAD

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Oct 30, 2015
2 parents 7bc8e0c + 7f1e7b2 commit fdf9276
Show file tree
Hide file tree
Showing 20 changed files with 189 additions and 153 deletions.
12 changes: 12 additions & 0 deletions docs/qmp-events.txt
Expand Up @@ -28,6 +28,8 @@ Example:
"data": { "actual": 944766976 },
"timestamp": { "seconds": 1267020223, "microseconds": 435656 } }

Note: this event is rate-limited.

BLOCK_IMAGE_CORRUPTED
---------------------

Expand Down Expand Up @@ -296,6 +298,8 @@ Example:
"data": { "reference": "usr1", "sector-num": 345435, "sectors-count": 5 },
"timestamp": { "seconds": 1344522075, "microseconds": 745528 } }

Note: this event is rate-limited.

QUORUM_REPORT_BAD
-----------------

Expand All @@ -318,6 +322,8 @@ Example:
"data": { "node-name": "1.raw", "sector-num": 345435, "sectors-count": 5 },
"timestamp": { "seconds": 1344522075, "microseconds": 745528 } }

Note: this event is rate-limited.

RESET
-----

Expand Down Expand Up @@ -358,6 +364,8 @@ Example:
"data": { "offset": 78 },
"timestamp": { "seconds": 1267020223, "microseconds": 435656 } }

Note: this event is rate-limited.

SHUTDOWN
--------

Expand Down Expand Up @@ -632,6 +640,8 @@ Example:
"data": { "id": "channel0", "open": true },
"timestamp": { "seconds": 1401385907, "microseconds": 422329 } }

Note: this event is rate-limited separately for each "id".

WAKEUP
------

Expand Down Expand Up @@ -662,3 +672,5 @@ Example:

Note: If action is "reset", "shutdown", or "pause" the WATCHDOG event is
followed respectively by the RESET, SHUTDOWN, or STOP events.

Note: this event is rate-limited.
5 changes: 5 additions & 0 deletions docs/qmp-spec.txt
Expand Up @@ -175,6 +175,11 @@ The format of asynchronous events is:
For a listing of supported asynchronous events, please, refer to the
qmp-events.txt file.

Some events are rate-limited to at most one per second. If additional
"similar" events arrive within one second, all but the last one are
dropped, and the last one is delayed. "Similar" normally means same
event type. See qmp-events.txt for details.

2.5 QGA Synchronization
-----------------------

Expand Down
8 changes: 8 additions & 0 deletions include/glib-compat.h
Expand Up @@ -165,6 +165,14 @@ static inline GThread *g_thread_new(const char *name,
#define CompatGCond GCond
#endif /* glib 2.31 */

#if !GLIB_CHECK_VERSION(2, 32, 0)
/* Beware, function returns gboolean since 2.39.2, see GLib commit 9101915 */
static inline void g_hash_table_add(GHashTable *hash_table, gpointer key)
{
g_hash_table_replace(hash_table, key, key);
}
#endif

#ifndef g_assert_true
#define g_assert_true(expr) \
do { \
Expand Down
2 changes: 1 addition & 1 deletion include/qapi/qmp/qbool.h
Expand Up @@ -18,7 +18,7 @@
#include "qapi/qmp/qobject.h"

typedef struct QBool {
QObject_HEAD;
QObject base;
bool value;
} QBool;

Expand Down
2 changes: 1 addition & 1 deletion include/qapi/qmp/qdict.h
Expand Up @@ -28,7 +28,7 @@ typedef struct QDictEntry {
} QDictEntry;

typedef struct QDict {
QObject_HEAD;
QObject base;
size_t size;
QLIST_HEAD(,QDictEntry) table[QDICT_BUCKET_MAX];
} QDict;
Expand Down
2 changes: 1 addition & 1 deletion include/qapi/qmp/qfloat.h
Expand Up @@ -18,7 +18,7 @@
#include "qapi/qmp/qobject.h"

typedef struct QFloat {
QObject_HEAD;
QObject base;
double value;
} QFloat;

Expand Down
2 changes: 1 addition & 1 deletion include/qapi/qmp/qint.h
Expand Up @@ -17,7 +17,7 @@
#include "qapi/qmp/qobject.h"

typedef struct QInt {
QObject_HEAD;
QObject base;
int64_t value;
} QInt;

Expand Down
2 changes: 1 addition & 1 deletion include/qapi/qmp/qlist.h
Expand Up @@ -22,7 +22,7 @@ typedef struct QListEntry {
} QListEntry;

typedef struct QList {
QObject_HEAD;
QObject base;
QTAILQ_HEAD(,QListEntry) head;
} QList;

Expand Down
4 changes: 0 additions & 4 deletions include/qapi/qmp/qobject.h
Expand Up @@ -59,10 +59,6 @@ typedef struct QObject {
size_t refcnt;
} QObject;

/* Objects definitions must include this */
#define QObject_HEAD \
QObject base

/* Get the 'base' part of an object */
#define QOBJECT(obj) (&(obj)->base)

Expand Down
2 changes: 1 addition & 1 deletion include/qapi/qmp/qstring.h
Expand Up @@ -17,7 +17,7 @@
#include "qapi/qmp/qobject.h"

typedef struct QString {
QObject_HEAD;
QObject base;
char *string;
size_t length;
size_t capacity;
Expand Down

0 comments on commit fdf9276

Please sign in to comment.