Flag guard vfio_handler
Guard the following on the value of the
RELEASE_AVF_ENABLE_DEVICE_ASSIGNMENT flag:
* vfio_handler binary & vfio_handler.rc in com.android.virt APEX;
* --devices flag in the vm shell binary
* Usage of the CustomConfig.devices field in the
VirtualMachineAppConfig;
Test: atest MicrodroidTests
Change-Id: I40611b0cd93d17aacd68acf74f442e479a80d488
diff --git a/vm/src/main.rs b/vm/src/main.rs
index 0af9791..14db27c 100644
--- a/vm/src/main.rs
+++ b/vm/src/main.rs
@@ -108,6 +108,7 @@
vendor: Option<PathBuf>,
/// SysFS nodes of devices to assign to VM
+ #[cfg(device_assignment)]
#[arg(long)]
devices: Vec<PathBuf>,
}
@@ -132,6 +133,16 @@
fn vendor(&self) -> Option<PathBuf> {
None
}
+
+ #[cfg(device_assignment)]
+ fn devices(&self) -> &Vec<PathBuf> {
+ &self.devices
+ }
+
+ #[cfg(not(device_assignment))]
+ fn devices(&self) -> Vec<PathBuf> {
+ Vec::new()
+ }
}
#[derive(Args)]