INNER CODE UNIT · Rust
fscheck
openebs/mayastor · io-engine-tests/src/lib.rs:288
pub fn fscheck(device: &str) {
let output = Command::new("fsck")
.args([device, "-n"])
.output()
.expect("fsck exec failed");
io::stdout().write_all(&output.stderr).unwrap();
io::stdout().write_all(&output.stdout).unwrap();
assert!(output.status.success(), "{:#?}", output);
}
pub fn mkfs(path: &str, fstype: &str) -> bool {
let (fs, args) = match fstype {
"xfs" => ("mkfs.xfs", vec!["-i", "nrext64=0", "-f", path]),
"ext4" => ("mkfs.ext4", vec!["-F", path]),
_ => {
panic!("unsupported fstype");