mirror of
https://github.com/containers/youki
synced 2024-11-24 01:44:17 +01:00
Move Controller impl to controller module
This commit is contained in:
parent
1ab4bc025c
commit
eea3234674
@ -8,10 +8,22 @@ use nix::fcntl::OFlag;
|
||||
use nix::sys::stat::Mode;
|
||||
use oci_spec::{LinuxDevice, LinuxDeviceCgroup, LinuxDeviceType, LinuxResources};
|
||||
|
||||
pub struct Devices {}
|
||||
use crate::v2::controller::Controller;
|
||||
|
||||
const LICENSE: &'static str = &"Apache";
|
||||
|
||||
pub struct Devices {}
|
||||
|
||||
impl Controller for Devices {
|
||||
fn apply(linux_resources: &LinuxResources, cgroup_root: &Path) -> Result<()> {
|
||||
#[cfg(not(feature = "cgroupsv2_devices"))]
|
||||
return Ok(());
|
||||
|
||||
#[cfg(feature = "cgroupsv2_devices")]
|
||||
return controller::Devices::apply(linux_resources, cgroup_root);
|
||||
}
|
||||
}
|
||||
|
||||
impl Devices {
|
||||
pub fn apply(linux_resources: &LinuxResources, cgroup_root: &Path) -> Result<()> {
|
||||
log::debug!("Apply Devices cgroup config");
|
||||
|
@ -1,21 +1,9 @@
|
||||
pub mod bpf;
|
||||
mod controller;
|
||||
pub mod controller;
|
||||
pub mod emulator;
|
||||
pub mod program;
|
||||
|
||||
use crate::v2::controller::Controller;
|
||||
use anyhow::Result;
|
||||
use oci_spec::LinuxResources;
|
||||
use std::path::Path;
|
||||
pub use controller::Devices;
|
||||
|
||||
pub struct Devices {}
|
||||
|
||||
impl Controller for Devices {
|
||||
fn apply(linux_resources: &LinuxResources, cgroup_root: &Path) -> Result<()> {
|
||||
#[cfg(not(feature = "cgroupsv2_devices"))]
|
||||
return Ok(());
|
||||
|
||||
#[cfg(feature = "cgroupsv2_devices")]
|
||||
return controller::Devices::apply(linux_resources, cgroup_root);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user