From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=54313 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PIf6P-0000ux-GB for qemu-devel@nongnu.org; Wed, 17 Nov 2010 05:19:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PIf6N-0006aQ-0d for qemu-devel@nongnu.org; Wed, 17 Nov 2010 05:18:56 -0500 Received: from david.siemens.de ([192.35.17.14]:23550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PIf6M-0006ZA-NP for qemu-devel@nongnu.org; Wed, 17 Nov 2010 05:18:54 -0500 Message-ID: <4CE3AC07.2050400@siemens.com> Date: Wed, 17 Nov 2010 11:18:47 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <4CBDB361.1060606@siemens.com> In-Reply-To: <4CBDB361.1060606@siemens.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH][RESEND] char: Flush read buffer in mux_chr_can_read List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel , Alexander Graf Am 19.10.2010 17:04, Jan Kiszka wrote: > Move the buffer flush from mux_chr_read to mux_chr_can_read. While the > latter is called periodically, the former will only be invoked when new > characters arrive at the back-end. This caused problems to front-end > drivers whenever they were unable to read data immediately, e.g. > virtio-console attached to stdio. > Ping. > Signed-off-by: Jan Kiszka > --- > qemu-char.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/qemu-char.c b/qemu-char.c > index 6d2dce7..f4c3876 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -398,6 +398,8 @@ static int mux_chr_can_read(void *opaque) > MuxDriver *d = chr->opaque; > int m = d->focus; > > + mux_chr_accept_input(opaque); > + > if ((d->prod[m] - d->cons[m]) < MUX_BUFFER_SIZE) > return 1; > if (d->chr_can_read[m]) > @@ -412,8 +414,6 @@ static void mux_chr_read(void *opaque, const uint8_t *buf, int size) > int m = d->focus; > int i; > > - mux_chr_accept_input (opaque); > - > for(i = 0; i < size; i++) > if (mux_proc_byte(chr, d, buf[i])) { > if (d->prod[m] == d->cons[m] &&