#[derive(Default, Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[derive(Deserialize, Serialize)]
#[serde(default, deny_unknown_fields)]
pub struct GlobalBpfConfiguration
{
pub mount_file_system_for_pinning_objects_if_not_already_mounted: bool,
pub enable_just_in_time_compilation: Option<JustInTimeCompilationChoice>,
pub global_limit_for_memory_allocation: Option<JustInTimeMemoryAllocationLimitSizeInBytes>,
}
impl GlobalBpfConfiguration
{
pub fn configure(&self, sys_path: &SysPath, proc_path: &ProcPath) -> Result<(), GlobalBpfConfigurationError>
{
use self::GlobalBpfConfigurationError::*;
if self.mount_file_system_for_pinning_objects_if_not_already_mounted
{
let mounts = Mounts::parse(proc_path, ProcessIdentifierChoice::Current).map_err(CouldNotParseMounts)?;
let _mount_point = mounts.mount_if_not_mounted::<BpfMountPoint>(sys_path).map_err(CouldNotMount)?;
}
instance_set_value(proc_path, JustInTimeCompilationChoice::set_value, self.enable_just_in_time_compilation, CouldNotChangeJustInTimeCompilation)?;
instance_set_value(proc_path, JustInTimeMemoryAllocationLimitSizeInBytes::set_global_maximum, self.global_limit_for_memory_allocation, CouldNotChangeJustInTimeCompilationMemoryLimit)?;
Ok(())
}
}