Skip to content

Commit

Permalink
mounts: Use a more sensible field name for Mounts
Browse files Browse the repository at this point in the history
vec is...weird.

Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
Samuel Ortiz authored and sameo committed Apr 13, 2022
1 parent 52e5476 commit cdce0eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions container/src/mounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ struct Mount {

#[derive(Clone)]
pub struct Mounts {
vec: Vec<Mount>,
mounts: Vec<Mount>,
}

impl Mounts {
/// Apply some mounts.
/// This method should be called before the container process execution in order to prepare
/// & mount every mounts defined for it.
pub fn apply(&self) -> Result<(), std::io::Error> {
for mount in &self.vec {
for mount in &self.mounts {
if let Some(code) = Command::new("mount")
.args(["-t", &mount.typ, &mount.source, &mount.destination])
.status()?
Expand All @@ -37,7 +37,7 @@ impl Mounts {
/// Cleanup the mounts of a rootfs.
/// This method should be called when a container has ended, to clean up the FS.
pub fn cleanup(&self, rootfs: PathBuf) -> Result<(), crate::Error> {
for mount in &self.vec {
for mount in &self.mounts {
let mut path = rootfs.clone();
path.push(&mount.source);

Expand All @@ -64,7 +64,7 @@ impl Default for Mounts {
/// Based on the OCI Specification
fn default() -> Self {
Mounts {
vec: vec![
mounts: vec![
Mount {
typ: String::from("devtmpfs"),
source: String::from("dev"),
Expand Down

0 comments on commit cdce0eb

Please sign in to comment.