[thin_check (rust)] add --sync-io flag

Makes it easier to switch between engines
This commit is contained in:
Joe Thornber
2020-08-10 11:24:50 +01:00
parent 0f865856ed
commit 4e4b7ca2b1
2 changed files with 31 additions and 5 deletions

View File

@ -5,6 +5,7 @@ use clap::{App, Arg};
use std::path::Path;
use std::process;
use thinp::file_utils;
use thinp::thin::check::{check, ThinCheckOptions};
use std::process::exit;
@ -56,6 +57,13 @@ fn main() {
.help("Specify the input device to check")
.required(true)
.index(1),
)
.arg(
Arg::with_name("SYNC_IO")
.help("Force use of synchronous io")
.long("sync-io")
.value_name("SYNC_IO")
.takes_value(false),
);
let matches = parser.get_matches();
@ -66,7 +74,12 @@ fn main() {
exit(1);
}
if let Err(reason) = thinp::thin::check::check(&input_file) {
let opts = ThinCheckOptions {
dev: &input_file,
async_io: !matches.is_present("SYNC_IO"),
};
if let Err(reason) = check(&opts) {
println!("Application error: {}", reason);
process::exit(1);
}