virtio-serial-bus: Add ability to hot-unplug ports
authorAmit Shah <amit.shah@redhat.com>
Tue, 19 Jan 2010 19:06:55 +0000 (00:36 +0530)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 20 Jan 2010 14:25:23 +0000 (08:25 -0600)
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/virtio-serial-bus.c
hw/virtio-serial.h

index 7e100d0..403268f 100644 (file)
@@ -520,6 +520,8 @@ static int virtser_port_qdev_exit(DeviceState *qdev)
     VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
     VirtIOSerial *vser = port->vser;
 
+    send_control_event(port, VIRTIO_CONSOLE_PORT_REMOVE, 1);
+
     /*
      * Don't decrement nr_ports here; thus we keep a linearly
      * increasing port id. Not utilising an id again saves us a couple
index 28ea7da..f297b00 100644 (file)
@@ -51,6 +51,7 @@ struct virtio_console_control {
 #define VIRTIO_CONSOLE_RESIZE          2
 #define VIRTIO_CONSOLE_PORT_OPEN       3
 #define VIRTIO_CONSOLE_PORT_NAME       4
+#define VIRTIO_CONSOLE_PORT_REMOVE     5
 
 /* == In-qemu interface == */