monitor: Split out monitor/hmp.c

Move HMP infrastructure from monitor/misc.c to monitor/hmp.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 HMP
and the monitor core can be cleaned up later.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20190613153405.24769-12-kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Comment reformatted to make checkpatch.pl happy, #include <dirent.h>
moved to fix Windows build, superfluous #include dropped]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Kevin Wolf 2019-06-13 17:34:01 +02:00 committed by Markus Armbruster
parent 7e3c0deab1
commit ed7bda5d07
5 changed files with 1443 additions and 1352 deletions

View File

@ -1,3 +1,3 @@
obj-y += misc.o
common-obj-y += qmp.o
common-obj-y += qmp.o hmp.o
common-obj-y += qmp-cmds.o hmp-cmds.o

1417
monitor/hmp.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -159,7 +159,10 @@ extern QemuMutex monitor_lock;
extern MonitorList mon_list;
extern int mon_refcount;
extern HMPCommand hmp_cmds[];
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,
@ -172,4 +175,9 @@ void qmp_send_response(MonitorQMP *mon, const QDict *rsp);
void monitor_data_destroy_qmp(MonitorQMP *mon);
void monitor_qmp_bh_dispatcher(void *data);
int get_monitor_def(int64_t *pval, const char *name);
void help_cmd(Monitor *mon, const char *name);
void handle_hmp_command(MonitorHMP *mon, const char *cmdline);
int hmp_compare_cmd(const char *name, const char *list);
#endif

View File

@ -1,10 +1,12 @@
# See docs/devel/tracing.txt for syntax documentation.
# hmp.c
handle_hmp_command(void *mon, const char *cmdline) "mon %p cmdline: %s"
# misc.c
monitor_protocol_event_handler(uint32_t event, void *qdict) "event=%d data=%p"
monitor_protocol_event_emit(uint32_t event, void *data) "event=%d data=%p"
monitor_protocol_event_queue(uint32_t event, void *qdict, uint64_t rate) "event=%d data=%p rate=%" PRId64
handle_hmp_command(void *mon, const char *cmdline) "mon %p cmdline: %s"
monitor_suspend(void *ptr, int cnt) "mon %p: %d"
# qmp.c