vmconfig: remove path (use paths always)
Fixes: 190503456
Test: MicrodroidHostTestCases
Change-Id: I083eaacf5057337334467713ab3f8d12813491e2
diff --git a/vmconfig/src/lib.rs b/vmconfig/src/lib.rs
index e5c8e1b..7b0d2a5 100644
--- a/vmconfig/src/lib.rs
+++ b/vmconfig/src/lib.rs
@@ -121,9 +121,6 @@
pub label: String,
/// The filename of the partition image.
#[serde(default)]
- pub path: Option<PathBuf>,
- /// The filename of the partition image.
- #[serde(default)]
pub paths: Vec<PathBuf>,
/// Whether the partition should be writable.
#[serde(default)]
@@ -132,26 +129,15 @@
impl Partition {
fn to_parcelable(&self) -> Result<AidlPartition> {
- if !self.paths.is_empty() {
- if self.path.is_some() {
- bail!("Partition {} contains both path/paths", &self.label);
- }
- let images = self
- .paths
- .iter()
- .map(|path| open_parcel_file(&path, self.writable))
- .collect::<Result<Vec<_>, _>>()?;
- Ok(AidlPartition { images, writable: self.writable, label: self.label.to_owned() })
- } else {
- let path = self.path.as_ref().ok_or_else(|| {
- Error::msg(format!("Partition {} doesn't set path/paths", &self.label))
- })?;
- Ok(AidlPartition {
- images: vec![open_parcel_file(&path, self.writable)?],
- writable: self.writable,
- label: self.label.to_owned(),
- })
+ if self.paths.is_empty() {
+ bail!("Partition {} contains no paths", &self.label);
}
+ let images = self
+ .paths
+ .iter()
+ .map(|path| open_parcel_file(&path, self.writable))
+ .collect::<Result<Vec<_>, _>>()?;
+ Ok(AidlPartition { images, writable: self.writable, label: self.label.to_owned() })
}
}