> diff --git a/tools/bpf/bpftool/Documentation/bpftool-map.rst
> b/tools/bpf/bpftool/Documentation/bpftool-map.rst
> index 5daf3de5c744..375321d55823 100644
> --- a/tools/bpf/bpftool/Documentation/bpftool-map.rst
> +++ b/tools/bpf/bpftool/Documentation/bpftool-map.rst
> @@ -76,9 +76,16 @@ bpftool map { show | list } [*MAP*]
> bpftool map create *FILE* type *TYPE* key *KEY_SIZE* value *VALUE_SIZE*
> entries *MAX_ENTRIES* name *NAME* [flags *FLAGS*] [inner_map *MAP*]
> [offload_dev *NAME*]
> Create a new map with given parameters and pin it to *bpffs* as *FILE*.
>
> - *FLAGS* should be an integer which is the combination of desired flags,
> - e.g. 1024 for **BPF_F_MMAPABLE** (see bpf.h UAPI header for existing
> - flags).
> + *FLAGS* accepts an unsigned 32-bit integer combining the desired flags
> + (decimal, hexadecimal with a **0x** prefix, or octal with a **0**
> prefix),
> + or a comma-separated list of full, case-sensitive map creation flag names
> + from the bpf.h UAPI header. For example, **1024**, **0x400**, and
> + **BPF_F_MMAPABLE** are equivalent. Multiple names are combined with
> + bitwise OR, for example **BPF_F_NO_PREALLOC,BPF_F_RDONLY_PROG**.
> + Repeated names are allowed. Empty list elements, abbreviated names, and
> + lists mixing numbers with names are not accepted. Use **0** for no flags.
> + Numeric values can include bits unknown to bpftool. The kernel checks
> + whether the flags are valid for the requested map type.
[ ... ]
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index 684a8fb72414..4445014247d6 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
[ ... ]
> @@ -1474,6 +1554,7 @@ static int do_help(int argc, char **argv)
> " DATA := { [hex] BYTES }\n"
> " " HELP_SPEC_PROGRAM "\n"
> " VALUE := { DATA | MAP | PROG }\n"
> + " FLAGS := { integer | BPF_F_NAME[,BPF_F_NAME...] }\n"
> " UPDATE_FLAGS := { any | exist | noexist }\n"
> " TYPE := { hash | array | prog_array | perf_event_array
> | percpu_hash |\n"
> " percpu_array | stack_trace | cgroup_array |
> lru_hash |\n"
The help text gained a FLAGS metavariable production, but the man page
synopsis did not. Looking at bpftool-map.rst, the synopsis section lists
metavariable productions like:
| *MAP* := { ... }
| *DATA* := { [**hex**] *BYTES* }
| *PROG* := { ... }
| *VALUE* := { *DATA* | *MAP* | *PROG* }
| *UPDATE_FLAGS* := { **any** | **exist** | **noexist** }
| *TYPE* := { **hash** | ... }
Should there be a corresponding line for FLAGS in the synopsis? Before
this patch, every metavariable in the map.c help block had a matching
production in the rst synopsis. The FLAGS metavariable is now the only
one that appears in the help text but not in the synopsis.
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/34075962636