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.c | |
| parent | 1d95db745b78439e9eec0782eca9cc0d679d6224 (diff) | |
| download | focaccia-qemu-920824165c49bfbd1e0e9e07fd92e0bbbf32aea3.tar.gz focaccia-qemu-920824165c49bfbd1e0e9e07fd92e0bbbf32aea3.zip | |
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.c')
| -rw-r--r-- | monitor/monitor.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/monitor/monitor.c b/monitor/monitor.c index db3d5ece99..3f4808240a 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -78,14 +78,18 @@ bool monitor_cur_is_qmp(void) * Note: not all HMP monitors use readline, e.g., gdbserver has a * non-interactive HMP monitor, so readline is not used there. */ -static inline bool monitor_uses_readline(const Monitor *mon) +static inline bool monitor_uses_readline(const MonitorHMP *mon) { - return mon->flags & MONITOR_USE_READLINE; + return mon->use_readline; } static inline bool monitor_is_hmp_non_interactive(const Monitor *mon) { - return !monitor_is_qmp(mon) && !monitor_uses_readline(mon); + if (monitor_is_qmp(mon)) { + return false; + } + + return !monitor_uses_readline(container_of(mon, MonitorHMP, common)); } static void monitor_flush_locked(Monitor *mon); @@ -521,17 +525,17 @@ static void monitor_iothread_init(void) mon_iothread = iothread_create("mon_iothread", &error_abort); } -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) { if (use_io_thread && !mon_iothread) { monitor_iothread_init(); } qemu_mutex_init(&mon->mon_lock); + mon->is_qmp = is_qmp; mon->outbuf = qstring_new(); mon->skip_flush = skip_flush; mon->use_io_thread = use_io_thread; - mon->flags = flags; } void monitor_data_destroy(Monitor *mon) |