}
}
- auto engine = finalize_reader(move(m));
- if (engine)
- engine->finalizeObject();
+ reader_engine_ = finalize_reader(move(m));
+ if (reader_engine_)
+ reader_engine_->finalizeObject();
return 0;
}
}
int BPFModule::table_fd(const string &name) const {
- int fd = b_loader_ ? b_loader_->get_table_fd(name) : -1;
- if (fd >= 0) return fd;
auto table_it = tables_->find(name);
if (table_it == tables_->end()) return -1;
return table_it->second.fd;
return table_key_size(table_names_[id]);
}
size_t BPFModule::table_key_size(const string &name) const {
- if (b_loader_) return 0;
auto table_it = tables_->find(name);
if (table_it == tables_->end()) return 0;
return table_it->second.key_size;
return table_leaf_size(table_names_[id]);
}
size_t BPFModule::table_leaf_size(const string &name) const {
- if (b_loader_) return 0;
auto table_it = tables_->find(name);
if (table_it == tables_->end()) return 0;
return table_it->second.leaf_size;
std::string proto_filename_;
std::unique_ptr<llvm::LLVMContext> ctx_;
std::unique_ptr<llvm::ExecutionEngine> engine_;
+ std::unique_ptr<llvm::ExecutionEngine> reader_engine_;
std::unique_ptr<llvm::Module> mod_;
std::unique_ptr<BLoader> b_loader_;
std::unique_ptr<ClangLoader> clang_loader_;
~BLoader();
int parse(llvm::Module *mod, const std::string &filename, const std::string &proto_filename,
std::unique_ptr<std::map<std::string, TableDesc>> *tables);
- int get_table_fd(const std::string &name) const;
private:
std::unique_ptr<cc::Parser> parser_;
std::unique_ptr<cc::Parser> proto_parser_;