Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: utils.h

Issue 3034026: AU: Provide a reboot_if_needed D-Bus API. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: reboot error code doesn't necessarily signal a problem. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « update_engine_client.cc ('k') | utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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__
OLDNEW
« no previous file with comments | « update_engine_client.cc ('k') | utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698