mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vhost_user_net: add --version
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
b0a2ce0598
commit
b8172408f8
@ -3,6 +3,7 @@ name = "vhost_user_net"
|
|||||||
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"
|
||||||
|
@ -15,7 +15,11 @@ struct TopLevel {
|
|||||||
#[argh(option, long = "net-backend")]
|
#[argh(option, long = "net-backend")]
|
||||||
/// vhost-user-net backend parameters
|
/// vhost-user-net backend parameters
|
||||||
/// ip=<ip_addr>,mask=<net_mask>,socket=<socket_path>,client=on|off,num_queues=<number_of_queues>,queue_size=<size_of_each_queue>,tap=<if_name>
|
/// ip=<ip_addr>,mask=<net_mask>,socket=<socket_path>,client=on|off,num_queues=<number_of_queues>,queue_size=<size_of_each_queue>,tap=<if_name>
|
||||||
backend_command: String,
|
backend_command: Option<String>,
|
||||||
|
|
||||||
|
#[argh(switch, short = 'V', long = "version")]
|
||||||
|
/// print version information
|
||||||
|
version: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -23,5 +27,15 @@ fn main() {
|
|||||||
|
|
||||||
let toplevel: TopLevel = argh::from_env();
|
let toplevel: TopLevel = argh::from_env();
|
||||||
|
|
||||||
start_net_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 --net-backend");
|
||||||
|
std::process::exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
start_net_backend(&toplevel.backend_command.unwrap());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user