qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/4] virtio-console: Add a in-qemu api for open/


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH 4/4] virtio-console: Add a in-qemu api for open/read/write/close ports
Date: Wed, 23 Sep 2009 11:12:36 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3

diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index d750c8e..c41f13c 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -58,6 +58,11 @@ struct VirtIOConsolePort {
+    size_t (*read_callback)(const uint8_t *buf, const size_t len);

+    if (port->read_callback) {
+        ret = port->read_callback(buf, len);
+    } else if (port->hd) {
+        ret = qemu_chr_write(port->hd, buf, len);
      }
-    return qemu_chr_write(port->hd, buf, len);

No.  port->info->data_for_you() again ;)

+/* Functions for use inside qemu to open and read from/write to ports */
+VirtIOConsolePort *virtio_console_open(uint32_t id,
+                                       size_t(*read_callback)(const 
uint8_t*buf,
+                                                              const size_t 
len))

Anyone who wants talk using a port should be a port driver.

cheers,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]