summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2019-01-08 15:50:34 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-01-08 23:25:55 -0800
commitbd1a0843bcf442068386c4eb3ab50b79c0fd13ab (patch)
tree10ee5cf0e9d088334125f501426f3ae502e01d2b /src/main.rs
parentd41d726c2f977789fdd3f6cd701f0c7616b778ac (diff)
downloadcrosvm-bd1a0843bcf442068386c4eb3ab50b79c0fd13ab.tar
crosvm-bd1a0843bcf442068386c4eb3ab50b79c0fd13ab.tar.gz
crosvm-bd1a0843bcf442068386c4eb3ab50b79c0fd13ab.tar.bz2
crosvm-bd1a0843bcf442068386c4eb3ab50b79c0fd13ab.tar.lz
crosvm-bd1a0843bcf442068386c4eb3ab50b79c0fd13ab.tar.xz
crosvm-bd1a0843bcf442068386c4eb3ab50b79c0fd13ab.tar.zst
crosvm-bd1a0843bcf442068386c4eb3ab50b79c0fd13ab.zip
main: only show plugin options when feature is on
The crosvm run --plugin option was behind #[cfg(feature = "plugin")],
but the recently-added --plugin-root and --plugin-mount were not.  Add
feature checks around those options as well so that they are only
enabled when the plugin feature is enabled (and so they don't show up in
crosvm run -h for a non-plugin build).

Also allow dead code in struct BindMount, since this is only used for
plugin-enabled builds.

We could wrap all of the plugin-related command line parsing code with
feature checks instead, but that adds a lot of clutter and makes the
code harder to read.

BUG=None
TEST='cargo build' and 'cargo build --features=plugin'

Change-Id: Ieb240cfc55b8cad64748fe39c7de5faa58f1a26c
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1401123
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index e977620..79d0432 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -63,6 +63,7 @@ struct DiskOption {
     read_only: bool,
 }
 
+#[allow(dead_code)]
 struct BindMount {
     src: PathBuf,
     dst: PathBuf,
@@ -505,7 +506,9 @@ fn run_vm(args: std::env::Args) -> std::result::Result<(), ()> {
           Argument::value("seccomp-policy-dir", "PATH", "Path to seccomp .policy files."),
           #[cfg(feature = "plugin")]
           Argument::value("plugin", "PATH", "Absolute path to plugin process to run under crosvm."),
+          #[cfg(feature = "plugin")]
           Argument::value("plugin-root", "PATH", "Absolute path to a directory that will become root filesystem for the plugin process."),
+          #[cfg(feature = "plugin")]
           Argument::value("plugin-mount", "PATH:PATH:BOOL", "Path to be mounted into the plugin's root filesystem.  Can be given more than once."),
           Argument::flag("vhost-net", "Use vhost for networking."),
           Argument::value("tap-fd",