mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-21 09:02:00 -06:00
util/fifo8: Rename fifo8_peek_buf() -> fifo8_peek_bufptr()
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>
This commit is contained in:
parent
b81bc8dc8d
commit
06a16e7ba9
3 changed files with 8 additions and 7 deletions
|
@ -486,7 +486,7 @@ static bool esp_cdb_ready(ESPState *s)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pbuf = fifo8_peek_buf(&s->cmdfifo, len, &n);
|
pbuf = fifo8_peek_bufptr(&s->cmdfifo, len, &n);
|
||||||
if (n < len) {
|
if (n < len) {
|
||||||
/*
|
/*
|
||||||
* In normal use the cmdfifo should never wrap, but include this check
|
* In normal use the cmdfifo should never wrap, but include this check
|
||||||
|
|
|
@ -89,16 +89,17 @@ uint8_t fifo8_pop(Fifo8 *fifo);
|
||||||
const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr);
|
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
|
* @fifo: FIFO to read from
|
||||||
* @max: maximum number of bytes to peek
|
* @max: maximum number of bytes to peek
|
||||||
* @numptr: pointer filled with number of bytes returned (can be NULL)
|
* @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.
|
* 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
|
* The buffer containing the data peeked into is returned. This buffer points
|
||||||
* directly into the FIFO backing store. Since data is invalidated once any
|
* directly into the internal FIFO backing store (without checking for
|
||||||
* of the fifo8_* APIs are called on the FIFO, it is the caller responsibility
|
* overflow!). Since data is invalidated once any of the fifo8_* APIs are
|
||||||
* to access it before doing further API calls.
|
* 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
|
* 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
|
* 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.
|
* 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:
|
* fifo8_reset:
|
||||||
|
|
|
@ -92,7 +92,7 @@ static const uint8_t *fifo8_peekpop_buf(Fifo8 *fifo, uint32_t max,
|
||||||
return ret;
|
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);
|
return fifo8_peekpop_buf(fifo, max, numptr, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue