| 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> | 
| 11 #include <set> | 11 #include <set> | 
| 12 #include <string> | 12 #include <string> | 
| 13 #include <vector> | 13 #include <vector> | 
| 14 | 14 | 
| 15 #include <glib.h> | 15 #include <glib.h> | 
| 16 | 16 | 
| 17 #include "update_engine/action.h" | 17 #include "update_engine/action.h" | 
| 18 #include "update_engine/action_processor.h" | 18 #include "update_engine/action_processor.h" | 
| 19 | 19 | 
| 20 namespace chromeos_update_engine { | 20 namespace chromeos_update_engine { | 
| 21 | 21 | 
| 22 namespace utils { | 22 namespace utils { | 
| 23 | 23 | 
| 24 // Returns true if this is an official Chrome OS build, false | 24 // Returns true if this is an official Chrome OS build, false | 
| 25 // otherwise. Currently, this routine errs on the official build side | 25 // otherwise. Currently, this routine errs on the official build side | 
| 26 // -- if it doesn't recognize the update track as non-official, it | 26 // -- if it doesn't recognize the update track as non-official, it | 
| 27 // assumes the build is official. | 27 // assumes the build is official. | 
| 28 bool IsOfficialBuild(); | 28 bool IsOfficialBuild(); | 
| 29 | 29 | 
|  | 30 // Returns true if the OOBE process has been completed and EULA accepted, false | 
|  | 31 // otherwise. | 
|  | 32 bool IsOOBEComplete(); | 
|  | 33 | 
| 30 // Writes the data passed to path. The file at path will be overwritten if it | 34 // Writes the data passed to path. The file at path will be overwritten if it | 
| 31 // exists. Returns true on success, false otherwise. | 35 // exists. Returns true on success, false otherwise. | 
| 32 bool WriteFile(const char* path, const char* data, int data_len); | 36 bool WriteFile(const char* path, const char* data, int data_len); | 
| 33 | 37 | 
| 34 // Calls write() or pwrite() repeatedly until all count bytes at buf are | 38 // Calls write() or pwrite() repeatedly until all count bytes at buf are | 
| 35 // written to fd or an error occurs. Returns true on success. | 39 // written to fd or an error occurs. Returns true on success. | 
| 36 bool WriteAll(int fd, const void* buf, size_t count); | 40 bool WriteAll(int fd, const void* buf, size_t count); | 
| 37 bool PWriteAll(int fd, const void* buf, size_t count, off_t offset); | 41 bool PWriteAll(int fd, const void* buf, size_t count, off_t offset); | 
| 38 | 42 | 
| 39 // Calls pread() repeatedly until count bytes are read, or EOF is reached. | 43 // Calls pread() repeatedly until count bytes are read, or EOF is reached. | 
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 333     bool _success = (_x);                                                      \ | 337     bool _success = (_x);                                                      \ | 
| 334     if (!_success) {                                                           \ | 338     if (!_success) {                                                           \ | 
| 335       LOG(ERROR) << #_x " failed.";                                            \ | 339       LOG(ERROR) << #_x " failed.";                                            \ | 
| 336       return;                                                                  \ | 340       return;                                                                  \ | 
| 337     }                                                                          \ | 341     }                                                                          \ | 
| 338   } while (0) | 342   } while (0) | 
| 339 | 343 | 
| 340 | 344 | 
| 341 | 345 | 
| 342 #endif  // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ | 346 #endif  // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ | 
| OLD | NEW | 
|---|