[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/9] char: introduce udp_chr_detach()
From: |
Amit Shah |
Subject: |
[Qemu-devel] [PATCH 5/9] char: introduce udp_chr_detach() |
Date: |
Wed, 28 Aug 2013 10:40:47 +0530 |
Remove any registered callbacks if a frontend is detached.
CC: <address@hidden>
Signed-off-by: Amit Shah <address@hidden>
---
qemu-char.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/qemu-char.c b/qemu-char.c
index befecf2..4b26ff9 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2198,6 +2198,16 @@ typedef struct {
int max_size;
} NetCharDriver;
+static void udp_chr_detach(CharDriverState *chr)
+{
+ NetCharDriver *s = chr->opaque;
+
+ if (s->tag) {
+ io_remove_watch_poll(s->tag);
+ s->tag = 0;
+ }
+}
+
static int udp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
{
NetCharDriver *s = chr->opaque;
@@ -2309,6 +2319,7 @@ static CharDriverState *qemu_chr_open_udp_fd(int fd)
chr->chr_write = udp_chr_write;
chr->chr_update_read_handler = udp_chr_update_read_handler;
chr->chr_close = udp_chr_close;
+ chr->chr_detach = udp_chr_detach;
/* be isn't opened until we get a connection */
chr->explicit_be_open = true;
return chr;
--
1.8.3.1
- [Qemu-devel] [PATCH 0/9] char: fix segfault on chardev detach, Amit Shah, 2013/08/28
- [Qemu-devel] [PATCH 3/9] char: introduce fd_chr_detach(), Amit Shah, 2013/08/28
- [Qemu-devel] [PATCH 4/9] char: introduce pty_chr_detach(), Amit Shah, 2013/08/28
- [Qemu-devel] [PATCH 5/9] char: introduce udp_chr_detach(),
Amit Shah <=
- [Qemu-devel] [PATCH 6/9] char: use the new fd_chr_detach to dedup code, Amit Shah, 2013/08/28
- [Qemu-devel] [PATCH 7/9] char: use the new pty_chr_detach to dedup code, Amit Shah, 2013/08/28
- [Qemu-devel] [PATCH 8/9] char: use the new udp_chr_detach to dedup code, Amit Shah, 2013/08/28
- [Qemu-devel] [PATCH 9/9] char: use the new tcp_chr_detach to dedup code, Amit Shah, 2013/08/28