Patchwork [2/8] add qemu_chr_set_echo

login
register
mail settings
Submitter Paolo Bonzini
Date Dec. 23, 2010, 12:42 p.m.
Message ID <1293108174-24895-3-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/76509/
State New
Headers show

Comments

Paolo Bonzini - Dec. 23, 2010, 12:42 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 monitor.c   |    1 +
 qemu-char.c |    7 +++++++
 qemu-char.h |    2 ++
 3 files changed, 10 insertions(+), 0 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 5d74fe3..7bb54b8 100644
--- a/monitor.c
+++ b/monitor.c
@@ -5004,6 +5004,7 @@  void monitor_init(CharDriverState *chr, int flags)
         /* Control mode requires special handlers */
         qemu_chr_add_handlers(chr, monitor_can_read, monitor_control_read,
                               monitor_control_event, mon);
+        qemu_chr_set_echo(chr, true);
     } else {
         qemu_chr_add_handlers(chr, monitor_can_read, monitor_read,
                               monitor_event, mon);
diff --git a/qemu-char.c b/qemu-char.c
index 5dbdafa..e2a5e91 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2554,6 +2554,13 @@  CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*i
     return chr;
 }
 
+void qemu_chr_set_echo(struct CharDriverState *chr, bool echo)
+{
+    if (chr->chr_set_echo) {
+        chr->chr_set_echo(chr, echo);
+    }
+}
+
 void qemu_chr_close(CharDriverState *chr)
 {
     QTAILQ_REMOVE(&chardevs, chr, next);
diff --git a/qemu-char.h b/qemu-char.h
index e6ee6c4..56d9954 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -64,6 +64,7 @@  struct CharDriverState {
     void (*chr_send_event)(struct CharDriverState *chr, int event);
     void (*chr_close)(struct CharDriverState *chr);
     void (*chr_accept_input)(struct CharDriverState *chr);
+    void (*chr_set_echo)(struct CharDriverState *chr, bool echo);
     void *opaque;
     QEMUBH *bh;
     char *label;
@@ -76,6 +77,7 @@  QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
 CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
                                     void (*init)(struct CharDriverState *s));
 CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s));
+void qemu_chr_set_echo(struct CharDriverState *chr, bool echo);
 void qemu_chr_close(CharDriverState *chr);
 void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)
     GCC_FMT_ATTR(2, 3);