Move Slotinfo values into Images struct
So that this can be stored in its own structure, make it own the slot
info (which is only two usize values).
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/src/lib.rs b/sim/src/lib.rs
index 6ac796a..3f3967d 100644
--- a/sim/src/lib.rs
+++ b/sim/src/lib.rs
@@ -206,8 +206,8 @@
// upgraded to
let mut bad_flash = flash.clone();
let bad_slot1_image = Images {
- slot0: &slot0,
- slot1: &slot1,
+ slot0: slot0.clone(),
+ slot1: slot1.clone(),
primary: install_image(&mut bad_flash, slot0_base, 32784, false),
upgrade: install_image(&mut bad_flash, slot1_base, 41928, true),
};
@@ -215,8 +215,8 @@
failed |= run_signfail_upgrade(&bad_flash, &areadesc, &bad_slot1_image);
let images = Images {
- slot0: &slot0,
- slot1: &slot1,
+ slot0: slot0.clone(),
+ slot1: slot1.clone(),
primary: install_image(&mut flash, slot0_base, 32784, false),
upgrade: install_image(&mut flash, slot1_base, 41928, false),
};
@@ -943,14 +943,15 @@
build_num: u32,
}
+#[derive(Clone)]
struct SlotInfo {
base_off: usize,
trailer_off: usize,
}
-struct Images<'a> {
- slot0: &'a SlotInfo,
- slot1: &'a SlotInfo,
+struct Images {
+ slot0: SlotInfo,
+ slot1: SlotInfo,
primary: Vec<u8>,
upgrade: Vec<u8>,
}