Skip to content

Commit

Permalink
create mount_rootfs method
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroyuki Moriya <41197469+Gekko0114@users.noreply.github.com>
  • Loading branch information
Gekko0114 committed Oct 13, 2024
1 parent eaaca64 commit 25efa47
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions crates/libcontainer/src/rootfs/rootfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,14 @@ impl RootFS {
}
}

pub fn prepare_rootfs(
pub fn mount_to_rootfs(
&self,
linux: &Linux,
spec: &Spec,
rootfs: &Path,
bind_devices: bool,
cgroup_ns: bool,
) -> Result<()> {
tracing::debug!(?rootfs, "prepare rootfs");
let mut flags = MsFlags::MS_REC;
let linux = spec.linux().as_ref().ok_or(MissingSpecError::Linux)?;

match linux.rootfs_propagation().as_deref() {
Some("shared") => flags |= MsFlags::MS_SHARED,
Some("private") => flags |= MsFlags::MS_PRIVATE,
Expand Down Expand Up @@ -92,6 +89,20 @@ impl RootFS {
mounter.setup_mount(mount, &global_options)?;
}
}
Ok(())
}

pub fn prepare_rootfs(
&self,
spec: &Spec,
rootfs: &Path,
bind_devices: bool,
cgroup_ns: bool,
) -> Result<()> {
tracing::debug!(?rootfs, "prepare rootfs");
let linux = spec.linux().as_ref().ok_or(MissingSpecError::Linux)?;

let _ = self.mount_to_rootfs(linux, spec, rootfs, cgroup_ns)?;

Check failure on line 105 in crates/libcontainer/src/rootfs/rootfs.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, gnu)

this let-binding has unit value

Check failure on line 105 in crates/libcontainer/src/rootfs/rootfs.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, musl)

this let-binding has unit value

Check failure on line 105 in crates/libcontainer/src/rootfs/rootfs.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, gnu)

this let-binding has unit value

Check failure on line 105 in crates/libcontainer/src/rootfs/rootfs.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, musl)

this let-binding has unit value

let symlinker = Symlink::new();
symlinker.setup_kcore_symlink(rootfs)?;
Expand Down

0 comments on commit 25efa47

Please sign in to comment.