]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ring: add ring_data() to report the amount of data in a ring
authorWilly Tarreau <w@1wt.eu>
Tue, 27 Feb 2024 08:12:19 +0000 (09:12 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2024 17:34:19 +0000 (17:34 +0000)
This will be used as an accessor for the few functions that need this
outside of ring.c.

include/haproxy/ring.h

index 0e8a3bf860abae9671e6176ab02cb56e149e5e60..ddcc558c0aebe65d33db5c3821abc5a9ad6a9706 100644 (file)
@@ -45,6 +45,12 @@ size_t ring_max_payload(const struct ring *ring);
 int ring_dispatch_messages(struct ring *ring, void *ctx, size_t *ofs_ptr, size_t *last_ofs_ptr, uint flags,
                           ssize_t (*msg_handler)(void *ctx, const struct buffer *buf, size_t ofs, size_t len));
 
+/* returns the number of bytes in the ring */
+static inline size_t ring_data(const struct ring *ring)
+{
+       return b_data(&ring->buf);
+}
+
 #endif /* _HAPROXY_RING_H */
 
 /*