aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-07-23 15:15:46 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-07-23 15:15:46 +0100
commit9ba7dd14355bb7957680d5ef764471ab102df099 (patch)
tree7b25641ad2d46dca31fe8cb540d2213cf26b4065
parent55b1f14cefcb19ce6d5e28c4c83404230888aa7e (diff)
parent62aa1d887ff9fc76adb488d31447d126a78f4b8f (diff)
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2018-07-23' into staging
QAPI and monitor patches for 2018-07-23 (3.0.0-rc2) # gpg: Signature made Mon 23 Jul 2018 14:08:37 BST # 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-2018-07-23: monitor: Fix unsafe sharing of @cur_mon among threads qapi: Make 'allow-oob' optional in SchemaInfoCommand Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--include/monitor/monitor.h2
-rw-r--r--monitor.c2
-rw-r--r--qapi/introspect.json6
-rw-r--r--scripts/qapi/introspect.py10
-rw-r--r--stubs/monitor.c2
-rw-r--r--tests/test-util-sockets.c2
6 files changed, 12 insertions, 12 deletions
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index d6ab70cae2..2ef5e04b37 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -6,7 +6,7 @@
#include "qapi/qapi-types-misc.h"
#include "qemu/readline.h"
-extern Monitor *cur_mon;
+extern __thread Monitor *cur_mon;
/* flags for monitor_init */
/* 0x01 unused */
diff --git a/monitor.c b/monitor.c
index be29634a00..f75027b09e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -290,7 +290,7 @@ static mon_cmd_t info_cmds[];
QmpCommandList qmp_commands, qmp_cap_negotiation_commands;
-Monitor *cur_mon;
+__thread Monitor *cur_mon;
static void monitor_command_cb(void *opaque, const char *cmdline,
void *readline_opaque);
diff --git a/qapi/introspect.json b/qapi/introspect.json
index c7f67b7d78..137b39b992 100644
--- a/qapi/introspect.json
+++ b/qapi/introspect.json
@@ -259,8 +259,8 @@
#
# @ret-type: the name of the command's result type.
#
-# @allow-oob: whether the command allows out-of-band execution.
-# (Since: 2.12)
+# @allow-oob: whether the command allows out-of-band execution,
+# defaults to false (Since: 2.12)
#
# TODO: @success-response (currently irrelevant, because it's QGA, not QMP)
#
@@ -268,7 +268,7 @@
##
{ 'struct': 'SchemaInfoCommand',
'data': { 'arg-type': 'str', 'ret-type': 'str',
- 'allow-oob': 'bool' } }
+ '*allow-oob': 'bool' } }
##
# @SchemaInfoEvent:
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index 70ca5dd876..189a4edaba 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -184,11 +184,11 @@ const QLitObject %(c_name)s = %(c_string)s;
success_response, boxed, allow_oob, allow_preconfig):
arg_type = arg_type or self._schema.the_empty_object_type
ret_type = ret_type or self._schema.the_empty_object_type
- self._gen_qlit(name, 'command',
- {'arg-type': self._use_type(arg_type),
- 'ret-type': self._use_type(ret_type),
- 'allow-oob': allow_oob},
- ifcond)
+ obj = {'arg-type': self._use_type(arg_type),
+ 'ret-type': self._use_type(ret_type) }
+ if allow_oob:
+ obj['allow-oob'] = allow_oob
+ self._gen_qlit(name, 'command', obj, ifcond)
def visit_event(self, name, info, ifcond, arg_type, boxed):
arg_type = arg_type or self._schema.the_empty_object_type
diff --git a/stubs/monitor.c b/stubs/monitor.c
index e018c8f594..3890771bb5 100644
--- a/stubs/monitor.c
+++ b/stubs/monitor.c
@@ -3,7 +3,7 @@
#include "qemu-common.h"
#include "monitor/monitor.h"
-Monitor *cur_mon = NULL;
+__thread Monitor *cur_mon;
int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
{
diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c
index acadd85e8f..6195a3ac36 100644
--- a/tests/test-util-sockets.c
+++ b/tests/test-util-sockets.c
@@ -69,7 +69,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
* stubs/monitor.c is defined, to make sure monitor.o is discarded
* otherwise we get duplicate syms at link time.
*/
-Monitor *cur_mon;
+__thread Monitor *cur_mon;
void monitor_init(Chardev *chr, int flags) {}