Skip to content

Commit 8c868a3

Browse files
Jianyun Gaoanakryiko
authored andcommitted
libbpf: Fix some incorrect @param descriptions in the comment of libbpf.h
Fix up some of missing or incorrect @param descriptions for libbpf public APIs in libbpf.h. Signed-off-by: Jianyun Gao <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent f2cb066 commit 8c868a3

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

tools/lib/bpf/libbpf.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ LIBBPF_API int bpf_program__pin(struct bpf_program *prog, const char *path);
448448

449449
/**
450450
* @brief **bpf_program__unpin()** unpins the BPF program from a file
451-
* in the BPFFS specified by a path. This decrements the programs
451+
* in the BPFFS specified by a path. This decrements program's in-kernel
452452
* reference count.
453453
*
454454
* The file pinning the BPF program can also be unlinked by a different
@@ -481,14 +481,12 @@ LIBBPF_API int bpf_link__pin(struct bpf_link *link, const char *path);
481481

482482
/**
483483
* @brief **bpf_link__unpin()** unpins the BPF link from a file
484-
* in the BPFFS specified by a path. This decrements the links
485-
* reference count.
484+
* in the BPFFS. This decrements link's in-kernel reference count.
486485
*
487486
* The file pinning the BPF link can also be unlinked by a different
488487
* process in which case this function will return an error.
489488
*
490-
* @param prog BPF program to unpin
491-
* @param path file path to the pin in a BPF file system
489+
* @param link BPF link to unpin
492490
* @return 0, on success; negative error code, otherwise
493491
*/
494492
LIBBPF_API int bpf_link__unpin(struct bpf_link *link);
@@ -995,8 +993,13 @@ LIBBPF_API __u32 bpf_program__line_info_cnt(const struct bpf_program *prog);
995993
* - fentry/fexit/fmod_ret;
996994
* - lsm;
997995
* - freplace.
998-
* @param prog BPF program to set the attach type for
999-
* @param type attach type to set the BPF map to have
996+
* @param prog BPF program to configure; must be not yet loaded.
997+
* @param attach_prog_fd FD of target BPF program (for freplace/extension).
998+
* If >0 and func name omitted, defers BTF ID resolution.
999+
* @param attach_func_name Target function name. Used either with
1000+
* attach_prog_fd to find destination BTF type ID in that BPF program, or
1001+
* alone (no attach_prog_fd) to resolve kernel (vmlinux/module) BTF ID.
1002+
* Must be provided if attach_prog_fd is 0.
10001003
* @return error code; or 0 if no error occurred.
10011004
*/
10021005
LIBBPF_API int
@@ -1098,6 +1101,7 @@ LIBBPF_API __u32 bpf_map__value_size(const struct bpf_map *map);
10981101
/**
10991102
* @brief **bpf_map__set_value_size()** sets map value size.
11001103
* @param map the BPF map instance
1104+
* @param size the new value size
11011105
* @return 0, on success; negative error, otherwise
11021106
*
11031107
* There is a special case for maps with associated memory-mapped regions, like
@@ -1202,7 +1206,7 @@ LIBBPF_API struct bpf_map *bpf_map__inner_map(struct bpf_map *map);
12021206
* per-CPU values value size has to be aligned up to closest 8 bytes for
12031207
* alignment reasons, so expected size is: `round_up(value_size, 8)
12041208
* * libbpf_num_possible_cpus()`.
1205-
* @flags extra flags passed to kernel for this operation
1209+
* @param flags extra flags passed to kernel for this operation
12061210
* @return 0, on success; negative error, otherwise
12071211
*
12081212
* **bpf_map__lookup_elem()** is high-level equivalent of
@@ -1226,7 +1230,7 @@ LIBBPF_API int bpf_map__lookup_elem(const struct bpf_map *map,
12261230
* per-CPU values value size has to be aligned up to closest 8 bytes for
12271231
* alignment reasons, so expected size is: `round_up(value_size, 8)
12281232
* * libbpf_num_possible_cpus()`.
1229-
* @flags extra flags passed to kernel for this operation
1233+
* @param flags extra flags passed to kernel for this operation
12301234
* @return 0, on success; negative error, otherwise
12311235
*
12321236
* **bpf_map__update_elem()** is high-level equivalent of
@@ -1242,7 +1246,7 @@ LIBBPF_API int bpf_map__update_elem(const struct bpf_map *map,
12421246
* @param map BPF map to delete element from
12431247
* @param key pointer to memory containing bytes of the key
12441248
* @param key_sz size in bytes of key data, needs to match BPF map definition's **key_size**
1245-
* @flags extra flags passed to kernel for this operation
1249+
* @param flags extra flags passed to kernel for this operation
12461250
* @return 0, on success; negative error, otherwise
12471251
*
12481252
* **bpf_map__delete_elem()** is high-level equivalent of
@@ -1265,7 +1269,7 @@ LIBBPF_API int bpf_map__delete_elem(const struct bpf_map *map,
12651269
* per-CPU values value size has to be aligned up to closest 8 bytes for
12661270
* alignment reasons, so expected size is: `round_up(value_size, 8)
12671271
* * libbpf_num_possible_cpus()`.
1268-
* @flags extra flags passed to kernel for this operation
1272+
* @param flags extra flags passed to kernel for this operation
12691273
* @return 0, on success; negative error, otherwise
12701274
*
12711275
* **bpf_map__lookup_and_delete_elem()** is high-level equivalent of
@@ -1637,6 +1641,7 @@ struct perf_buffer_opts {
16371641
* @param sample_cb function called on each received data record
16381642
* @param lost_cb function called when record loss has occurred
16391643
* @param ctx user-provided extra context passed into *sample_cb* and *lost_cb*
1644+
* @param opts optional parameters for the perf buffer, can be null
16401645
* @return a new instance of struct perf_buffer on success, NULL on error with
16411646
* *errno* containing an error code
16421647
*/

0 commit comments

Comments
 (0)