INNER CODE UNIT · Rust
expand_tempfs_file_bytes
openebs/mayastor · io-engine-tests/src/lib.rs:200
pub fn expand_tempfs_file_bytes(path: &str, size: u64) {
let output = Command::new("truncate")
.args(["-s", &format!("+{size}"), path])
.output()
.expect("failed exec truncate");
assert!(output.status.success(), "{:#?}", output);
}
/// Automatically assign a loopdev to path
pub fn setup_loopdev_file(path: &str, sector_size: Option<u64>) -> String {
let log_sec = sector_size.unwrap_or(512);
let output = Command::new("losetup")
.args(["-f", "--show", "-b", &format!("{log_sec}"), path])
.output()
.expect("failed exec losetup");
assert!(output.status.success(), "{:#?}", output);
// return the assigned loop device