From patchwork Mon Jul 22 16:07:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 813735 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp1942300wro; Mon, 22 Jul 2024 09:11:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXNvfh37MLy504sPKdJgHJG4+pEmZjomvfbyD6tlganOXfnSDaQy7Br1uA2Knl4RmsnZwBnrelSgZQ18EbLcACr X-Google-Smtp-Source: AGHT+IEQWSNFZNEqWWINuUnNgxxUbd5u+uI47pKfm9F61jwh3ij/u3GJnG91pwc6vh+8Z4KpyiGW X-Received: by 2002:a05:6214:224b:b0:6b5:eba0:d0ab with SMTP id 6a1803df08f44-6b95a5de433mr93050866d6.15.1721664673402; Mon, 22 Jul 2024 09:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721664673; cv=none; d=google.com; s=arc-20160816; b=Rvi5bVnD2cvMmvP/UzKmgDynpEH30VQX8RDiMQJAXgcFhzdNK8XZi1rhxCni0LwUe6 ooGiojIt3CWRexj9tGU+9bfUE6eY5hgllqdbyf9uvHjI3F4Fh/NBamPU1FwO0WucJRIp T18Cq4dbdFlKcG+AwxP2L9Xk+m6Ht472QJ9tGA54zX49sN4VmRtY2JzQocgof1dM4Mqs Q7Lhwb+MLPymyn4Y/Ik3R88Bf3wsTDwgWGno40SvlZhA1DR3Z7o0c8NRCjd7OU4eG79C cRePHBKXDSJ1UcpqZJMzHG7KBDTM60NIWaueIwmV5sfMIDZ4Qb96UfSBJsVwEGNb/iib Pnow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D13SsLbTdb+rPn3f2Roi8BU4ul1b5GgWpSQvaH/PkW0=; fh=pA26/TpFHAj3dhwie1wJOLhR+LuI9XikNoV1W9RAiFw=; b=T+cNl/ipK5Kr6A4VWeXEJJpQ6Q7odSjQwSTwYG2e+OIbTfN0Z7p1NQA43s6x6SSoOK CJbh6uf+/0Um6Y3jDy4xmRFkvFlRkHx+GoFJ8P/RUfWlzvqjwyILsaHvrxdcsyArTvSY QH/eX8Or8DnZdFf5eTVBzBvrWoFeqdP+ZP+13h4vR5ZAE/7dZiz3RyghbRLOfD67VUj8 td+Yhh1aYpalg1xgHlkX0T2wuJeCmVED3WsivK9uUSDLAev4e5iu+J7fAXEASZYWQyY4 S6KOeSU3/tFz/evUBRUMqb3nD6at0FtQ6k3weYuM2CmgATCDFGv+j9yw1v8YTx4ARCY0 8g8Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HTc7vL43; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b7ac79f082si85293666d6.44.2024.07.22.09.11.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2024 09:11:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HTc7vL43; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVvaX-0007xL-NN; Mon, 22 Jul 2024 12:08:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVvaV-0007ly-P0 for qemu-devel@nongnu.org; Mon, 22 Jul 2024 12:08:35 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sVvaR-0007oY-NQ for qemu-devel@nongnu.org; Mon, 22 Jul 2024 12:08:35 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4279c924ca7so32747795e9.2 for ; Mon, 22 Jul 2024 09:08:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721664508; x=1722269308; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D13SsLbTdb+rPn3f2Roi8BU4ul1b5GgWpSQvaH/PkW0=; b=HTc7vL43soHt7J6N36/gUO0tC/QXqOJoRM/m2NjFiZwn0Ji5lF3DYub8vZ3RCM0ozp H0M7ASpBR5eNIWXKy+WDre3635XoGouBHqiE0rJc8DitqFXKyaYzvSIcdTTKOfsAme0H jH3bXTae42i61HHa+4kJFayaJBgU7DMU/Tud7M7J+I8aDuurmnpcq6bma0NQFjmgrJwv g31NKensoH7tS59Ec/QTC0aXySN22Wh4mflcDPwa4JZMs42N7YOAeJGSSzALtss6KTjE DNz6+f+Gnwm8xuCFYRaIAOvPEhyZCvd4wfH8Cd5i25PcBBVZYByZPsLG3/dEfXwqs51s EHxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721664508; x=1722269308; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D13SsLbTdb+rPn3f2Roi8BU4ul1b5GgWpSQvaH/PkW0=; b=eqGEyGmuQJAkq+FgUvhhkzksHTSF+YD44L8UHpxMuxe4yFcuPwTiPmHUxp0gd0ctC/ hbxMdZYBQEFe2SfXjyTk0Ps/wNbL1f9egIj4SmeV+6qrMf4cSOCZbMK80q3TDYTxUfZN EpjVCKCmNkdhOMJsWzkrbsZx+0CsP8Msssaj+X1LnuKJpNjPAk8L0lzejmzz6wtUU5rW 59Ib1ngx6I7JDQ9PFRh58QkA8Pj9K2CIu7Yk2SXia0NT/JYoAqb/5WlpF0bOp8Ec94IP aY7synxlj+v7FlG50ZVEdztf0mMmP+VtvTDjx1XJuF+lGkw3OULoYRyFirFo0XrOv5lS WoGw== X-Gm-Message-State: AOJu0YxiTOdfelTRJT+bGZmVO3yQnPD9dkCCiT5G/PJCxN26OyG0oeGb gm6B1O6w8zluiBJPLOMzgQ2WkRwA5LchYoqGaXRrg4+zOxZfnv7OrY00FbywfbbXkYQiN4caN94 S X-Received: by 2002:a05:600c:1d8f:b0:426:51dc:f6cd with SMTP id 5b1f17b1804b1-427dc529057mr55262845e9.18.1721664508179; Mon, 22 Jul 2024 09:08:28 -0700 (PDT) Received: from localhost.localdomain (gen92-h02-176-184-20-254.dsl.sta.abo.bbox.fr. [176.184.20.254]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-368787ced33sm8964748f8f.86.2024.07.22.09.08.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 22 Jul 2024 09:08:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 5/7] util/fifo8: Rename fifo8_pop_buf() -> fifo8_pop_constbuf() Date: Mon, 22 Jul 2024 18:07:43 +0200 Message-ID: <20240722160745.67904-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240722160745.67904-1-philmd@linaro.org> References: <20240722160745.67904-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since fifo8_pop_buf() return a const buffer (which points directly into the FIFO backing store), rename it using the 'constbuf' suffix. This will help differentiate with methods *copying* the FIFO data. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Reviewed-by: Mark Cave-Ayland --- include/qemu/fifo8.h | 4 ++-- chardev/msmouse.c | 2 +- hw/char/goldfish_tty.c | 4 ++-- hw/net/allwinner_emac.c | 2 +- hw/scsi/esp.c | 4 ++-- ui/console-vc.c | 2 +- ui/gtk.c | 2 +- util/fifo8.c | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/qemu/fifo8.h b/include/qemu/fifo8.h index 79450f4583..686918a3a4 100644 --- a/include/qemu/fifo8.h +++ b/include/qemu/fifo8.h @@ -63,7 +63,7 @@ void fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num); uint8_t fifo8_pop(Fifo8 *fifo); /** - * fifo8_pop_buf: + * fifo8_pop_constbuf: * @fifo: FIFO to pop from * @max: maximum number of bytes to pop * @numptr: pointer filled with number of bytes returned (can be NULL) @@ -86,7 +86,7 @@ uint8_t fifo8_pop(Fifo8 *fifo); * * Returns: A pointer to popped data. */ -const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr); +const uint8_t *fifo8_pop_constbuf(Fifo8 *fifo, uint32_t max, uint32_t *numptr); /** * fifo8_peek_constbuf: read upto max bytes from the fifo diff --git a/chardev/msmouse.c b/chardev/msmouse.c index a774c397b4..08836d92e8 100644 --- a/chardev/msmouse.c +++ b/chardev/msmouse.c @@ -81,7 +81,7 @@ static void msmouse_chr_accept_input(Chardev *chr) const uint8_t *buf; uint32_t size; - buf = fifo8_pop_buf(&mouse->outbuf, MIN(len, avail), &size); + buf = fifo8_pop_constbuf(&mouse->outbuf, MIN(len, avail), &size); qemu_chr_be_write(chr, buf, size); len = qemu_chr_be_can_write(chr); avail -= size; diff --git a/hw/char/goldfish_tty.c b/hw/char/goldfish_tty.c index f8ff043c39..2c5004851d 100644 --- a/hw/char/goldfish_tty.c +++ b/hw/char/goldfish_tty.c @@ -69,7 +69,7 @@ static uint64_t goldfish_tty_read(void *opaque, hwaddr addr, static void goldfish_tty_cmd(GoldfishTTYState *s, uint32_t cmd) { uint32_t to_copy; - uint8_t *buf; + const uint8_t *buf; uint8_t data_out[GOLFISH_TTY_BUFFER_SIZE]; int len; uint64_t ptr; @@ -109,7 +109,7 @@ static void goldfish_tty_cmd(GoldfishTTYState *s, uint32_t cmd) len = s->data_len; ptr = s->data_ptr; while (len && !fifo8_is_empty(&s->rx_fifo)) { - buf = (uint8_t *)fifo8_pop_buf(&s->rx_fifo, len, &to_copy); + buf = fifo8_pop_constbuf(&s->rx_fifo, len, &to_copy); address_space_rw(&address_space_memory, ptr, MEMTXATTRS_UNSPECIFIED, buf, to_copy, 1); diff --git a/hw/net/allwinner_emac.c b/hw/net/allwinner_emac.c index 989839784a..3b0a2ee07e 100644 --- a/hw/net/allwinner_emac.c +++ b/hw/net/allwinner_emac.c @@ -349,7 +349,7 @@ static void aw_emac_write(void *opaque, hwaddr offset, uint64_t value, "allwinner_emac: TX length > fifo data length\n"); } if (len > 0) { - data = fifo8_pop_buf(fifo, len, &ret); + data = fifo8_pop_constbuf(fifo, len, &ret); qemu_send_packet(nc, data, ret); aw_emac_tx_reset(s, chan); /* Raise TX interrupt */ diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 526ed91bef..64384f9b0e 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -208,7 +208,7 @@ static uint32_t esp_fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, int maxlen) } len = maxlen; - buf = fifo8_pop_buf(fifo, len, &n); + buf = fifo8_pop_constbuf(fifo, len, &n); if (dest) { memcpy(dest, buf, n); } @@ -217,7 +217,7 @@ static uint32_t esp_fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, int maxlen) len -= n; len = MIN(len, fifo8_num_used(fifo)); if (len) { - buf = fifo8_pop_buf(fifo, len, &n2); + buf = fifo8_pop_constbuf(fifo, len, &n2); if (dest) { memcpy(&dest[n], buf, n2); } diff --git a/ui/console-vc.c b/ui/console-vc.c index 899fa11c94..e9906aae59 100644 --- a/ui/console-vc.c +++ b/ui/console-vc.c @@ -287,7 +287,7 @@ static void kbd_send_chars(QemuTextConsole *s) const uint8_t *buf; uint32_t size; - buf = fifo8_pop_buf(&s->out_fifo, MIN(len, avail), &size); + buf = fifo8_pop_constbuf(&s->out_fifo, MIN(len, avail), &size); qemu_chr_be_write(s->chr, buf, size); len = qemu_chr_be_can_write(s->chr); avail -= size; diff --git a/ui/gtk.c b/ui/gtk.c index bc29f7a1b4..a4db90e8cb 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1820,7 +1820,7 @@ static void gd_vc_send_chars(VirtualConsole *vc) const uint8_t *buf; uint32_t size; - buf = fifo8_pop_buf(&vc->vte.out_fifo, MIN(len, avail), &size); + buf = fifo8_pop_constbuf(&vc->vte.out_fifo, MIN(len, avail), &size); qemu_chr_be_write(vc->vte.chr, buf, size); len = qemu_chr_be_can_write(vc->vte.chr); avail -= size; diff --git a/util/fifo8.c b/util/fifo8.c index 21943c6032..31f0d34c0c 100644 --- a/util/fifo8.c +++ b/util/fifo8.c @@ -97,7 +97,7 @@ const uint8_t *fifo8_peek_constbuf(Fifo8 *fifo, uint32_t max, uint32_t *numptr) return fifo8_peekpop_buf(fifo, max, numptr, false); } -const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr) +const uint8_t *fifo8_pop_constbuf(Fifo8 *fifo, uint32_t max, uint32_t *numptr) { return fifo8_peekpop_buf(fifo, max, numptr, true); }