aboutsummaryrefslogtreecommitdiff
path: root/include/qemu
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2024-08-28 13:22:57 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-09-13 20:11:13 +0200
commit570bf1439477db0a2fc839f745a1ab16688004c0 (patch)
treea88adfaef83f3d426e64d655e16126a9b5081a34 /include/qemu
parent28fbf33b3f6925dff8fcf1bae217d850d604a1d3 (diff)
downloadqemu-570bf1439477db0a2fc839f745a1ab16688004c0.zip
qemu-570bf1439477db0a2fc839f745a1ab16688004c0.tar.gz
qemu-570bf1439477db0a2fc839f745a1ab16688004c0.tar.bz2
fifo8: introduce fifo8_peek() function
This allows uses to peek the byte at the current head of the FIFO. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Octavian Purdila <tavip@google.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240828122258.928947-9-mark.cave-ayland@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/fifo8.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/qemu/fifo8.h b/include/qemu/fifo8.h
index d09984b..4f768d4 100644
--- a/include/qemu/fifo8.h
+++ b/include/qemu/fifo8.h
@@ -63,6 +63,17 @@ void fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num);
uint8_t fifo8_pop(Fifo8 *fifo);
/**
+ * fifo8_peek:
+ * @fifo: fifo to peek from
+ *
+ * Peek the data byte at the current head of the FIFO. Clients are responsible
+ * for checking for emptyness using fifo8_is_empty().
+ *
+ * Returns: The peeked data byte.
+ */
+uint8_t fifo8_peek(Fifo8 *fifo);
+
+/**
* fifo8_pop_buf:
* @fifo: FIFO to pop from
* @dest: the buffer to write the data into (can be NULL)