Skip to content

Commit

Permalink
Merge pull request #950 from etungsten/signpost-cancel-upgrade
Browse files Browse the repository at this point in the history
signpost: `cancel-upgrade` behavior fix
  • Loading branch information
etungsten authored Jun 20, 2020
2 parents 6a5a06c + 3f3a26d commit 759c8c3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sources/updater/signpost/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ impl State {
}

/// Sets the inactive partition as a new upgrade partition, but **does not write to the disk**.
/// Ensures that the inactive partition is marked as valid beforehand
///
/// * Sets the inactive partition's priority to 2 and the active partition's priority to 1.
/// * Sets the inactive partition's tries left to 1.
/// * Sets the inactive partition as not successfully booted.
/// * Returns an error if the partition has not been marked as potentially
/// valid or if it has already been marked for upgrade.
Expand Down Expand Up @@ -243,10 +243,12 @@ impl State {

/// Reverts upgrade_to_inactive(), but **does not write to the disk**.
///
/// * Clears all bits of the inactive partition.
/// * Sets the inactive partition's priority to 0
/// * Restores the active partition's priority to 2
pub fn cancel_upgrade(&mut self) {
self.clear_inactive();
let mut inactive_flags = self.gptprio(self.inactive());
inactive_flags.set_priority(0);
self.set_gptprio(self.inactive(), inactive_flags);

let mut active_flags = self.gptprio(self.active());
active_flags.set_priority(2);
Expand Down

0 comments on commit 759c8c3

Please sign in to comment.