| 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 #include "update_engine/delta_performer.h" | 5 #include "update_engine/delta_performer.h" |
| 6 #include <endian.h> | 6 #include <endian.h> |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <cstring> | 9 #include <cstring> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ssize_t total_operations = manifest_.install_operations_size() + | 186 ssize_t total_operations = manifest_.install_operations_size() + |
| 187 manifest_.kernel_install_operations_size(); | 187 manifest_.kernel_install_operations_size(); |
| 188 while (next_operation_num_ < total_operations) { | 188 while (next_operation_num_ < total_operations) { |
| 189 const DeltaArchiveManifest_InstallOperation &op = | 189 const DeltaArchiveManifest_InstallOperation &op = |
| 190 next_operation_num_ < manifest_.install_operations_size() ? | 190 next_operation_num_ < manifest_.install_operations_size() ? |
| 191 manifest_.install_operations(next_operation_num_) : | 191 manifest_.install_operations(next_operation_num_) : |
| 192 manifest_.kernel_install_operations( | 192 manifest_.kernel_install_operations( |
| 193 next_operation_num_ - manifest_.install_operations_size()); | 193 next_operation_num_ - manifest_.install_operations_size()); |
| 194 if (!CanPerformInstallOperation(op)) | 194 if (!CanPerformInstallOperation(op)) |
| 195 break; | 195 break; |
| 196 LOG(INFO) << "Performing operation " << next_operation_num_ << "/" |
| 197 << total_operations; |
| 196 bool is_kernel_partition = | 198 bool is_kernel_partition = |
| 197 (next_operation_num_ >= manifest_.install_operations_size()); | 199 (next_operation_num_ >= manifest_.install_operations_size()); |
| 198 if (op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE || | 200 if (op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE || |
| 199 op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ) { | 201 op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ) { |
| 200 if (!PerformReplaceOperation(op, is_kernel_partition)) { | 202 if (!PerformReplaceOperation(op, is_kernel_partition)) { |
| 201 LOG(ERROR) << "Failed to perform replace operation " | 203 LOG(ERROR) << "Failed to perform replace operation " |
| 202 << next_operation_num_; | 204 << next_operation_num_; |
| 203 return -EINVAL; | 205 return -EINVAL; |
| 204 } | 206 } |
| 205 } else if (op.type() == DeltaArchiveManifest_InstallOperation_Type_MOVE) { | 207 } else if (op.type() == DeltaArchiveManifest_InstallOperation_Type_MOVE) { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 utils::PWriteAll(fd, &zeros[0], end_byte - begin_byte, begin_byte)); | 425 utils::PWriteAll(fd, &zeros[0], end_byte - begin_byte, begin_byte)); |
| 424 } | 426 } |
| 425 | 427 |
| 426 // Update buffer. | 428 // Update buffer. |
| 427 buffer_offset_ += operation.data_length(); | 429 buffer_offset_ += operation.data_length(); |
| 428 RemoveBufferHeadBytes(&buffer_, operation.data_length()); | 430 RemoveBufferHeadBytes(&buffer_, operation.data_length()); |
| 429 return true; | 431 return true; |
| 430 } | 432 } |
| 431 | 433 |
| 432 } // namespace chromeos_update_engine | 434 } // namespace chromeos_update_engine |
| OLD | NEW |