Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3178)

Unified Diff: delta_diff_generator.cc

Issue 5684002: Add support for bsdiff of file system metadata blocks (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Forgot newly added metadata processing files. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: delta_diff_generator.cc
diff --git a/delta_diff_generator.cc b/delta_diff_generator.cc
index 21a4c03ad84b98decd39afa9c7a94bfd6e4f29d1..4d8ccab0697fa1844d7605d28b10eefc620b95d8 100644
--- a/delta_diff_generator.cc
+++ b/delta_diff_generator.cc
@@ -30,6 +30,7 @@
#include "update_engine/full_update_generator.h"
#include "update_engine/graph_types.h"
#include "update_engine/graph_utils.h"
+#include "update_engine/metadata.h"
#include "update_engine/omaha_hash_calculator.h"
#include "update_engine/payload_signer.h"
#include "update_engine/subprocess.h"
@@ -52,31 +53,6 @@ typedef DeltaDiffGenerator::Block Block;
typedef map<const DeltaArchiveManifest_InstallOperation*,
const string*> OperationNameMap;
-namespace {
-const size_t kBlockSize = 4096; // bytes
-
-// TODO(adlr): switch from 1GiB to 2GiB when we no longer care about old
-// clients:
-const size_t kRootFSPartitionSize = 1 * 1024 * 1024 * 1024; // bytes
-const uint64_t kVersionNumber = 1;
-const uint64_t kFullUpdateChunkSize = 1024 * 1024; // bytes
-
-static const char* kInstallOperationTypes[] = {
- "REPLACE",
- "REPLACE_BZ",
- "MOVE",
- "BSDIFF"
-};
-
-// Stores all Extents for a file into 'out'. Returns true on success.
-bool GatherExtents(const string& path,
- google::protobuf::RepeatedPtrField<Extent>* out) {
- vector<Extent> extents;
- TEST_AND_RETURN_FALSE(extent_mapper::ExtentsForFileFibmap(path, &extents));
- DeltaDiffGenerator::StoreExtents(extents, out);
- return true;
-}
-
// Runs the bsdiff tool on two files and returns the resulting delta in
// 'out'. Returns true on success.
bool BsdiffFiles(const string& old_file,
@@ -152,6 +128,31 @@ bool AddInstallOpToBlocksVector(
return true;
}
+namespace {
+const size_t kBlockSize = 4096; // bytes
+
+// TODO(adlr): switch from 1GiB to 2GiB when we no longer care about old
+// clients:
+const size_t kRootFSPartitionSize = 1 * 1024 * 1024 * 1024; // bytes
+const uint64_t kVersionNumber = 1;
+const uint64_t kFullUpdateChunkSize = 1024 * 1024; // bytes
+
+static const char* kInstallOperationTypes[] = {
+ "REPLACE",
+ "REPLACE_BZ",
+ "MOVE",
+ "BSDIFF"
+};
+
+// Stores all Extents for a file into 'out'. Returns true on success.
+bool GatherExtents(const string& path,
+ google::protobuf::RepeatedPtrField<Extent>* out) {
+ vector<Extent> extents;
+ TEST_AND_RETURN_FALSE(extent_mapper::ExtentsForFileFibmap(path, &extents));
+ DeltaDiffGenerator::StoreExtents(extents, out);
+ return true;
+}
+
// For a given regular file which must exist at new_root + path, and
// may exist at old_root + path, creates a new InstallOperation and
// adds it to the graph. Also, populates the |blocks| array as
@@ -1390,6 +1391,16 @@ bool DeltaDiffGenerator::GenerateDeltaUpdateFile(
LOG(INFO) << "done reading normal files";
CheckGraph(graph);
+ LOG(INFO) << "Starting metadata processing";
+ TEST_AND_RETURN_FALSE(DeltaReadMetadata(&graph,
+ &blocks,
+ old_image,
+ new_image,
+ fd,
+ &data_file_size));
+ LOG(INFO) << "Done metadata processing";
+ CheckGraph(graph);
+
graph.resize(graph.size() + 1);
TEST_AND_RETURN_FALSE(ReadUnwrittenBlocks(blocks,
fd,

Powered by Google App Engine
This is Rietveld 408576698