diff mbox

[2/4] virtio-serial: add a post_load callback implemented by port

Message ID 1363773314-32332-3-git-send-email-alevy@redhat.com
State New
Headers show

Commit Message

Alon Levy March 20, 2013, 9:55 a.m. UTC
Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/virtio-serial-bus.c | 5 +++++
 hw/virtio-serial.h     | 2 ++
 2 files changed, 7 insertions(+)
diff mbox

Patch

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;
 
 /*