diff mbox series

[bpf-next,v1] docs/bpf: Fix sphinx warnings in BPF map docs

Message ID 20221122143933.91321-1-donald.hunter@gmail.com (mailing list archive)
State Accepted
Commit 539886a32a6a4601241d928dc8b776b052c04ed0
Delegated to: BPF
Headers show
Series [bpf-next,v1] docs/bpf: Fix sphinx warnings in BPF map docs | 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: sdf@google.com martin.lau@linux.dev kpsingh@kernel.org haoluo@google.com jolsa@kernel.org song@kernel.org john.fastabend@gmail.com yhs@fb.com
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/check_selftest success No net selftest shell script
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, 239 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-7 success Logs for llvm-toolchain
bpf/vmtest-bpf-next-VM_Test-8 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-5 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-6 success Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-3 success Logs for build for aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-4 success Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-10 success Logs for test_maps on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-12 success Logs for test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-13 success Logs for test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-15 success Logs for test_progs on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-19 success Logs for test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-20 success Logs for test_progs_no_alu32 on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-22 success Logs for test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-23 success Logs for test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-24 success Logs for test_progs_no_alu32_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-25 success Logs for test_progs_no_alu32_parallel on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-27 success Logs for test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-28 success Logs for test_progs_no_alu32_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-29 success Logs for test_progs_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-30 success Logs for test_progs_parallel on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-32 success Logs for test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-33 success Logs for test_progs_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-34 success Logs for test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-35 success Logs for test_verifier on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-37 success Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-38 success Logs for test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-14 success Logs for test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-17 success Logs for test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-18 success Logs for test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-36 success Logs for test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-21 success Logs for test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-26 success Logs for test_progs_no_alu32_parallel on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-31 success Logs for test_progs_parallel on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-16 success Logs for test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-11 success Logs for test_maps on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-2 success Logs for llvm-toolchain

Commit Message

Donald Hunter Nov. 22, 2022, 2:39 p.m. UTC
Fix duplicate C declaration warnings when using sphinx >= 3.1

Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
Reported-by: Akira Yokosawa <akiyks@gmail.com>
Link: https://lore.kernel.org/bpf/ed4dac84-1b12-5c58-e4de-93ab9ac67c09@gmail.com
---
 Documentation/bpf/map_array.rst       | 20 ++++++++++++---
 Documentation/bpf/map_hash.rst        | 33 ++++++++++++++++++++----
 Documentation/bpf/map_lpm_trie.rst    | 24 +++++++++++++++---
 Documentation/bpf/map_of_maps.rst     |  6 ++++-
 Documentation/bpf/map_queue_stack.rst | 36 ++++++++++++++++++++++-----
 5 files changed, 99 insertions(+), 20 deletions(-)

Comments

Akira Yokosawa Nov. 23, 2022, 2:41 a.m. UTC | #1
Hi Donald,

On Tue, 22 Nov 2022 14:39:33 +0000, Donald Hunter wrote:
> Fix duplicate C declaration warnings when using sphinx >= 3.1
> 
> Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
> Reported-by: Akira Yokosawa <akiyks@gmail.com>
> Link: https://lore.kernel.org/bpf/ed4dac84-1b12-5c58-e4de-93ab9ac67c09@gmail.com
> ---
>  Documentation/bpf/map_array.rst       | 20 ++++++++++++---
>  Documentation/bpf/map_hash.rst        | 33 ++++++++++++++++++++----
>  Documentation/bpf/map_lpm_trie.rst    | 24 +++++++++++++++---
>  Documentation/bpf/map_of_maps.rst     |  6 ++++-
>  Documentation/bpf/map_queue_stack.rst | 36 ++++++++++++++++++++++-----
>  5 files changed, 99 insertions(+), 20 deletions(-)

Thank you for taking care of them!

Reviewed-by: Akira Yokosawa <akiyks@gmail.com> # Sphinx >= 3.1
patchwork-bot+netdevbpf@kernel.org Nov. 24, 2022, 12:10 a.m. UTC | #2
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Tue, 22 Nov 2022 14:39:33 +0000 you wrote:
> Fix duplicate C declaration warnings when using sphinx >= 3.1
> 
> Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
> Reported-by: Akira Yokosawa <akiyks@gmail.com>
> Link: https://lore.kernel.org/bpf/ed4dac84-1b12-5c58-e4de-93ab9ac67c09@gmail.com
> ---
>  Documentation/bpf/map_array.rst       | 20 ++++++++++++---
>  Documentation/bpf/map_hash.rst        | 33 ++++++++++++++++++++----
>  Documentation/bpf/map_lpm_trie.rst    | 24 +++++++++++++++---
>  Documentation/bpf/map_of_maps.rst     |  6 ++++-
>  Documentation/bpf/map_queue_stack.rst | 36 ++++++++++++++++++++++-----
>  5 files changed, 99 insertions(+), 20 deletions(-)

