diff options
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) { |