[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/28] util/fifo8: Rename fifo8_peek_buf() -> fifo8_peek_bufptr()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 23/28] util/fifo8: Rename fifo8_peek_buf() -> fifo8_peek_bufptr() |
Date: |
Tue, 23 Jul 2024 22:38:50 +0200 |
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é <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
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);
}
--
2.41.0
- [PULL 15/28] system/memory_mapping: make range overlap check more readable, (continued)
- [PULL 15/28] system/memory_mapping: make range overlap check more readable, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 14/28] sparc/ldst_helper: make range overlap check more readable, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 13/28] cxl/mailbox: make range overlap check more readable, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 16/28] crypto/block-luks: make range overlap check more readable, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 18/28] hw/nubus/virtio-mmio: Fix missing ERRP_GUARD() in realize handler, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 19/28] hw/char/goldfish: Use DMA memory API, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 17/28] dump: make range overlap check more readable, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 20/28] chardev/char-fe: Document returned value on error, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 21/28] util/fifo8: Fix style, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 22/28] util/fifo8: Use fifo8_reset() in fifo8_create(), Philippe Mathieu-Daudé, 2024/07/23
- [PULL 23/28] util/fifo8: Rename fifo8_peek_buf() -> fifo8_peek_bufptr(),
Philippe Mathieu-Daudé <=
- [PULL 24/28] util/fifo8: Rename fifo8_pop_buf() -> fifo8_pop_bufptr(), Philippe Mathieu-Daudé, 2024/07/23
- [PULL 25/28] util/fifo8: Expose fifo8_pop_buf(), Philippe Mathieu-Daudé, 2024/07/23
- [PULL 27/28] MAINTAINERS: Cover guest-agent in QAPI schema, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 28/28] MAINTAINERS: Add myself as a reviewer of machine core, Philippe Mathieu-Daudé, 2024/07/23
- [PULL 26/28] util/fifo8: Introduce fifo8_drop(), Philippe Mathieu-Daudé, 2024/07/23
- Re: [PULL 00/28] Misc HW+ patches for 2024-07-23, Richard Henderson, 2024/07/24