blkio: Add support for customized-attributes

Customized attributes are useful for customized kernels

Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
Tim Zhang
2022-09-23 17:43:17 +08:00
parent bd31dc0e7d
commit ed49cf77e2
2 changed files with 16 additions and 1 deletions
+7 -1
View File
@@ -16,7 +16,8 @@ use crate::error::*;
use crate::{read_string_from, read_u64_from};
use crate::{
BlkIoResources, ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem,
BlkIoResources, ControllIdentifier, ControllerInternal, Controllers, CustomizedAttribute,
Resources, Subsystem,
};
/// A controller that allows controlling the `blkio` subsystem of a Cgroup.
@@ -378,6 +379,10 @@ impl ControllerInternal for BlkIoController {
let _ = self.throttle_write_iops_for_device(dev.major, dev.minor, dev.rate);
}
res.attrs.iter().for_each(|(k, v)| {
let _ = self.set(k, v);
});
Ok(())
}
}
@@ -771,6 +776,7 @@ impl BlkIoController {
}
}
impl CustomizedAttribute for BlkIoController {}
#[cfg(test)]
mod test {
use crate::blkio::{parse_blkio_data, BlkIoData};