Here is the summary with links:
  - [bpf-next,v1] docs/bpf: Fix sphinx warnings in BPF map docs
    https://git.kernel.org/bpf/bpf-next/c/539886a32a6a

You are awesome, thank you!
diff mbox series

Patch

diff --git a/Documentation/bpf/map_array.rst b/Documentation/bpf/map_array.rst
index 97bb80333254..f2f51a53e8ae 100644
--- a/Documentation/bpf/map_array.rst
+++ b/Documentation/bpf/map_array.rst
@@ -32,7 +32,11 @@  Usage
 Kernel BPF
 ----------
 
-.. c:function::
+bpf_map_lookup_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    void *bpf_map_lookup_elem(struct bpf_map *map, const void *key)
 
 Array elements can be retrieved using the ``bpf_map_lookup_elem()`` helper.
@@ -40,7 +44,11 @@  This helper returns a pointer into the array element, so to avoid data races
 with userspace reading the value, the user must use primitives like
 ``__sync_fetch_and_add()`` when updating the value in-place.
 
-.. c:function::
+bpf_map_update_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    long bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags)
 
 Array elements can be updated using the ``bpf_map_update_elem()`` helper.
@@ -53,7 +61,7 @@  To clear an array element, you may use ``bpf_map_update_elem()`` to insert a
 zero value to that index.
 
 Per CPU Array
-~~~~~~~~~~~~~
+-------------
 
 Values stored in ``BPF_MAP_TYPE_ARRAY`` can be accessed by multiple programs
 across different CPUs. To restrict storage to a single CPU, you may use a
@@ -63,7 +71,11 @@  When using a ``BPF_MAP_TYPE_PERCPU_ARRAY`` the ``bpf_map_update_elem()`` and
 ``bpf_map_lookup_elem()`` helpers automatically access the slot for the current
 CPU.
 
-.. c:function::
+bpf_map_lookup_percpu_elem()
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    void *bpf_map_lookup_percpu_elem(struct bpf_map *map, const void *key, u32 cpu)
 
 The ``bpf_map_lookup_percpu_elem()`` helper can be used to lookup the array
diff --git a/Documentation/bpf/map_hash.rst b/Documentation/bpf/map_hash.rst
index e85120878b27..8669426264c6 100644
--- a/Documentation/bpf/map_hash.rst
+++ b/Documentation/bpf/map_hash.rst
@@ -34,7 +34,14 @@  the ``BPF_F_NO_COMMON_LRU`` flag when calling ``bpf_map_create``.
 Usage
 =====
 
-.. c:function::
+Kernel BPF
+----------
+
+bpf_map_update_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    long bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags)
 
 Hash entries can be added or updated using the ``bpf_map_update_elem()``
@@ -49,14 +56,22 @@  parameter can be used to control the update behaviour:
 ``bpf_map_update_elem()`` returns 0 on success, or negative error in
 case of failure.
 
-.. c:function::
+bpf_map_lookup_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    void *bpf_map_lookup_elem(struct bpf_map *map, const void *key)
 
 Hash entries can be retrieved using the ``bpf_map_lookup_elem()``
 helper. This helper returns a pointer to the value associated with
 ``key``, or ``NULL`` if no entry was found.
 
-.. c:function::
+bpf_map_delete_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    long bpf_map_delete_elem(struct bpf_map *map, const void *key)
 
 Hash entries can be deleted using the ``bpf_map_delete_elem()``
@@ -70,7 +85,11 @@  For ``BPF_MAP_TYPE_PERCPU_HASH`` and ``BPF_MAP_TYPE_LRU_PERCPU_HASH``
 the ``bpf_map_update_elem()`` and ``bpf_map_lookup_elem()`` helpers
 automatically access the hash slot for the current CPU.
 
-.. c:function::
+bpf_map_lookup_percpu_elem()
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    void *bpf_map_lookup_percpu_elem(struct bpf_map *map, const void *key, u32 cpu)
 
 The ``bpf_map_lookup_percpu_elem()`` helper can be used to lookup the
@@ -89,7 +108,11 @@  See ``tools/testing/selftests/bpf/progs/test_spin_lock.c``.
 Userspace
 ---------
 
-.. c:function::
+bpf_map_get_next_key()
+~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    int bpf_map_get_next_key(int fd, const void *cur_key, void *next_key)
 
 In userspace, it is possible to iterate through the keys of a hash using
