Commit 0a1dc297 authored by Brenden Blanco's avatar Brenden Blanco

Remove some deprecated checks in bpf_module

Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent 00ee4fe8
...@@ -242,9 +242,9 @@ int BPFModule::annotate() { ...@@ -242,9 +242,9 @@ int BPFModule::annotate() {
} }
} }
auto engine = finalize_reader(move(m)); reader_engine_ = finalize_reader(move(m));
if (engine) if (reader_engine_)
engine->finalizeObject(); reader_engine_->finalizeObject();
return 0; return 0;
} }
...@@ -370,8 +370,6 @@ size_t BPFModule::num_tables() const { ...@@ -370,8 +370,6 @@ size_t BPFModule::num_tables() const {
} }
int BPFModule::table_fd(const string &name) const { 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); auto table_it = tables_->find(name);
if (table_it == tables_->end()) return -1; if (table_it == tables_->end()) return -1;
return table_it->second.fd; return table_it->second.fd;
...@@ -415,7 +413,6 @@ size_t BPFModule::table_key_size(size_t id) const { ...@@ -415,7 +413,6 @@ size_t BPFModule::table_key_size(size_t id) const {
return table_key_size(table_names_[id]); return table_key_size(table_names_[id]);
} }
size_t BPFModule::table_key_size(const string &name) const { size_t BPFModule::table_key_size(const string &name) const {
if (b_loader_) return 0;
auto table_it = tables_->find(name); auto table_it = tables_->find(name);
if (table_it == tables_->end()) return 0; if (table_it == tables_->end()) return 0;
return table_it->second.key_size; return table_it->second.key_size;
...@@ -426,7 +423,6 @@ size_t BPFModule::table_leaf_size(size_t id) const { ...@@ -426,7 +423,6 @@ size_t BPFModule::table_leaf_size(size_t id) const {
return table_leaf_size(table_names_[id]); return table_leaf_size(table_names_[id]);
} }
size_t BPFModule::table_leaf_size(const string &name) const { size_t BPFModule::table_leaf_size(const string &name) const {
if (b_loader_) return 0;
auto table_it = tables_->find(name); auto table_it = tables_->find(name);
if (table_it == tables_->end()) return 0; if (table_it == tables_->end()) return 0;
return table_it->second.leaf_size; return table_it->second.leaf_size;
......
...@@ -82,6 +82,7 @@ class BPFModule { ...@@ -82,6 +82,7 @@ class BPFModule {
std::string proto_filename_; std::string proto_filename_;
std::unique_ptr<llvm::LLVMContext> ctx_; std::unique_ptr<llvm::LLVMContext> ctx_;
std::unique_ptr<llvm::ExecutionEngine> engine_; std::unique_ptr<llvm::ExecutionEngine> engine_;
std::unique_ptr<llvm::ExecutionEngine> reader_engine_;
std::unique_ptr<llvm::Module> mod_; std::unique_ptr<llvm::Module> mod_;
std::unique_ptr<BLoader> b_loader_; std::unique_ptr<BLoader> b_loader_;
std::unique_ptr<ClangLoader> clang_loader_; std::unique_ptr<ClangLoader> clang_loader_;
......
...@@ -73,9 +73,4 @@ int BLoader::parse(llvm::Module *mod, const string &filename, const string &prot ...@@ -73,9 +73,4 @@ int BLoader::parse(llvm::Module *mod, const string &filename, const string &prot
return 0; return 0;
} }
int BLoader::get_table_fd(const string &name) const {
if (!codegen_) return -1;
return codegen_->get_table_fd(name);
}
} // namespace ebpf } // namespace ebpf
...@@ -39,7 +39,6 @@ class BLoader { ...@@ -39,7 +39,6 @@ class BLoader {
~BLoader(); ~BLoader();
int parse(llvm::Module *mod, const std::string &filename, const std::string &proto_filename, int parse(llvm::Module *mod, const std::string &filename, const std::string &proto_filename,
std::unique_ptr<std::map<std::string, TableDesc>> *tables); std::unique_ptr<std::map<std::string, TableDesc>> *tables);
int get_table_fd(const std::string &name) const;
private: private:
std::unique_ptr<cc::Parser> parser_; std::unique_ptr<cc::Parser> parser_;
std::unique_ptr<cc::Parser> proto_parser_; std::unique_ptr<cc::Parser> proto_parser_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment