[PATCH v3 0/2] Print map ID on successful creation

From: Harshit Mogalapalli
Date: Sat Nov 01 2025 - 15:35:05 EST


Hi all,

I have tried looking at an issue from the bpftool repository:
https://github.com/libbpf/bpftool/issues/121 and this patch series
tries to add that enhancement.

Summary: Currently when a map creation is successful there is no message
on the terminal, printing IDs on successful creation of maps can help
notify the user and can be used in CI/CD.

The first patch adds the logic for printing and the second patch adds a
simple selftest for the same.

Thank you very much.

V1 --> V2: PATCH 1 updated [Thanks Yonghong for suggesting better way of
error handling with a new label for close(fd); instead of calling
multiple times]

V2 --> V3: Thanks to Quentin.
PATCH1: drop \n in p_err statement
PATCH2: Remove messages in cases of successful ID printing. Also
remove message with a "FAIL:" prefix to make it more consistent.

Regards,
Harshit


Harshit Mogalapalli (2):
bpftool: Print map ID upon creation and support JSON output
selftests/bpf: Add test for bpftool map ID printing

tools/bpf/bpftool/map.c | 21 +++++++++---
.../testing/selftests/bpf/test_bpftool_map.sh | 32 +++++++++++++++++++
2 files changed, 49 insertions(+), 4 deletions(-)

--
2.50.1