monitor: Create monitor-internal.h with common definitions
Before we can split monitor/misc.c, we need to create a header file that
contains the common definitions that will be used by multiple source
files.
For a start, add the type definitions for Monitor, MonitorHMP and
MonitorQMP and their dependencies. We'll add functions as needed when
splitting monitor/misc.c.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190613153405.24769-10-kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Header guard symbol tidied up, superfluous #include dropped, FIXME in
hmp_change() resolved]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index c917e24..c283dde 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -24,7 +24,7 @@
#include "qemu/option.h"
#include "qemu/timer.h"
#include "qemu/sockets.h"
-#include "monitor/monitor.h"
+#include "monitor/monitor-internal.h"
#include "monitor/qdev.h"
#include "qapi/error.h"
#include "qapi/opts-visitor.h"
@@ -1943,8 +1943,7 @@
void hmp_change(Monitor *mon, const QDict *qdict)
{
- /* FIXME Make MonitorHMP public and use container_of */
- MonitorHMP *hmp_mon = (MonitorHMP *)mon;
+ MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
const char *device = qdict_get_str(qdict, "device");
const char *target = qdict_get_str(qdict, "target");
const char *arg = qdict_get_try_str(qdict, "arg");