From 7c781b0b3c3222fc3d832777adec79b305ea98cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Thu, 27 Feb 2025 14:22:35 -0800 Subject: [PATCH] bpf_map_def: undo incorrect comment change. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a *partial* NOOP revert of: 'bpf: support BPF_F_NO_PREALLOC in bpf_map_def.h' https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3457780 The comment is simply wrong, the negativeness is hidden by the map declaration macros and thus never makes it into the max_entries field of bpf_map_def struct. A negative value passed to the map creation macros will store the absolute value in max_entries, and set the BPF_F_NO_PREALLOC flag in map_flags. A negative / excessively large max_entries field will (presumably) fail during map creation due to lack of ram. Bug: 399549732 Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: I86951605cb1397c512c484c84e9d67a85b992b07 --- bpf/headers/include/bpf_map_def.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpf/headers/include/bpf_map_def.h b/bpf/headers/include/bpf_map_def.h index e95ca5fbad..2e5afca97b 100644 --- a/bpf/headers/include/bpf_map_def.h +++ b/bpf/headers/include/bpf_map_def.h @@ -163,7 +163,7 @@ struct bpf_map_def { enum bpf_map_type type; unsigned int key_size; unsigned int value_size; - int max_entries; // negative means BPF_F_NO_PREALLOC, but *might* not work with S + unsigned int max_entries; unsigned int map_flags; // The following are not supported by the Android bpfloader: