| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium 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_UTILS_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 BootLoader_SYSLINUX = 0, | 95 BootLoader_SYSLINUX = 0, |
| 96 BootLoader_CHROME_FIRMWARE = 1 | 96 BootLoader_CHROME_FIRMWARE = 1 |
| 97 }; | 97 }; |
| 98 // Detects which bootloader this system uses and returns it via the out | 98 // Detects which bootloader this system uses and returns it via the out |
| 99 // param. Returns true on success. | 99 // param. Returns true on success. |
| 100 bool GetBootloader(BootLoader* out_bootloader); | 100 bool GetBootloader(BootLoader* out_bootloader); |
| 101 | 101 |
| 102 // Returns the error message, if any, from a GError pointer. | 102 // Returns the error message, if any, from a GError pointer. |
| 103 const char* GetGErrorMessage(const GError* error); | 103 const char* GetGErrorMessage(const GError* error); |
| 104 | 104 |
| 105 // Initiates a system reboot. Returns true on success, false otherwise. |
| 106 bool Reboot(); |
| 107 |
| 105 // Log a string in hex to LOG(INFO). Useful for debugging. | 108 // Log a string in hex to LOG(INFO). Useful for debugging. |
| 106 void HexDumpArray(const unsigned char* const arr, const size_t length); | 109 void HexDumpArray(const unsigned char* const arr, const size_t length); |
| 107 inline void HexDumpString(const std::string& str) { | 110 inline void HexDumpString(const std::string& str) { |
| 108 HexDumpArray(reinterpret_cast<const unsigned char*>(str.data()), str.size()); | 111 HexDumpArray(reinterpret_cast<const unsigned char*>(str.data()), str.size()); |
| 109 } | 112 } |
| 110 inline void HexDumpVector(const std::vector<char>& vect) { | 113 inline void HexDumpVector(const std::vector<char>& vect) { |
| 111 HexDumpArray(reinterpret_cast<const unsigned char*>(&vect[0]), vect.size()); | 114 HexDumpArray(reinterpret_cast<const unsigned char*>(&vect[0]), vect.size()); |
| 112 } | 115 } |
| 113 | 116 |
| 114 extern const char* const kStatefulPartition; | 117 extern const char* const kStatefulPartition; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 bool _success = (_x); \ | 294 bool _success = (_x); \ |
| 292 if (!_success) { \ | 295 if (!_success) { \ |
| 293 LOG(ERROR) << #_x " failed."; \ | 296 LOG(ERROR) << #_x " failed."; \ |
| 294 return; \ | 297 return; \ |
| 295 } \ | 298 } \ |
| 296 } while (0) | 299 } while (0) |
| 297 | 300 |
| 298 | 301 |
| 299 | 302 |
| 300 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ | 303 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ |
| OLD | NEW |