vmm: Limit the visibility of Landlock objects

Limit the visibility of objects and methods introduced by Landlock
implementation.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
This commit is contained in:
Praveen K Paladugu 2024-06-26 15:22:12 +00:00 committed by Liu Wei
parent 457fd9ef96
commit 7f6731cd05
2 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,7 @@ pub enum LandlockError {
// https://docs.rs/landlock/latest/landlock/enum.ABI.html for more info on ABI // https://docs.rs/landlock/latest/landlock/enum.ABI.html for more info on ABI
static ABI: ABI = ABI::V3; static ABI: ABI = ABI::V3;
pub struct LandlockAccess { pub(crate) struct LandlockAccess {
access: BitFlags<AccessFs>, access: BitFlags<AccessFs>,
} }
@ -83,7 +83,7 @@ impl Landlock {
Ok(Landlock { ruleset }) Ok(Landlock { ruleset })
} }
pub fn add_rule( pub(crate) fn add_rule(
&mut self, &mut self,
path: PathBuf, path: PathBuf,
access: BitFlags<AccessFs>, access: BitFlags<AccessFs>,
@ -100,7 +100,7 @@ impl Landlock {
Ok(()) Ok(())
} }
pub fn add_rule_with_access( pub(crate) fn add_rule_with_access(
&mut self, &mut self,
path: PathBuf, path: PathBuf,
access: &str, access: &str,

View File

@ -802,7 +802,7 @@ pub struct VmConfig {
} }
impl VmConfig { impl VmConfig {
pub fn apply_landlock(&self) -> LandlockResult<()> { pub(crate) fn apply_landlock(&self) -> LandlockResult<()> {
let mut landlock = Landlock::new()?; let mut landlock = Landlock::new()?;
if let Some(mem_zones) = &self.memory.zones { if let Some(mem_zones) = &self.memory.zones {