INNER CODE UNIT · Rust
detach_loopdev
openebs/mayastor · io-engine-tests/src/lib.rs:222
pub fn detach_loopdev(dev: &str) {
let output = Command::new("losetup")
.args(["-d", dev])
.output()
.expect("failed exec losetup");
assert!(output.status.success(), "{:#?}", output);
}
/// Load the `scsi_debug` kernel test-driver module, creating a real (though
/// fully virtual, no backing disk) SCSI block device of the given size.
/// Requires root -- shells out via `sudo`, same assumption CI's own kernel
/// module setup already relies on (see `.github/workflows/unit-int.yml`).
pub fn setup_scsi_debug_device(dev_size_mb: u32) -> String {
let output = Command::new("sudo")
.args([
"modprobe",
"scsi_debug",
&format!("dev_size_mb={dev_size_mb}"),