[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/8] qemu-char: Add fe_open tracking
From: |
Anthony Liguori |
Subject: |
Re: [Qemu-devel] [PATCH 3/8] qemu-char: Add fe_open tracking |
Date: |
Mon, 25 Mar 2013 07:45:09 -0500 |
User-agent: |
Notmuch/0.13.2+93~ged93d79 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) |
Hans de Goede <address@hidden> writes:
> Add tracking of the fe_open state to struct CharDriverState.
>
> Signed-off-by: Hans de Goede <address@hidden>
> ---
> include/char/char.h | 1 +
> qemu-char.c | 2 ++
> 2 files changed, 3 insertions(+)
>
> diff --git a/include/char/char.h b/include/char/char.h
> index dd8f39a..3174575 100644
> --- a/include/char/char.h
> +++ b/include/char/char.h
> @@ -75,6 +75,7 @@ struct CharDriverState {
> char *label;
> char *filename;
> int be_open;
> + int fe_open;
> int avail_connections;
> QemuOpts *opts;
> QTAILQ_ENTRY(CharDriverState) next;
> diff --git a/qemu-char.c b/qemu-char.c
> index 55795d7..554d72f 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -3385,6 +3385,7 @@ void qemu_chr_fe_set_echo(struct CharDriverState *chr,
> bool echo)
>
> void qemu_chr_fe_open(struct CharDriverState *chr)
> {
> + chr->fe_open = 1;
> if (chr->chr_guest_open) {
> chr->chr_guest_open(chr);
> }
> @@ -3392,6 +3393,7 @@ void qemu_chr_fe_open(struct CharDriverState *chr)
>
> void qemu_chr_fe_close(struct CharDriverState *chr)
> {
> + chr->fe_open = 0;
Even though this gets rewritten later on, you should avoid calling the
callback when open is called when fe_open=1. Something like
if (!chr->fe_open) {
return;
}
Then later when this becomes set_fe_open() the backend doesn't need to
deal with double open/close.
Regards,
Anthony Liguori
> if (chr->chr_guest_close) {
> chr->chr_guest_close(chr);
> }
> --
> 1.8.1.4
- [Qemu-devel] [PATCH 1/8] RFC: chardev frontend open handling cleanup, Hans de Goede, 2013/03/24
- [Qemu-devel] [PATCH 5/8] qemu-char: Cleanup: consolidate fe_open/fe_close into fe_set_open, Hans de Goede, 2013/03/24
- [Qemu-devel] [PATCH 6/8] qemu-char: Consolidate guest_close/guest_open into a set_fe_open callback, Hans de Goede, 2013/03/24
- [Qemu-devel] [PATCH 7/8] virtio-serial: Consolidate guest_open/guest_close into set_guest_connected, Hans de Goede, 2013/03/24
- [Qemu-devel] [PATCH 8/8] spice-qemu-char: Drop hackish vmc_register on spice_chr_write, Hans de Goede, 2013/03/24
- Re: [Qemu-devel] [PATCH 1/8] RFC: chardev frontend open handling cleanup, Alon Levy, 2013/03/25