From a7296bbb52152fa4f7b78e298d25a8ce4a7dbb73 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 12 Mar 2020 16:31:26 +0000 Subject: [PATCH] bin, vmm: Centralise the pmem syntax This will allow the syntax to be reused with cloud-hypervisor binary and ch-remote. Signed-off-by: Rob Bradford --- src/main.rs | 6 +----- vmm/src/config.rs | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 42ec38477..609444263 100755 --- a/src/main.rs +++ b/src/main.rs @@ -165,11 +165,7 @@ fn create_app<'a, 'b>( .arg( Arg::with_name("pmem") .long("pmem") - .help( - "Persistent memory parameters \ - \"file=,size=,iommu=on|off,\ - mergeable=on|off,discard_writes=on|off,\"", - ) + .help(config::PmemConfig::SYNTAX) .takes_value(true) .min_values(1) .group("vm-config"), diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 3a88024b5..c0b6847b6 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -776,6 +776,9 @@ pub struct PmemConfig { } impl PmemConfig { + pub const SYNTAX: &'static str = "Persistent memory parameters \ + \"file=,size=,iommu=on|off,\ + mergeable=on|off,discard_writes=on|off,\""; pub fn parse(pmem: &str) -> Result { // Split the parameters based on the comma delimiter let params_list: Vec<&str> = pmem.split(',').collect();