diff options
author | Kevin Wolf <kwolf@redhat.com> | 2019-06-13 17:34:03 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2019-06-18 08:14:17 +0200 |
commit | 920824165c49bfbd1e0e9e07fd92e0bbbf32aea3 (patch) | |
tree | e338c3af03ec3f86d017b581cf5d7f86fc8b2e65 /monitor/monitor-internal.h | |
parent | 1d95db745b78439e9eec0782eca9cc0d679d6224 (diff) |
monitor: Split Monitor.flags into separate bools
Monitor.flags contains three different flags: One to distinguish HMP
from QMP; one specific to HMP (MONITOR_USE_READLINE) that is ignored
with QMP; and another one specific to QMP (MONITOR_USE_PRETTY) that is
ignored with HMP.
Split the flags field into three bools and move them to the right
subclass. Flags are still in use for the monitor_init() interface.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20190613153405.24769-14-kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'monitor/monitor-internal.h')
-rw-r--r-- | monitor/monitor-internal.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index b4996c14ac..03ea0239ef 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -86,8 +86,8 @@ typedef struct HMPCommand { struct Monitor { CharBackend chr; int reset_seen; - int flags; int suspend_cnt; /* Needs to be accessed atomically */ + bool is_qmp; bool skip_flush; bool use_io_thread; @@ -112,6 +112,7 @@ struct Monitor { struct MonitorHMP { Monitor common; + bool use_readline; /* * State used only in the thread "owning" the monitor. * If @use_io_thread, this is @mon_iothread. (This does not actually happen @@ -125,6 +126,7 @@ struct MonitorHMP { typedef struct { Monitor common; JSONMessageParser parser; + bool pretty; /* * When a client connects, we're in capabilities negotiation mode. * @commands is &qmp_cap_negotiation_commands then. When command @@ -148,7 +150,7 @@ typedef struct { */ static inline bool monitor_is_qmp(const Monitor *mon) { - return mon->flags & MONITOR_USE_CONTROL; + return mon->is_qmp; } typedef QTAILQ_HEAD(MonitorList, Monitor) MonitorList; @@ -165,7 +167,7 @@ void monitor_init_qmp(Chardev *chr, int flags); void monitor_init_hmp(Chardev *chr, int flags); int monitor_puts(Monitor *mon, const char *str); -void monitor_data_init(Monitor *mon, int flags, bool skip_flush, +void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush, bool use_io_thread); void monitor_data_destroy(Monitor *mon); int monitor_can_read(void *opaque); |