All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH 10 of 13] add an init function parameter to qemu_chr_open()
Date: Mon, 02 Mar 2009 17:22:02 +0000	[thread overview]
Message-ID: <49AC15BA.6030302@eu.citrix.com> (raw)

Import "add an init function parameter to qemu_chr_open()" from qemu
mainstream.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6365 c046a42c-6fe2-441c-8c8c-71466251a162

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

---

diff -r da3a2fee3759 console.c
--- a/console.c	Mon Feb 16 11:19:04 2009 +0000
+++ b/console.c	Mon Feb 16 11:19:22 2009 +0000
@@ -1292,6 +1292,8 @@
     text_console_resize(s);
 
     qemu_chr_reset(chr);
+    if (chr->init)
+        chr->init(chr);
 }
 
 CharDriverState *text_console_init(const char *p)
diff -r da3a2fee3759 gdbstub.c
--- a/gdbstub.c	Mon Feb 16 11:19:04 2009 +0000
+++ b/gdbstub.c	Mon Feb 16 11:19:22 2009 +0000
@@ -1852,7 +1852,7 @@
         port = gdbstub_port_name;
     }
 
-    chr = qemu_chr_open("gdb", port);
+    chr = qemu_chr_open("gdb", port, NULL);
     if (!chr)
         return -1;
 
diff -r da3a2fee3759 hw/usb-serial.c
--- a/hw/usb-serial.c	Mon Feb 16 11:19:04 2009 +0000
+++ b/hw/usb-serial.c	Mon Feb 16 11:19:22 2009 +0000
@@ -558,7 +558,7 @@
         return NULL;
 
     snprintf(label, sizeof(label), "usbserial%d", index++);
-    cdrv = qemu_chr_open(label, filename);
+    cdrv = qemu_chr_open(label, filename, NULL);
     if (!cdrv)
         goto fail;
     s->cs = cdrv;
diff -r da3a2fee3759 qemu-char.h
--- a/qemu-char.h	Mon Feb 16 11:19:04 2009 +0000
+++ b/qemu-char.h	Mon Feb 16 11:19:22 2009 +0000
@@ -43,6 +43,7 @@
 typedef void IOEventHandler(void *opaque, int event);
 
 struct CharDriverState {
+    void (*init)(struct CharDriverState *s);
     int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len);
     void (*chr_update_read_handler)(struct CharDriverState *s);
     int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg);
@@ -62,7 +63,7 @@
     TAILQ_ENTRY(CharDriverState) next;
 };
 
-CharDriverState *qemu_chr_open(const char *label, const char *filename);
+CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s));
 void qemu_chr_close(CharDriverState *chr);
 void qemu_chr_printf(CharDriverState *s, const char *fmt, ...);
 int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len);
diff -r da3a2fee3759 vl.c
--- a/vl.c	Mon Feb 16 11:19:04 2009 +0000
+++ b/vl.c	Mon Feb 16 11:19:22 2009 +0000
@@ -3836,7 +3836,7 @@
 static TAILQ_HEAD(CharDriverStateHead, CharDriverState) chardevs
 = TAILQ_HEAD_INITIALIZER(chardevs);
 
-CharDriverState *qemu_chr_open(const char *label, const char *filename)
+CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s))
 {
     const char *p;
     CharDriverState *chr;
@@ -3860,7 +3860,7 @@
         chr = qemu_chr_open_udp(p);
     } else
     if (strstart(filename, "mon:", &p)) {
-        chr = qemu_chr_open(label, p);
+        chr = qemu_chr_open(label, p, NULL);
         if (chr) {
             chr = qemu_chr_open_mux(chr);
             monitor_init(chr, !nographic);
@@ -3917,6 +3917,7 @@
     if (chr) {
         if (!chr->filename)
             chr->filename = qemu_strdup(filename);
+        chr->init = init;
         chr->label = qemu_strdup(label);
         TAILQ_INSERT_TAIL(&chardevs, chr, next);
     }
@@ -10084,7 +10085,7 @@
     }
 
     if (monitor_device) {
-        monitor_hd = qemu_chr_open("monitor", monitor_device);
+        monitor_hd = qemu_chr_open("monitor", monitor_device, NULL);
         if (!monitor_hd) {
             fprintf(stderr, "qemu: could not open monitor device '%s'\n", monitor_device);
             exit(1);
@@ -10096,7 +10097,7 @@
         if (devname && strcmp(devname, "none")) {
             char label[32];
             snprintf(label, sizeof(label), "serial%d", i);
-            serial_hds[i] = qemu_chr_open(label, devname);
+            serial_hds[i] = qemu_chr_open(label, devname, NULL);
             if (!serial_hds[i]) {
                 fprintf(stderr, "qemu: could not open serial device '%s'\n",
                         devname);
@@ -10110,7 +10111,7 @@
         if (devname && strcmp(devname, "none")) {
             char label[32];
             snprintf(label, sizeof(label), "parallel%d", i);
-            parallel_hds[i] = qemu_chr_open(label, devname);
+            parallel_hds[i] = qemu_chr_open(label, devname, NULL);
             if (!parallel_hds[i]) {
                 fprintf(stderr, "qemu: could not open parallel device '%s'\n",
                         devname);

                 reply	other threads:[~2009-03-02 17:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49AC15BA.6030302@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.