qmonnet / rbpf

Rust virtual machine and JIT compiler for eBPF programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Define a type for the eBPF helper functions

qmonnet opened this issue · comments

So we declare a type for a verifier function:

pub type Verifier = fn(prog: &[u8]) -> Result<(), Error>;

Would be nice to have 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?)

From discussion on #32.

@jackcmay ooh you beat me to it by a few seconds :/ I'm marking this one as a duplicate of #41.