提交 7591c5c1 编写于 作者: G Gerd Hoffmann 提交者: Anthony Liguori

convert mux chardev to QemuOpts.

new cmd line syntax:  you can add mux=1 to any chardev to enable muxing,
then attach it multiple times, like this:

	-chardev pty,name=mux,mux=on
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 6ea314d9
...@@ -2230,6 +2230,11 @@ static QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename) ...@@ -2230,6 +2230,11 @@ static QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
if (NULL == opts) if (NULL == opts)
return NULL; return NULL;
if (strstart(filename, "mon:", &p)) {
filename = p;
qemu_opt_set(opts, "mux", "on");
}
if (strcmp(filename, "null") == 0 || if (strcmp(filename, "null") == 0 ||
strcmp(filename, "pty") == 0 || strcmp(filename, "pty") == 0 ||
strcmp(filename, "msmouse") == 0 || strcmp(filename, "msmouse") == 0 ||
...@@ -2378,8 +2383,18 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts, ...@@ -2378,8 +2383,18 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
if (!chr->filename) if (!chr->filename)
chr->filename = qemu_strdup(qemu_opt_get(opts, "backend")); chr->filename = qemu_strdup(qemu_opt_get(opts, "backend"));
chr->init = init; chr->init = init;
chr->label = qemu_strdup(qemu_opts_id(opts));
TAILQ_INSERT_TAIL(&chardevs, chr, next); TAILQ_INSERT_TAIL(&chardevs, chr, next);
if (qemu_opt_get_bool(opts, "mux", 0)) {
CharDriverState *base = chr;
int len = strlen(qemu_opts_id(opts)) + 6;
base->label = qemu_malloc(len);
snprintf(base->label, len, "%s-base", qemu_opts_id(opts));
chr = qemu_chr_open_mux(base);
chr->filename = base->filename;
TAILQ_INSERT_TAIL(&chardevs, chr, next);
}
chr->label = qemu_strdup(qemu_opts_id(opts));
return chr; return chr;
} }
...@@ -2391,21 +2406,16 @@ CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*i ...@@ -2391,21 +2406,16 @@ CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*i
opts = qemu_chr_parse_compat(label, filename); opts = qemu_chr_parse_compat(label, filename);
if (opts) { if (opts) {
return qemu_chr_open_opts(opts, init); chr = qemu_chr_open_opts(opts, init);
if (qemu_opt_get_bool(opts, "mux", 0)) {
monitor_init(chr, MONITOR_USE_READLINE);
}
return chr;
} }
if (strstart(filename, "udp:", &p)) { if (strstart(filename, "udp:", &p)) {
chr = qemu_chr_open_udp(p); chr = qemu_chr_open_udp(p);
} else } else
if (strstart(filename, "mon:", &p)) {
chr = qemu_chr_open(label, p, NULL);
if (chr) {
chr = qemu_chr_open_mux(chr);
monitor_init(chr, MONITOR_USE_READLINE);
} else {
printf("Unable to open driver: %s\n", p);
}
} else
{ {
chr = NULL; chr = NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册