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

Side by Side Diff: utils.h

Issue 3706006: AU: Add a utility routine to get the filesystem size from a device. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: review comments Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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) 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Returns true if the root |device| (e.g., "/dev/sdb") is known to be 108 // Returns true if the root |device| (e.g., "/dev/sdb") is known to be
109 // removable, false otherwise. 109 // removable, false otherwise.
110 bool IsRemovableDevice(const std::string& device); 110 bool IsRemovableDevice(const std::string& device);
111 111
112 // Synchronously mount or unmount a filesystem. Return true on success. 112 // Synchronously mount or unmount a filesystem. Return true on success.
113 // Mounts as ext3 with default options. 113 // Mounts as ext3 with default options.
114 bool MountFilesystem(const std::string& device, const std::string& mountpoint, 114 bool MountFilesystem(const std::string& device, const std::string& mountpoint,
115 unsigned long flags); 115 unsigned long flags);
116 bool UnmountFilesystem(const std::string& mountpoint); 116 bool UnmountFilesystem(const std::string& mountpoint);
117 117
118 // Returns the block count and the block byte size of the ext3 file system on
119 // |device| (which may be a real device or a path to a filesystem image) or on
120 // an opened file descriptor |fd|. The actual file-system size is |block_count|
121 // * |block_size| bytes. Returns true on success, false otherwise.
122 bool GetFilesystemSize(const std::string& device,
123 int* out_block_count,
124 int* out_block_size);
125 bool GetFilesystemSizeFromFD(int fd,
126 int* out_block_count,
127 int* out_block_size);
128
118 enum BootLoader { 129 enum BootLoader {
119 BootLoader_SYSLINUX = 0, 130 BootLoader_SYSLINUX = 0,
120 BootLoader_CHROME_FIRMWARE = 1 131 BootLoader_CHROME_FIRMWARE = 1
121 }; 132 };
122 // Detects which bootloader this system uses and returns it via the out 133 // Detects which bootloader this system uses and returns it via the out
123 // param. Returns true on success. 134 // param. Returns true on success.
124 bool GetBootloader(BootLoader* out_bootloader); 135 bool GetBootloader(BootLoader* out_bootloader);
125 136
126 // Returns the error message, if any, from a GError pointer. 137 // Returns the error message, if any, from a GError pointer.
127 const char* GetGErrorMessage(const GError* error); 138 const char* GetGErrorMessage(const GError* error);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 bool _success = (_x); \ 361 bool _success = (_x); \
351 if (!_success) { \ 362 if (!_success) { \
352 LOG(ERROR) << #_x " failed."; \ 363 LOG(ERROR) << #_x " failed."; \
353 return; \ 364 return; \
354 } \ 365 } \
355 } while (0) 366 } while (0)
356 367
357 368
358 369
359 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ 370 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__
OLDNEW
« no previous file with comments | « no previous file | utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698