From 477bc17f18d06337bae205ef593a116f3a94ad43 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 12 Mar 2020 16:20:31 +0000 Subject: [PATCH] bin: Share VFIO device syntax between cloud-hypervisor and ch-remote Signed-off-by: Rob Bradford --- src/bin/ch-remote.rs | 9 +++++---- src/main.rs | 5 +---- vmm/src/config.rs | 2 ++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bin/ch-remote.rs b/src/bin/ch-remote.rs index 38964b455..f964888e2 100644 --- a/src/bin/ch-remote.rs +++ b/src/bin/ch-remote.rs @@ -267,10 +267,11 @@ fn main() { .subcommand( SubCommand::with_name("add-device") .about("Add VFIO device") - .arg(Arg::with_name("device_config").index(1).help( - "Direct device assignment parameters \ - \"path=,iommu=on|off,id=\"", - )), + .arg( + Arg::with_name("device_config") + .index(1) + .help(vmm::config::DeviceConfig::SYNTAX), + ), ) .subcommand( SubCommand::with_name("remove-device") diff --git a/src/main.rs b/src/main.rs index 2d96374f9..502711b93 100755 --- a/src/main.rs +++ b/src/main.rs @@ -198,10 +198,7 @@ fn create_app<'a, 'b>( .arg( Arg::with_name("device") .long("device") - .help( - "Direct device assignment parameters \ - \"path=,iommu=on|off,id=\"", - ) + .help(config::DeviceConfig::SYNTAX) .takes_value(true) .min_values(1) .group("vm-config"), diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 5613865f8..207e441ad 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -904,6 +904,8 @@ pub struct DeviceConfig { } impl DeviceConfig { + pub const SYNTAX: &'static str = + "Direct device assignment parameters \"path=,iommu=on|off,id=\""; pub fn parse(device: &str) -> Result { // Split the parameters based on the comma delimiter let params_list: Vec<&str> = device.split(',').collect();