Revision 0b6d2266
b/hw/virtio-console.c | ||
---|---|---|
28 | 28 |
return qemu_chr_write(vcon->chr, buf, len); |
29 | 29 |
} |
30 | 30 |
|
31 |
/* Callback function that's called when the guest opens the port */ |
|
32 |
static void guest_open(VirtIOSerialPort *port) |
|
33 |
{ |
|
34 |
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); |
|
35 |
|
|
36 |
qemu_chr_guest_open(vcon->chr); |
|
37 |
} |
|
38 |
|
|
39 |
/* Callback function that's called when the guest closes the port */ |
|
40 |
static void guest_close(VirtIOSerialPort *port) |
|
41 |
{ |
|
42 |
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); |
|
43 |
|
|
44 |
qemu_chr_guest_close(vcon->chr); |
|
45 |
} |
|
46 |
|
|
31 | 47 |
/* Readiness of the guest to accept data on a port */ |
32 | 48 |
static int chr_can_read(void *opaque) |
33 | 49 |
{ |
... | ... | |
64 | 80 |
qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event, |
65 | 81 |
vcon); |
66 | 82 |
vcon->port.info->have_data = flush_buf; |
83 |
vcon->port.info->guest_open = guest_open; |
|
84 |
vcon->port.info->guest_close = guest_close; |
|
67 | 85 |
} |
68 | 86 |
return 0; |
69 | 87 |
} |
Also available in: Unified diff