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

Configure Feed

Select the types of activity you want to include in your feed.

libbpf: Document bpf_{btf,link,map,prog}_get_info_by_fd()

Replace the short informal description with the proper doc comments.

Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230220234958.764997-1-iii@linux.ibm.com

authored by

Ilya Leoshkevich and committed by
Andrii Nakryiko
0a504fa1 06943ae6

+64 -5
+64 -5
tools/lib/bpf/bpf.h
··· 1 1 /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ 2 2 3 3 /* 4 - * common eBPF ELF operations. 4 + * Common BPF ELF operations. 5 5 * 6 6 * Copyright (C) 2013-2015 Alexei Starovoitov <ast@kernel.org> 7 7 * Copyright (C) 2015 Wang Nan <wangnan0@huawei.com> ··· 386 386 LIBBPF_API int bpf_link_get_fd_by_id_opts(__u32 id, 387 387 const struct bpf_get_fd_by_id_opts *opts); 388 388 LIBBPF_API int bpf_obj_get_info_by_fd(int bpf_fd, void *info, __u32 *info_len); 389 - /* Type-safe variants of bpf_obj_get_info_by_fd(). The callers still needs to 390 - * pass info_len, which should normally be 391 - * sizeof(struct bpf_{prog,map,btf,link}_info), in order to be compatible with 392 - * different libbpf and kernel versions. 389 + 390 + /** 391 + * @brief **bpf_prog_get_info_by_fd()** obtains information about the BPF 392 + * program corresponding to *prog_fd*. 393 + * 394 + * Populates up to *info_len* bytes of *info* and updates *info_len* with the 395 + * actual number of bytes written to *info*. 396 + * 397 + * @param prog_fd BPF program file descriptor 398 + * @param info pointer to **struct bpf_prog_info** that will be populated with 399 + * BPF program information 400 + * @param info_len pointer to the size of *info*; on success updated with the 401 + * number of bytes written to *info* 402 + * @return 0, on success; negative error code, otherwise (errno is also set to 403 + * the error code) 393 404 */ 394 405 LIBBPF_API int bpf_prog_get_info_by_fd(int prog_fd, struct bpf_prog_info *info, __u32 *info_len); 406 + 407 + /** 408 + * @brief **bpf_map_get_info_by_fd()** obtains information about the BPF 409 + * map corresponding to *map_fd*. 410 + * 411 + * Populates up to *info_len* bytes of *info* and updates *info_len* with the 412 + * actual number of bytes written to *info*. 413 + * 414 + * @param map_fd BPF map file descriptor 415 + * @param info pointer to **struct bpf_map_info** that will be populated with 416 + * BPF map information 417 + * @param info_len pointer to the size of *info*; on success updated with the 418 + * number of bytes written to *info* 419 + * @return 0, on success; negative error code, otherwise (errno is also set to 420 + * the error code) 421 + */ 395 422 LIBBPF_API int bpf_map_get_info_by_fd(int map_fd, struct bpf_map_info *info, __u32 *info_len); 423 + 424 + /** 425 + * @brief **bpf_btf_get_info_by_fd()** obtains information about the 426 + * BTF object corresponding to *btf_fd*. 427 + * 428 + * Populates up to *info_len* bytes of *info* and updates *info_len* with the 429 + * actual number of bytes written to *info*. 430 + * 431 + * @param btf_fd BTF object file descriptor 432 + * @param info pointer to **struct bpf_btf_info** that will be populated with 433 + * BTF object information 434 + * @param info_len pointer to the size of *info*; on success updated with the 435 + * number of bytes written to *info* 436 + * @return 0, on success; negative error code, otherwise (errno is also set to 437 + * the error code) 438 + */ 396 439 LIBBPF_API int bpf_btf_get_info_by_fd(int btf_fd, struct bpf_btf_info *info, __u32 *info_len); 440 + 441 + /** 442 + * @brief **bpf_btf_get_info_by_fd()** obtains information about the BPF 443 + * link corresponding to *link_fd*. 444 + * 445 + * Populates up to *info_len* bytes of *info* and updates *info_len* with the 446 + * actual number of bytes written to *info*. 447 + * 448 + * @param link_fd BPF link file descriptor 449 + * @param info pointer to **struct bpf_link_info** that will be populated with 450 + * BPF link information 451 + * @param info_len pointer to the size of *info*; on success updated with the 452 + * number of bytes written to *info* 453 + * @return 0, on success; negative error code, otherwise (errno is also set to 454 + * the error code) 455 + */ 397 456 LIBBPF_API int bpf_link_get_info_by_fd(int link_fd, struct bpf_link_info *info, __u32 *info_len); 398 457 399 458 struct bpf_prog_query_opts {