Skip to contentSkip to conversation

libbpf: Add doc comments for bpf_program__(un)pin()

PATCH Applied grantseltzer 2 participants 2 messages Dec 9, 2021 – Dec 13, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbpf: Add doc comments for bpf_program__(un)pin()

From: Grant Seltzer <[email protected]>

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

---
 tools/lib/bpf/libbpf.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
tools/lib/bpf/libbpf.h +24 -0
index 4802c1e73..d6518f30a 100644
@@ -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);
 
Signature · 1 line
2.33.1
#1 lore raw
Quoted 8 lines · grantseltzer

From: Grant Seltzer <[email protected]>

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

---

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

Quoted 42 lines
 tools/lib/bpf/libbpf.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
tools/lib/bpf/libbpf.h +24 -1
index 4802c1e73..d6518f30a 100644
@@ -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