lsm: update program.load() to use new signature with &Btf

pull/15/head
William Findlay 3 years ago
parent a9c18a96cc
commit 7908e8593d
No known key found for this signature in database
GPG Key ID: 7162B44E9E560373

@ -19,7 +19,7 @@ use aya::programs::{CgroupSkb, CgroupSkbAttachType};
{%- when "tracepoint" -%} {%- when "tracepoint" -%}
use aya::programs::TracePoint; use aya::programs::TracePoint;
{%- when "lsm" -%} {%- when "lsm" -%}
use aya::programs::Lsm; use aya::{programs::Lsm, Btf};
{%- endcase %} {%- endcase %}
use std::{ use std::{
convert::{TryFrom,TryInto}, convert::{TryFrom,TryInto},
@ -94,8 +94,9 @@ fn try_main() -> Result<(), anyhow::Error> {
program.load()?; program.load()?;
program.attach("{{tracepoint_category}}", "{{tracepoint_name}}")?; program.attach("{{tracepoint_category}}", "{{tracepoint_name}}")?;
{%- when "lsm" -%} {%- when "lsm" -%}
let btf = Btf::from_sys_fs()?;
let program: &mut Lsm = bpf.program_mut("{{lsm_hook}}")?.try_into()?; let program: &mut Lsm = bpf.program_mut("{{lsm_hook}}")?.try_into()?;
program.load("{{lsm_hook}}")?; program.load("{{lsm_hook}}", &btf)?;
program.attach()?; program.attach()?;
{%- endcase %} {%- endcase %}

Loading…
Cancel
Save