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

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

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/utils.h ('k') | no next file » | 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 #include "update_engine/utils.h" 5 #include "update_engine/utils.h"
6 #include <sys/mount.h> 6 #include <sys/mount.h>
7 #include <sys/stat.h> 7 #include <sys/stat.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <dirent.h> 9 #include <dirent.h>
10 #include <errno.h> 10 #include <errno.h>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool ReadFileToString(const std::string& path, std::string* out) { 98 bool ReadFileToString(const std::string& path, std::string* out) {
99 vector<char> data; 99 vector<char> data;
100 bool success = ReadFile(path, &data); 100 bool success = ReadFile(path, &data);
101 if (!success) { 101 if (!success) {
102 return false; 102 return false;
103 } 103 }
104 (*out) = string(&data[0], data.size()); 104 (*out) = string(&data[0], data.size());
105 return true; 105 return true;
106 } 106 }
107 107
108 off_t FileSize(const string& path) {
109 struct stat stbuf;
110 int rc = stat(path.c_str(), &stbuf);
111 CHECK_EQ(rc, 0);
112 if (rc < 0)
113 return rc;
114 return stbuf.st_size;
115 }
116
108 void HexDumpArray(const unsigned char* const arr, const size_t length) { 117 void HexDumpArray(const unsigned char* const arr, const size_t length) {
109 const unsigned char* const char_arr = 118 const unsigned char* const char_arr =
110 reinterpret_cast<const unsigned char* const>(arr); 119 reinterpret_cast<const unsigned char* const>(arr);
111 LOG(INFO) << "Logging array of length: " << length; 120 LOG(INFO) << "Logging array of length: " << length;
112 const unsigned int bytes_per_line = 16; 121 const unsigned int bytes_per_line = 16;
113 for (uint32_t i = 0; i < length; i += bytes_per_line) { 122 for (uint32_t i = 0; i < length; i += bytes_per_line) {
114 const unsigned int bytes_remaining = length - i; 123 const unsigned int bytes_remaining = length - i;
115 const unsigned int bytes_per_this_line = min(bytes_per_line, 124 const unsigned int bytes_per_this_line = min(bytes_per_line,
116 bytes_remaining); 125 bytes_remaining);
117 char header[100]; 126 char header[100];
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 return "Unknown error."; 347 return "Unknown error.";
339 return error->message; 348 return error->message;
340 } 349 }
341 350
342 const char* const kStatefulPartition = "/mnt/stateful_partition"; 351 const char* const kStatefulPartition = "/mnt/stateful_partition";
343 352
344 } // namespace utils 353 } // namespace utils
345 354
346 } // namespace chromeos_update_engine 355 } // namespace chromeos_update_engine
347 356
OLDNEW
« no previous file with comments | « src/platform/update_engine/utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698