@ -242,7 +242,7 @@ impl<'a> EbpfLoader<'a> {
self
self
}
}
/// Sets the value of a global variable.
/// Override the value of a global variable.
///
///
/// If the `must_exist` argument is `true`, [`EbpfLoader::load`] will fail with [`ParseError::SymbolNotFound`] if the loaded object code does not contain the variable.
/// If the `must_exist` argument is `true`, [`EbpfLoader::load`] will fail with [`ParseError::SymbolNotFound`] if the loaded object code does not contain the variable.
///
///
@ -275,13 +275,13 @@ impl<'a> EbpfLoader<'a> {
/// use aya::EbpfLoader;
/// use aya::EbpfLoader;
///
///
/// let bpf = EbpfLoader::new()
/// let bpf = EbpfLoader::new()
/// . set _global("VERSION", &2, true)
/// . override _global("VERSION", &2, true)
/// . set _global("PIDS", &[1234u16, 5678], true)
/// . override _global("PIDS", &[1234u16, 5678], true)
/// .load_file("file.o")?;
/// .load_file("file.o")?;
/// # Ok::<(), aya::EbpfError>(())
/// # Ok::<(), aya::EbpfError>(())
/// ```
/// ```
///
///
pub fn set _global< T : Into < GlobalData < ' a > > > (
pub fn override _global< T : Into < GlobalData < ' a > > > (
& mut self ,
& mut self ,
name : & ' a str ,
name : & ' a str ,
value : T ,
value : T ,
@ -291,6 +291,12 @@ impl<'a> EbpfLoader<'a> {
self
self
}
}
/// Override the value of a global variable.
#[ deprecated(since = " 0.13.2 " , note = " please use `override_global` instead " ) ]
pub fn set_global < T : Into < GlobalData < ' a > > > ( & mut self , name : & ' a str , value : T ) -> & mut Self {
self . override_global ( name , value , false )
}
/// Set the max_entries for specified map.
/// Set the max_entries for specified map.
///
///
/// Overwrite the value of max_entries of the map that matches
/// Overwrite the value of max_entries of the map that matches
@ -302,16 +308,22 @@ impl<'a> EbpfLoader<'a> {
/// use aya::EbpfLoader;
/// use aya::EbpfLoader;
///
///
/// let bpf = EbpfLoader::new()
/// let bpf = EbpfLoader::new()
/// . set _max_entries("map", 64)
/// . map _max_entries("map", 64)
/// .load_file("file.o")?;
/// .load_file("file.o")?;
/// # Ok::<(), aya::EbpfError>(())
/// # Ok::<(), aya::EbpfError>(())
/// ```
/// ```
///
///
pub fn set _max_entries( & mut self , name : & ' a str , size : u32 ) -> & mut Self {
pub fn map _max_entries( & mut self , name : & ' a str , size : u32 ) -> & mut Self {
self . max_entries . insert ( name , size ) ;
self . max_entries . insert ( name , size ) ;
self
self
}
}
/// Set the max_entries for specified map.
#[ deprecated(since = " 0.13.2 " , note = " please use `map_max_entries` instead " ) ]
pub fn set_max_entries ( & mut self , name : & ' a str , size : u32 ) -> & mut Self {
self . map_max_entries ( name , size )
}
/// Set the pin path for the map that matches the provided name.
/// Set the pin path for the map that matches the provided name.
///
///
/// Note that this is an absolute path to the pinned map; it is not a prefix
/// Note that this is an absolute path to the pinned map; it is not a prefix
@ -1189,7 +1201,7 @@ fn load_btf(
/// Global data that can be exported to eBPF programs before they are loaded.
/// Global data that can be exported to eBPF programs before they are loaded.
///
///
/// Valid global data includes `Pod` types and slices of `Pod` types. See also
/// Valid global data includes `Pod` types and slices of `Pod` types. See also
/// [EbpfLoader:: set _global].
/// [EbpfLoader:: override _global].
pub struct GlobalData < ' a > {
pub struct GlobalData < ' a > {
bytes : & ' a [ u8 ] ,
bytes : & ' a [ u8 ] ,
}
}