Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libbpf: Add documentation to version and error API functions

Add documentation for the following API functions:

- libbpf_major_version()
- libbpf_minor_version()
- libbpf_version_string()
- libbpf_strerror()

Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250820-libbpf-doc-1-v1-1-13841f25a134@uniontech.com

authored by

Cryolitia PukNgae and committed by
Andrii Nakryiko
78e097fb 2693227c

+25
+25
tools/lib/bpf/libbpf.h
··· 24 24 extern "C" { 25 25 #endif 26 26 27 + /** 28 + * @brief **libbpf_major_version()** provides the major version of libbpf. 29 + * @return An integer, the major version number 30 + */ 27 31 LIBBPF_API __u32 libbpf_major_version(void); 32 + 33 + /** 34 + * @brief **libbpf_minor_version()** provides the minor version of libbpf. 35 + * @return An integer, the minor version number 36 + */ 28 37 LIBBPF_API __u32 libbpf_minor_version(void); 38 + 39 + /** 40 + * @brief **libbpf_version_string()** provides the version of libbpf in a 41 + * human-readable form, e.g., "v1.7". 42 + * @return Pointer to a static string containing the version 43 + * 44 + * The format is *not* a part of a stable API and may change in the future. 45 + */ 29 46 LIBBPF_API const char *libbpf_version_string(void); 30 47 31 48 enum libbpf_errno { ··· 66 49 __LIBBPF_ERRNO__END, 67 50 }; 68 51 52 + /** 53 + * @brief **libbpf_strerror()** converts the provided error code into a 54 + * human-readable string. 55 + * @param err The error code to convert 56 + * @param buf Pointer to a buffer where the error message will be stored 57 + * @param size The number of bytes in the buffer 58 + * @return 0, on success; negative error code, otherwise 59 + */ 69 60 LIBBPF_API int libbpf_strerror(int err, char *buf, size_t size); 70 61 71 62 /**