aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2019-06-13 17:33:54 +0200
committerMarkus Armbruster <armbru@redhat.com>2019-06-17 20:36:56 +0200
commit5f9dba1600de5e6312ea2d86cff61a5f03c8207e (patch)
treed2267c43bbddf9451d41bdabe96b0e90b3420e30 /hmp.c
parentb8e31d6ccc40de09392766fc8a77133196ba8468 (diff)
monitor: Create MonitorHMP with readline state
The ReadLineState in Monitor is only used for HMP monitors. Create MonitorHMP and move it there. Can't use container_of() in hmp_change(). Cast instead, and mark FIXME. Will be cleaned up shortly. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20190613153405.24769-5-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Superfluous variable in monitor_data_destroy() eliminated, whitespace tweaked in hmp_change(), commit message improved] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hmp.c b/hmp.c
index be5e345c6f..e6ea7cb9c2 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1943,6 +1943,8 @@ static void hmp_change_read_arg(void *opaque, const char *password,
void hmp_change(Monitor *mon, const QDict *qdict)
{
+ /* FIXME Make MonitorHMP public and use container_of */
+ MonitorHMP *hmp_mon = (MonitorHMP *)mon;
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");
@@ -1960,7 +1962,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
if (strcmp(target, "passwd") == 0 ||
strcmp(target, "password") == 0) {
if (!arg) {
- monitor_read_password(mon, hmp_change_read_arg, NULL);
+ monitor_read_password(hmp_mon, hmp_change_read_arg, NULL);
return;
}
}