diff options
author | Andrii Nakryiko <andriin@fb.com> | 2020-09-26 04:13:51 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-09-29 03:27:31 +0300 |
commit | 192f5a1fe6894dca58d14dc883e6c7030e7267f7 (patch) | |
tree | ce117a588a970443c405f4ca0e94e368739d0451 /tools/lib/bpf/libbpf_internal.h | |
parent | b86042478fa083d87f1b67047e788d70b8c81eef (diff) | |
download | linux-192f5a1fe6894dca58d14dc883e6c7030e7267f7.tar.xz |
libbpf: Generalize common logic for managing dynamically-sized arrays
Managing dynamically-sized array is a common, but not trivial functionality,
which significant amount of logic and code to implement properly. So instead
of re-implementing it all the time, extract it into a helper function ans
reuse.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20200926011357.2366158-4-andriin@fb.com
Diffstat (limited to 'tools/lib/bpf/libbpf_internal.h')
-rw-r--r-- | tools/lib/bpf/libbpf_internal.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h index d3f7a6a6bc98..eed5b624a784 100644 --- a/tools/lib/bpf/libbpf_internal.h +++ b/tools/lib/bpf/libbpf_internal.h @@ -105,6 +105,9 @@ static inline void *libbpf_reallocarray(void *ptr, size_t nmemb, size_t size) return realloc(ptr, total); } +void *btf_add_mem(void **data, size_t *cap_cnt, size_t elem_sz, + size_t cur_cnt, size_t max_cnt, size_t add_cnt); + static inline bool libbpf_validate_opts(const char *opts, size_t opts_sz, size_t user_sz, const char *type_name) |