From c66f5c6bc1f6a3ca2d6959e1be5f7896e5ab6876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Tue, 14 Jan 2020 01:44:33 -0800 Subject: [PATCH] libbpf_android/BpfUtils - remove unused bpfProgLoad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (due to switch to bpfloader from loading via netd) Test: build, atest Signed-off-by: Maciej Żenczykowski Change-Id: Ic95cdfde26b8e7b905551a7fd2b465e0cf99bbce --- libbpf_android/BpfUtils.cpp | 24 ------------------------ libbpf_android/include/bpf/BpfUtils.h | 2 -- 2 files changed, 26 deletions(-) diff --git a/libbpf_android/BpfUtils.cpp b/libbpf_android/BpfUtils.cpp index df8c901..32b4120 100644 --- a/libbpf_android/BpfUtils.cpp +++ b/libbpf_android/BpfUtils.cpp @@ -125,30 +125,6 @@ int getFirstMapKey(const base::unique_fd& map_fd, void* firstKey) { return bpf(BPF_MAP_GET_NEXT_KEY, Slice(&attr, sizeof(attr))); } -int bpfProgLoad(bpf_prog_type prog_type, Slice bpf_insns, const char* license, - uint32_t kern_version, Slice bpf_log) { - bpf_attr attr; - memset(&attr, 0, sizeof(attr)); - attr.prog_type = prog_type; - attr.insns = ptr_to_u64(bpf_insns.base()); - attr.insn_cnt = bpf_insns.size() / sizeof(struct bpf_insn); - attr.license = ptr_to_u64((void*)license); - attr.log_buf = ptr_to_u64(bpf_log.base()); - attr.log_size = bpf_log.size(); - attr.log_level = DEFAULT_LOG_LEVEL; - attr.kern_version = kern_version; - int ret = bpf(BPF_PROG_LOAD, Slice(&attr, sizeof(attr))); - - if (ret < 0) { - std::string prog_log = netdutils::toString(bpf_log); - std::istringstream iss(prog_log); - for (std::string line; std::getline(iss, line);) { - ALOGE("%s", line.c_str()); - } - } - return ret; -} - int bpfFdPin(const base::unique_fd& map_fd, const char* pathname) { bpf_attr attr; memset(&attr, 0, sizeof(attr)); diff --git a/libbpf_android/include/bpf/BpfUtils.h b/libbpf_android/include/bpf/BpfUtils.h index 7afdb5b..f2b2c84 100644 --- a/libbpf_android/include/bpf/BpfUtils.h +++ b/libbpf_android/include/bpf/BpfUtils.h @@ -106,8 +106,6 @@ int findMapEntry(const base::unique_fd& map_fd, void* key, void* value); int deleteMapEntry(const base::unique_fd& map_fd, void* key); int getNextMapKey(const base::unique_fd& map_fd, void* key, void* next_key); int getFirstMapKey(const base::unique_fd& map_fd, void* firstKey); -int bpfProgLoad(bpf_prog_type prog_type, netdutils::Slice bpf_insns, const char* license, - uint32_t kern_version, netdutils::Slice bpf_log); int bpfFdPin(const base::unique_fd& map_fd, const char* pathname); int bpfFdGet(const char* pathname, uint32_t flags); int attachProgram(bpf_attach_type type, uint32_t prog_fd, uint32_t cg_fd);