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_ << "/" | 196 // Log every thousandth operation, and also the first and last ones |
197 << total_operations; | 197 if ((next_operation_num_ % 1000 == 0) || |
| 198 (next_operation_num_ + 1 == total_operations)) { |
| 199 LOG(INFO) << "Performing operation " << (next_operation_num_ + 1) << "/" |
| 200 << total_operations; |
| 201 } |
198 bool is_kernel_partition = | 202 bool is_kernel_partition = |
199 (next_operation_num_ >= manifest_.install_operations_size()); | 203 (next_operation_num_ >= manifest_.install_operations_size()); |
200 if (op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE || | 204 if (op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE || |
201 op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ) { | 205 op.type() == DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ) { |
202 if (!PerformReplaceOperation(op, is_kernel_partition)) { | 206 if (!PerformReplaceOperation(op, is_kernel_partition)) { |
203 LOG(ERROR) << "Failed to perform replace operation " | 207 LOG(ERROR) << "Failed to perform replace operation " |
204 << next_operation_num_; | 208 << next_operation_num_; |
205 return -EINVAL; | 209 return -EINVAL; |
206 } | 210 } |
207 } else if (op.type() == DeltaArchiveManifest_InstallOperation_Type_MOVE) { | 211 } else if (op.type() == DeltaArchiveManifest_InstallOperation_Type_MOVE) { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 utils::PWriteAll(fd, &zeros[0], end_byte - begin_byte, begin_byte)); | 429 utils::PWriteAll(fd, &zeros[0], end_byte - begin_byte, begin_byte)); |
426 } | 430 } |
427 | 431 |
428 // Update buffer. | 432 // Update buffer. |
429 buffer_offset_ += operation.data_length(); | 433 buffer_offset_ += operation.data_length(); |
430 RemoveBufferHeadBytes(&buffer_, operation.data_length()); | 434 RemoveBufferHeadBytes(&buffer_, operation.data_length()); |
431 return true; | 435 return true; |
432 } | 436 } |
433 | 437 |
434 } // namespace chromeos_update_engine | 438 } // namespace chromeos_update_engine |
OLD | NEW |