From patchwork Tue Jul 23 20:38:50 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: 813982 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp2489655wro; Tue, 23 Jul 2024 13:42:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVCCsY+EbvLIC/PBWy4Vw4goCfB82Z7n/+o+JoXSnVPrUrD6UyJBpB3vQ1jKXoWGxqWgv/+mFZnXEqosGSN+jrB X-Google-Smtp-Source: AGHT+IF0h0m++eOuPuFZA4iNfhR5zpQdtG8QkBJrUb3QnURpEzaUYVAq8EGZUQz1A1gMp5AL0aoD X-Received: by 2002:a05:620a:44c9:b0:79d:751b:67b6 with SMTP id af79cd13be357-7a1a652d2b2mr1290018485a.16.1721767353642; Tue, 23 Jul 2024 13:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721767353; cv=none; d=google.com; s=arc-20160816; b=RNnDfYwaQWBO5fHVREKBb4slu9tWUvcZBKlzzpPfYao9Da/5CkWdeFZNFuXQlMByK6 FkM/XZGU62fPk7f5rlwKnCTJ0xE8jVSm6vSByAela/jIdE4wRdFEA+nb1+x56u1XGN4k tWteEroKsL2KXeCtUXzforSawjv2ExPHPToFB+aUpm+zrkZJeYjKIr0ZgK1MTbPbV12J lHWbmuqB44U4lGkuh5uIVUhNiCGQidcigGX//mcbBAIwxSQQ/LCrpyLmOKqBn5l6It0y zaVvf+KQ63ZGOCtyKVQSDiY/5k6ywxhNtBmTDEPolYOsiNq3mxOwmD6OME+QvZiQ9mzO jNug== 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=dSCWBLk+dTPyKUi346CpD+A3ideUlHg+vbcXd5eth70=; fh=2xHiZd0a2mpp4kaBwYvfP53LjG71w1oajHEDa7sJQT4=; b=eerSgsu5ayR7KDVsuwmIvQa1XtEj+2cydBo9rHDDBHPQ2Mg7PSeCdDQ4j/f66W5AvX dWElEJsAeHQ5qK7IxXdR+wjiDszDE0cDz0Ryt1yVjLRed2ndTQnn6KmfPJbEXmErtSse 8G9IHmFTA+BGHeFEiQKDg5zH1hnrG/h8rVkaOaCMYSM2VXjqlr36QgWbshRjcC34jZNx mPXAGqptJ/4asds2M4hivtEpJNCAp/OORS/HCzXerR717S4qMYf99z7ypJDjyCFMuuaM BqvCBUMwig5wmbEyrxKQbMuOvSz9cWUHAIvU+pgztw9sX1PjXf864z3LbH3kUlJ83q9i 6N5w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qapZBxDW; 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 af79cd13be357-7a198f94152si1060624085a.149.2024.07.23.13.42.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jul 2024 13:42:33 -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=qapZBxDW; 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 1sWMJs-0006GB-Fc; Tue, 23 Jul 2024 16:41:12 -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 1sWMJq-00062Y-Qd for qemu-devel@nongnu.org; Tue, 23 Jul 2024 16:41:11 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sWMJo-0004Vs-QJ for qemu-devel@nongnu.org; Tue, 23 Jul 2024 16:41:10 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-367940c57ddso3144279f8f.3 for ; Tue, 23 Jul 2024 13:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721767267; x=1722372067; 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=dSCWBLk+dTPyKUi346CpD+A3ideUlHg+vbcXd5eth70=; b=qapZBxDWb//CkAlAcCV2eDsSeTAadPyUoxa9ROkt43zyWWoX01SRKCXrb2QUdHTbI+ 0CFqoD6gGfw1U/eo8xPK0Z1kkYOk65BgGMLklrh+3dfvatyrlwK+4RarmDjBfArTCv2N FrlnemUB64CVzbXQE/fXca3R7/QeYCYtIKx/LvCcIQ96rBYgG5DvjjD6aWRmGgS/i5+2 4sdvcO0noNDvBpVMt61gjElJhUDpsXvO/LLM0sNOxAsbllFTIJajoEW3WW6MqL1mC0vE QY9TZ0+Tm763/NDOcWFunNwcPHz+JNjWkTXnHl+J+NF17Tt6ivF5PWIPFPdedeZbATUs MwXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721767267; x=1722372067; 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=dSCWBLk+dTPyKUi346CpD+A3ideUlHg+vbcXd5eth70=; b=nHFaDLATtcHeQLCCgp3SCJFx+n+x31cQNfBWGLssR1c1wJ2i8VRgN09oyAINCTaDNn o8B/p5nqKz3/D3BjyuyqnO9a0nS6dYHAPzSlqDlbR3sjqE7nxaz7UFsC6vHr0FDGdgiw 1frObyT87S7/hCTowGZ44hjXSyx1awi/x7egbEm+mOaT1yyFRZakQIMIRIBXVc/AWBoU kn/TCNd924LIfbilemgpSKMZsrcDZyYxTfI2DzRx39pdA4lmtKb/utPEPzAMuagQzNTg T2kS4AwXzkgJTlctE32sXYANG3bpmyemp5358O5ZkFW6dAcBrxl71n/dFnEPeaaKbIOU SWQw== X-Gm-Message-State: AOJu0YwRRltk07VaCcwUs6UeDg/DOTf/wuahKFaw7U8oelmEMHKugjqX HsujcO6O0g0dl+dF+CDVn/xgcpyx87eOW0Z60WRzBp4ugox4/jofuOwv92h9MVwnbSP4BWVlmfl +W7M= X-Received: by 2002:a5d:6a47:0:b0:368:4ed7:2acb with SMTP id ffacd0b85a97d-369bae01e22mr5450473f8f.5.1721767266672; Tue, 23 Jul 2024 13:41:06 -0700 (PDT) Received: from localhost.localdomain (vbo91-h01-176-184-50-4.dsl.sta.abo.bbox.fr. [176.184.50.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-368787eced0sm12312095f8f.98.2024.07.23.13.41.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jul 2024 13:41:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Mark Cave-Ayland Subject: [PULL 23/28] util/fifo8: Rename fifo8_peek_buf() -> fifo8_peek_bufptr() Date: Tue, 23 Jul 2024 22:38:50 +0200 Message-ID: <20240723203855.65033-24-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240723203855.65033-1-philmd@linaro.org> References: <20240723203855.65033-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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=ham 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_peek_buf() return a const buffer (which points directly into the FIFO backing store). Rename it using the 'bufptr' suffix to better reflect that it is a pointer to the internal buffer that is being returned. 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 Message-Id: <20240722160745.67904-5-philmd@linaro.org> --- include/qemu/fifo8.h | 11 ++++++----- hw/scsi/esp.c | 2 +- util/fifo8.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/qemu/fifo8.h b/include/qemu/fifo8.h index 2692d6bfdaa..e287e871190 100644 --- a/include/qemu/fifo8.h +++ b/include/qemu/fifo8.h @@ -89,16 +89,17 @@ uint8_t fifo8_pop(Fifo8 *fifo); const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr); /** - * fifo8_peek_buf: read upto max bytes from the fifo + * fifo8_peek_bufptr: read upto max bytes from the fifo * @fifo: FIFO to read from * @max: maximum number of bytes to peek * @numptr: pointer filled with number of bytes returned (can be NULL) * * Peek into a number of elements from the FIFO up to a maximum of @max. * The buffer containing the data peeked into is returned. This buffer points - * directly into the FIFO backing store. Since data is invalidated once any - * of the fifo8_* APIs are called on the FIFO, it is the caller responsibility - * to access it before doing further API calls. + * directly into the internal FIFO backing store (without checking for + * overflow!). Since data is invalidated once any of the fifo8_* APIs are + * called on the FIFO, it is the caller responsibility to access it before + * doing further API calls. * * The function may return fewer bytes than requested when the data wraps * around in the ring buffer; in this case only a contiguous part of the data @@ -113,7 +114,7 @@ const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr); * * Returns: A pointer to peekable data. */ -const uint8_t *fifo8_peek_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr); +const uint8_t *fifo8_peek_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr); /** * fifo8_reset: diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 8504dd30a0d..412c8cf2260 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -486,7 +486,7 @@ static bool esp_cdb_ready(ESPState *s) return false; } - pbuf = fifo8_peek_buf(&s->cmdfifo, len, &n); + pbuf = fifo8_peek_bufptr(&s->cmdfifo, len, &n); if (n < len) { /* * In normal use the cmdfifo should never wrap, but include this check diff --git a/util/fifo8.c b/util/fifo8.c index 2925fe56119..566b0893441 100644 --- a/util/fifo8.c +++ b/util/fifo8.c @@ -92,7 +92,7 @@ static const uint8_t *fifo8_peekpop_buf(Fifo8 *fifo, uint32_t max, return ret; } -const uint8_t *fifo8_peek_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr) +const uint8_t *fifo8_peek_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr) { return fifo8_peekpop_buf(fifo, max, numptr, false); }