-
Notifications
You must be signed in to change notification settings - Fork 333
Open
Labels
Description
From the #6
PS: working on this API I start thinking about this RawBpfCode and VerifiedBpfCode and let myself create needless functionality. And I understood the reason. It is because my code is OOP-like rather then procedural-like as in the other modules. 😄
I start to imagine that we could write chaining code for BPF program in general. For instance:
let bpf_vm = ... // create VM of any type RawBpfCode::new().load(...).push().store(...).push() // or RawBpfCode::parse(...) // or RawBpfCode::from_elf(...) .verify().map(|verified| verified.execute_with(bpf_vm)).err().map(...);and RawBpfCode::parse() can actually use asm_parser functionality to be synched with it.
Taking into account @qmonnet comment:
we already have the “procedural-like” approach that works well, why change it
we can improve procedural API that instead of panic! return Result.
Any thoughts?