qmonnet / rbpf

Rust virtual machine and JIT compiler for eBPF programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide Helper function type

jackcmay opened this issue · comments

I liked the type you declared for a verifier:

pub type Verifier = fn(prog: &[u8]) -> Result<(), Error>;
Do you think it would be worth doing the same for the helpers? So that instead of:

pub fn register_helper(&mut self,
key: u32,
function: fn (u64, u64, u64, u64, u64) -> u64)
-> Result<(), Error>
... we'd have something like:

pub fn register_helper(&mut self,
key: u32,
function: Helper) -> Result<(), Error>
(EbpfHelper or Helper, I don't really know what sounds best. Maybe just Helper if people call that with the rbpf:: prefix already?)

Fixed in #44