cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
218e99
From e7980021a52658198f04024cb762f09aac607e97 Mon Sep 17 00:00:00 2001
218e99
From: Gerd Hoffmann <kraxel@redhat.com>
218e99
Date: Mon, 14 Oct 2013 13:35:20 +0200
218e99
Subject: [PATCH 13/18] qemu-char: add -chardev mux support
218e99
218e99
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
218e99
Message-id: <1381757723-23134-13-git-send-email-kraxel@redhat.com>
218e99
Patchwork-id: 54857
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH 12/15] qemu-char: add -chardev mux support
218e99
Bugzilla: 922010
218e99
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
218e99
Allow to explicitly create mux chardevs on the command line,
218e99
like you can using QMP.
218e99
218e99
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
218e99
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
218e99
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
218e99
(cherry picked from commit bb6fb7c0857aeda7982ac14460328edf3c29cfc8)
218e99
218e99
Conflicts:
218e99
	qemu-char.c
218e99
---
218e99
 qemu-char.c | 18 ++++++++++++++++++
218e99
 1 file changed, 18 insertions(+)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 qemu-char.c |   18 ++++++++++++++++++
218e99
 1 files changed, 18 insertions(+), 0 deletions(-)
218e99
218e99
diff --git a/qemu-char.c b/qemu-char.c
218e99
index 145fd30..fc1b21a 100644
218e99
--- a/qemu-char.c
218e99
+++ b/qemu-char.c
218e99
@@ -3142,6 +3142,19 @@ static void qemu_chr_parse_ringbuf(QemuOpts *opts, ChardevBackend *backend,
218e99
     }
218e99
 }
218e99
 
218e99
+static void qemu_chr_parse_mux(QemuOpts *opts, ChardevBackend *backend,
218e99
+                               Error **errp)
218e99
+{
218e99
+    const char *chardev = qemu_opt_get(opts, "chardev");
218e99
+
218e99
+    if (chardev == NULL) {
218e99
+        error_setg(errp, "chardev: mux: no chardev given");
218e99
+        return;
218e99
+    }
218e99
+    backend->mux = g_new0(ChardevMux, 1);
218e99
+    backend->mux->chardev = g_strdup(chardev);
218e99
+}
218e99
+
218e99
 typedef struct CharDriver {
218e99
     const char *name;
218e99
     /* old, pre qapi */
218e99
@@ -3509,6 +3522,9 @@ QemuOptsList qemu_chardev_opts = {
218e99
         },{
218e99
             .name = "size",
218e99
             .type = QEMU_OPT_SIZE,
218e99
+        },{
218e99
+            .name = "chardev",
218e99
+            .type = QEMU_OPT_STRING,
218e99
         },
218e99
         { /* end of list */ }
218e99
     },
218e99
@@ -3800,6 +3816,8 @@ static void register_types(void)
218e99
     register_char_driver_qapi("console", CHARDEV_BACKEND_KIND_CONSOLE, NULL);
218e99
     register_char_driver_qapi("pipe", CHARDEV_BACKEND_KIND_PIPE,
218e99
                               qemu_chr_parse_pipe);
218e99
+    register_char_driver_qapi("mux", CHARDEV_BACKEND_KIND_MUX,
218e99
+                              qemu_chr_parse_mux);
218e99
     /* Bug-compatibility: */
218e99
     register_char_driver_qapi("memory", CHARDEV_BACKEND_KIND_MEMORY,
218e99
                               qemu_chr_parse_ringbuf);
218e99
-- 
218e99
1.7.1
218e99