Move partition info to PartitionUpdate in payload verison 2.
old_kernel_info, old_rootfs_info is now old_partition_info.
new_kernel_info, new_rootfs_info is now new_partition_info.
AddPartitionOperations is renamed to AddPartition because it now adds
partition info too.
Bug: 23694580
TEST=cros_workon_make update_engine --test
Generated a version 2 payload with delta_generator.
Change-Id: I07c7fc21198307e935679e62861cdac4b406c84f
diff --git a/payload_generator/payload_file.h b/payload_generator/payload_file.h
index 7cf9160..d877ef7 100644
--- a/payload_generator/payload_file.h
+++ b/payload_generator/payload_file.h
@@ -19,7 +19,6 @@
#include <string>
#include <vector>
-#include <utility>
#include <chromeos/secure_blob.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@@ -39,10 +38,12 @@
// required hashes of the requested partitions.
bool Init(const PayloadGenerationConfig& config);
- // Sets the list of operations to the payload manifest. The operations
+ // Add a partition to the payload manifest. Including partition name, list of
+ // operations and partition info. The operations in |aops|
// reference a blob stored in the file provided to WritePayload().
- bool AddPartitionOperations(const std::string& partition_name,
- const std::vector<AnnotatedOperation>& aops);
+ bool AddPartition(const PartitionConfig& old_conf,
+ const PartitionConfig& new_conf,
+ const std::vector<AnnotatedOperation>& aops);
// Write the payload to the |payload_file| file. The operations reference
// blobs in the |data_blobs_path| file and the blobs will be reordered in the
@@ -82,8 +83,19 @@
DeltaArchiveManifest manifest_;
- std::vector<std::pair<std::string,
- std::vector<AnnotatedOperation>>> aops_vec_;
+ // Struct has necessary information to write PartitionUpdate in protobuf.
+ struct Partition {
+ // The name of the partition.
+ std::string name;
+
+ // The operations to be performed to this partition.
+ std::vector<AnnotatedOperation> aops;
+
+ PartitionInfo old_info;
+ PartitionInfo new_info;
+ };
+
+ std::vector<Partition> part_vec_;
};
// Adds a dummy operation that points to a signature blob located at the