diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-03-24 08:11:58 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-03-24 08:11:58 -0500 |
commit | 56d7a964a5664d3778a0b7a369a5f350d0fe099f (patch) | |
tree | a851ba09087f5291d2c412981efd6605118a9142 /hw/virtio-console.c | |
parent | 24e838b787959eba0bc516d36224df2c6855d02a (diff) | |
parent | 2d6c1ef40f3678ab47a4d14fb5dadaa486bfcda6 (diff) | |
download | qemu-56d7a964a5664d3778a0b7a369a5f350d0fe099f.tar.gz |
Merge remote branch 'amit/for-anthony' into staging
Diffstat (limited to 'hw/virtio-console.c')
-rw-r--r-- | hw/virtio-console.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/hw/virtio-console.c b/hw/virtio-console.c index c235b2726c..6b5237b3ce 100644 --- a/hw/virtio-console.c +++ b/hw/virtio-console.c @@ -11,6 +11,7 @@ */ #include "qemu-char.h" +#include "qemu-error.h" #include "virtio-serial.h" typedef struct VirtConsole { @@ -81,8 +82,11 @@ static int virtconsole_exitfn(VirtIOSerialPort *port) VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); if (vcon->chr) { - port->info->have_data = NULL; - qemu_chr_close(vcon->chr); + /* + * Instead of closing the chardev, free it so it can be used + * for other purposes. + */ + qemu_chr_add_handlers(vcon->chr, NULL, NULL, NULL, NULL); } return 0; @@ -113,6 +117,14 @@ static int virtserialport_initfn(VirtIOSerialPort *port) { VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); + if (port->id == 0) { + /* + * Disallow a generic port at id 0, that's reserved for + * console ports. + */ + error_report("Port number 0 on virtio-serial devices reserved for virtconsole devices for backward compatibility."); + return -1; + } return generic_port_init(vcon, port); } |