Parcourir la source

aya: ProgramArray: tweak docs

Alessandro Decina il y a 3 ans
Parent
commit
4bde0c54bd
1 fichiers modifiés avec 10 ajouts et 9 suppressions
  1. 10 9
      aya/src/maps/array/program_array.rs

+ 10 - 9
aya/src/maps/array/program_array.rs

@@ -16,30 +16,31 @@ use crate::{
 
 /// An array of eBPF program file descriptors used as a jump table.
 ///
-/// eBPF programs can jump to other programs calling `bpf_tail_call(prog_array, index)`. You can
-/// use [`ProgramArray`] to configure which programs correspond to which jump indexes.
+/// eBPF programs can jump to other programs calling `bpf_tail_call(ctx,
+/// prog_array, index)`. You can use [`ProgramArray`] to configure which
+/// programs correspond to which jump indexes.
 ///
 /// # Example
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[], None)?;
 /// use aya::maps::ProgramArray;
-/// use aya::programs::KProbe;
+/// use aya::programs::CgroupSkb;
 /// use std::convert::{TryFrom, TryInto};
 ///
 /// let mut prog_array = ProgramArray::try_from(bpf.map_mut("JUMP_TABLE")?)?;
-/// let prog_0: &KProbe = bpf.program("example_prog_0")?.try_into()?;
-/// let prog_1: &KProbe = bpf.program("example_prog_1")?.try_into()?;
-/// let prog_2: &KProbe = bpf.program("example_prog_2")?.try_into()?;
+/// let prog_0: &CgroupSkb = bpf.program("example_prog_0")?.try_into()?;
+/// let prog_1: &CgroupSkb = bpf.program("example_prog_1")?.try_into()?;
+/// let prog_2: &CgroupSkb = bpf.program("example_prog_2")?.try_into()?;
 ///
 /// let flags = 0;
 ///
-/// // bpf_tail_call(JUMP_TABLE, 0) will jump to prog_0
+/// // bpf_tail_call(ctx, JUMP_TABLE, 0) will jump to prog_0
 /// prog_array.set(0, prog_0, flags);
 ///
-/// // bpf_tail_call(JUMP_TABLE, 1) will jump to prog_1
+/// // bpf_tail_call(ctx, JUMP_TABLE, 1) will jump to prog_1
 /// prog_array.set(1, prog_1, flags);
 ///
-/// // bpf_tail_call(JUMP_TABLE, 2) will jump to prog_2
+/// // bpf_tail_call(ctx, JUMP_TABLE, 2) will jump to prog_2
 /// prog_array.set(2, prog_2, flags);
 /// # Ok::<(), aya::BpfError>(())
 /// ```