From patchwork Mon Dec 12 22:43:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 705214 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tczjP1Gyqz9t10 for ; Tue, 13 Dec 2016 10:35:37 +1100 (AEDT) Received: from localhost ([::1]:34197 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGa87-0005iy-5O for incoming@patchwork.ozlabs.org; Mon, 12 Dec 2016 18:35:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43831) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGZMG-0005Es-Lr for qemu-devel@nongnu.org; Mon, 12 Dec 2016 17:46:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGZMD-0004VQ-HZ for qemu-devel@nongnu.org; Mon, 12 Dec 2016 17:46:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47656) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cGZMD-0004UR-BM for qemu-devel@nongnu.org; Mon, 12 Dec 2016 17:46:05 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EB9A8B13C for ; Mon, 12 Dec 2016 22:46:02 +0000 (UTC) Received: from localhost (ovpn-116-54.ams2.redhat.com [10.36.116.54]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uBCMk0rS016586; Mon, 12 Dec 2016 17:46:01 -0500 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 13 Dec 2016 01:43:10 +0300 Message-Id: <20161212224325.20790-40-marcandre.lureau@redhat.com> In-Reply-To: <20161212224325.20790-1-marcandre.lureau@redhat.com> References: <20161212224325.20790-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 12 Dec 2016 22:46:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 39/54] char: rename and move to header CHR_READ_BUF_LEN X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This define is used by several character devices, place it in char common header. Signed-off-by: Marc-André Lureau --- chardev/char.c | 13 ++++++------- include/sysemu/char.h | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chardev/char.c b/chardev/char.c index 94b42bbe01..1fdfa98954 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -87,7 +87,6 @@ #include "char-mux.h" -#define READ_BUF_LEN 4096 #define READ_RETRIES 10 #define TCP_MAX_FDS 16 @@ -471,7 +470,7 @@ void qemu_chr_fe_accept_input(CharBackend *be) void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...) { - char buf[READ_BUF_LEN]; + char buf[CHR_READ_BUF_LEN]; va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); @@ -911,7 +910,7 @@ static gboolean fd_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque) Chardev *chr = CHARDEV(opaque); FDChardev *s = FD_CHARDEV(opaque); int len; - uint8_t buf[READ_BUF_LEN]; + uint8_t buf[CHR_READ_BUF_LEN]; ssize_t ret; len = sizeof(buf); @@ -1263,7 +1262,7 @@ static gboolean pty_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque) Chardev *chr = CHARDEV(opaque); PtyChardev *s = PTY_CHARDEV(opaque); gsize len; - uint8_t buf[READ_BUF_LEN]; + uint8_t buf[CHR_READ_BUF_LEN]; ssize_t ret; len = sizeof(buf); @@ -1953,7 +1952,7 @@ static void win_chr_readfile(Chardev *chr) WinChardev *s = WIN_CHARDEV(chr); int ret, err; - uint8_t buf[READ_BUF_LEN]; + uint8_t buf[CHR_READ_BUF_LEN]; DWORD size; ZeroMemory(&s->orecv, sizeof(s->orecv)); @@ -2355,7 +2354,7 @@ err1: typedef struct { Chardev parent; QIOChannel *ioc; - uint8_t buf[READ_BUF_LEN]; + uint8_t buf[CHR_READ_BUF_LEN]; int bufcnt; int bufptr; int max_size; @@ -2760,7 +2759,7 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque) { Chardev *chr = CHARDEV(opaque); SocketChardev *s = SOCKET_CHARDEV(opaque); - uint8_t buf[READ_BUF_LEN]; + uint8_t buf[CHR_READ_BUF_LEN]; int len, size; if (!s->connected || s->max_size <= 0) { diff --git a/include/sysemu/char.h b/include/sysemu/char.h index dd91c4c03e..0b96b00d56 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -22,6 +22,7 @@ typedef enum { CHR_EVENT_CLOSED /* connection closed */ } QEMUChrEvent; +#define CHR_READ_BUF_LEN 4096 #define CHR_IOCTL_SERIAL_SET_PARAMS 1 typedef struct {