diff --git a/Documentation/bpf/map_lpm_trie.rst b/Documentation/bpf/map_lpm_trie.rst
index 31be1aa7ba2c..74d64a30f500 100644
--- a/Documentation/bpf/map_lpm_trie.rst
+++ b/Documentation/bpf/map_lpm_trie.rst
@@ -35,7 +35,11 @@  Usage
 Kernel BPF
 ----------
 
-.. c:function::
+bpf_map_lookup_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    void *bpf_map_lookup_elem(struct bpf_map *map, const void *key)
 
 The longest prefix entry for a given data value can be found using the
@@ -48,7 +52,11 @@  performing longest prefix lookups. For example, when searching for the
 longest prefix match for an IPv4 address, ``prefixlen`` should be set to
 ``32``.
 
-.. c:function::
+bpf_map_update_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    long bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags)
 
 Prefix entries can be added or updated using the ``bpf_map_update_elem()``
@@ -61,7 +69,11 @@  case of failure.
     The flags parameter must be one of BPF_ANY, BPF_NOEXIST or BPF_EXIST,
     but the value is ignored, giving BPF_ANY semantics.
 
-.. c:function::
+bpf_map_delete_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    long bpf_map_delete_elem(struct bpf_map *map, const void *key)
 
 Prefix entries can be deleted using the ``bpf_map_delete_elem()``
@@ -74,7 +86,11 @@  Userspace
 Access from userspace uses libbpf APIs with the same names as above, with
 the map identified by ``fd``.
 
-.. c:function::
+bpf_map_get_next_key()
+~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    int bpf_map_get_next_key (int fd, const void *cur_key, void *next_key)
 
 A userspace program can iterate through the entries in an LPM trie using
diff --git a/Documentation/bpf/map_of_maps.rst b/Documentation/bpf/map_of_maps.rst
index 07212b9227a9..7b5617c2d017 100644
--- a/Documentation/bpf/map_of_maps.rst
+++ b/Documentation/bpf/map_of_maps.rst
@@ -45,7 +45,11 @@  Usage
 Kernel BPF Helper
 -----------------
 
-.. c:function::
+bpf_map_lookup_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    void *bpf_map_lookup_elem(struct bpf_map *map, const void *key)
 
 Inner maps can be retrieved using the ``bpf_map_lookup_elem()`` helper. This
diff --git a/Documentation/bpf/map_queue_stack.rst b/Documentation/bpf/map_queue_stack.rst
index f20e31a647b9..8d14ed49d6e1 100644
--- a/Documentation/bpf/map_queue_stack.rst
+++ b/Documentation/bpf/map_queue_stack.rst
@@ -28,7 +28,11 @@  Usage
 Kernel BPF
 ----------
 
-.. c:function::
+bpf_map_push_elem()
+~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    long bpf_map_push_elem(struct bpf_map *map, const void *value, u64 flags)
 
 An element ``value`` can be added to a queue or stack using the
@@ -38,14 +42,22 @@  when the queue or stack is full, the oldest element will be removed to
 make room for ``value`` to be added. Returns ``0`` on success, or
 negative error in case of failure.
 
-.. c:function::
+bpf_map_peek_elem()
+~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    long bpf_map_peek_elem(struct bpf_map *map, void *value)
 
 This helper fetches an element ``value`` from a queue or stack without
 removing it. Returns ``0`` on success, or negative error in case of
 failure.
 
-.. c:function::
+bpf_map_pop_elem()
+~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    long bpf_map_pop_elem(struct bpf_map *map, void *value)
 
 This helper removes an element into ``value`` from a queue or
@@ -55,7 +67,11 @@  stack. Returns ``0`` on success, or negative error in case of failure.
 Userspace
 ---------
 
-.. c:function::
+bpf_map_update_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    int bpf_map_update_elem (int fd, const void *key, const void *value, __u64 flags)
 
 A userspace program can push ``value`` onto a queue or stack using libbpf's
@@ -64,7 +80,11 @@  A userspace program can push ``value`` onto a queue or stack using libbpf's
 same semantics as the ``bpf_map_push_elem`` kernel helper. Returns ``0`` on
 success, or negative error in case of failure.
 
-.. c:function::
+bpf_map_lookup_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    int bpf_map_lookup_elem (int fd, const void *key, void *value)
 
 A userspace program can peek at the ``value`` at the head of a queue or stack
@@ -72,7 +92,11 @@  using the libbpf ``bpf_map_lookup_elem`` function. The ``key`` parameter must be
 set to ``NULL``.  Returns ``0`` on success, or negative error in case of
 failure.
 
-.. c:function::
+bpf_map_lookup_and_delete_elem()
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
    int bpf_map_lookup_and_delete_elem (int fd, const void *key, void *value)
 
 A userspace program can pop a ``value`` from the head of a queue or stack using