mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vhost_user_net: switch to argh
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Generated
+1
-41
@@ -147,30 +147,6 @@ version = "1.0.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap"
|
|
||||||
version = "4.0.32"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"clap_lex",
|
|
||||||
"is-terminal",
|
|
||||||
"once_cell",
|
|
||||||
"strsim",
|
|
||||||
"termcolor",
|
|
||||||
"terminal_size",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap_lex"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
|
|
||||||
dependencies = [
|
|
||||||
"os_str_bytes",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cloud-hypervisor"
|
name = "cloud-hypervisor"
|
||||||
version = "29.0.0"
|
version = "29.0.0"
|
||||||
@@ -729,12 +705,6 @@ dependencies = [
|
|||||||
name = "option_parser"
|
name = "option_parser"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "os_str_bytes"
|
|
||||||
version = "6.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
version = "0.11.2"
|
version = "0.11.2"
|
||||||
@@ -1216,16 +1186,6 @@ dependencies = [
|
|||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "terminal_size"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cb20089a8ba2b69debd491f8d2d023761cbf196e999218c591fa1e7e15a21907"
|
|
||||||
dependencies = [
|
|
||||||
"rustix",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "test_infra"
|
name = "test_infra"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -1437,7 +1397,7 @@ dependencies = [
|
|||||||
name = "vhost_user_net"
|
name = "vhost_user_net"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"argh",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"epoll",
|
"epoll",
|
||||||
"libc",
|
"libc",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ authors = ["The Cloud Hypervisor Authors"]
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.0.32", features = ["wrap_help","cargo"] }
|
argh = "0.1.9"
|
||||||
env_logger = "0.10.0"
|
env_logger = "0.10.0"
|
||||||
epoll = "4.3.1"
|
epoll = "4.3.1"
|
||||||
libc = "0.2.139"
|
libc = "0.2.139"
|
||||||
|
|||||||
+12
-15
@@ -6,25 +6,22 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause)
|
// SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause)
|
||||||
|
|
||||||
use clap::{Arg, Command};
|
use argh::FromArgs;
|
||||||
use vhost_user_net::start_net_backend;
|
use vhost_user_net::start_net_backend;
|
||||||
|
|
||||||
|
#[derive(FromArgs)]
|
||||||
|
/// Launch a vhost-user-net backend.
|
||||||
|
struct TopLevel {
|
||||||
|
#[argh(option, long = "net-backend")]
|
||||||
|
/// 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>
|
||||||
|
backend_command: String,
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
let cmd_arguments = Command::new("vhost-user-net backend")
|
let toplevel: TopLevel = argh::from_env();
|
||||||
.version(env!("CARGO_PKG_VERSION"))
|
|
||||||
.author(env!("CARGO_PKG_AUTHORS"))
|
|
||||||
.about("Launch a vhost-user-net backend.")
|
|
||||||
.arg(
|
|
||||||
Arg::new("net-backend")
|
|
||||||
.long("net-backend")
|
|
||||||
.help(vhost_user_net::SYNTAX)
|
|
||||||
.num_args(1)
|
|
||||||
.required(true),
|
|
||||||
)
|
|
||||||
.get_matches();
|
|
||||||
|
|
||||||
let backend_command = cmd_arguments.get_one::<String>("net-backend").unwrap();
|
start_net_backend(&toplevel.backend_command);
|
||||||
start_net_backend(backend_command);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user