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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // operation. If there is a change, or the old file doesn't exist, | 96 // operation. If there is a change, or the old file doesn't exist, |
97 // the smallest of REPLACE, REPLACE_BZ, or BSDIFF wins. | 97 // the smallest of REPLACE, REPLACE_BZ, or BSDIFF wins. |
98 // new_filename must contain at least one byte. | 98 // new_filename must contain at least one byte. |
99 // Returns true on success. | 99 // Returns true on success. |
100 static bool ReadFileToDiff(const std::string& old_filename, | 100 static bool ReadFileToDiff(const std::string& old_filename, |
101 const std::string& new_filename, | 101 const std::string& new_filename, |
102 std::vector<char>* out_data, | 102 std::vector<char>* out_data, |
103 DeltaArchiveManifest_InstallOperation* out_op, | 103 DeltaArchiveManifest_InstallOperation* out_op, |
104 bool gather_extents); | 104 bool gather_extents); |
105 | 105 |
| 106 // Similar to ReadFileToDiff but instead of working with a regular file, |
| 107 // this function processes all file system related metadata and adds the |
| 108 // required operations to graph. |
| 109 static bool DeltaReadMetadata(Graph* graph, |
| 110 std::vector<Block>* blocks, |
| 111 const std::string& old_image, |
| 112 const std::string& new_image, |
| 113 int data_fd, |
| 114 off_t* data_file_size); |
| 115 |
106 // Creates a dummy REPLACE_BZ node in the given |vertex|. This can be used | 116 // Creates a dummy REPLACE_BZ node in the given |vertex|. This can be used |
107 // to provide scratch space. The node writes |num_blocks| blocks starting at | 117 // to provide scratch space. The node writes |num_blocks| blocks starting at |
108 // |start_block|The node should be marked invalid before writing all nodes to | 118 // |start_block|The node should be marked invalid before writing all nodes to |
109 // the output file. | 119 // the output file. |
110 static void CreateScratchNode(uint64_t start_block, | 120 static void CreateScratchNode(uint64_t start_block, |
111 uint64_t num_blocks, | 121 uint64_t num_blocks, |
112 Vertex* vertex); | 122 Vertex* vertex); |
113 | 123 |
114 // Modifies blocks read by 'op' so that any blocks referred to by | 124 // Modifies blocks read by 'op' so that any blocks referred to by |
115 // 'remove_extents' are replaced with blocks from 'replace_extents'. | 125 // 'remove_extents' are replaced with blocks from 'replace_extents'. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 DISALLOW_IMPLICIT_CONSTRUCTORS(DeltaDiffGenerator); | 228 DISALLOW_IMPLICIT_CONSTRUCTORS(DeltaDiffGenerator); |
219 }; | 229 }; |
220 | 230 |
221 extern const char* const kBsdiffPath; | 231 extern const char* const kBsdiffPath; |
222 extern const char* const kBspatchPath; | 232 extern const char* const kBspatchPath; |
223 extern const char* const kDeltaMagic; | 233 extern const char* const kDeltaMagic; |
224 | 234 |
225 }; // namespace chromeos_update_engine | 235 }; // namespace chromeos_update_engine |
226 | 236 |
227 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__ | 237 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__ |
OLD | NEW |