aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2019-06-13 17:34:04 +0200
committerMarkus Armbruster <armbru@redhat.com>2019-06-18 08:14:17 +0200
commitfbfc29e3bf145581e84c12ffc432ab56ce1dea0d (patch)
tree2922c5fadb07f55fb45b816bdd1806c4cfcaed46 /vl.c
parent920824165c49bfbd1e0e9e07fd92e0bbbf32aea3 (diff)
monitor: Replace monitor_init() with monitor_init_{hmp, qmp}()
Most callers know which monitor type they want to have. Instead of calling monitor_init() with flags that can describe both types of monitors, make monitor_init_{hmp,qmp}() public interfaces that take specific bools instead of flags and call these functions directly. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20190613153405.24769-15-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/vl.c b/vl.c
index 005468cbfb..32daa434eb 100644
--- a/vl.c
+++ b/vl.c
@@ -2299,25 +2299,27 @@ static int fsdev_init_func(void *opaque, QemuOpts *opts, Error **errp)
static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
{
Chardev *chr;
+ bool qmp;
+ bool pretty = false;
const char *chardev;
const char *mode;
- int flags;
mode = qemu_opt_get(opts, "mode");
if (mode == NULL) {
mode = "readline";
}
if (strcmp(mode, "readline") == 0) {
- flags = MONITOR_USE_READLINE;
+ qmp = false;
} else if (strcmp(mode, "control") == 0) {
- flags = MONITOR_USE_CONTROL;
+ qmp = true;
} else {
error_setg(errp, "unknown monitor mode \"%s\"", mode);
return -1;
}
- if (qemu_opt_get_bool(opts, "pretty", 0))
- flags |= MONITOR_USE_PRETTY;
+ if (qemu_opt_get_bool(opts, "pretty", 0)) {
+ pretty = true;
+ }
chardev = qemu_opt_get(opts, "chardev");
if (!chardev) {
@@ -2330,7 +2332,11 @@ static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
return -1;
}
- monitor_init(chr, flags);
+ if (qmp) {
+ monitor_init_qmp(chr, pretty);
+ } else {
+ monitor_init_hmp(chr, true);
+ }
return 0;
}