qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 2/4] virtio-serial: add a post_load callback impleme


From: Alon Levy
Subject: [Qemu-devel] [PATCH 2/4] virtio-serial: add a post_load callback implemented by port
Date: Wed, 20 Mar 2013 11:55:12 +0200

Signed-off-by: Alon Levy <address@hidden>
---
 hw/virtio-serial-bus.c | 5 +++++
 hw/virtio-serial.h     | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index ab7168e..b2a50cb 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -584,12 +584,14 @@ static void virtio_serial_post_load_timer_cb(void *opaque)
     VirtIOSerial *s = opaque;
     VirtIOSerialPort *port;
     uint8_t host_connected;
+    VirtIOSerialPortClass *vsc;
 
     if (!s->post_load) {
         return;
     }
     for (i = 0 ; i < s->post_load->nr_active_ports; ++i) {
         port = s->post_load->connected[i].port;
+        vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
         host_connected = s->post_load->connected[i].host_connected;
         if (host_connected != port->host_connected) {
             /*
@@ -599,6 +601,9 @@ static void virtio_serial_post_load_timer_cb(void *opaque)
             send_control_event(s, port->id, VIRTIO_CONSOLE_PORT_OPEN,
                                port->host_connected);
         }
+        if (vsc->post_load) {
+            vsc->post_load(port);
+        }
     }
     g_free(s->post_load->connected);
     qemu_free_timer(s->post_load->timer);
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h
index 484dcfe..24d70ed 100644
--- a/hw/virtio-serial.h
+++ b/hw/virtio-serial.h
@@ -107,6 +107,8 @@ typedef struct VirtIOSerialPortClass {
      */
     ssize_t (*have_data)(VirtIOSerialPort *port, const uint8_t *buf,
                          size_t len);
+
+    void (*post_load)(VirtIOSerialPort *port);
 } VirtIOSerialPortClass;
 
 /*
-- 
1.8.1.4




reply via email to

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