Patchwork [1/3] virtio-serial: add virtio_serial_guest_connected

login
register
mail settings
Submitter Alon Levy
Date Nov. 28, 2012, 9:05 a.m.
Message ID <1354093540-22583-2-git-send-email-alevy@redhat.com>
Download mbox | patch
Permalink /patch/202391/
State New
Headers show

Comments

Alon Levy - Nov. 28, 2012, 9:05 a.m.
Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/virtio-serial-bus.c | 9 +++++++++
 hw/virtio-serial.h     | 5 +++++
 2 files changed, 14 insertions(+)

Patch

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index ccce1fa..9147497 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -290,6 +290,15 @@  ssize_t virtio_serial_write(VirtIOSerialPort *port, const uint8_t *buf,
 }
 
 /*
+ * Connectedness of the guest to the port.
+ * Returns 1 for guest connected, 0 for disconnected.
+ */
+int virtio_serial_guest_connected(VirtIOSerialPort *port)
+{
+    return port->guest_connected;
+}
+
+/*
  * Readiness of the guest to accept data on a port.
  * Returns max. data the guest can receive
  */
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h
index 16e3982..5012194 100644
--- a/hw/virtio-serial.h
+++ b/hw/virtio-serial.h
@@ -194,6 +194,11 @@  ssize_t virtio_serial_write(VirtIOSerialPort *port, const uint8_t *buf,
                             size_t size);
 
 /*
+ * Query whether a guest is connected.
+ */
+int virtio_serial_guest_connected(VirtIOSerialPort *port);
+
+/*
  * Query whether a guest is ready to receive data.
  */
 size_t virtio_serial_guest_ready(VirtIOSerialPort *port);