Commit e5b0bc44 authored by pbrook's avatar pbrook
Browse files

Rearrange char event handlers to fix CHR_EVENT_RESET.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2361 c046a42c-6fe2-441c-8c8c-71466251a162
parent dff5efc8
...@@ -132,10 +132,7 @@ struct TextConsole { ...@@ -132,10 +132,7 @@ struct TextConsole {
int esc_params[MAX_ESC_PARAMS]; int esc_params[MAX_ESC_PARAMS];
int nb_esc_params; int nb_esc_params;
/* kbd read handler */ CharDriverState *chr;
IOCanRWHandler *fd_can_read;
IOReadHandler *fd_read;
void *fd_opaque;
/* fifo for key pressed */ /* fifo for key pressed */
QEMUFIFO out_fifo; QEMUFIFO out_fifo;
uint8_t out_fifo_buf[16]; uint8_t out_fifo_buf[16];
...@@ -1021,16 +1018,6 @@ static int console_puts(CharDriverState *chr, const uint8_t *buf, int len) ...@@ -1021,16 +1018,6 @@ static int console_puts(CharDriverState *chr, const uint8_t *buf, int len)
return len; return len;
} }
static void console_chr_add_read_handler(CharDriverState *chr,
IOCanRWHandler *fd_can_read,
IOReadHandler *fd_read, void *opaque)
{
TextConsole *s = chr->opaque;
s->fd_can_read = fd_can_read;
s->fd_read = fd_read;
s->fd_opaque = opaque;
}
static void console_send_event(CharDriverState *chr, int event) static void console_send_event(CharDriverState *chr, int event)
{ {
TextConsole *s = chr->opaque; TextConsole *s = chr->opaque;
...@@ -1052,14 +1039,14 @@ static void kbd_send_chars(void *opaque) ...@@ -1052,14 +1039,14 @@ static void kbd_send_chars(void *opaque)
int len; int len;
uint8_t buf[16]; uint8_t buf[16];
len = s->fd_can_read(s->fd_opaque); len = qemu_chr_can_read(s->chr);
if (len > s->out_fifo.count) if (len > s->out_fifo.count)
len = s->out_fifo.count; len = s->out_fifo.count;
if (len > 0) { if (len > 0) {
if (len > sizeof(buf)) if (len > sizeof(buf))
len = sizeof(buf); len = sizeof(buf);
qemu_fifo_read(&s->out_fifo, buf, len); qemu_fifo_read(&s->out_fifo, buf, len);
s->fd_read(s->fd_opaque, buf, len); qemu_chr_read(s->chr, buf, len);
} }
/* characters are pending: we send them a bit later (XXX: /* characters are pending: we send them a bit later (XXX:
horrible, should change char device API) */ horrible, should change char device API) */
...@@ -1110,7 +1097,7 @@ void kbd_put_keysym(int keysym) ...@@ -1110,7 +1097,7 @@ void kbd_put_keysym(int keysym)
} else { } else {
*q++ = keysym; *q++ = keysym;
} }
if (s->fd_read) { if (s->chr->chr_read) {
qemu_fifo_write(&s->out_fifo, buf, q - buf); qemu_fifo_write(&s->out_fifo, buf, q - buf);
kbd_send_chars(s); kbd_send_chars(s);
} }
...@@ -1186,9 +1173,9 @@ CharDriverState *text_console_init(DisplayState *ds) ...@@ -1186,9 +1173,9 @@ CharDriverState *text_console_init(DisplayState *ds)
} }
chr->opaque = s; chr->opaque = s;
chr->chr_write = console_puts; chr->chr_write = console_puts;
chr->chr_add_read_handler = console_chr_add_read_handler;
chr->chr_send_event = console_send_event; chr->chr_send_event = console_send_event;
s->chr = chr;
s->out_fifo.buf = s->out_fifo_buf; s->out_fifo.buf = s->out_fifo_buf;
s->out_fifo.buf_size = sizeof(s->out_fifo_buf); s->out_fifo.buf_size = sizeof(s->out_fifo_buf);
s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s); s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s);
......
...@@ -243,8 +243,8 @@ void pl011_init(uint32_t base, void *pic, int irq, ...@@ -243,8 +243,8 @@ void pl011_init(uint32_t base, void *pic, int irq,
s->cr = 0x300; s->cr = 0x300;
s->flags = 0x90; s->flags = 0x90;
if (chr){ if (chr){
qemu_chr_add_read_handler(chr, pl011_can_recieve, pl011_recieve, s); qemu_chr_add_handlers(chr, pl011_can_recieve, pl011_recieve,
qemu_chr_add_event_handler(chr, pl011_event); pl011_event, s);
} }
/* ??? Save/restore. */ /* ??? Save/restore. */
} }
......
...@@ -365,8 +365,8 @@ SerialState *serial_init(SetIRQFunc *set_irq, void *opaque, ...@@ -365,8 +365,8 @@ SerialState *serial_init(SetIRQFunc *set_irq, void *opaque,
register_ioport_write(base, 8, 1, serial_ioport_write, s); register_ioport_write(base, 8, 1, serial_ioport_write, s);
register_ioport_read(base, 8, 1, serial_ioport_read, s); register_ioport_read(base, 8, 1, serial_ioport_read, s);
s->chr = chr; s->chr = chr;
qemu_chr_add_read_handler(chr, serial_can_receive1, serial_receive1, s); qemu_chr_add_handlers(chr, serial_can_receive1, serial_receive1,
qemu_chr_add_event_handler(chr, serial_event); serial_event, s);
return s; return s;
} }
...@@ -453,7 +453,7 @@ SerialState *serial_mm_init (SetIRQFunc *set_irq, void *opaque, ...@@ -453,7 +453,7 @@ SerialState *serial_mm_init (SetIRQFunc *set_irq, void *opaque,
serial_mm_write, s); serial_mm_write, s);
cpu_register_physical_memory(base, 8 << it_shift, s_io_memory); cpu_register_physical_memory(base, 8 << it_shift, s_io_memory);
s->chr = chr; s->chr = chr;
qemu_chr_add_read_handler(chr, serial_can_receive1, serial_receive1, s); qemu_chr_add_handlers(chr, serial_can_receive1, serial_receive1,
qemu_chr_add_event_handler(chr, serial_event); serial_event, s);
return s; return s;
} }
...@@ -299,9 +299,8 @@ static void init_serial1(SH7750State * s, int serial_nb) ...@@ -299,9 +299,8 @@ static void init_serial1(SH7750State * s, int serial_nb)
} }
s->serial1 = chr; s->serial1 = chr;
qemu_chr_add_read_handler(chr, serial1_can_receive, qemu_chr_add_handlers(chr, serial1_can_receive,
serial1_receive, s); serial1_receive, serial1_event, s);
qemu_chr_add_event_handler(chr, serial1_event);
} }
/********************************************************************** /**********************************************************************
...@@ -415,9 +414,8 @@ static void init_serial2(SH7750State * s, int serial_nb) ...@@ -415,9 +414,8 @@ static void init_serial2(SH7750State * s, int serial_nb)
} }
s->serial2 = chr; s->serial2 = chr;
qemu_chr_add_read_handler(chr, serial2_can_receive, qemu_chr_add_handlers(chr, serial2_can_receive,
serial2_receive, s); serial2_receive, serial1_event, s);
qemu_chr_add_event_handler(chr, serial2_event);
} }
static void init_serial_ports(SH7750State * s) static void init_serial_ports(SH7750State * s)
......
...@@ -565,8 +565,8 @@ SerialState *slavio_serial_init(int base, int irq, CharDriverState *chr1, CharDr ...@@ -565,8 +565,8 @@ SerialState *slavio_serial_init(int base, int irq, CharDriverState *chr1, CharDr
s->chn[i].chn = 1 - i; s->chn[i].chn = 1 - i;
s->chn[i].type = ser; s->chn[i].type = ser;
if (s->chn[i].chr) { if (s->chn[i].chr) {
qemu_chr_add_read_handler(s->chn[i].chr, serial_can_receive, serial_receive1, &s->chn[i]); qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive,
qemu_chr_add_event_handler(s->chn[i].chr, serial_event); serial_receive1, serial_event, &s->chn[i]);
} }
} }
s->chn[0].otherchn = &s->chn[1]; s->chn[0].otherchn = &s->chn[1];
......
...@@ -2455,8 +2455,7 @@ void monitor_init(CharDriverState *hd, int show_banner) ...@@ -2455,8 +2455,7 @@ void monitor_init(CharDriverState *hd, int show_banner)
monitor_hd = hd; monitor_hd = hd;
hide_banner = !show_banner; hide_banner = !show_banner;
qemu_chr_add_read_handler(hd, term_can_read, term_read, NULL); qemu_chr_add_handlers(hd, term_can_read, term_read, term_event, NULL);
qemu_chr_add_event_handler(hd, term_event);
} }
/* XXX: use threads ? */ /* XXX: use threads ? */
......
...@@ -1119,11 +1119,17 @@ void quit_timers(void) ...@@ -1119,11 +1119,17 @@ void quit_timers(void)
/***********************************************************/ /***********************************************************/
/* character device */ /* character device */
static void qemu_chr_event(CharDriverState *s, int event)
{
if (!s->chr_event)
return;
s->chr_event(s->handler_opaque, event);
}
static void qemu_chr_reset_bh(void *opaque) static void qemu_chr_reset_bh(void *opaque)
{ {
CharDriverState *s = opaque; CharDriverState *s = opaque;
if (s->chr_event) qemu_chr_event(s, CHR_EVENT_RESET);
s->chr_event(s, CHR_EVENT_RESET);
qemu_bh_delete(s->bh); qemu_bh_delete(s->bh);
s->bh = NULL; s->bh = NULL;
} }
...@@ -1148,6 +1154,19 @@ int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg) ...@@ -1148,6 +1154,19 @@ int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg)
return s->chr_ioctl(s, cmd, arg); return s->chr_ioctl(s, cmd, arg);
} }
int qemu_chr_can_read(CharDriverState *s)
{
if (!s->chr_can_read)
return 0;
return s->chr_can_read(s->handler_opaque);
}
void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len)
{
s->chr_read(s->handler_opaque, buf, len);
}
void qemu_chr_printf(CharDriverState *s, const char *fmt, ...) void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)
{ {
char buf[4096]; char buf[4096];
...@@ -1164,16 +1183,18 @@ void qemu_chr_send_event(CharDriverState *s, int event) ...@@ -1164,16 +1183,18 @@ void qemu_chr_send_event(CharDriverState *s, int event)
s->chr_send_event(s, event); s->chr_send_event(s, event);
} }
void qemu_chr_add_read_handler(CharDriverState *s, void qemu_chr_add_handlers(CharDriverState *s,
IOCanRWHandler *fd_can_read, IOCanRWHandler *fd_can_read,
IOReadHandler *fd_read, void *opaque) IOReadHandler *fd_read,
{ IOEventHandler *fd_event,
s->chr_add_read_handler(s, fd_can_read, fd_read, opaque); void *opaque)
}
void qemu_chr_add_event_handler(CharDriverState *s, IOEventHandler *chr_event)
{ {
s->chr_event = chr_event; s->chr_can_read = fd_can_read;
s->chr_read = fd_read;
s->chr_event = fd_event;
s->handler_opaque = opaque;
if (s->chr_update_read_handler)
s->chr_update_read_handler(s);
} }
static int null_chr_write(CharDriverState *chr, const uint8_t *buf, int len) static int null_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
...@@ -1181,12 +1202,6 @@ static int null_chr_write(CharDriverState *chr, const uint8_t *buf, int len) ...@@ -1181,12 +1202,6 @@ static int null_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
return len; return len;
} }
static void null_chr_add_read_handler(CharDriverState *chr,
IOCanRWHandler *fd_can_read,
IOReadHandler *fd_read, void *opaque)
{
}
static CharDriverState *qemu_chr_open_null(void) static CharDriverState *qemu_chr_open_null(void)
{ {
CharDriverState *chr; CharDriverState *chr;
...@@ -1195,7 +1210,6 @@ static CharDriverState *qemu_chr_open_null(void) ...@@ -1195,7 +1210,6 @@ static CharDriverState *qemu_chr_open_null(void)
if (!chr) if (!chr)
return NULL; return NULL;
chr->chr_write = null_chr_write; chr->chr_write = null_chr_write;
chr->chr_add_read_handler = null_chr_add_read_handler;
return chr; return chr;
} }
...@@ -1287,9 +1301,6 @@ void socket_set_nonblock(int fd) ...@@ -1287,9 +1301,6 @@ void socket_set_nonblock(int fd)
typedef struct { typedef struct {
int fd_in, fd_out; int fd_in, fd_out;
IOCanRWHandler *fd_can_read;
IOReadHandler *fd_read;
void *fd_opaque;
int max_size; int max_size;
} FDCharDriver; } FDCharDriver;
...@@ -1309,7 +1320,7 @@ static int fd_chr_read_poll(void *opaque) ...@@ -1309,7 +1320,7 @@ static int fd_chr_read_poll(void *opaque)
CharDriverState *chr = opaque; CharDriverState *chr = opaque;
FDCharDriver *s = chr->opaque; FDCharDriver *s = chr->opaque;
s->max_size = s->fd_can_read(s->fd_opaque); s->max_size = qemu_chr_can_read(chr);
return s->max_size; return s->max_size;
} }
...@@ -1332,20 +1343,15 @@ static void fd_chr_read(void *opaque) ...@@ -1332,20 +1343,15 @@ static void fd_chr_read(void *opaque)
return; return;
} }
if (size > 0) { if (size > 0) {
s->fd_read(s->fd_opaque, buf, size); qemu_chr_read(chr, buf, size);
} }
} }
static void fd_chr_add_read_handler(CharDriverState *chr, static void fd_chr_update_read_handler(CharDriverState *chr)
IOCanRWHandler *fd_can_read,
IOReadHandler *fd_read, void *opaque)
{ {
FDCharDriver *s = chr->opaque; FDCharDriver *s = chr->opaque;
if (s->fd_in >= 0) { if (s->fd_in >= 0) {
s->fd_can_read = fd_can_read;
s->fd_read = fd_read;
s->fd_opaque = opaque;
if (nographic && s->fd_in == 0) { if (nographic && s->fd_in == 0) {
} else { } else {
qemu_set_fd_handler2(s->fd_in, fd_chr_read_poll, qemu_set_fd_handler2(s->fd_in, fd_chr_read_poll,
...@@ -1372,7 +1378,7 @@ static CharDriverState *qemu_chr_open_fd(int fd_in, int fd_out) ...@@ -1372,7 +1378,7 @@ static CharDriverState *qemu_chr_open_fd(int fd_in, int fd_out)
s->fd_out = fd_out; s->fd_out = fd_out;
chr->opaque = s; chr->opaque = s;
chr->chr_write = fd_chr_write; chr->chr_write = fd_chr_write;
chr->chr_add_read_handler = fd_chr_add_read_handler; chr->chr_update_read_handler = fd_chr_update_read_handler;
qemu_chr_reset(chr); qemu_chr_reset(chr);
...@@ -1465,7 +1471,7 @@ static void stdio_received_byte(int ch) ...@@ -1465,7 +1471,7 @@ static void stdio_received_byte(int ch)
chr = stdio_clients[client_index]; chr = stdio_clients[client_index];
s = chr->opaque; s = chr->opaque;
chr->chr_event(s->fd_opaque, CHR_EVENT_BREAK); qemu_chr_event(chr, CHR_EVENT_BREAK);
} }
break; break;
case 'c': case 'c':
...@@ -1492,13 +1498,11 @@ static void stdio_received_byte(int ch) ...@@ -1492,13 +1498,11 @@ static void stdio_received_byte(int ch)
if (client_index < stdio_nb_clients) { if (client_index < stdio_nb_clients) {
uint8_t buf[1]; uint8_t buf[1];
CharDriverState *chr; CharDriverState *chr;
FDCharDriver *s;
chr = stdio_clients[client_index]; chr = stdio_clients[client_index];
s = chr->opaque; if (qemu_chr_can_read(chr) > 0) {
if (s->fd_can_read(s->fd_opaque) > 0) {
buf[0] = ch; buf[0] = ch;
s->fd_read(s->fd_opaque, buf, 1); qemu_chr_read(chr, buf, 1);
} else if (term_fifo_size == 0) { } else if (term_fifo_size == 0) {
term_fifo[term_fifo_size++] = ch; term_fifo[term_fifo_size++] = ch;
} }
...@@ -1509,14 +1513,12 @@ static void stdio_received_byte(int ch) ...@@ -1509,14 +1513,12 @@ static void stdio_received_byte(int ch)
static int stdio_read_poll(void *opaque) static int stdio_read_poll(void *opaque)
{ {
CharDriverState *chr; CharDriverState *chr;
FDCharDriver *s;
if (client_index < stdio_nb_clients) { if (client_index < stdio_nb_clients) {
chr = stdio_clients[client_index]; chr = stdio_clients[client_index];
s = chr->opaque;
/* try to flush the queue if needed */ /* try to flush the queue if needed */
if (term_fifo_size != 0 && s->fd_can_read(s->fd_opaque) > 0) { if (term_fifo_size != 0 && qemu_chr_can_read(chr) > 0) {
s->fd_read(s->fd_opaque, term_fifo, 1); qemu_chr_read(chr, term_fifo, 1);
term_fifo_size = 0; term_fifo_size = 0;
} }
/* see if we can absorb more chars */ /* see if we can absorb more chars */
...@@ -1855,7 +1857,6 @@ static CharDriverState *qemu_chr_open_pp(const char *filename) ...@@ -1855,7 +1857,6 @@ static CharDriverState *qemu_chr_open_pp(const char *filename)
} }
chr->opaque = (void *)fd; chr->opaque = (void *)fd;
chr->chr_write = null_chr_write; chr->chr_write = null_chr_write;
chr->chr_add_read_handler = null_chr_add_read_handler;
chr->chr_ioctl = pp_ioctl; chr->chr_ioctl = pp_ioctl;
qemu_chr_reset(chr); qemu_chr_reset(chr);
...@@ -1874,9 +1875,6 @@ static CharDriverState *qemu_chr_open_pty(void) ...@@ -1874,9 +1875,6 @@ static CharDriverState *qemu_chr_open_pty(void)
#ifdef _WIN32 #ifdef _WIN32
typedef struct { typedef struct {
IOCanRWHandler *fd_can_read;
IOReadHandler *fd_read;
void *win_opaque;
int max_size; int max_size;
HANDLE hcom, hrecv, hsend; HANDLE hcom, hrecv, hsend;
OVERLAPPED orecv, osend; OVERLAPPED orecv, osend;
...@@ -2020,7 +2018,7 @@ static int win_chr_write(CharDriverState *chr, const uint8_t *buf, int len1) ...@@ -2020,7 +2018,7 @@ static int win_chr_write(CharDriverState *chr, const uint8_t *buf, int len1)
static int win_chr_read_poll(WinCharState *s) static int win_chr_read_poll(WinCharState *s)
{ {
s->max_size = s->fd_can_read(s->win_opaque); s->max_size = qemu_chr_can_read(s->chr);
return s->max_size; return s->max_size;
} }
...@@ -2041,7 +2039,7 @@ static void win_chr_readfile(WinCharState *s) ...@@ -2041,7 +2039,7 @@ static void win_chr_readfile(WinCharState *s)
} }
if (size > 0) { if (size > 0) {
s->fd_read(s->win_opaque, buf, size); qemu_chr_read(s->chr, buf, size);
} }
} }
...@@ -2071,17 +2069,6 @@ static int win_chr_poll(void *opaque) ...@@ -2071,17 +2069,6 @@ static int win_chr_poll(void *opaque)
return 0; return 0;
} }
static void win_chr_add_read_handler(CharDriverState *chr,
IOCanRWHandler *fd_can_read,
IOReadHandler *fd_read, void *opaque)
{
WinCharState *s = chr->opaque;
s->fd_can_read = fd_can_read;
s->fd_read = fd_read;
s->win_opaque = opaque;
}
static CharDriverState *qemu_chr_open_win(const char *filename) static CharDriverState *qemu_chr_open_win(const char *filename)
{ {
CharDriverState *chr; CharDriverState *chr;
...@@ -2097,7 +2084,6 @@ static CharDriverState *qemu_chr_open_win(const char *filename) ...@@ -2097,7 +2084,6 @@ static CharDriverState *qemu_chr_open_win(const char *filename)
} }
chr->opaque = s; chr->opaque = s;
chr->chr_write = win_chr_write; chr->chr_write = win_chr_write;
chr->chr_add_read_handler = win_chr_add_read_handler;
chr->chr_close = win_chr_close; chr->chr_close = win_chr_close;
if (win_chr_init(s, filename) < 0) { if (win_chr_init(s, filename) < 0) {
...@@ -2201,7 +2187,6 @@ static CharDriverState *qemu_chr_open_win_pipe(const char *filename) ...@@ -2201,7 +2187,6 @@ static CharDriverState *qemu_chr_open_win_pipe(const char *filename)
} }
chr->opaque = s; chr->opaque = s;
chr->chr_write = win_chr_write; chr->chr_write = win_chr_write;
chr->chr_add_read_handler = win_chr_add_read_handler;
chr->chr_close = win_chr_close; chr->chr_close = win_chr_close;
if (win_chr_pipe_init(s, filename) < 0) { if (win_chr_pipe_init(s, filename) < 0) {
...@@ -2229,7 +2214,6 @@ static CharDriverState *qemu_chr_open_win_file(HANDLE fd_out) ...@@ -2229,7 +2214,6 @@ static CharDriverState *qemu_chr_open_win_file(HANDLE fd_out)
s->hcom = fd_out; s->hcom = fd_out;
chr->opaque = s; chr->opaque = s;
chr->chr_write = win_chr_write; chr->chr_write = win_chr_write;
chr->chr_add_read_handler = win_chr_add_read_handler;
qemu_chr_reset(chr); qemu_chr_reset(chr);
return chr; return chr;
} }
...@@ -2251,9 +2235,6 @@ static CharDriverState *qemu_chr_open_win_file_out(const char *file_out) ...@@ -2251,9 +2235,6 @@ static CharDriverState *qemu_chr_open_win_file_out(const char *file_out)
/* UDP Net console */ /* UDP Net console */
typedef struct { typedef struct {
IOCanRWHandler *fd_can_read;
IOReadHandler *fd_read;
void *fd_opaque;
int fd; int fd;
struct sockaddr_in daddr; struct sockaddr_in daddr;
char buf[1024]; char buf[1024];
...@@ -2275,15 +2256,15 @@ static int udp_chr_read_poll(void *opaque) ...@@ -2275,15 +2256,15 @@ static int udp_chr_read_poll(void *opaque)
CharDriverState *chr = opaque; CharDriverState *chr = opaque;
NetCharDriver *s = chr->opaque; NetCharDriver *s = chr->opaque;
s->max_size = s->fd_can_read(s->fd_opaque); s->max_size = qemu_chr_can_read(chr);
/* If there were any stray characters in the queue process them /* If there were any stray characters in the queue process them
* first * first
*/ */
while (s->max_size > 0 && s->bufptr < s->bufcnt) { while (s->max_size > 0 && s->bufptr < s->bufcnt) {
s->fd_read(s->fd_opaque, &s->buf[s->bufptr], 1); qemu_chr_read(chr, &s->buf[s->bufptr], 1);
s->bufptr++; s->bufptr++;
s->max_size = s->fd_can_read(s->fd_opaque); s->max_size = qemu_chr_can_read(chr);
} }
return s->max_size; return s->max_size;
} }
...@@ -2302,22 +2283,17 @@ static void udp_chr_read(void *opaque) ...@@ -2302,22 +2283,17 @@ static void udp_chr_read(void *opaque)
s->bufptr = 0; s->bufptr = 0;
while (s->max_size > 0 && s->bufptr < s->bufcnt) { while (s->max_size > 0 && s->bufptr < s->bufcnt) {
s->fd_read(s->fd_opaque, &s->buf[s->bufptr], 1); qemu_chr_read(chr, &s->buf[s->bufptr], 1);
s->bufptr++; s->bufptr++;
s->max_size = s->fd_can_read(s->fd_opaque); s->max_size = qemu_chr_can_read(chr);
} }
} }
static void udp_chr_add_read_handler(CharDriverState *chr, static void udp_chr_update_read_handler(CharDriverState *chr)
IOCanRWHandler *fd_can_read,
IOReadHandler *fd_read, void *opaque)
{