diff --git a/libbpf-rs/CHANGELOG.md b/libbpf-rs/CHANGELOG.md index 45cfeb5e..6c645de3 100644 --- a/libbpf-rs/CHANGELOG.md +++ b/libbpf-rs/CHANGELOG.md @@ -4,7 +4,7 @@ Unreleased - Deprecated `Program::get_id_by_fd` - Renamed `Program::get_fd_by_id` to `fd_from_id` - Deprecated `Program::get_fd_by_id` -- Adjusted various `Program::attach_*` methods to work on shared +- Adjusted `Program::{attach_*, test_run}` methods to work on shared receivers - Adjusted `PerfBufferBuilder` to work with `MapCore` objects diff --git a/libbpf-rs/src/program.rs b/libbpf-rs/src/program.rs index 62f92432..fba9657a 100644 --- a/libbpf-rs/src/program.rs +++ b/libbpf-rs/src/program.rs @@ -1101,7 +1101,7 @@ impl<'obj> ProgramMut<'obj> { /// This function uses the /// [BPF_PROG_RUN](https://www.kernel.org/doc/html/latest/bpf/bpf_prog_run.html) /// facility. - pub fn test_run<'dat>(&mut self, input: Input<'dat>) -> Result> { + pub fn test_run<'dat>(&self, input: Input<'dat>) -> Result> { unsafe fn slice_from_array<'t, T>(items: *mut T, num_items: usize) -> Option<&'t mut [T]> { if items.is_null() { None diff --git a/libbpf-rs/tests/test.rs b/libbpf-rs/tests/test.rs index 91389a6a..798c50d2 100644 --- a/libbpf-rs/tests/test.rs +++ b/libbpf-rs/tests/test.rs @@ -2027,7 +2027,7 @@ fn test_run_prog_success() { bump_rlimit_mlock(); let mut obj = get_test_object("run_prog.bpf.o"); - let mut prog = get_prog_mut(&mut obj, "test_1"); + let prog = get_prog_mut(&mut obj, "test_1"); #[repr(C)] struct bpf_dummy_ops_state { @@ -2054,7 +2054,7 @@ fn test_run_prog_fail() { bump_rlimit_mlock(); let mut obj = get_test_object("run_prog.bpf.o"); - let mut prog = get_prog_mut(&mut obj, "test_2"); + let prog = get_prog_mut(&mut obj, "test_2"); let input = ProgramInput::default(); let _err = prog.test_run(input).unwrap_err();