diff --git a/src/bin/vhost_user_net.rs b/src/bin/vhost_user_net.rs index 520bb0fe8..7d26aeb1c 100644 --- a/src/bin/vhost_user_net.rs +++ b/src/bin/vhost_user_net.rs @@ -21,11 +21,7 @@ fn main() { .arg( Arg::with_name("net-backend") .long("net-backend") - .help( - "vhost-user-net backend parameters \ - \"ip=,mask=,sock=,\ - num_queues=,queue_size=,tap=\"", - ) + .help(vhost_user_net::SYNTAX) .takes_value(true) .min_values(1), ) diff --git a/src/main.rs b/src/main.rs index 4208ab927..d757b0274 100755 --- a/src/main.rs +++ b/src/main.rs @@ -235,11 +235,7 @@ fn create_app<'a, 'b>( .arg( Arg::with_name("net-backend") .long("net-backend") - .help( - "vhost-user-net backend parameters \ - \"ip=,mask=,sock=,\ - num_queues=,queue_size=,tap=\"", - ) + .help(vhost_user_net::SYNTAX) .takes_value(true) .conflicts_with_all(&["block-backend", "kernel"]) .min_values(1), diff --git a/vhost_user_net/src/lib.rs b/vhost_user_net/src/lib.rs index 1a152b91f..d2518e3a6 100644 --- a/vhost_user_net/src/lib.rs +++ b/vhost_user_net/src/lib.rs @@ -77,6 +77,10 @@ pub enum Error { OpenTap(vm_virtio::net_util::Error), } +pub const SYNTAX: &str = "vhost-user-net backend parameters \ +\"ip=,mask=,sock=,\ +num_queues=,queue_size=,tap=\""; + impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "vhost_user_net_error: {:?}", self)