From patchwork Thu Mar 11 16:55:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 47359 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 6BEEEB7CE7 for ; Fri, 12 Mar 2010 04:35:10 +1100 (EST) Received: from localhost ([127.0.0.1]:54401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpmDO-0006ii-3S for incoming@patchwork.ozlabs.org; Thu, 11 Mar 2010 12:30:30 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NplgG-0004zF-G5 for qemu-devel@nongnu.org; Thu, 11 Mar 2010 11:56:16 -0500 Received: from [199.232.76.173] (port=35571 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NplgF-0004yp-MS for qemu-devel@nongnu.org; Thu, 11 Mar 2010 11:56:15 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NplgB-0003s9-Is for qemu-devel@nongnu.org; Thu, 11 Mar 2010 11:56:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44931) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NplgA-0003rs-V8 for qemu-devel@nongnu.org; Thu, 11 Mar 2010 11:56:11 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2BGuAov027527 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 11 Mar 2010 11:56:10 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2BGtoNu002794; Thu, 11 Mar 2010 11:56:08 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 11 Mar 2010 17:55:47 +0100 Message-Id: <2ef837449469b756938b92aeffd5045191edf13e.1268326362.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 13/16] 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); } }