BpfInterfaceMapHelper - flag map use as readonly.

This is the case (by code inspection): this map is read/written
by C++ jni code, but only read from java.

Getting rid of the java read (used in test/dump code only afaict)
would be annoying due to needing to return a java String from jni.

As such lets just flag it as R/O, this will allow write-through
caching in jni.

Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iadf0a96f3100d32ea4ffd423b5293c6f2de706cb
This commit is contained in:
Maciej Żenczykowski 2025-08-11 23:34:40 -07:00
commit 52535e446f

View file

@ -57,7 +57,7 @@ public class BpfInterfaceMapHelper {
public IBpfMap<S32, InterfaceMapValue> getInterfaceMap() {
try {
return new BpfMap<>(IFACE_INDEX_NAME_MAP_PATH,
S32.class, InterfaceMapValue.class);
BpfMap.BPF_F_RDONLY, S32.class, InterfaceMapValue.class);
} catch (ErrnoException e) {
Log.e(TAG, "Cannot create interface map: " + e);
return null;