Lines Matching refs:cs
298 static bool isRelSection(codeSection& cs, string& name) { in isRelSection() argument
302 if (st.type != cs.type) continue; in isRelSection()
388 static int readCodeSections(ifstream& elfFile, vector<codeSection>& cs, size_t sizeOfBpfProgDef) { in readCodeSections() argument
449 cs.push_back(std::move(cs_temp)); in readCodeSections()
606 static void dumpAllCs(vector<codeSection>& cs) { in dumpAllCs() argument
607 for (int i = 0; i < (int)cs.size(); i++) { in dumpAllCs()
608 ALOGE("Dumping cs %d, name %s\n", int(i), cs[i].name.c_str()); in dumpAllCs()
609 dumpIns((char*)cs[i].data.data(), cs[i].data.size()); in dumpAllCs()
639 static void applyMapRelo(ifstream& elfFile, vector<unique_fd> &mapFds, vector<codeSection>& cs) { in applyMapRelo() argument
645 for (int k = 0; k != (int)cs.size(); k++) { in applyMapRelo()
646 Elf64_Rel* rel = (Elf64_Rel*)(cs[k].rel_data.data()); in applyMapRelo()
647 int n_rel = cs[k].rel_data.size() / sizeof(*rel); in applyMapRelo()
659 applyRelo(cs[k].data.data(), rel[i].r_offset, mapFds[j]); in applyMapRelo()
667 static int loadCodeSections(const char* elfPath, vector<codeSection>& cs, const string& license, in loadCodeSections() argument
676 for (int i = 0; i < (int)cs.size(); i++) { in loadCodeSections()
677 string name = cs[i].name; in loadCodeSections()
681 if (cs[i].prog_def.has_value()) { in loadCodeSections()
682 unsigned min_kver = cs[i].prog_def->min_kver; in loadCodeSections()
683 unsigned max_kver = cs[i].prog_def->max_kver; in loadCodeSections()
689 bpfMinVer = cs[i].prog_def->bpfloader_min_ver; in loadCodeSections()
690 bpfMaxVer = cs[i].prog_def->bpfloader_max_ver; in loadCodeSections()
720 fd = bpf_prog_load(cs[i].type, name.c_str(), (struct bpf_insn*)cs[i].data.data(), in loadCodeSections()
721 cs[i].data.size(), license.c_str(), kvers, 0, log_buf.data(), in loadCodeSections()
724 cs[i].name.c_str(), fd, (fd < 0 ? std::strerror(errno) : "no error")); in loadCodeSections()
733 if (cs[i].prog_def->optional) { in loadCodeSections()
747 if (cs[i].prog_def.has_value()) { in loadCodeSections()
748 if (chown(progPinLoc.c_str(), (uid_t)cs[i].prog_def->uid, in loadCodeSections()
749 (gid_t)cs[i].prog_def->gid)) { in loadCodeSections()
756 cs[i].prog_fd.reset(fd); in loadCodeSections()
765 vector<codeSection> cs; in loadProg() local
827 ret = readCodeSections(elfFile, cs, sizeOfBpfProgDef); in loadProg()
834 if (0) dumpAllCs(cs); in loadProg()
845 applyMapRelo(elfFile, mapFds, cs); in loadProg()
847 ret = loadCodeSections(elfPath, cs, string(license.data()), prefix); in loadProg()