X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=vl.c;h=99a56b5556f6d96a67ddd1c26fe69d0e610c85e9;hb=6b7ac49d570c66754fad1b80cc200c7596d1facd;hp=efdfea26ee9f031225d7c98860cfea62e3364642;hpb=14a48c1d0d687735c76880e59bcede6e99871ded;p=mirror_qemu.git diff --git a/vl.c b/vl.c index efdfea26ee..99a56b5556 100644 --- a/vl.c +++ b/vl.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" #include "qemu/units.h" #include "qapi/error.h" #include "qemu-version.h" @@ -2298,25 +2299,31 @@ 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 (!qmp && qemu_opt_get(opts, "pretty")) { + warn_report("'pretty' is deprecated for HMP monitors, it has no effect " + "and will be removed in future versions"); + } + if (qemu_opt_get_bool(opts, "pretty", 0)) { + pretty = true; + } chardev = qemu_opt_get(opts, "chardev"); if (!chardev) { @@ -2329,7 +2336,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; } @@ -2355,7 +2366,11 @@ static void monitor_parse(const char *optarg, const char *mode, bool pretty) opts = qemu_opts_create(qemu_find_opts("mon"), label, 1, &error_fatal); qemu_opt_set(opts, "mode", mode, &error_abort); qemu_opt_set(opts, "chardev", label, &error_abort); - qemu_opt_set_bool(opts, "pretty", pretty, &error_abort); + if (!strcmp(mode, "control")) { + qemu_opt_set_bool(opts, "pretty", pretty, &error_abort); + } else { + assert(pretty == false); + } monitor_device_index++; }