diff options
author | Martin Kelly <martin.kelly@crowdstrike.com> | 2023-09-25 14:50:40 -0700 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2023-09-25 16:22:43 -0700 |
commit | e79abf717fce6439022547124571dfe17f2ac15a (patch) | |
tree | d677165172cc96d059ac7fc0ac61db88f7eccb05 /tools/lib/bpf/libbpf.h | |
parent | f3a01d385fbb9c76abfad8d104d08453f289e2d3 (diff) | |
download | linux-e79abf717fce6439022547124571dfe17f2ac15a.tar.gz linux-e79abf717fce6439022547124571dfe17f2ac15a.tar.bz2 linux-e79abf717fce6439022547124571dfe17f2ac15a.zip |
libbpf: Add ring__size
Add ring__size to get the total size of a given ringbuffer.
Signed-off-by: Martin Kelly <martin.kelly@crowdstrike.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230925215045.2375758-10-martin.kelly@crowdstrike.com
Diffstat (limited to 'tools/lib/bpf/libbpf.h')
-rw-r--r-- | tools/lib/bpf/libbpf.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index d60254c5edc6..53e2a645c560 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -1293,6 +1293,16 @@ LIBBPF_API unsigned long ring__producer_pos(const struct ring *r); */ LIBBPF_API size_t ring__avail_data_size(const struct ring *r); +/** + * @brief **ring__size()** returns the total size of the ringbuffer's map data + * area (excluding special producer/consumer pages). Effectively this gives the + * amount of usable bytes of data inside the ringbuffer. + * + * @param r A ringbuffer object. + * @return The total size of the ringbuffer map data area. + */ +LIBBPF_API size_t ring__size(const struct ring *r); + struct user_ring_buffer_opts { size_t sz; /* size of this struct, for forward/backward compatibility */ }; |