mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vhost_user_block: add --version
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
a0922930b1
commit
b0a2ce0598
@ -3,6 +3,7 @@ name = "vhost_user_block"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["The Cloud Hypervisor Authors"]
|
authors = ["The Cloud Hypervisor Authors"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
build = "../build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
argh = "0.1.9"
|
argh = "0.1.9"
|
||||||
|
@ -19,7 +19,11 @@ struct TopLevel {
|
|||||||
#[argh(option, long = "block-backend")]
|
#[argh(option, long = "block-backend")]
|
||||||
/// vhost-user-block backend parameters
|
/// vhost-user-block backend parameters
|
||||||
/// path=<image_path>,socket=<socket_path>,num_queues=<number_of_queues>,queue_size=<size_of_each_queue>,readonly=true|false,direct=true|false,poll_queue=true|false
|
/// path=<image_path>,socket=<socket_path>,num_queues=<number_of_queues>,queue_size=<size_of_each_queue>,readonly=true|false,direct=true|false,poll_queue=true|false
|
||||||
backend_command: String,
|
backend_command: Option<String>,
|
||||||
|
|
||||||
|
#[argh(switch, short = 'V', long = "version")]
|
||||||
|
/// print version information
|
||||||
|
version: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -27,5 +31,15 @@ fn main() {
|
|||||||
|
|
||||||
let toplevel: TopLevel = argh::from_env();
|
let toplevel: TopLevel = argh::from_env();
|
||||||
|
|
||||||
start_block_backend(&toplevel.backend_command);
|
if toplevel.version {
|
||||||
|
println!("{} {}", env!("CARGO_BIN_NAME"), env!("BUILT_VERSION"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if toplevel.backend_command.is_none() {
|
||||||
|
println!("Please specify --block-backend");
|
||||||
|
std::process::exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
start_block_backend(&toplevel.backend_command.unwrap());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user