Update Loader.cpp for updated bcc

bpf_create_map and bpf_prog_load have been renamed, so update those
calls. bcc now depends on upstream libbpf and has deleted its
redundant implementations of bpf_obj_pin and bpf_obj_get, so add
upstream libbpf as a dependency.

Test: m libbpf_android
Bug: 203823368
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I324cab44227b0e2f73873f37a28d640ab2373204
This commit is contained in:
Connor O'Brien 2022-01-11 18:38:15 -08:00
commit 52863b6ba6
2 changed files with 4 additions and 2 deletions

View file

@ -59,6 +59,7 @@ cc_library {
"libutils",
"liblog",
"libbpf_bcc",
"libbpf_minimal",
],
header_libs: [
"bpf_headers",
@ -95,6 +96,7 @@ cc_test {
shared_libs: [
"libbpf_android",
"libbpf_bcc",
"libbpf_minimal",
"libbase",
"liblog",
"libutils",

View file

@ -575,7 +575,7 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
// programs as being 5.4+...
type = BPF_MAP_TYPE_HASH;
}
fd.reset(bpf_create_map(type, mapNames[i].c_str(), md[i].key_size, md[i].value_size,
fd.reset(bcc_create_map(type, mapNames[i].c_str(), md[i].key_size, md[i].value_size,
md[i].max_entries, md[i].map_flags));
saved_errno = errno;
ALOGD("bpf_create_map name %s, ret: %d\n", mapNames[i].c_str(), fd.get());
@ -724,7 +724,7 @@ static int loadCodeSections(const char* elfPath, vector<codeSection>& cs, const
} else {
vector<char> log_buf(BPF_LOAD_LOG_SZ, 0);
fd = bpf_prog_load(cs[i].type, name.c_str(), (struct bpf_insn*)cs[i].data.data(),
fd = bcc_prog_load(cs[i].type, name.c_str(), (struct bpf_insn*)cs[i].data.data(),
cs[i].data.size(), license.c_str(), kvers, 0, log_buf.data(),
log_buf.size());
ALOGD("bpf_prog_load lib call for %s (%s) returned fd: %d (%s)\n", elfPath,