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 #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 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace utils { | 23 namespace utils { |
24 | 24 |
25 // Returns true if this is an official Chrome OS build, false otherwise. | 25 // Returns true if this is an official Chrome OS build, false otherwise. |
26 bool IsOfficialBuild(); | 26 bool IsOfficialBuild(); |
27 | 27 |
28 // Returns true if the OOBE process has been completed and EULA accepted, false | 28 // Returns true if the OOBE process has been completed and EULA accepted, false |
29 // otherwise. | 29 // otherwise. |
30 bool IsOOBEComplete(); | 30 bool IsOOBEComplete(); |
31 | 31 |
| 32 // Returns true if the boot mode is normal, false otherwise (e.g., developer or |
| 33 // recovery). |
| 34 bool IsNormalBootMode(); |
| 35 |
32 // Writes the data passed to path. The file at path will be overwritten if it | 36 // Writes the data passed to path. The file at path will be overwritten if it |
33 // exists. Returns true on success, false otherwise. | 37 // exists. Returns true on success, false otherwise. |
34 bool WriteFile(const char* path, const char* data, int data_len); | 38 bool WriteFile(const char* path, const char* data, int data_len); |
35 | 39 |
36 // Calls write() or pwrite() repeatedly until all count bytes at buf are | 40 // Calls write() or pwrite() repeatedly until all count bytes at buf are |
37 // written to fd or an error occurs. Returns true on success. | 41 // written to fd or an error occurs. Returns true on success. |
38 bool WriteAll(int fd, const void* buf, size_t count); | 42 bool WriteAll(int fd, const void* buf, size_t count); |
39 bool PWriteAll(int fd, const void* buf, size_t count, off_t offset); | 43 bool PWriteAll(int fd, const void* buf, size_t count, off_t offset); |
40 | 44 |
41 // Calls pread() repeatedly until count bytes are read, or EOF is reached. | 45 // Calls pread() repeatedly until count bytes are read, or EOF is reached. |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 if (_error) { \ | 415 if (_error) { \ |
412 errno = _error; \ | 416 errno = _error; \ |
413 LOG(ERROR) << #_x " failed: " << _error; \ | 417 LOG(ERROR) << #_x " failed: " << _error; \ |
414 return false; \ | 418 return false; \ |
415 } \ | 419 } \ |
416 } while (0) | 420 } while (0) |
417 | 421 |
418 | 422 |
419 | 423 |
420 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ | 424 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ |
OLD | NEW |