Browse Source

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

Alessandro Decina 4 years ago
parent
commit
286e117fe0
1 changed files with 5 additions and 1 deletions
  1. 5 1
      aya/src/programs/mod.rs

+ 5 - 1
aya/src/programs/mod.rs

@@ -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)]