obmc-console: Fix ringbuffer-test-utils analysis
ninja's clang-tidy target barfs due to the strategy of including C files
into each other for test purposes. Help it out by moving the ringbuffer
struct definitions into console-server.h so it can find them when
analysing test/ringbuffer-test-utils.c.
obmc-console isn't a library, so it's not like we're trying to avoid
expanding API/ABI surface.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ifd4501d3ca7f3bb02c557a1c31364aadd2b26abe
diff --git a/console-server.h b/console-server.h
index eee032b..f42b3ad 100644
--- a/console-server.h
+++ b/console-server.h
@@ -94,6 +94,7 @@
const struct timeval *tv);
/* ringbuffer API */
+
enum ringbuffer_poll_ret {
RINGBUFFER_POLL_OK = 0,
RINGBUFFER_POLL_REMOVE,
@@ -102,9 +103,23 @@
typedef enum ringbuffer_poll_ret (*ringbuffer_poll_fn_t)(void *data,
size_t force_len);
-struct ringbuffer;
struct ringbuffer_consumer;
+struct ringbuffer {
+ uint8_t *buf;
+ size_t size;
+ size_t tail;
+ struct ringbuffer_consumer **consumers;
+ int n_consumers;
+};
+
+struct ringbuffer_consumer {
+ struct ringbuffer *rb;
+ ringbuffer_poll_fn_t poll_fn;
+ void *poll_data;
+ size_t pos;
+};
+
struct ringbuffer *ringbuffer_init(size_t size);
void ringbuffer_fini(struct ringbuffer *rb);