diff options
author | Amin Hassani <ahassani@chromium.org> | 2020-09-16 11:19:28 -0700 |
---|---|---|
committer | Amin Hassani <ahassani@chromium.org> | 2020-09-17 10:17:36 -0700 |
commit | e53b39b8b9c5c0871841bbbb86f23657c0b7f91b (patch) | |
tree | 12746e5e7e4716ba7fc94d3ed5c1a36c4d47d474 /common/boot_control_interface.h | |
parent | a02a1f1dc837f22226499d9856a949fb180d099a (diff) | |
parent | 9956320ffa4edb340d20bd7f3c852a9e87437bd3 (diff) |
update_engine: Merge remote-tracking branch 'cros/upstream' into cros/master
Done with:
git merge cros/upstream --commit -s recursive
- Added EC key support and its unittests.
- Resolved a conlict on error codes. Since Android versions are not
uploading any UMA metrics, I gave the priority to the Android version
Since they can't be changed.
- Changed the openssl functions to get1 version (from get0) version
because of a current issue with gale. Once the issue is resolved we
need to change them back.
- Some remaining styling issues fixed by clang-format
BUG=b:163153182
TEST=CQ passes
TEST=unittests
Change-Id: Ib95034422b92433ce26e28336bc4806b34910d38
Diffstat (limited to 'common/boot_control_interface.h')
-rw-r--r-- | common/boot_control_interface.h | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/common/boot_control_interface.h b/common/boot_control_interface.h index 392d7851..c93de5c5 100644 --- a/common/boot_control_interface.h +++ b/common/boot_control_interface.h @@ -25,6 +25,9 @@ #include <base/callback.h> #include <base/macros.h> +#include "update_engine/common/dynamic_partition_control_interface.h" +#include "update_engine/update_metadata.pb.h" + namespace chromeos_update_engine { // The abstract boot control interface defines the interaction with the @@ -35,19 +38,6 @@ class BootControlInterface { public: using Slot = unsigned int; - struct PartitionMetadata { - struct Partition { - std::string name; - uint64_t size; - }; - struct Group { - std::string name; - uint64_t size; - std::vector<Partition> partitions; - }; - std::vector<Group> groups; - }; - static const Slot kInvalidSlot = UINT_MAX; virtual ~BootControlInterface() = default; @@ -67,9 +57,20 @@ class BootControlInterface { // The |slot| number must be between 0 and GetNumSlots() - 1 and the // |partition_name| is a platform-specific name that identifies a partition on // every slot. In order to access the dynamic partitions in the target slot, - // InitPartitionMetadata() must be called (once per payload) prior to calling - // this function. On success, returns true and stores the block device in - // |device|. + // GetDynamicPartitionControl()->PreparePartitionsForUpdate() must be called + // (with |update| == true for the first time for a payload, and |false| for + // for the rest of the times) prior to calling this function. + // The handling may be different based on whether the partition is included + // in the update payload. On success, returns true; and stores the block + // device in |device|, if the partition is dynamic in |is_dynamic|. + virtual bool GetPartitionDevice(const std::string& partition_name, + Slot slot, + bool not_in_payload, + std::string* device, + bool* is_dynamic) const = 0; + + // Overload of the above function. We assume the partition is always included + // in the payload. virtual bool GetPartitionDevice(const std::string& partition_name, Slot slot, std::string* device) const = 0; @@ -94,17 +95,11 @@ class BootControlInterface { // of the operation. virtual bool MarkBootSuccessfulAsync(base::Callback<void(bool)> callback) = 0; - // Initializes the metadata of the underlying partitions for a given |slot| - // and sets up the states for accessing dynamic partitions. - // |partition_metadata| will be written to the specified |slot| if - // |update_metadata| is set. - virtual bool InitPartitionMetadata( - Slot slot, - const PartitionMetadata& partition_metadata, - bool update_metadata) = 0; - - // Do necessary clean-up operations after the whole update. - virtual void Cleanup() = 0; + // Check if |slot| is marked boot successfully. + virtual bool IsSlotMarkedSuccessful(Slot slot) const = 0; + + // Return the dynamic partition control interface. + virtual DynamicPartitionControlInterface* GetDynamicPartitionControl() = 0; // Return a human-readable slot name used for logging. static std::string SlotName(Slot slot) { |