diff mbox series

[bpf-next] libbpf: Add doc comments for bpf_program__(un)pin()

Message ID 20211209232222.541733-1-grantseltzer@gmail.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series [bpf-next] libbpf: Add doc comments for bpf_program__(un)pin() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 8 maintainers not CCed: netdev@vger.kernel.org kafai@fb.com daniel@iogearbox.net songliubraving@fb.com john.fastabend@gmail.com kpsingh@kernel.org yhs@fb.com ast@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 31 lines checked
netdev/kdoc fail Errors and warnings before: 24 this patch: 28
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next success VM_Test

Commit Message

Grant Seltzer Richman Dec. 9, 2021, 11:22 p.m. UTC
From: Grant Seltzer <grantseltzer@gmail.com>

This adds doc comments for the two bpf_program pinning functions,
bpf_program__pin() and bpf_program__unpin()

Signed-off-by: Grant Seltzer <grantseltzer@gmail.com>
---
 tools/lib/bpf/libbpf.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Andrii Nakryiko Dec. 13, 2021, 9:56 p.m. UTC | #1
On Thu, Dec 9, 2021 at 3:23 PM grantseltzer <grantseltzer@gmail.com> wrote:
>
> From: Grant Seltzer <grantseltzer@gmail.com>
>
> This adds doc comments for the two bpf_program pinning functions,
> bpf_program__pin() and bpf_program__unpin()
>
> Signed-off-by: Grant Seltzer <grantseltzer@gmail.com>
> ---

Applied to bpf-next with few minor tweaks. Thanks.

>  tools/lib/bpf/libbpf.h | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> index 4802c1e73..d6518f30a 100644
> --- a/tools/lib/bpf/libbpf.h
> +++ b/tools/lib/bpf/libbpf.h
> @@ -299,7 +299,31 @@ LIBBPF_DEPRECATED_SINCE(0, 7, "multi-instance bpf_program support is deprecated"
>  LIBBPF_API int bpf_program__unpin_instance(struct bpf_program *prog,
>                                            const char *path,
>                                            int instance);
> +
> +/**
> + * @brief **bpf_program__pin()** pins the BPF program to a file
> + * in the BPFFS specified by a path. This increments the programs
> + * reference count, allowing it to stay loaded after the process
> + * which loaded it has exited.
> + *
> + * @param prog BPF program to pin, must already be loaded
> + * @param path filepath in a BPF Filesystem
> + * @return int error code, 0 if no error (errno is also set to error)
> + */
>  LIBBPF_API int bpf_program__pin(struct bpf_program *prog, const char *path);
> +
> +/**
> + * @brief **bpf_program__unpin()** unpins the BPF program from a file
> + * in the BPFFS specified by a path. This decrements the programs
> + * reference count.
> + *
> + * The file pinning the BPF program can also be unlinked by a different
> + * process in which case this function will return an error
> + *
> + * @param prog BPF program to unpin
> + * @param path filepath to the pin in a BPF Filesystem
> + * @return int error code, 0 if no error (errno is also set to error)
> + */
>  LIBBPF_API int bpf_program__unpin(struct bpf_program *prog, const char *path);
>  LIBBPF_API void bpf_program__unload(struct bpf_program *prog);
>
> --
> 2.33.1
>
diff mbox series

Patch

diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index 4802c1e73..d6518f30a 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -299,7 +299,31 @@  LIBBPF_DEPRECATED_SINCE(0, 7, "multi-instance bpf_program support is deprecated"
 LIBBPF_API int bpf_program__unpin_instance(struct bpf_program *prog,
 					   const char *path,
 					   int instance);
+
+/**
+ * @brief **bpf_program__pin()** pins the BPF program to a file
+ * in the BPFFS specified by a path. This increments the programs
+ * reference count, allowing it to stay loaded after the process
+ * which loaded it has exited.
+ *
+ * @param prog BPF program to pin, must already be loaded
+ * @param path filepath in a BPF Filesystem
+ * @return int error code, 0 if no error (errno is also set to error)
+ */
 LIBBPF_API int bpf_program__pin(struct bpf_program *prog, const char *path);
+
+/**
+ * @brief **bpf_program__unpin()** unpins the BPF program from a file
+ * in the BPFFS specified by a path. This decrements the programs
+ * reference count.
+ *
+ * The file pinning the BPF program can also be unlinked by a different
+ * process in which case this function will return an error
+ *
+ * @param prog BPF program to unpin
+ * @param path filepath to the pin in a BPF Filesystem
+ * @return int error code, 0 if no error (errno is also set to error)
+ */
 LIBBPF_API int bpf_program__unpin(struct bpf_program *prog, const char *path);
 LIBBPF_API void bpf_program__unload(struct bpf_program *prog);