aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-03-06 19:56:38 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-06-02 10:07:16 +0200
commit9f3982f2dcd96753d57d0ac64bd1ae3b37a90eb3 (patch)
tree5693beadf3dc4c1f4874451f1e31bd8fb68741c2 /monitor.c
parentf994b2587f081693b017ebd03b362d162d3108b3 (diff)
downloadqemu-9f3982f2dcd96753d57d0ac64bd1ae3b37a90eb3.zip
qemu-9f3982f2dcd96753d57d0ac64bd1ae3b37a90eb3.tar.gz
qemu-9f3982f2dcd96753d57d0ac64bd1ae3b37a90eb3.tar.bz2
monitor: Rename monitor_ctrl_mode() to monitor_is_qmp()
... and change return type to bool. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/monitor.c b/monitor.c
index 0550283..be18ac1 100644
--- a/monitor.c
+++ b/monitor.c
@@ -231,8 +231,10 @@ Monitor *default_mon;
static void monitor_command_cb(void *opaque, const char *cmdline,
void *readline_opaque);
-/* Return true if in control mode, false otherwise */
-static inline int monitor_ctrl_mode(const Monitor *mon)
+/**
+ * Is @mon a QMP monitor?
+ */
+static inline bool monitor_is_qmp(const Monitor *mon)
{
return (mon->flags & MONITOR_USE_CONTROL);
}
@@ -240,7 +242,7 @@ static inline int monitor_ctrl_mode(const Monitor *mon)
/* Return non-zero iff we have a current monitor, and it is in QMP mode. */
int monitor_cur_is_qmp(void)
{
- return cur_mon && monitor_ctrl_mode(cur_mon);
+ return cur_mon && monitor_is_qmp(cur_mon);
}
void monitor_read_command(Monitor *mon, int show_prompt)
@@ -350,7 +352,7 @@ void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
if (!mon)
return;
- if (monitor_ctrl_mode(mon)) {
+ if (monitor_is_qmp(mon)) {
return;
}
@@ -446,7 +448,7 @@ static void monitor_qapi_event_emit(QAPIEvent event, QObject *data)
trace_monitor_protocol_event_emit(event, data);
QLIST_FOREACH(mon, &mon_list, entry) {
- if (monitor_ctrl_mode(mon) && mon->qmp.in_command_mode) {
+ if (monitor_is_qmp(mon) && mon->qmp.in_command_mode) {
monitor_json_emitter(mon, data);
}
}
@@ -5251,7 +5253,7 @@ void monitor_init(CharDriverState *chr, int flags)
monitor_read_command(mon, 0);
}
- if (monitor_ctrl_mode(mon)) {
+ if (monitor_is_qmp(mon)) {
qemu_chr_add_handlers(chr, monitor_can_read, monitor_qmp_read,
monitor_qmp_event, mon);
qemu_chr_fe_set_echo(chr, true);