expose readSectionUint() for testing

Bug: 190519702
Test: atest bpf_module_test, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Original-Change: https://android-review.googlesource.com/1756850
Merged-In: I772c918d162440de6cc492b2faeafe03340fca11
Change-Id: I772c918d162440de6cc492b2faeafe03340fca11
This commit is contained in:
Maciej Żenczykowski 2021-07-06 10:37:12 +00:00 committed by Maciej Zenczykowski
parent 2a51516a63
commit c1f8ca3060
2 changed files with 4 additions and 1 deletions

View file

@ -210,7 +210,7 @@ static int readSectionByName(const char* name, ifstream& elfFile, vector<char>&
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) {

View file

@ -29,6 +29,9 @@ namespace bpf {
// 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