]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEV: haring: make haring not depend on the struct ring itself
authorWilly Tarreau <w@1wt.eu>
Mon, 4 Mar 2024 18:04:09 +0000 (19:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 9 Mar 2024 10:23:52 +0000 (11:23 +0100)
haring needs to be self-sufficient about the ring format so that it continues
to build when the ring API changes. Let's import the struct ring definition
and call it "ring_v1".

dev/haring/haring.c

index ee7e1aa4e7fec3e6e09c7745c9b1f5a247eae8d0..fbd386b4ca757db10c592f4d7661dfa1276d3b53 100644 (file)
 
 #include <haproxy/api.h>
 #include <haproxy/buf.h>
-#include <haproxy/ring.h>
+#include <haproxy/ring-t.h>
+#include <haproxy/thread.h>
 
 int force = 0; // force access to a different layout
 int lfremap = 0; // remap LF in traces
 int repair = 0; // repair file
 
+struct ring_v1 {
+       struct buffer buf;   // storage area
+       struct list waiters; // list of waiters, for now, CLI "show event"
+       __decl_thread(HA_RWLOCK_T lock);
+       int readers_count;
+};
 
 /* display the message and exit with the code */
 __attribute__((noreturn)) void die(int code, const char *format, ...)
@@ -78,7 +85,7 @@ __attribute__((noreturn)) void usage(int code, const char *arg0)
  * called again, otherwise non-zero. It is meant to be used with
  * cli_release_show_ring() to clean up.
  */
-int dump_ring(struct ring *ring, size_t ofs, int flags)
+int dump_ring(struct ring_v1 *ring, size_t ofs, int flags)
 {
        struct buffer buf;
        uint64_t msg_len = 0;
@@ -212,7 +219,7 @@ int dump_ring(struct ring *ring, size_t ofs, int flags)
 
 int main(int argc, char **argv)
 {
-       struct ring *ring;
+       void *ring;
        struct stat statbuf;
        const char *arg0;
        int fd;