chardev-frontends: Explicitly check, inc and dec avail_connections
PATCH 1/1 chardev-frontends: Explicitly check, inc and dec avail_connections
chardev-frontends need to explictly check, increase and decrement the avail_connections "property" of the chardev when they are not using a qdev-chardev-property for the chardev.
This fixes things like:
qemu-kvm -chardev stdio,id=foo -device isa-serial,chardev=foo \
-mon chardev=foo
Working, where they should fail. Most of the changes here are due to old hardware emulation code which is using serial_hds directly rather then a qdev-chardev-property.
--- backends/rng-egd.c | 7 +++++++ gdbstub.c | 1 + hw/arm/pxa2xx.c | 9 ++++++++- hw/bt-hci-csr.c | 1 + hw/ipoctal232.c | 1 + hw/ivshmem.c | 1 + hw/mcf_uart.c | 6 ++++++ hw/serial.c | 16 ++++++++++++++++ hw/serial.h | 1 + hw/sh_serial.c | 9 ++++++++- hw/xen_console.c | 19 +++++++++++++++---- net/slirp.c | 1 + qemu-char.c | 14 +++++++++++++- vl.c | 7 +++++++ 14 files changed, 86 insertions(+), 7 deletions(-)
backends/rng-egd.c +7 -0
@@ -149,6 +149,12 @@ static void rng_egd_opened(RngBackend *b, Error **errp)return ; } +if (s->chr->avail_connections <1 ) { +error_set (errp,QERR_DEVICE_IN_USE , s->chr_name); +return ; + } + s->chr->avail_connections--; +/* FIXME we should resubmit pending requests when the CDS reconnects. */ qemu_chr_add_handlers (s->chr, rng_egd_chr_can_read, rng_egd_chr_read,NULL , s);
@@ -191,6 +197,7 @@ static void rng_egd_finalize(Object *obj)if (s->chr) {qemu_chr_add_handlers (s->chr,NULL ,NULL ,NULL ,NULL ); + s->chr->avail_connections++; }g_free (s->chr_name);
gdbstub.c +1 -0
@@ -3025,6 +3025,7 @@ int gdbserver_start(const char *device)if (!chr)return -1 ; + chr->avail_connections--;qemu_chr_add_handlers (chr, gdb_chr_can_receive, gdb_chr_receive, gdb_chr_event,NULL ); }
hw/arm/pxa2xx.c +8 -1
@@ -1981,9 +1981,16 @@ static PXA2xxFIrState *pxa2xx_fir_init(MemoryRegion *sysmem,memory_region_init_io (&s->iomem, &pxa2xx_fir_ops, s,"pxa2xx-fir" ,0x1000 );memory_region_add_subregion (sysmem, base, &s->iomem); -if (chr) +if (chr) { +if (chr->avail_connections <1 ) { +fprintf (stderr,"pxa2xx_fir_init error chardev %s already used\n" , + chr->label); +exit (1 ); + } + chr->avail_connections--;qemu_chr_add_handlers (chr, pxa2xx_fir_is_empty, pxa2xx_fir_rx, pxa2xx_fir_event, s); + }register_savevm (NULL ,"pxa2xx_fir" ,0 ,0 , pxa2xx_fir_save, pxa2xx_fir_load, s);
hw/bt-hci-csr.c +1 -0
@@ -439,6 +439,7 @@ CharDriverState *uart_hci_init(qemu_irq wakeup) s->chr.opaque = s; s->chr.chr_write = csrhci_write; s->chr.chr_ioctl = csrhci_ioctl; + s->chr.avail_connections =1 ; s->hci =qemu_next_hci (); s->hci->opaque = s;
hw/ipoctal232.c +1 -0
@@ -556,6 +556,7 @@ static int ipoctal_init(IPackDevice *ip)if (ch->dev) { index++; + ch->dev->avail_connections--;qemu_chr_add_handlers (ch->dev, hostdev_can_receive, hostdev_receive, hostdev_event, ch); DPRINTF("Redirecting channel %u to %s (%s)\n",
hw/ivshmem.c +1 -0
@@ -292,6 +292,7 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *fprintf (stderr,"creating eventfd for eventfd %d failed\n" , eventfd);exit (-1 ); } + chr->avail_connections--;/* if MSI is supported we need multiple interrupts */ if (ivshmem_has_feature (s,IVSHMEM_MSI )) {
hw/mcf_uart.c +6 -0
@@ -280,6 +280,12 @@ void *mcf_uart_init(qemu_irq irq, CharDriverState *chr) s->chr = chr; s->irq = irq;if (chr) { +if (chr->avail_connections <1 ) { +fprintf (stderr,"mcf_uart_init error chardev %s already used\n" , + chr->label); +exit (1 ); + } + chr->avail_connections--;qemu_chr_add_handlers (chr, mcf_uart_can_receive, mcf_uart_receive, mcf_uart_event, s); }
hw/serial.c +16 -0
@@ -676,6 +676,15 @@ void serial_init_core(SerialState *s)fprintf (stderr,"Can't create serial device, empty char device\n" );exit (1 ); } +if (s->chr_owned_by_serial_core) { +if (s->chr->avail_connections <1 ) { +fprintf (stderr, +"Can't create serial device, char device \"%s\" in use\n" , + s->chr->label); +exit (1 ); + } + s->chr->avail_connections--; + } s->modem_status_poll =qemu_new_timer_ns (vm_clock, (QEMUTimerCB *) serial_update_msl, s);
@@ -689,6 +698,9 @@ void serial_init_core(SerialState *s)void serial_exit_core (SerialState *s) {qemu_chr_add_handlers (s->chr,NULL ,NULL ,NULL ,NULL ); +if (s->chr_owned_by_serial_core) { + s->chr->avail_connections++; + }qemu_unregister_reset (serial_reset, s); }
@@ -719,6 +731,8 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, s->irq = irq; s->baudbase = baudbase; s->chr = chr; +/* We always get called with chr an entry of serial_hds */ + s->chr_owned_by_serial_core =1 ;serial_init_core (s);vmstate_register (NULL , base, &vmstate_serial, s);
@@ -776,6 +790,8 @@ SerialState *serial_mm_init(MemoryRegion *address_space, s->irq = irq; s->baudbase = baudbase; s->chr = chr; +/* We always get called with chr an entry of serial_hds */ + s->chr_owned_by_serial_core =1 ;serial_init_core (s);vmstate_register (NULL , base, &vmstate_serial, s);
hw/serial.h +1 -0
@@ -59,6 +59,7 @@ struct SerialState {int thr_ipending;qemu_irq irq;CharDriverState *chr; +int chr_owned_by_serial_core;int last_break_enable;int it_shift;int baudbase;
hw/sh_serial.c +8 -1
@@ -396,9 +396,16 @@ void sh_serial_init(MemoryRegion *sysmem, s->chr = chr; -if (chr) +if (chr) { +if (chr->avail_connections <1 ) { +fprintf (stderr,"sh_serial_init error chardev %s already used\n" , + chr->label); +exit (1 ); + } + chr->avail_connections--;qemu_chr_add_handlers (chr, sh_serial_can_receive1, sh_serial_receive1, sh_serial_event, s); + } s->eri = eri_source; s->rxi = rxi_source;
hw/xen_console.c +15 -4
@@ -241,9 +241,18 @@ static int con_initialise(struct XenDevice *xendev)return -1 ;xen_be_bind_evtchn (&con->xendev); -if (con->chr) -qemu_chr_add_handlers (con->chr, xencons_can_receive, xencons_receive, -NULL , con); +if (con->chr) { +if (con->chr->avail_connections >=1 ) { +qemu_chr_add_handlers (con->chr, xencons_can_receive, + xencons_receive,NULL , con); + con->chr->avail_connections--; + }else { +xen_be_printf (xendev,0 , +"xen_console_init error chardev %s already used\n" , + con->chr->label); + con->chr =NULL ; + } + } xen_be_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n", con->ring_ref,
@@ -260,8 +269,10 @@ static void con_disconnect(struct XenDevice *xendev)if (!xendev->dev) {return ; } -if (con->chr) +if (con->chr) {qemu_chr_add_handlers (con->chr,NULL ,NULL ,NULL ,NULL ); + con->chr->avail_connections++; + }xen_be_unbind_evtchn (&con->xendev);if (con->sring) {
net/slirp.c +1 -0
@@ -649,6 +649,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str,g_free (fwd);return -1 ; } + fwd->hd->avail_connections--;if (slirp_add_exec (s->slirp,3 , fwd->hd, &server, port) <0 ) { error_report("conflicting/invalid host:port in guest forwarding "
qemu-char.c +13 -1
@@ -3377,6 +3377,7 @@ CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*inerror_free (err); }if (chr &&qemu_opt_get_bool (opts,"mux" ,0 )) { + chr->avail_connections--;monitor_init (chr,MONITOR_USE_READLINE ); }return chr;
@@ -3466,9 +3467,20 @@ CharDriverState *qemu_chr_find(const char *name)CharDriverState *qemu_char_get_next_serial (void ) {static int next_serial; +CharDriverState *chr;/* FIXME: This function needs to go away: use chardev properties! */ -return serial_hds[next_serial++]; + +while (next_serial <MAX_SERIAL_PORTS && serial_hds[next_serial]) { + chr = serial_hds[next_serial++]; +/* Skip already used chardevs */ +if (chr->avail_connections <1 ) { +continue ; + } + chr->avail_connections--; +return chr; + } +return NULL ; }QemuOptsList qemu_chardev_opts = {
vl.c +7 -0
@@ -2391,6 +2391,13 @@ static int mon_init_func(QemuOpts *opts, void *opaque)exit (1 ); } +if (chr->avail_connections <1 ) { +fprintf (stderr,"monitor init error chardev \"%s\" already used\n" , + chardev); +exit (1 ); + } + chr->avail_connections--; +monitor_init (chr, flags);return 0 ; }
Signature · 1 line
1.8.1.4
Il 27/03/2013 15:10, Hans de Goede ha scritto:
Quoted 48 lines
chardev-frontends need to explictly check, increase and decrement the
avail_connections"property" of the chardev when they are not using a qdev-chardev-property for the chardev.This fixes things like:
qemu-kvm -chardev stdio,id=foo -device isa-serial,chardev=foo \
-mon chardev=fooWorking, where they should fail. Most of the changes here are due to old hardware emulation code which is using
serial_hdsdirectly rather then a qdev-chardev-property.Signed-off-by Hans de Goede <[email protected]>--- backends/rng-egd.c | 7 +++++++ gdbstub.c | 1 + hw/arm/pxa2xx.c | 9 ++++++++- hw/bt-hci-csr.c | 1 + hw/ipoctal232.c | 1 + hw/ivshmem.c | 1 + hw/mcf_uart.c | 6 ++++++ hw/serial.c | 16 ++++++++++++++++ hw/serial.h | 1 + hw/sh_serial.c | 9 ++++++++- hw/xen_console.c | 19 +++++++++++++++---- net/slirp.c | 1 + qemu-char.c | 14 +++++++++++++- vl.c | 7 +++++++ 14 files changed, 86 insertions(+), 7 deletions(-)backends/rng-egd.c +6
-0@@ -149,6 +149,12 @@ static void rng_egd_opened(RngBackend *b, Error **errp)return ; } +if (s->chr->avail_connections <1 ) { +error_set (errp,QERR_DEVICE_IN_USE , s->chr_name); +return ; + } + s->chr->avail_connections--; +/* FIXME we should resubmit pending requests when the CDS reconnects. */ qemu_chr_add_handlers (s->chr, rng_egd_chr_can_read, rng_egd_chr_read,NULL , s);
backends/rng-egd.c static void rng_egd_finalize(Object *obj) · line 203
Quoted 7 lines
backends/rng-egd.c +1
-0@@ -191,6 +197,7 @@ static void rng_egd_finalize(Object *obj)if (s->chr) {qemu_chr_add_handlers (s->chr,NULL ,NULL ,NULL ,NULL ); + s->chr->avail_connections++; }g_free (s->chr_name);
Ok, but please create wrappers for these (e.g. qemu_chr_be_start/stop and qemu_chr_be_start_nofail) and use them throughout.
gdbstub.c int gdbserver_start(const char *device) · line 3031
Quoted 12 lines
gdbstub.c +1
-0@@ -3025,6 +3025,7 @@ int gdbserver_start(const char *device)if (!chr)return -1 ; + chr->avail_connections--;qemu_chr_add_handlers (chr, gdb_chr_can_receive, gdb_chr_receive, gdb_chr_event,NULL ); }
Ok.
Quoted 12 lines
hw/arm/pxa2xx.c +3
-1@@ -1981,9 +1981,16 @@ static PXA2xxFIrState *pxa2xx_fir_init(MemoryRegion *sysmem,memory_region_init_io (&s->iomem, &pxa2xx_fir_ops, s,"pxa2xx-fir" ,0x1000 );memory_region_add_subregion (sysmem, base, &s->iomem); -if (chr) +if (chr) { +if (chr->avail_connections <1 ) { + fprintf(stderr, "pxa2xx_fir_init error chardev %s already used\n",
hw/arm/pxa2xx.c static PXA2xxFIrState *pxa2xx_fir_init(MemoryRegion *sysmem, · line 1996
Quoted 10 lines
hw/arm/pxa2xx.c +5
-0+ chr->label); +exit (1 ); + } + chr->avail_connections--;qemu_chr_add_handlers (chr, pxa2xx_fir_is_empty, pxa2xx_fir_rx, pxa2xx_fir_event, s); + }register_savevm (NULL ,"pxa2xx_fir" ,0 ,0 , pxa2xx_fir_save, pxa2xx_fir_load, s);
Errors won't be reported, because serial_hds[] will always create its own CharDriverState and avail_connections will always be 1. Use a wrapper and the code can ignore this.
hw/bt-hci-csr.c CharDriverState *uart_hci_init(qemu_irq wakeup) · line 445
Quoted 12 lines
hw/bt-hci-csr.c +1
-0@@ -439,6 +439,7 @@ CharDriverState *uart_hci_init(qemu_irq wakeup) s->chr.opaque = s; s->chr.chr_write = csrhci_write; s->chr.chr_ioctl = csrhci_ioctl; + s->chr.avail_connections =1 ; s->hci =qemu_next_hci (); s->hci->opaque = s;
Ok.
hw/ipoctal232.c static int ipoctal_init(IPackDevice *ip) · line 562
Quoted 12 lines
hw/ipoctal232.c +1
-0@@ -556,6 +556,7 @@ static int ipoctal_init(IPackDevice *ip)if (ch->dev) { index++; + ch->dev->avail_connections--;qemu_chr_add_handlers (ch->dev, hostdev_can_receive, hostdev_receive, hostdev_event, ch); DPRINTF("Redirecting channel %u to %s (%s)\n",
Ouch. WTF was I thinking when I reviewed this? :) Please change this to use DEFINE_PROP_CHARDEV. I don't really care if it is backwards-incompatible.
hw/ivshmem.c static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier * · line 298
Quoted 12 lines
hw/ivshmem.c +1
-0@@ -292,6 +292,7 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *fprintf (stderr,"creating eventfd for eventfd %d failed\n" , eventfd);exit (-1 ); } + chr->avail_connections--;/* if MSI is supported we need multiple interrupts */ if (ivshmem_has_feature (s,IVSHMEM_MSI )) {
Ok.
Quoted 7 lines
hw/mcf_uart.c +0
-0@@ -280,6 +280,12 @@ void *mcf_uart_init(qemu_irq irq, CharDriverState *chr) s->chr = chr; s->irq = irq;
hw/mcf_uart.c void *mcf_uart_init(qemu_irq irq, CharDriverState *chr) · line 291
Quoted 10 lines
hw/mcf_uart.c +6
-0if (chr) { +if (chr->avail_connections <1 ) { +fprintf (stderr,"mcf_uart_init error chardev %s already used\n" , + chr->label); +exit (1 ); + } + chr->avail_connections--;qemu_chr_add_handlers (chr, mcf_uart_can_receive, mcf_uart_receive, mcf_uart_event, s); }
Ok.
Quoted 53 lines
hw/serial.c +16
-0@@ -676,6 +676,15 @@ void serial_init_core(SerialState *s)fprintf (stderr,"Can't create serial device, empty char device\n" );exit (1 ); } +if (s->chr_owned_by_serial_core) { +if (s->chr->avail_connections <1 ) { +fprintf (stderr, +"Can't create serial device, char device \"%s\" in use\n" , + s->chr->label); +exit (1 ); + } + s->chr->avail_connections--; + } s->modem_status_poll =qemu_new_timer_ns (vm_clock, (QEMUTimerCB *) serial_update_msl, s);@@ -689,6 +698,9 @@ void serial_init_core(SerialState *s)void serial_exit_core (SerialState *s) {qemu_chr_add_handlers (s->chr,NULL ,NULL ,NULL ,NULL ); +if (s->chr_owned_by_serial_core) { + s->chr->avail_connections++; + }qemu_unregister_reset (serial_reset, s); }@@ -719,6 +731,8 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, s->irq = irq; s->baudbase = baudbase; s->chr = chr; +/* We always get called with chr an entry of serial_hds */ + s->chr_owned_by_serial_core =1 ;serial_init_core (s);vmstate_register (NULL , base, &vmstate_serial, s);@@ -776,6 +790,8 @@ SerialState *serial_mm_init(MemoryRegion *address_space, s->irq = irq; s->baudbase = baudbase; s->chr = chr; +/* We always get called with chr an entry of serial_hds */ + s->chr_owned_by_serial_core =1 ;serial_init_core (s);vmstate_register (NULL , base, &vmstate_serial, s);hw/serial.h +0
-0
hw/serial.h struct SerialState { · line 65
Quoted 7 lines
hw/serial.h +1
-0@@ -59,6 +59,7 @@ struct SerialState {int thr_ipending;qemu_irq irq;CharDriverState *chr; +int chr_owned_by_serial_core;int last_break_enable;int it_shift;int baudbase;
Please leave these aside. It is better to QOM-ify SerialState, I'll put it on my list...
Quoted 115 lines
hw/sh_serial.c +8
-1@@ -396,9 +396,16 @@ void sh_serial_init(MemoryRegion *sysmem, s->chr = chr; -if (chr) +if (chr) { +if (chr->avail_connections <1 ) { +fprintf (stderr,"sh_serial_init error chardev %s already used\n" , + chr->label); +exit (1 ); + } + chr->avail_connections--;qemu_chr_add_handlers (chr, sh_serial_can_receive1, sh_serial_receive1, sh_serial_event, s); + } s->eri = eri_source; s->rxi = rxi_source;hw/xen_console.c +15
-4@@ -241,9 +241,18 @@ static int con_initialise(struct XenDevice *xendev)return -1 ;xen_be_bind_evtchn (&con->xendev); -if (con->chr) -qemu_chr_add_handlers (con->chr, xencons_can_receive, xencons_receive, -NULL , con); +if (con->chr) { +if (con->chr->avail_connections >=1 ) { +qemu_chr_add_handlers (con->chr, xencons_can_receive, + xencons_receive,NULL , con); + con->chr->avail_connections--; + }else { +xen_be_printf (xendev,0 , +"xen_console_init error chardev %s already used\n" , + con->chr->label); + con->chr =NULL ; + } + } xen_be_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n", con->ring_ref,@@ -260,8 +269,10 @@ static void con_disconnect(struct XenDevice *xendev)if (!xendev->dev) {return ; } -if (con->chr) +if (con->chr) {qemu_chr_add_handlers (con->chr,NULL ,NULL ,NULL ,NULL ); + con->chr->avail_connections++; + }xen_be_unbind_evtchn (&con->xendev);if (con->sring) {net/slirp.c +1
-0@@ -649,6 +649,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str,g_free (fwd);return -1 ; } + fwd->hd->avail_connections--;if (slirp_add_exec (s->slirp,3 , fwd->hd, &server, port) <0 ) { error_report("conflicting/invalid host:port in guest forwarding "qemu-char.c +13
-1@@ -3377,6 +3377,7 @@ CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*inerror_free (err); }if (chr &&qemu_opt_get_bool (opts,"mux" ,0 )) { + chr->avail_connections--;monitor_init (chr,MONITOR_USE_READLINE ); }return chr;@@ -3466,9 +3467,20 @@ CharDriverState *qemu_chr_find(const char *name)CharDriverState *qemu_char_get_next_serial (void ) {static int next_serial; +CharDriverState *chr;/* FIXME: This function needs to go away: use chardev properties! */ -return serial_hds[next_serial++]; + +while (next_serial <MAX_SERIAL_PORTS && serial_hds[next_serial]) { + chr = serial_hds[next_serial++]; +/* Skip already used chardevs */ +if (chr->avail_connections <1 ) { +continue ; + } + chr->avail_connections--; +return chr; + } +return NULL ; }QemuOptsList qemu_chardev_opts = {vl.c +0
-0@@ -2391,6 +2391,13 @@ static int mon_init_func(QemuOpts *opts, void *opaque)exit (1 ); }
vl.c static int mon_init_func(QemuOpts *opts, void *opaque) · line 2403
Quoted 10 lines
vl.c +7
-0+if (chr->avail_connections <1 ) { +fprintf (stderr,"monitor init error chardev \"%s\" already used\n" , + chardev); +exit (1 ); + } + chr->avail_connections--; +monitor_init (chr, flags);return 0 ; }
Ok.
Paolo
Hi,
On 03/27/2013 04:11 PM, Paolo Bonzini wrote:
<snip>
Quoted 24 lines
Quoted 24 lines
backends/rng-egd.c +7
-0@@ -149,6 +149,12 @@ static void rng_egd_opened(RngBackend *b, Error **errp)return ; } +if (s->chr->avail_connections <1 ) { +error_set (errp,QERR_DEVICE_IN_USE , s->chr_name); +return ; + } + s->chr->avail_connections--; +/* FIXME we should resubmit pending requests when the CDS reconnects. */ qemu_chr_add_handlers (s->chr, rng_egd_chr_can_read, rng_egd_chr_read,NULL , s);@@ -191,6 +197,7 @@ static void rng_egd_finalize(Object *obj)if (s->chr) {qemu_chr_add_handlers (s->chr,NULL ,NULL ,NULL ,NULL ); + s->chr->avail_connections++; }
Quoted 4 lines
backends/rng-egd.c static void rng_egd_finalize(Object *obj) · line 203
Quoted 1 line
backends/rng-egd.c +0
-0g_free (s->chr_name);Ok, but please create wrappers for these (e.g. qemu_chr_be_start/stop and
qemu_chr_be_start_nofail) and use them throughout.
That would be fe_start fe_stop, ack otherwise.
Quoted 35 lines
gdbstub.c int gdbserver_start(const char *device) · line 3031
Quoted 12 lines
gdbstub.c +1
-0@@ -3025,6 +3025,7 @@ int gdbserver_start(const char *device)if (!chr)return -1 ; + chr->avail_connections--;qemu_chr_add_handlers (chr, gdb_chr_can_receive, gdb_chr_receive, gdb_chr_event,NULL ); }Ok.
Quoted 20 lines
hw/arm/pxa2xx.c +8
-1@@ -1981,9 +1981,16 @@ static PXA2xxFIrState *pxa2xx_fir_init(MemoryRegion *sysmem,memory_region_init_io (&s->iomem, &pxa2xx_fir_ops, s,"pxa2xx-fir" ,0x1000 );memory_region_add_subregion (sysmem, base, &s->iomem); -if (chr) +if (chr) { +if (chr->avail_connections <1 ) { +fprintf (stderr,"pxa2xx_fir_init error chardev %s already used\n" , + chr->label); +exit (1 ); + } + chr->avail_connections--;qemu_chr_add_handlers (chr, pxa2xx_fir_is_empty, pxa2xx_fir_rx, pxa2xx_fir_event, s); + }
Quoted 6 lines
hw/arm/pxa2xx.c static PXA2xxFIrState *pxa2xx_fir_init(MemoryRegion *sysmem, · line 1996
Quoted 2 lines
hw/arm/pxa2xx.c +0
-0register_savevm (NULL ,"pxa2xx_fir" ,0 ,0 , pxa2xx_fir_save, pxa2xx_fir_load, s);Errors won't be reported, because serial_hds[] will always create its own CharDriverState and
avail_connectionswill always be 1. Use a wrapper and the code can ignore this.
Unless some smartass adds, ie: -mon chardev=serial0 to the cmdline, then an error will be reported.
I'll respin the patch taking your comments into account.
Regards,
Hans
Il 27/03/2013 16:36, Hans de Goede ha scritto:
Quoted 2 lines
Unless some smartass adds, ie: -mon chardev=serial0 to the cmdline, then an error will be reported.
Right. :) For smartasses we can use qemu_chr_fe_start_nofail. :)
Paolo