OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // the smallest way to encode this file for the diff. It stores | 90 // the smallest way to encode this file for the diff. It stores |
91 // necessary data in out_data and fills in out_op. | 91 // necessary data in out_data and fills in out_op. |
92 // If there's no change in old and new files, it creates a MOVE | 92 // If there's no change in old and new files, it creates a MOVE |
93 // operation. If there is a change, or the old file doesn't exist, | 93 // operation. If there is a change, or the old file doesn't exist, |
94 // the smallest of REPLACE, REPLACE_BZ, or BSDIFF wins. | 94 // the smallest of REPLACE, REPLACE_BZ, or BSDIFF wins. |
95 // new_filename must contain at least one byte. | 95 // new_filename must contain at least one byte. |
96 // Returns true on success. | 96 // Returns true on success. |
97 static bool ReadFileToDiff(const std::string& old_filename, | 97 static bool ReadFileToDiff(const std::string& old_filename, |
98 const std::string& new_filename, | 98 const std::string& new_filename, |
99 std::vector<char>* out_data, | 99 std::vector<char>* out_data, |
100 DeltaArchiveManifest_InstallOperation* out_op); | 100 DeltaArchiveManifest_InstallOperation* out_op, |
| 101 bool gather_extents); |
101 | 102 |
102 // Modifies blocks read by 'op' so that any blocks referred to by | 103 // Modifies blocks read by 'op' so that any blocks referred to by |
103 // 'remove_extents' are replaced with blocks from 'replace_extents'. | 104 // 'remove_extents' are replaced with blocks from 'replace_extents'. |
104 // 'remove_extents' and 'replace_extents' must be the same number of blocks. | 105 // 'remove_extents' and 'replace_extents' must be the same number of blocks. |
105 // Blocks will be substituted in the order listed in the vectors. | 106 // Blocks will be substituted in the order listed in the vectors. |
106 // E.g. if 'op' reads blocks 1, 2, 3, 4, 5, 6, 7, 8, remove_extents | 107 // E.g. if 'op' reads blocks 1, 2, 3, 4, 5, 6, 7, 8, remove_extents |
107 // contains blocks 6, 2, 3, 5, and replace blocks contains | 108 // contains blocks 6, 2, 3, 5, and replace blocks contains |
108 // 12, 13, 14, 15, then op will be changed to read from: | 109 // 12, 13, 14, 15, then op will be changed to read from: |
109 // 1, 13, 14, 4, 15, 12, 7, 8 | 110 // 1, 13, 14, 4, 15, 12, 7, 8 |
110 static void SubstituteBlocks(Vertex* vertex, | 111 static void SubstituteBlocks(Vertex* vertex, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 DISALLOW_IMPLICIT_CONSTRUCTORS(DeltaDiffGenerator); | 216 DISALLOW_IMPLICIT_CONSTRUCTORS(DeltaDiffGenerator); |
216 }; | 217 }; |
217 | 218 |
218 extern const char* const kBsdiffPath; | 219 extern const char* const kBsdiffPath; |
219 extern const char* const kBspatchPath; | 220 extern const char* const kBspatchPath; |
220 extern const char* const kDeltaMagic; | 221 extern const char* const kDeltaMagic; |
221 | 222 |
222 }; // namespace chromeos_update_engine | 223 }; // namespace chromeos_update_engine |
223 | 224 |
224 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__ | 225 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__ |
OLD | NEW |