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);
diff --git a/ringbuffer.c b/ringbuffer.c
index 5ec1fbc..13104e9 100644
--- a/ringbuffer.c
+++ b/ringbuffer.c
@@ -26,21 +26,6 @@
return a < b ? a : b;
}
-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)
{
struct ringbuffer *rb;
diff --git a/test/ringbuffer-test-utils.c b/test/ringbuffer-test-utils.c
index 3b3a4a9..e372845 100644
--- a/test/ringbuffer-test-utils.c
+++ b/test/ringbuffer-test-utils.c
@@ -1,3 +1,6 @@
+#include <stdbool.h>
+
+#include "console-server.h"
struct rb_test_ctx {
struct ringbuffer_consumer *rbc;