mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
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>
This commit is contained in:
parent
1d95db745b
commit
920824165c
5 changed files with 22 additions and 15 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue