pub struct EunomiaObjectMeta {
pub export_types: Vec<ExportedTypesStructMeta>,
pub bpf_skel: BpfSkeletonMeta,
pub perf_buffer_pages: usize,
pub perf_buffer_time_ms: usize,
pub poll_timeout_ms: i32,
pub debug_verbose: bool,
pub print_header: bool,
pub enable_multiple_export_types: bool,
}
Expand description
global meta data config
Fields§
§export_types: Vec<ExportedTypesStructMeta>
Export types
bpf_skel: BpfSkeletonMeta
The object skeleton
perf_buffer_pages: usize
perf buffer related config
perf_buffer_time_ms: usize
perf buffer related config
poll_timeout_ms: i32
poll config
debug_verbose: bool
Whether libbpf should print debug info This will only be apply to libbpf when start running
print_header: bool
print config print the types and names of export headers
enable_multiple_export_types: bool
Whether to enable support of multiple export types
If set to false, bpf-loader-rs will keep compatibility to the old version
If set to true, the field export_config
of each map will be used
and the export_types
field will be ignored
Implementations§
Source§impl EunomiaObjectMeta
impl EunomiaObjectMeta
Sourcepub fn build_argument_parser(&self) -> Result<Command>
pub fn build_argument_parser(&self) -> Result<Command>
Build an argument parser use the cmdarg
sections in .rodata/.bss variables.
Each variable in the .bss
or .rodata
sections will be mapped into a command line argument.
If a variable has it’s default value, the default value will be used in the command line parser.
Variables with bool
will have some special cases:
- If the variable has no default values, a switch named
--<NAME>
will be added, indicating to set the value to true or false - If the default value if true, a switch named
--disable-<NAME>
will be added, means set the value to false - If the default value if false, a switch named
--enable-<NAME>
will be added, means to set the value to true.
The first will be used to set the value of the variable to true
, second one will be used to set false
Variables with other types will accept values. But values will be checked in parse_arguments_and_fill_skeleton_variables
, so here the values input in the command line parser will be regarded as strings.
Source§impl EunomiaObjectMeta
impl EunomiaObjectMeta
Sourcepub fn parse_arguments_and_fill_skeleton_variables(
&mut self,
args: &ArgMatches,
on_unpresent: UnpresentVariableAction,
) -> Result<()>
pub fn parse_arguments_and_fill_skeleton_variables( &mut self, args: &ArgMatches, on_unpresent: UnpresentVariableAction, ) -> Result<()>
Parser the values from the command line parser
The clap parser gives us all values as strings, so here will try to parse the strings into the variable’s own types (e.g, string, int, unsigned int). If it fails, Err
will be returned
This function will fill the value
field in the DataSectionVariableMeta
.
If the on_unpresent
behavior is FillWithZero
, in this way if we find a command line argument with no values provided (this situation may only happen if the command line argument was created with no default values, a.k.a the value
field is None
in DataSectionVariableMeta
), the value
field will still be leaved None
. In this way, the section_loader will fill zeros in the corresponding memory areas.
If the on_unpresent
behavior is ReportError
, in this way if we find a command line argument with no values, we’ll report an error.
Trait Implementations§
Source§impl Clone for EunomiaObjectMeta
impl Clone for EunomiaObjectMeta
Source§fn clone(&self) -> EunomiaObjectMeta
fn clone(&self) -> EunomiaObjectMeta
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for EunomiaObjectMeta
impl Debug for EunomiaObjectMeta
Source§impl<'de> Deserialize<'de> for EunomiaObjectMeta
impl<'de> Deserialize<'de> for EunomiaObjectMeta
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for EunomiaObjectMeta
impl PartialEq for EunomiaObjectMeta
Source§impl Serialize for EunomiaObjectMeta
impl Serialize for EunomiaObjectMeta
impl Eq for EunomiaObjectMeta
impl StructuralPartialEq for EunomiaObjectMeta
Auto Trait Implementations§
impl Freeze for EunomiaObjectMeta
impl RefUnwindSafe for EunomiaObjectMeta
impl Send for EunomiaObjectMeta
impl Sync for EunomiaObjectMeta
impl Unpin for EunomiaObjectMeta
impl UnwindSafe for EunomiaObjectMeta
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.