expose readSectionUint() for testing am: c1f8ca3060
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/15212804
Change-Id: I8295ca337517fcf9b95b6f36f7d0da47dcfe765e
diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp
index aa1f3c0..259068a 100644
--- a/libbpf_android/Loader.cpp
+++ b/libbpf_android/Loader.cpp
@@ -210,7 +210,7 @@
return -2;
}
-static unsigned int readSectionUint(const char* name, ifstream& elfFile, unsigned int defVal) {
+unsigned int readSectionUint(const char* name, ifstream& elfFile, unsigned int defVal) {
vector<char> theBytes;
int ret = readSectionByName(name, elfFile, theBytes);
if (ret) {
diff --git a/libbpf_android/include/libbpf_android.h b/libbpf_android/include/libbpf_android.h
index 90c9906..640f35b 100644
--- a/libbpf_android/include/libbpf_android.h
+++ b/libbpf_android/include/libbpf_android.h
@@ -29,6 +29,9 @@
// BPF loader implementation. Loads an eBPF ELF object
int loadProg(const char* elfPath, bool* isCritical, const char* prefix = "");
+// Exposed for testing
+unsigned int readSectionUint(const char* name, std::ifstream& elfFile, unsigned int defVal);
+
// Wait for bpfloader to load BPF programs.
static inline void waitForProgsLoaded() {
// infinite loop until success with 5/10/20/40/60/60/60... delay