Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Furisto committed Oct 8, 2021
1 parent 9ad6c36 commit 620ef5f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
12 changes: 9 additions & 3 deletions src/rootfs/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ use super::{
use crate::syscall::{syscall::create_syscall, Syscall};
use crate::utils::PathBufExt;
use anyhow::{bail, Context, Result};
use cgroups::common::{CgroupSetup::{Hybrid, Legacy, Unified}, DEFAULT_CGROUP_ROOT};
use cgroups::common::{
CgroupSetup::{Hybrid, Legacy, Unified},
DEFAULT_CGROUP_ROOT,
};
use nix::{errno::Errno, mount::MsFlags};
use oci_spec::runtime::{Mount as SpecMount, MountBuilder as SpecMountBuilder};
use procfs::process::{MountOptFields, Process};
use std::{collections::HashMap, fs::{canonicalize, create_dir_all, OpenOptions}};
use std::path::{Path, PathBuf};
use std::borrow::Cow;
use std::path::{Path, PathBuf};
use std::{
collections::HashMap,
fs::{canonicalize, create_dir_all, OpenOptions},
};

#[derive(Debug)]
pub struct MountOptions<'a> {
Expand Down
17 changes: 9 additions & 8 deletions src/rootfs/symlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ impl Default for Symlink {

impl Symlink {
pub fn new() -> Symlink {
Symlink::with_syscall(create_syscall())
Symlink::with_syscall(create_syscall())
}

fn with_syscall(syscall: Box<dyn Syscall>) -> Symlink {
Symlink {
syscall,
}
Symlink { syscall }
}

// Create symlinks for subsystems that have been comounted e.g. cpu -> cpu,cpuacct, cpuacct -> cpu,cpuacct
Expand Down Expand Up @@ -86,8 +84,8 @@ impl Symlink {
mod tests {
use super::*;
use crate::syscall::linux::LinuxSyscall;
use crate::{syscall::test::TestHelperSyscall, utils::create_temp_dir};
use crate::utils::TempDir;
use crate::{syscall::test::TestHelperSyscall, utils::create_temp_dir};
use nix::{
fcntl::{open, OFlag},
sys::stat::Mode,
Expand Down Expand Up @@ -178,7 +176,9 @@ mod tests {
let symlink = Symlink::with_syscall(Box::new(LinuxSyscall));

// act
symlink.setup_comount_symlinks(&tmp, "cpu,cpuacct").context("failed to setup symlinks")?;
symlink
.setup_comount_symlinks(&tmp, "cpu,cpuacct")
.context("failed to setup symlinks")?;

// assert
assert!(cpu.exists(), "cpu symlink does not exist");
Expand Down Expand Up @@ -214,8 +214,9 @@ mod tests {
let symlink = Symlink::with_syscall(Box::new(LinuxSyscall));

// act
let result =
symlink.setup_comount_symlinks(&tmp, "memory,task").context("failed to setup symlinks");
let result = symlink
.setup_comount_symlinks(&tmp, "memory,task")
.context("failed to setup symlinks");

// assert
assert!(result.is_ok());
Expand Down

0 comments on commit 620ef5f

Please sign in to comment.