From nobody Sun Nov 9 14:51:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550625994313622.813071012683; Tue, 19 Feb 2019 17:26:34 -0800 (PST) Received: from localhost ([127.0.0.1]:57655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwGeX-0000nW-62 for importer@patchew.org; Tue, 19 Feb 2019 20:26:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwGQx-0006Ll-JH for qemu-devel@nongnu.org; Tue, 19 Feb 2019 20:12:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwGQn-00055g-93 for qemu-devel@nongnu.org; Tue, 19 Feb 2019 20:12:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54418) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gwGQl-00042S-7A; Tue, 19 Feb 2019 20:12:13 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F1BBB81DF3; Wed, 20 Feb 2019 01:08:58 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A515A1018A02; Wed, 20 Feb 2019 01:08:49 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Prasad J Pandit , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Date: Wed, 20 Feb 2019 02:02:32 +0100 Message-Id: <20190220010232.18731-26-philmd@redhat.com> In-Reply-To: <20190220010232.18731-1-philmd@redhat.com> References: <20190220010232.18731-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 20 Feb 2019 01:08:59 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 25/25] chardev: Let qemu_chr_write[_all] use size_t 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: Corey Minyard , Stefano Stabellini , Samuel Thibault , Li Zhijian , Amit Shah , "Michael S. Tsirkin" , Jason Wang , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Paul Durrant , qemu-ppc@nongnu.org, Gerd Hoffmann , Pavel Dovgalyuk , Zhang Chen , Anthony Perard , xen-devel@lists.xenproject.org, Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We now know all callers use a size_t argument. We can convert qemu_chr_write() and qemu_chr_write_all() to use a size_t argument. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- chardev/char.c | 8 ++++---- include/chardev/char.h | 2 +- include/sysemu/replay.h | 2 +- replay/replay-char.c | 2 +- stubs/replay.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/chardev/char.c b/chardev/char.c index 3149cd3ba9..8f1f56a802 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -99,8 +99,8 @@ static void qemu_chr_write_log(Chardev *s, const uint8_t = *buf, size_t len) } =20 static int qemu_chr_write_buffer(Chardev *s, - const uint8_t *buf, int len, - int *offset, bool write_all) + const uint8_t *buf, size_t len, + size_t *offset, bool write_all) { ChardevClass *cc =3D CHARDEV_GET_CLASS(s); int res =3D 0; @@ -132,9 +132,9 @@ static int qemu_chr_write_buffer(Chardev *s, return res; } =20 -int qemu_chr_write(Chardev *s, const uint8_t *buf, int len, bool write_all) +int qemu_chr_write(Chardev *s, const uint8_t *buf, size_t len, bool write_= all) { - int offset =3D 0; + size_t offset =3D 0; int res; =20 if (qemu_chr_replay(s) && replay_mode =3D=3D REPLAY_MODE_PLAY) { diff --git a/include/chardev/char.h b/include/chardev/char.h index 0341dd1ba2..2e3b5a15ca 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -221,7 +221,7 @@ void qemu_chr_set_feature(Chardev *chr, ChardevFeature feature); QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename, bool permit_mux_mon); -int qemu_chr_write(Chardev *s, const uint8_t *buf, int len, bool write_all= ); +int qemu_chr_write(Chardev *s, const uint8_t *buf, size_t len, bool write_= all); #define qemu_chr_write_all(s, buf, len) qemu_chr_write(s, buf, len, true) int qemu_chr_wait_connected(Chardev *chr, Error **errp); =20 diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index 3a7c58e423..334944715d 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -158,7 +158,7 @@ void replay_chr_be_write(struct Chardev *s, uint8_t *bu= f, int len); /*! Writes char write return value to the replay log. */ void replay_char_write_event_save(int res, int offset); /*! Reads char write return value from the replay log. */ -void replay_char_write_event_load(int *res, int *offset); +void replay_char_write_event_load(int *res, size_t *offset); /*! Reads information about read_all character event. */ int replay_char_read_all_load(uint8_t *buf); /*! Writes character read_all error code into the replay log. */ diff --git a/replay/replay-char.c b/replay/replay-char.c index 736cc8c2e6..f0308578eb 100644 --- a/replay/replay-char.c +++ b/replay/replay-char.c @@ -104,7 +104,7 @@ void replay_char_write_event_save(int res, int offset) replay_put_dword(offset); } =20 -void replay_char_write_event_load(int *res, int *offset) +void replay_char_write_event_load(int *res, size_t *offset) { g_assert(replay_mutex_locked()); =20 diff --git a/stubs/replay.c b/stubs/replay.c index 4ac607895d..cf584d3191 100644 --- a/stubs/replay.c +++ b/stubs/replay.c @@ -44,7 +44,7 @@ void replay_char_write_event_save(int res, int offset) abort(); } =20 -void replay_char_write_event_load(int *res, int *offset) +void replay_char_write_event_load(int *res, size_t *offset) { abort(); } --=20 2.20.1