1 // 2 // Copyright (C) 2020 The Android Open Source Project 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 #ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_PARTITION_UPDATE_GENERATOR_INTERFACE_H_ 18 #define UPDATE_ENGINE_PAYLOAD_CONSUMER_PARTITION_UPDATE_GENERATOR_INTERFACE_H_ 19 20 #include <memory> 21 #include <set> 22 #include <string> 23 #include <vector> 24 25 #include "update_engine/common/boot_control_interface.h" 26 27 namespace chromeos_update_engine { 28 class PartitionUpdate; 29 30 // This class parses the partitions that are not included in the payload of a 31 // partial A/B update. And it generates additional operations for these 32 // partitions to make the update complete. 33 class PartitionUpdateGeneratorInterface { 34 public: 35 virtual ~PartitionUpdateGeneratorInterface() = default; 36 37 // Adds PartitionUpdate for partitions not included in the payload. For static 38 // partitions, it generates SOURCE_COPY operations to copy the bytes from the 39 // source slot to target slot. For dynamic partitions, it only calculates the 40 // partition hash for the filesystem verification later. 41 virtual bool GenerateOperationsForPartitionsNotInPayload( 42 BootControlInterface::Slot source_slot, 43 BootControlInterface::Slot target_slot, 44 const std::set<std::string>& partitions_in_payload, 45 std::vector<PartitionUpdate>* update_list) = 0; 46 }; 47 48 namespace partition_update_generator { 49 std::unique_ptr<PartitionUpdateGeneratorInterface> Create( 50 BootControlInterface* boot_control, size_t block_size); 51 } 52 53 } // namespace chromeos_update_engine 54 55 #endif 56