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

Side by Side Diff: src/platform/update_engine/utils.h

Issue 1819002: AU: delta compress the kernel partition (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: fixes for review Created 10 years, 7 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
« no previous file with comments | « src/platform/update_engine/update_metadata.proto ('k') | src/platform/update_engine/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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium 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>
(...skipping 18 matching lines...) Expand all
29 29
30 // Calls pread() repeatedly until count bytes are read, or EOF is reached. 30 // Calls pread() repeatedly until count bytes are read, or EOF is reached.
31 // Returns number of bytes read in *bytes_read. Returns true on success. 31 // Returns number of bytes read in *bytes_read. Returns true on success.
32 bool PReadAll(int fd, void* buf, size_t count, off_t offset, 32 bool PReadAll(int fd, void* buf, size_t count, off_t offset,
33 ssize_t* out_bytes_read); 33 ssize_t* out_bytes_read);
34 34
35 // Returns the entire contents of the file at path. Returns true on success. 35 // Returns the entire contents of the file at path. Returns true on success.
36 bool ReadFile(const std::string& path, std::vector<char>* out); 36 bool ReadFile(const std::string& path, std::vector<char>* out);
37 bool ReadFileToString(const std::string& path, std::string* out); 37 bool ReadFileToString(const std::string& path, std::string* out);
38 38
39 // Returns the size of the file at path. If the file doesn't exist or some
40 // error occurrs, -1 is returned.
41 off_t FileSize(const std::string& path);
42
39 std::string ErrnoNumberAsString(int err); 43 std::string ErrnoNumberAsString(int err);
40 44
41 // Strips duplicate slashes, and optionally removes all trailing slashes. 45 // Strips duplicate slashes, and optionally removes all trailing slashes.
42 // Does not compact /./ or /../. 46 // Does not compact /./ or /../.
43 std::string NormalizePath(const std::string& path, bool strip_trailing_slash); 47 std::string NormalizePath(const std::string& path, bool strip_trailing_slash);
44 48
45 // Returns true if the file exists for sure. Returns false if it doesn't exist, 49 // Returns true if the file exists for sure. Returns false if it doesn't exist,
46 // or an error occurs. 50 // or an error occurs.
47 bool FileExists(const char* path); 51 bool FileExists(const char* path);
48 52
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 bool _success = (_x); \ 268 bool _success = (_x); \
265 if (!_success) { \ 269 if (!_success) { \
266 LOG(ERROR) << #_x " failed."; \ 270 LOG(ERROR) << #_x " failed."; \
267 return; \ 271 return; \
268 } \ 272 } \
269 } while (0) 273 } while (0)
270 274
271 275
272 276
273 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ 277 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__
OLDNEW
« no previous file with comments | « src/platform/update_engine/update_metadata.proto ('k') | src/platform/update_engine/utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698