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

Side by Side Diff: utils.h

Issue 2868105: Disable automatic update checks if booting from a removable device. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Created 10 years, 4 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 | « main.cc ('k') | 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 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // in the dirname param. Returns TRUE on success. dirname must not be NULL. 77 // in the dirname param. Returns TRUE on success. dirname must not be NULL.
78 bool MakeTempDirectory(const std::string& dirname_template, 78 bool MakeTempDirectory(const std::string& dirname_template,
79 std::string* dirname); 79 std::string* dirname);
80 80
81 // Deletes a directory and all its contents synchronously. Returns true 81 // Deletes a directory and all its contents synchronously. Returns true
82 // on success. This may be called with a regular file--it will just unlink it. 82 // on success. This may be called with a regular file--it will just unlink it.
83 // This WILL cross filesystem boundaries. 83 // This WILL cross filesystem boundaries.
84 bool RecursiveUnlinkDir(const std::string& path); 84 bool RecursiveUnlinkDir(const std::string& path);
85 85
86 // Returns the root device for a partition. For example, 86 // Returns the root device for a partition. For example,
87 // RootDevice("/dev/sda3") returns "/dev/sda". 87 // RootDevice("/dev/sda3") returns "/dev/sda". Returns an empty string
88 // if the input device is not of the "/dev/xyz" form.
88 std::string RootDevice(const std::string& partition_device); 89 std::string RootDevice(const std::string& partition_device);
89 90
90 // Returns the partition number, as a string, of partition_device. For example, 91 // Returns the partition number, as a string, of partition_device. For example,
91 // PartitionNumber("/dev/sda3") return "3". 92 // PartitionNumber("/dev/sda3") returns "3".
92 std::string PartitionNumber(const std::string& partition_device); 93 std::string PartitionNumber(const std::string& partition_device);
93 94
95 // Returns the sysfs block device for a root block device. For
96 // example, SysfsBlockDevice("/dev/sda") returns
97 // "/sys/block/sda". Returns an empty string if the input device is
98 // not of the "/dev/xyz" form.
99 std::string SysfsBlockDevice(const std::string& device);
100
101 // Returns true if the root |device| (e.g., "/dev/sdb") is known to be
102 // removable, false otherwise.
103 bool IsRemovableDevice(const std::string& device);
104
94 // Synchronously mount or unmount a filesystem. Return true on success. 105 // Synchronously mount or unmount a filesystem. Return true on success.
95 // Mounts as ext3 with default options. 106 // Mounts as ext3 with default options.
96 bool MountFilesystem(const std::string& device, const std::string& mountpoint, 107 bool MountFilesystem(const std::string& device, const std::string& mountpoint,
97 unsigned long flags); 108 unsigned long flags);
98 bool UnmountFilesystem(const std::string& mountpoint); 109 bool UnmountFilesystem(const std::string& mountpoint);
99 110
100 enum BootLoader { 111 enum BootLoader {
101 BootLoader_SYSLINUX = 0, 112 BootLoader_SYSLINUX = 0,
102 BootLoader_CHROME_FIRMWARE = 1 113 BootLoader_CHROME_FIRMWARE = 1
103 }; 114 };
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 bool _success = (_x); \ 311 bool _success = (_x); \
301 if (!_success) { \ 312 if (!_success) { \
302 LOG(ERROR) << #_x " failed."; \ 313 LOG(ERROR) << #_x " failed."; \
303 return; \ 314 return; \
304 } \ 315 } \
305 } while (0) 316 } while (0)
306 317
307 318
308 319
309 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ 320 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__
OLDNEW
« no previous file with comments | « main.cc ('k') | utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698