Commit d7e09730 authored by rickyz's avatar rickyz Committed by Commit bot

sandbox_bpf: Remove Traverse method.

All calls to this were removed in
https://codereview.chromium.org/628823003/.

BUG=414363

Review URL: https://codereview.chromium.org/652123002

Cr-Commit-Position: refs/heads/master@{#299436}
parent f6935316
...@@ -14,31 +14,6 @@ ...@@ -14,31 +14,6 @@
#include "sandbox/linux/seccomp-bpf/instruction.h" #include "sandbox/linux/seccomp-bpf/instruction.h"
#include "sandbox/linux/seccomp-bpf/linux_seccomp.h" #include "sandbox/linux/seccomp-bpf/linux_seccomp.h"
namespace {
// Helper function for Traverse().
void TraverseRecursively(std::set<sandbox::Instruction*>* visited,
sandbox::Instruction* instruction) {
if (visited->find(instruction) == visited->end()) {
visited->insert(instruction);
switch (BPF_CLASS(instruction->code)) {
case BPF_JMP:
if (BPF_OP(instruction->code) != BPF_JA) {
TraverseRecursively(visited, instruction->jf_ptr);
}
TraverseRecursively(visited, instruction->jt_ptr);
break;
case BPF_RET:
break;
default:
TraverseRecursively(visited, instruction->next);
break;
}
}
}
} // namespace
namespace sandbox { namespace sandbox {
CodeGen::CodeGen() : compiled_(false) {} CodeGen::CodeGen() : compiled_(false) {}
...@@ -189,18 +164,6 @@ Instruction* CodeGen::MakeInstruction(uint16_t code, ...@@ -189,18 +164,6 @@ Instruction* CodeGen::MakeInstruction(uint16_t code,
return insn; return insn;
} }
void CodeGen::Traverse(Instruction* instruction,
void (*fnc)(Instruction*, void*),
void* aux) {
std::set<Instruction*> visited;
TraverseRecursively(&visited, instruction);
for (std::set<Instruction*>::const_iterator iter = visited.begin();
iter != visited.end();
++iter) {
fnc(*iter, aux);
}
}
void CodeGen::FindBranchTargets(const Instruction& instructions, void CodeGen::FindBranchTargets(const Instruction& instructions,
BranchTargets* branch_targets) { BranchTargets* branch_targets) {
// Follow all possible paths through the "instructions" graph and compute // Follow all possible paths through the "instructions" graph and compute
......
...@@ -72,14 +72,6 @@ class SANDBOX_EXPORT CodeGen { ...@@ -72,14 +72,6 @@ class SANDBOX_EXPORT CodeGen {
Instruction* jt, Instruction* jt,
Instruction* jf); Instruction* jf);
// Traverse the graph of instructions and visit each instruction once.
// Traversal order is implementation-defined. It is acceptable to make
// changes to the graph from within the callback function. These changes
// do not affect traversal.
// The "fnc" function gets called with both the instruction and the opaque
// "aux" pointer.
void Traverse(Instruction*, void (*fnc)(Instruction*, void* aux), void* aux);
// Compiles the graph of instructions into a BPF program that can be passed // Compiles the graph of instructions into a BPF program that can be passed
// to the kernel. Please note that this function modifies the graph in place // to the kernel. Please note that this function modifies the graph in place
// and must therefore only be called once per graph. // and must therefore only be called once per graph.
......
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