| 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 | 6 |
| 7 #include <endian.h> | 7 #include <endian.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "update_engine/subprocess.h" | 26 #include "update_engine/subprocess.h" |
| 27 #include "update_engine/terminator.h" | 27 #include "update_engine/terminator.h" |
| 28 | 28 |
| 29 using std::min; | 29 using std::min; |
| 30 using std::string; | 30 using std::string; |
| 31 using std::vector; | 31 using std::vector; |
| 32 using google::protobuf::RepeatedPtrField; | 32 using google::protobuf::RepeatedPtrField; |
| 33 | 33 |
| 34 namespace chromeos_update_engine { | 34 namespace chromeos_update_engine { |
| 35 | 35 |
| 36 const char DeltaPerformer::kUpdatePayloadPublicKeyPath[] = |
| 37 "/usr/share/update_engine/update-payload-key.pub.pem"; |
| 38 |
| 36 namespace { | 39 namespace { |
| 37 | 40 |
| 38 const int kDeltaVersionLength = 8; | 41 const int kDeltaVersionLength = 8; |
| 39 const int kDeltaProtobufLengthLength = 8; | 42 const int kDeltaProtobufLengthLength = 8; |
| 40 const char kUpdatePayloadPublicKeyPath[] = | |
| 41 "/usr/share/update_engine/update-payload-key.pub.pem"; | |
| 42 const int kUpdateStateOperationInvalid = -1; | 43 const int kUpdateStateOperationInvalid = -1; |
| 43 const int kMaxResumedUpdateFailures = 10; | 44 const int kMaxResumedUpdateFailures = 10; |
| 44 | 45 |
| 45 // Converts extents to a human-readable string, for use by DumpUpdateProto(). | 46 // Converts extents to a human-readable string, for use by DumpUpdateProto(). |
| 46 string ExtentsToString(const RepeatedPtrField<Extent>& extents) { | 47 string ExtentsToString(const RepeatedPtrField<Extent>& extents) { |
| 47 string ret; | 48 string ret; |
| 48 for (int i = 0; i < extents.size(); i++) { | 49 for (int i = 0; i < extents.size(); i++) { |
| 49 const Extent& extent = extents.Get(i); | 50 const Extent& extent = extents.Get(i); |
| 50 if (extent.start_block() == kSparseHole) { | 51 if (extent.start_block() == kSparseHole) { |
| 51 ret += StringPrintf("{kSparseHole, %" PRIu64 "}, ", extent.num_blocks()); | 52 ret += StringPrintf("{kSparseHole, %" PRIu64 "}, ", extent.num_blocks()); |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 if (prefs_->GetInt64(kPrefsResumedUpdateFailures, &resumed_update_failures)) { | 763 if (prefs_->GetInt64(kPrefsResumedUpdateFailures, &resumed_update_failures)) { |
| 763 resumed_update_failures++; | 764 resumed_update_failures++; |
| 764 } else { | 765 } else { |
| 765 resumed_update_failures = 1; | 766 resumed_update_failures = 1; |
| 766 } | 767 } |
| 767 prefs_->SetInt64(kPrefsResumedUpdateFailures, resumed_update_failures); | 768 prefs_->SetInt64(kPrefsResumedUpdateFailures, resumed_update_failures); |
| 768 return true; | 769 return true; |
| 769 } | 770 } |
| 770 | 771 |
| 771 } // namespace chromeos_update_engine | 772 } // namespace chromeos_update_engine |
| OLD | NEW |