Patchwork [11/17] chardev: add console support to qapi

login
register
mail settings
Submitter Gerd Hoffmann
Date Feb. 28, 2013, 7:50 a.m.
Message ID <1362037809-27836-12-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/223796/
State New
Headers show

Comments

Gerd Hoffmann - Feb. 28, 2013, 7:50 a.m.
This patch adds 'console' support to qapi and also switches over the
console chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 qapi-schema.json |    3 ++-
 qemu-char.c      |    9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

Patch

diff --git a/qapi-schema.json b/qapi-schema.json
index 77d4153..94a3f02 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3226,7 +3226,8 @@ 
                                        'mux'    : 'ChardevMux',
                                        'msmouse': 'ChardevDummy',
                                        'braille': 'ChardevDummy',
-                                       'stdio'  : 'ChardevStdio' } }
+                                       'stdio'  : 'ChardevStdio',
+                                       'console': 'ChardevDummy' } }
 
 ##
 # @ChardevReturn:
diff --git a/qemu-char.c b/qemu-char.c
index 2652b86..fe117ca 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1765,7 +1765,7 @@  static CharDriverState *qemu_chr_open_win_file(HANDLE fd_out)
     return chr;
 }
 
-static CharDriverState *qemu_chr_open_win_con(QemuOpts *opts)
+static CharDriverState *qemu_chr_open_win_con(void)
 {
     return qemu_chr_open_win_file(GetStdHandle(STD_OUTPUT_HANDLE));
 }
@@ -2985,9 +2985,9 @@  static const struct {
     { .name = "parport",   .kind  = CHARDEV_BACKEND_KIND_PARALLEL,
                            .parse = qemu_chr_parse_parallel },
     { .name = "pty",       .kind  = CHARDEV_BACKEND_KIND_PTY },
+    { .name = "console",   .kind  = CHARDEV_BACKEND_KIND_CONSOLE },
 #ifdef _WIN32
     { .name = "pipe",      .open = qemu_chr_open_win_pipe },
-    { .name = "console",   .open = qemu_chr_open_win_con },
 #else
     { .name = "pipe",      .open = qemu_chr_open_pipe },
 #endif
@@ -3463,6 +3463,11 @@  ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
     case CHARDEV_BACKEND_KIND_STDIO:
         chr = qemu_chr_open_stdio(backend->stdio);
         break;
+#ifdef _WIN32
+    case CHARDEV_BACKEND_KIND_CONSOLE:
+        chr = qemu_chr_open_win_con();
+        break;
+#endif
     default:
         error_setg(errp, "unknown chardev backend (%d)", backend->kind);
         break;