Add comma-separated BPF_F_* names to map create flags while retaining base-0 numeric input, with matching documentation, completion and tests.
Changes in v3: - Expose the parser's existing flag table through feature list_builtins map_create_flags, and use that command for Bash completion. Update the feature help, manual and group completion for the new group. - Explain that when comma is not a word break, Readline replaces the whole word and completion must repeat the already-entered flag prefix. - Give invalid_combination its own comment: the kernel validates combinations of known flags; the preceding all_bits case instead checks that unknown numeric bits are passed through to the kernel. These address the v2 review comments: https://lore.kernel.org/r/693f57c4fee08005c6e67811a2fbc497e95fbb7373154e9ecdb1f9a76afab...@mail.kernel.org https://lore.kernel.org/r/7dbfef853aacc32527a352d59861e86f00b7a1e4634c070e569aed415792b...@mail.kernel.org Validation of v3: - Built bpftool and the focused BPF selftest runner with LLVM 20, alongside the ring-buffer and batch v2 series and recursive dump v3. - All 29 bpftool_map_flags subtests passed in an x86-64 KVM guest running Linux 7.3.0-rc1, with no skips or failures. - Plain, JSON and pretty-JSON list_builtins output contains exactly the 19 names in the parser table. The existing map shorthand still selects map_types. - Real Bash Readline completion checked with default COMP_WORDBREAKS and with comma included: first and subsequent flags remain in one argument; after an explicit space, entries gets its normal trailing space. The new list_builtins group also completes correctly. - Bash syntax, bpftool synchronization checks, diff checks and feature/map manual generation passed. Changes in v2: - Complete list elements without adding a trailing space, so the user can immediately append another comma-separated flag. v2: https://lore.kernel.org/r/[email protected] v1: https://lore.kernel.org/r/[email protected] Request: https://github.com/libbpf/bpftool/issues/57 Tianyi Chen (2): bpftool: Accept symbolic map creation flags selftests/bpf: Cover symbolic bpftool map creation flags .../bpftool/Documentation/bpftool-feature.rst | 10 +- .../bpf/bpftool/Documentation/bpftool-map.rst | 13 ++- tools/bpf/bpftool/bash-completion/bpftool | 22 +++- tools/bpf/bpftool/feature.c | 7 +- tools/bpf/bpftool/main.h | 1 + tools/bpf/bpftool/map.c | 85 ++++++++++++++- .../bpf/prog_tests/bpftool_map_flags.c | 100 ++++++++++++++++++ 7 files changed, 225 insertions(+), 13 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_map_flags.c -- 2.55.0
