OLD | NEW |
---|---|
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 } | 73 } |
74 (*out) = string(&data[0], data.size()); | 74 (*out) = string(&data[0], data.size()); |
75 return true; | 75 return true; |
76 } | 76 } |
77 | 77 |
78 void HexDumpArray(const unsigned char* const arr, const size_t length) { | 78 void HexDumpArray(const unsigned char* const arr, const size_t length) { |
79 const unsigned char* const char_arr = | 79 const unsigned char* const char_arr = |
80 reinterpret_cast<const unsigned char* const>(arr); | 80 reinterpret_cast<const unsigned char* const>(arr); |
81 LOG(INFO) << "Logging array of length: " << length; | 81 LOG(INFO) << "Logging array of length: " << length; |
82 const unsigned int bytes_per_line = 16; | 82 const unsigned int bytes_per_line = 16; |
83 for (size_t i = 0; i < length; i += bytes_per_line) { | 83 for (uint32 i = 0; i < length; i += bytes_per_line) { |
Daniel Erat
2010/04/15 00:55:47
uint32_t
| |
84 const unsigned int bytes_remaining = length - i; | 84 const unsigned int bytes_remaining = length - i; |
85 const unsigned int bytes_per_this_line = min(bytes_per_line, | 85 const unsigned int bytes_per_this_line = min(bytes_per_line, |
86 bytes_remaining); | 86 bytes_remaining); |
87 char header[100]; | 87 char header[100]; |
88 int r = snprintf(header, sizeof(header), "0x%08x : ", i); | 88 int r = snprintf(header, sizeof(header), "0x%08x : ", i); |
89 TEST_AND_RETURN(r == 13); | 89 TEST_AND_RETURN(r == 13); |
90 string line = header; | 90 string line = header; |
91 for (unsigned int j = 0; j < bytes_per_this_line; j++) { | 91 for (unsigned int j = 0; j < bytes_per_this_line; j++) { |
92 char buf[20]; | 92 char buf[20]; |
93 unsigned char c = char_arr[i + j]; | 93 unsigned char c = char_arr[i + j]; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 TEST_AND_RETURN_FALSE_ERRNO(umount(mountpoint.c_str()) == 0); | 288 TEST_AND_RETURN_FALSE_ERRNO(umount(mountpoint.c_str()) == 0); |
289 return true; | 289 return true; |
290 } | 290 } |
291 | 291 |
292 const char* const kStatefulPartition = "/mnt/stateful_partition"; | 292 const char* const kStatefulPartition = "/mnt/stateful_partition"; |
293 | 293 |
294 } // namespace utils | 294 } // namespace utils |
295 | 295 |
296 } // namespace chromeos_update_engine | 296 } // namespace chromeos_update_engine |
297 | 297 |
OLD | NEW |