libbpf: Introduce libbpf_bpf_attach_type_str

This change introduces a new function, libbpf_bpf_attach_type_str, to
the public libbpf API. The function allows users to get a string
representation for a bpf_attach_type variant.

Signed-off-by: Daniel Müller <deso@posteo.net>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20220523230428.3077108-8-deso@posteo.net
This commit is contained in:
Daniel Müller
2022-05-23 23:04:23 +00:00
committed by Andrii Nakryiko
parent 2e98964bd6
commit ccde5760ba
3 changed files with 64 additions and 0 deletions

View File

@@ -51,6 +51,15 @@ enum libbpf_errno {
LIBBPF_API int libbpf_strerror(int err, char *buf, size_t size);
/**
* @brief **libbpf_bpf_attach_type_str()** converts the provided attach type
* value into a textual representation.
* @param t The attach type.
* @return Pointer to a static string identifying the attach type. NULL is
* returned for unknown **bpf_attach_type** values.
*/
LIBBPF_API const char *libbpf_bpf_attach_type_str(enum bpf_attach_type t);
/**
* @brief **libbpf_bpf_map_type_str()** converts the provided map type value
* into a textual representation.