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 | 32 // Returns true if the boot mode is normal or if it's unable to determine the |
33 // recovery). | 33 // boot mode. Returns false if the boot mode is developer. |
34 bool IsNormalBootMode(); | 34 bool IsNormalBootMode(); |
35 | 35 |
36 // 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 |
37 // exists. Returns true on success, false otherwise. | 37 // exists. Returns true on success, false otherwise. |
38 bool WriteFile(const char* path, const char* data, int data_len); | 38 bool WriteFile(const char* path, const char* data, int data_len); |
39 | 39 |
40 // 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 |
41 // written to fd or an error occurs. Returns true on success. | 41 // written to fd or an error occurs. Returns true on success. |
42 bool WriteAll(int fd, const void* buf, size_t count); | 42 bool WriteAll(int fd, const void* buf, size_t count); |
43 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); |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 if (_error) { \ | 423 if (_error) { \ |
424 errno = _error; \ | 424 errno = _error; \ |
425 LOG(ERROR) << #_x " failed: " << _error; \ | 425 LOG(ERROR) << #_x " failed: " << _error; \ |
426 return false; \ | 426 return false; \ |
427 } \ | 427 } \ |
428 } while (0) | 428 } while (0) |
429 | 429 |
430 | 430 |
431 | 431 |
432 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ | 432 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ |
OLD | NEW |