[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/4] char: Emit 'OPENED' events on char device open
From: |
Amit Shah |
Subject: |
[Qemu-devel] [PATCH 1/4] char: Emit 'OPENED' events on char device open |
Date: |
Tue, 22 Sep 2009 21:53:44 +0530 |
Notify users of the char interface whenever the file / connection is
opened.
The existing RESET event is triggered when the qemu char state is reset
as well; which may not be as interesting as char device open events.
Signed-off-by: Amit Shah <address@hidden>
---
qemu-char.c | 14 +++++++++++++-
qemu-char.h | 1 +
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 8084a67..e7d091c 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -479,6 +479,8 @@ static CharDriverState *qemu_chr_open_mux(CharDriverState
*drv)
chr->chr_write = mux_chr_write;
chr->chr_update_read_handler = mux_chr_update_read_handler;
chr->chr_accept_input = mux_chr_accept_input;
+
+ qemu_chr_event(chr, CHR_EVENT_OPENED);
return chr;
}
@@ -627,6 +629,7 @@ static CharDriverState *qemu_chr_open_fd(int fd_in, int
fd_out)
chr->chr_close = fd_chr_close;
qemu_chr_reset(chr);
+ qemu_chr_event(chr, CHR_EVENT_OPENED);
return chr;
}
@@ -925,8 +928,10 @@ static void pty_chr_state(CharDriverState *chr, int
connected)
* the virtual device linked to our pty. */
qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 1000);
} else {
- if (!s->connected)
+ if (!s->connected) {
qemu_chr_reset(chr);
+ qemu_chr_event(chr, CHR_EVENT_OPENED);
+ }
s->connected = 1;
}
}
@@ -1166,6 +1171,7 @@ static CharDriverState *qemu_chr_open_tty(QemuOpts *opts)
}
chr->chr_ioctl = tty_serial_ioctl;
qemu_chr_reset(chr);
+ qemu_chr_event(chr, CHR_EVENT_OPENED);
return chr;
}
#else /* ! __linux__ && ! __sun__ */
@@ -1312,6 +1318,7 @@ static CharDriverState *qemu_chr_open_pp(QemuOpts *opts)
chr->opaque = drv;
qemu_chr_reset(chr);
+ qemu_chr_event(chr, CHR_EVENT_OPENED);
return chr;
}
@@ -1593,6 +1600,7 @@ static CharDriverState *qemu_chr_open_win(QemuOpts *opts)
return NULL;
}
qemu_chr_reset(chr);
+ qemu_chr_event(chr, CHR_EVENT_OPENED);
return chr;
}
@@ -1693,6 +1701,7 @@ static CharDriverState *qemu_chr_open_win_pipe(QemuOpts
*opts)
return NULL;
}
qemu_chr_reset(chr);
+ qemu_chr_event(chr, CHR_EVENT_OPENED);
return chr;
}
@@ -1707,6 +1716,7 @@ static CharDriverState *qemu_chr_open_win_file(HANDLE
fd_out)
chr->opaque = s;
chr->chr_write = win_chr_write;
qemu_chr_reset(chr);
+ qemu_chr_event(chr, CHR_EVENT_OPENED);
return chr;
}
@@ -1828,6 +1838,7 @@ static CharDriverState *qemu_chr_open_udp(QemuOpts *opts)
chr->chr_write = udp_chr_write;
chr->chr_update_read_handler = udp_chr_update_read_handler;
chr->chr_close = udp_chr_close;
+ qemu_chr_event(chr, CHR_EVENT_OPENED);
return chr;
return_err:
@@ -2034,6 +2045,7 @@ static void tcp_chr_connect(void *opaque)
qemu_set_fd_handler2(s->fd, tcp_chr_read_poll,
tcp_chr_read, NULL, chr);
qemu_chr_reset(chr);
+ qemu_chr_event(chr, CHR_EVENT_OPENED);
}
#define IACSET(x,a,b,c) x[0] = a; x[1] = b; x[2] = c;
diff --git a/qemu-char.h b/qemu-char.h
index c0654bc..43e61e0 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -14,6 +14,7 @@
#define CHR_EVENT_MUX_IN 3 /* mux-focus was set to this terminal */
#define CHR_EVENT_MUX_OUT 4 /* mux-focus will move on */
#define CHR_EVENT_CLOSED 5 /* connection closed */
+#define CHR_EVENT_OPENED 6 /* connection opened */
#define CHR_IOCTL_SERIAL_SET_PARAMS 1
--
1.6.2.5
- [Qemu-devel] Re: [PATCH 2/2] virtio-console: Add interface for generic guest-host communication, (continued)
[Qemu-devel] Multiple Port Support for virtio-console, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH] virtio_console: Add support for multiple ports for generic guest and host communication, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH 1/5] char: Emit 'OPENED' events on char device open, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH 2/5] virtio-console: Add support for multiple ports for generic guest-host communication, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH 3/5] virtio-console: in-qemu api for open/read/write/close ports, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH 4/5] vnc: add a is_vnc_active() helper, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH 5/5] vnc: Send / receive guest clipboard if virtio-console connected to clipboard port, Amit Shah, 2009/09/09
[Qemu-devel] Re: Multiple Port Support for virtio-console, Amit Shah, 2009/09/10
[Qemu-devel] Multiple port support for virtio-console, Amit Shah, 2009/09/22
- [Qemu-devel] [PATCH 1/4] char: Emit 'OPENED' events on char device open,
Amit Shah <=
- Re: [Qemu-devel] [PATCH 3/4] virtio-console: Add support for multiple ports for generic guest-host communication, Gerd Hoffmann, 2009/09/23
- Re: [Qemu-devel] [PATCH 3/4] virtio-console: Add support for multiple ports for generic guest-host communication, Amit Shah, 2009/09/23
- Re: [Qemu-devel] [PATCH 3/4] virtio-console: Add support for multiple ports for generic guest-host communication, Gerd Hoffmann, 2009/09/23
- Re: [Qemu-devel] [PATCH 3/4] virtio-console: Add support for multiple ports for generic guest-host communication, Amit Shah, 2009/09/23
- Re: [Qemu-devel] [PATCH 3/4] virtio-console: Add support for multiple ports for generic guest-host communication, Gerd Hoffmann, 2009/09/23
- Re: [Qemu-devel] [PATCH 3/4] virtio-console: Add support for multiple ports for generic guest-host communication, Amit Shah, 2009/09/23