From patchwork Wed Mar 10 10:03:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 47223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CF790B7C09 for ; Wed, 10 Mar 2010 21:25:46 +1100 (EST) Received: from localhost ([127.0.0.1]:44786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpJ6E-0002tk-Kp for incoming@patchwork.ozlabs.org; Wed, 10 Mar 2010 05:25:10 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NpIlX-0003tP-Kh for qemu-devel@nongnu.org; Wed, 10 Mar 2010 05:03:47 -0500 Received: from [199.232.76.173] (port=49337 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpIlX-0003t3-5Z for qemu-devel@nongnu.org; Wed, 10 Mar 2010 05:03:47 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NpIlV-0001tY-KJ for qemu-devel@nongnu.org; Wed, 10 Mar 2010 05:03:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32462) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NpIlV-0001tM-65 for qemu-devel@nongnu.org; Wed, 10 Mar 2010 05:03:45 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2AA3iAF003962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 10 Mar 2010 05:03:44 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2AA3SbM017099; Wed, 10 Mar 2010 05:03:43 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 10 Mar 2010 11:03:25 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 11/14] qemu-char:udp insert poll call into read one X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This way we can remove the poll test Signed-off-by: Juan Quintela --- qemu-char.c | 13 ++----------- 1 files changed, 2 insertions(+), 11 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index bc294af..9098d79 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1767,7 +1767,7 @@ static int udp_chr_write(CharDriverState *chr, const uint8_t *buf, int len) return send(s->fd, (const void *)buf, len, 0); } -static int udp_chr_read_poll(void *opaque) +static void udp_chr_read(void *opaque) { CharDriverState *chr = opaque; NetCharDriver *s = chr->opaque; @@ -1782,14 +1782,6 @@ static int udp_chr_read_poll(void *opaque) s->bufptr++; s->max_size = qemu_chr_can_read(chr); } - return s->max_size; -} - -static void udp_chr_read(void *opaque) -{ - CharDriverState *chr = opaque; - NetCharDriver *s = chr->opaque; - if (s->max_size == 0) return; s->bufcnt = recv(s->fd, (void *)s->buf, sizeof(s->buf), 0); @@ -1810,8 +1802,7 @@ static void udp_chr_update_read_handler(CharDriverState *chr) NetCharDriver *s = chr->opaque; if (s->fd >= 0) { - qemu_set_fd_handler2(s->fd, udp_chr_read_poll, - udp_chr_read, NULL, chr); + qemu_set_fd_handler(s->fd, udp_chr_read, NULL, chr); } }