Revision bd5c51ee qemu-char.c
b/qemu-char.c | ||
---|---|---|
110 | 110 |
s->chr_event(s->handler_opaque, event); |
111 | 111 |
} |
112 | 112 |
|
113 |
static gboolean qemu_chr_be_generic_open_bh(gpointer opaque) |
|
114 |
{ |
|
115 |
CharDriverState *s = opaque; |
|
116 |
qemu_chr_be_event(s, CHR_EVENT_OPENED); |
|
117 |
s->idle_tag = 0; |
|
118 |
return FALSE; |
|
119 |
} |
|
120 |
|
|
121 | 113 |
void qemu_chr_be_generic_open(CharDriverState *s) |
122 | 114 |
{ |
123 |
if (s->idle_tag == 0) { |
|
124 |
s->idle_tag = g_idle_add(qemu_chr_be_generic_open_bh, s); |
|
125 |
} |
|
115 |
qemu_chr_be_event(s, CHR_EVENT_OPENED); |
|
126 | 116 |
} |
127 | 117 |
|
128 | 118 |
int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len) |
... | ... | |
247 | 237 |
|
248 | 238 |
chr = g_malloc0(sizeof(CharDriverState)); |
249 | 239 |
chr->chr_write = null_chr_write; |
240 |
chr->explicit_be_open = true; |
|
250 | 241 |
return chr; |
251 | 242 |
} |
252 | 243 |
|
... | ... | |
504 | 495 |
/* Frontend guest-open / -close notification is not support with muxes */ |
505 | 496 |
chr->chr_set_fe_open = NULL; |
506 | 497 |
|
507 |
/* Muxes are always open on creation */ |
|
508 |
qemu_chr_be_generic_open(chr); |
|
509 |
|
|
510 | 498 |
return chr; |
511 | 499 |
} |
512 | 500 |
|
... | ... | |
883 | 871 |
chr->chr_update_read_handler = fd_chr_update_read_handler; |
884 | 872 |
chr->chr_close = fd_chr_close; |
885 | 873 |
|
886 |
qemu_chr_be_generic_open(chr); |
|
887 |
|
|
888 | 874 |
return chr; |
889 | 875 |
} |
890 | 876 |
|
... | ... | |
1243 | 1229 |
chr->chr_update_read_handler = pty_chr_update_read_handler; |
1244 | 1230 |
chr->chr_close = pty_chr_close; |
1245 | 1231 |
chr->chr_add_watch = pty_chr_add_watch; |
1232 |
chr->explicit_be_open = true; |
|
1246 | 1233 |
|
1247 | 1234 |
s->fd = io_channel_from_fd(master_fd); |
1248 | 1235 |
s->timer_tag = 0; |
... | ... | |
1595 | 1582 |
chr->chr_close = pp_close; |
1596 | 1583 |
chr->opaque = drv; |
1597 | 1584 |
|
1598 |
qemu_chr_be_generic_open(chr); |
|
1599 |
|
|
1600 | 1585 |
return chr; |
1601 | 1586 |
} |
1602 | 1587 |
#endif /* __linux__ */ |
... | ... | |
1650 | 1635 |
chr->opaque = (void *)(intptr_t)fd; |
1651 | 1636 |
chr->chr_write = null_chr_write; |
1652 | 1637 |
chr->chr_ioctl = pp_ioctl; |
1638 |
chr->explicit_be_open = true; |
|
1653 | 1639 |
return chr; |
1654 | 1640 |
} |
1655 | 1641 |
#endif |
... | ... | |
1880 | 1866 |
g_free(chr); |
1881 | 1867 |
return NULL; |
1882 | 1868 |
} |
1883 |
qemu_chr_be_generic_open(chr); |
|
1884 | 1869 |
return chr; |
1885 | 1870 |
} |
1886 | 1871 |
|
... | ... | |
1980 | 1965 |
g_free(chr); |
1981 | 1966 |
return NULL; |
1982 | 1967 |
} |
1983 |
qemu_chr_be_generic_open(chr); |
|
1984 | 1968 |
return chr; |
1985 | 1969 |
} |
1986 | 1970 |
|
... | ... | |
1994 | 1978 |
s->hcom = fd_out; |
1995 | 1979 |
chr->opaque = s; |
1996 | 1980 |
chr->chr_write = win_chr_write; |
1997 |
qemu_chr_be_generic_open(chr); |
|
1998 | 1981 |
return chr; |
1999 | 1982 |
} |
2000 | 1983 |
|
... | ... | |
2329 | 2312 |
chr->chr_write = udp_chr_write; |
2330 | 2313 |
chr->chr_update_read_handler = udp_chr_update_read_handler; |
2331 | 2314 |
chr->chr_close = udp_chr_close; |
2315 |
/* be isn't opened until we get a connection */ |
|
2316 |
chr->explicit_be_open = true; |
|
2332 | 2317 |
return chr; |
2333 | 2318 |
} |
2334 | 2319 |
|
... | ... | |
2731 | 2716 |
chr->get_msgfd = tcp_get_msgfd; |
2732 | 2717 |
chr->chr_add_client = tcp_chr_add_client; |
2733 | 2718 |
chr->chr_add_watch = tcp_chr_add_watch; |
2719 |
/* be isn't opened until we get a connection */ |
|
2720 |
chr->explicit_be_open = true; |
|
2734 | 2721 |
|
2735 | 2722 |
if (is_listen) { |
2736 | 2723 |
s->listen_fd = fd; |
... | ... | |
3325 | 3312 |
if (!chr->filename) |
3326 | 3313 |
chr->filename = g_strdup(qemu_opt_get(opts, "backend")); |
3327 | 3314 |
chr->init = init; |
3315 |
/* if we didn't create the chardev via qmp_chardev_add, we |
|
3316 |
* need to send the OPENED event here |
|
3317 |
*/ |
|
3318 |
if (!chr->explicit_be_open) { |
|
3319 |
qemu_chr_be_event(chr, CHR_EVENT_OPENED); |
|
3320 |
} |
|
3328 | 3321 |
QTAILQ_INSERT_TAIL(&chardevs, chr, next); |
3329 | 3322 |
|
3330 | 3323 |
if (qemu_opt_get_bool(opts, "mux", 0)) { |
... | ... | |
3804 | 3797 |
if (!chr->filename) { |
3805 | 3798 |
chr->filename = g_strdup(ChardevBackendKind_lookup[backend->kind]); |
3806 | 3799 |
} |
3800 |
if (!chr->explicit_be_open) { |
|
3801 |
qemu_chr_be_event(chr, CHR_EVENT_OPENED); |
|
3802 |
} |
|
3807 | 3803 |
QTAILQ_INSERT_TAIL(&chardevs, chr, next); |
3808 | 3804 |
return ret; |
3809 | 3805 |
} else { |
Also available in: Unified diff