pull/545/head
epompeii 2 years ago
parent b13070a342
commit 6a25d4ddec

@ -231,6 +231,7 @@ pub enum ProgramSection {
},
Lsm {
name: String,
sleepable_supported: bool,
},
BtfTracePoint {
name: String,
@ -281,7 +282,7 @@ impl ProgramSection {
ProgramSection::LircMode2 { name } => name,
ProgramSection::PerfEvent { name } => name,
ProgramSection::RawTracePoint { name } => name,
ProgramSection::Lsm { name } => name,
ProgramSection::Lsm { name, .. } => name,
ProgramSection::BtfTracePoint { name } => name,
ProgramSection::FEntry { name } => name,
ProgramSection::FExit { name } => name,
@ -472,7 +473,14 @@ impl FromStr for ProgramSection {
"lirc_mode2" => LircMode2 { name },
"perf_event" => PerfEvent { name },
"raw_tp" | "raw_tracepoint" => RawTracePoint { name },
"lsm" => Lsm { name },
"lsm" => Lsm {
name,
sleepable_supported: false,
},
"lsm.s+" => Lsm {
name,
sleepable_supported: true,
},
"fentry" => FEntry { name },
"fexit" => FExit { name },
"freplace" => Extension { name },
@ -1926,6 +1934,30 @@ mod tests {
);
}
#[test]
fn test_parse_section_lsm_sleepable() {
let mut obj = fake_obj();
assert_matches!(
obj.parse_section(fake_section(
BpfSectionKind::Program,
"lsm.s+/foo",
bytes_of(&fake_ins())
)),
Ok(())
);
assert_matches!(
obj.programs.get("foo"),
Some(Program {
section: ProgramSection::Lsm {
sleepable_supported: true,
..
},
..
})
);
}
#[test]
fn test_parse_section_btf_tracepoint() {
let mut obj = fake_obj();

Loading…
Cancel
Save