Merge "Cleanup some more llpvm_changes flags" into main am: d8fdb99554 am: de15e4c815
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/3516653
Change-Id: Iff94bf95b28dad8bb2e80f2eb46fe5c01103fb69
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/android/vm/src/main.rs b/android/vm/src/main.rs
index ff846a1..7178de5 100644
--- a/android/vm/src/main.rs
+++ b/android/vm/src/main.rs
@@ -22,8 +22,6 @@
CpuOptions::CpuTopology::CpuTopology, IVirtualizationService::IVirtualizationService,
PartitionType::PartitionType, VirtualMachineAppConfig::DebugLevel::DebugLevel,
};
-#[cfg(not(llpvm_changes))]
-use anyhow::anyhow;
use anyhow::{bail, Context, Error};
use binder::{ProcessState, Strong};
use clap::{Args, Parser};
@@ -220,7 +218,6 @@
instance: PathBuf,
/// Path to file containing instance_id. Required iff llpvm feature is enabled.
- #[cfg(llpvm_changes)]
#[arg(long = "instance-id-file")]
instance_id: PathBuf,
@@ -255,26 +252,8 @@
}
}
- fn instance_id(&self) -> Result<PathBuf, Error> {
- cfg_if::cfg_if! {
- if #[cfg(llpvm_changes)] {
- Ok(self.instance_id.clone())
- } else {
- Err(anyhow!("LLPVM feature is disabled, --instance_id flag not supported"))
- }
- }
- }
-
- fn set_instance_id(&mut self, instance_id_file: PathBuf) -> Result<(), Error> {
- cfg_if::cfg_if! {
- if #[cfg(llpvm_changes)] {
- self.instance_id = instance_id_file;
- Ok(())
- } else {
- let _ = instance_id_file;
- Err(anyhow!("LLPVM feature is disabled, --instance_id flag not supported"))
- }
- }
+ fn set_instance_id(&mut self, instance_id_file: PathBuf) {
+ self.instance_id = instance_id_file;
}
}
diff --git a/android/vm/src/run.rs b/android/vm/src/run.rs
index 8385fb4..1033164 100644
--- a/android/vm/src/run.rs
+++ b/android/vm/src/run.rs
@@ -87,8 +87,8 @@
)?;
}
- let instance_id = if cfg!(llpvm_changes) {
- let id_file = config.instance_id()?;
+ let instance_id = {
+ let id_file = config.instance_id;
if id_file.exists() {
let mut id = [0u8; 64];
let mut instance_id_file = File::open(id_file)?;
@@ -100,9 +100,6 @@
instance_id_file.write_all(&id)?;
id
}
- } else {
- // if llpvm feature flag is disabled, instance_id is not used.
- [0u8; 64]
};
let storage = if let Some(ref path) = config.microdroid.storage {
@@ -254,10 +251,8 @@
..Default::default()
};
- if cfg!(llpvm_changes) {
- app_config.set_instance_id(work_dir.join("instance_id"))?;
- println!("instance_id file path: {}", app_config.instance_id()?.display());
- }
+ app_config.set_instance_id(work_dir.join("instance_id"));
+ println!("instance_id file path: {}", app_config.instance_id.display());
command_run_app(app_config)
}