Commit ed7bda5d authored by Kevin Wolf's avatar Kevin Wolf Committed by Markus Armbruster
Browse files

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: default avatarKevin Wolf <kwolf@redhat.com>
Message-Id: <20190613153405.24769-12-kwolf@redhat.com>
Reviewed-by: default avatarMarkus 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: default avatarMarkus Armbruster <armbru@redhat.com>
parent 7e3c0dea
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
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

monitor/hmp.c

0 → 100644
+1417 −0

File added.

Preview size limit exceeded, changes collapsed.

+14 −1350

File changed.

Preview size limit exceeded, changes collapsed.

+8 −0
Original line number Diff line number Diff line
@@ -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
+3 −1
Original line number Diff line number Diff line
# 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