update_engine: Merge contiguous operations.
Merges operations of type SOURCE_COPY, REPLACE, or REPLACE_BZ if they
have the same type, are contiguous, have only one destination extent,
and their combined block count does not exceed the chunk size.
BUG=chromium:461651
TEST=`cros flash --src-image-to-delta`, checking generated payloads
using `cros payload show --list_ops`, unit tests.
CQ-DEPEND=CL:269134
Change-Id: I5f71e6828561f2e0a6a8ab3e3aae4c362ea2ddde
Reviewed-on: https://chromium-review.googlesource.com/269604
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Allie Wood <alliewood@chromium.org>
Trybot-Ready: Allie Wood <alliewood@chromium.org>
Tested-by: Allie Wood <alliewood@chromium.org>
diff --git a/payload_generator/annotated_operation.h b/payload_generator/annotated_operation.h
index e370cfe..d07b6ae 100644
--- a/payload_generator/annotated_operation.h
+++ b/payload_generator/annotated_operation.h
@@ -8,6 +8,7 @@
#include <ostream> // NOLINT(readability/streams)
#include <string>
+#include <chromeos/secure_blob.h>
#include "update_engine/update_metadata.pb.h"
namespace chromeos_update_engine {
@@ -23,6 +24,12 @@
// Sets |name| to a human readable representation of a chunk in a file.
void SetNameFromFileAndChunk(const std::string& filename,
off_t chunk_offset, off_t chunk_size);
+
+ // Writes |blob| to the end of |data_fd|, and updates |data_file_size| to
+ // match the new size of |data_fd|. It sets the data_offset and data_length
+ // in AnnotatedOperation to match the offset and size of |blob| in |data_fd|.
+ bool SetOperationBlob(chromeos::Blob* blob, int data_fd,
+ off_t* data_file_size);
};
// For logging purposes.