Patchwork [27/50] monitor: New monitor_cur_is_qmp()

login
register
mail settings
Submitter Markus Armbruster
Date March 4, 2010, 3:56 p.m.
Message ID <1267718231-13303-28-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/46965/
State New
Headers show

Comments

Markus Armbruster - March 4, 2010, 3:56 p.m.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 monitor.c |    6 ++++++
 monitor.h |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 55d78d5..3580d37 100644
--- a/monitor.c
+++ b/monitor.c
@@ -194,6 +194,12 @@  static inline int monitor_ctrl_mode(const Monitor *mon)
     return (mon->flags & MONITOR_USE_CONTROL);
 }
 
+/* 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);
+}
+
 static void monitor_read_command(Monitor *mon, int show_prompt)
 {
     if (!mon->rs)
diff --git a/monitor.h b/monitor.h
index 1222ff0..1f3df9f 100644
--- a/monitor.h
+++ b/monitor.h
@@ -30,6 +30,8 @@  typedef enum MonitorEvent {
     QEVENT_MAX,
 } MonitorEvent;
 
+int monitor_cur_is_qmp(void);
+
 void monitor_protocol_event(MonitorEvent event, QObject *data);
 void monitor_init(CharDriverState *chr, int flags);