aya: add Program::name() and make ::prog_type() public

This commit is contained in:
Alessandro Decina
2021-02-24 06:32:07 +00:00
parent 0199e4b297
commit 286e117fe0
+5 -1
View File
@@ -94,7 +94,7 @@ impl Program {
load_program(self.prog_type(), self.data_mut())
}
fn prog_type(&self) -> bpf_prog_type {
pub fn prog_type(&self) -> bpf_prog_type {
use crate::generated::bpf_prog_type::*;
match self {
Program::KProbe(_) => BPF_PROG_TYPE_KPROBE,
@@ -124,6 +124,10 @@ impl Program {
Program::Xdp(p) => &mut p.data,
}
}
pub fn name(&self) -> &str {
&self.data().name
}
}
#[derive(Debug)]