diff options
author | Kevin Wolf <kwolf@redhat.com> | 2019-06-13 17:34:00 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2019-06-17 20:36:56 +0200 |
commit | 7e3c0deab1b76f37ac0b3199324db976a6cd1b2c (patch) | |
tree | e3439f0373b6ddab20ead50a9878c105b081b56b /monitor/monitor-internal.h | |
parent | 5bce308aaaab5b1b1a460b7f13940a132278e34c (diff) |
monitor: Split out monitor/qmp.c
Move QMP infrastructure from monitor/misc.c to monitor/qmp.c. This is
code that can be shared for all targets, so compile it only once.
The amount of function and particularly extern variables in
monitor_int.h is probably a bit larger than it needs to be, but this way
no non-trivial code modifications are needed. The interfaces between QMP
and the monitor core can be cleaned up later.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190613153405.24769-11-kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[monitor_is_qmp() tidied up to make checkpatch.pl happy,
superfluous #include dropped]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'monitor/monitor-internal.h')
-rw-r--r-- | monitor/monitor-internal.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index ebaf0201c8..d859bd3894 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -31,6 +31,7 @@ #include "qapi/qmp/dispatch.h" #include "qapi/qmp/json-parser.h" #include "qemu/readline.h" +#include "sysemu/iothread.h" /* * Supported types: @@ -142,4 +143,33 @@ typedef struct { GQueue *qmp_requests; } MonitorQMP; +/** + * Is @mon a QMP monitor? + */ +static inline bool monitor_is_qmp(const Monitor *mon) +{ + return mon->flags & MONITOR_USE_CONTROL; +} + +typedef QTAILQ_HEAD(MonitorList, Monitor) MonitorList; +extern IOThread *mon_iothread; +extern QEMUBH *qmp_dispatcher_bh; +extern QmpCommandList qmp_commands, qmp_cap_negotiation_commands; +extern QemuMutex monitor_lock; +extern MonitorList mon_list; +extern int mon_refcount; + +void monitor_init_qmp(Chardev *chr, int flags); + +int monitor_puts(Monitor *mon, const char *str); +void monitor_data_init(Monitor *mon, int flags, bool skip_flush, + bool use_io_thread); +int monitor_can_read(void *opaque); +void monitor_list_append(Monitor *mon); +void monitor_fdsets_cleanup(void); + +void qmp_send_response(MonitorQMP *mon, const QDict *rsp); +void monitor_data_destroy_qmp(MonitorQMP *mon); +void monitor_qmp_bh_dispatcher(void *data); + #endif |