mirror of https://github.com/xemu-project/xemu.git
virtio-console: notify backend of guest open / close
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Alon Levy <alevy@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
This commit is contained in:
parent
7c32c4feeb
commit
0b6d2266e3
|
@ -28,6 +28,22 @@ static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
|
||||||
return qemu_chr_write(vcon->chr, buf, len);
|
return qemu_chr_write(vcon->chr, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Callback function that's called when the guest opens the port */
|
||||||
|
static void guest_open(VirtIOSerialPort *port)
|
||||||
|
{
|
||||||
|
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
|
||||||
|
|
||||||
|
qemu_chr_guest_open(vcon->chr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Callback function that's called when the guest closes the port */
|
||||||
|
static void guest_close(VirtIOSerialPort *port)
|
||||||
|
{
|
||||||
|
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
|
||||||
|
|
||||||
|
qemu_chr_guest_close(vcon->chr);
|
||||||
|
}
|
||||||
|
|
||||||
/* Readiness of the guest to accept data on a port */
|
/* Readiness of the guest to accept data on a port */
|
||||||
static int chr_can_read(void *opaque)
|
static int chr_can_read(void *opaque)
|
||||||
{
|
{
|
||||||
|
@ -64,6 +80,8 @@ static int generic_port_init(VirtConsole *vcon, VirtIOSerialPort *port)
|
||||||
qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
|
qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
|
||||||
vcon);
|
vcon);
|
||||||
vcon->port.info->have_data = flush_buf;
|
vcon->port.info->have_data = flush_buf;
|
||||||
|
vcon->port.info->guest_open = guest_open;
|
||||||
|
vcon->port.info->guest_close = guest_close;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue