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

Unified Diff: src/platform/update_engine/utils.cc

Issue 1694025: AU: Update Downloader to support our image formats. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: fixes for review Created 10 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/update_engine/utils.h ('k') | src/platform/update_engine/utils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/update_engine/utils.cc
diff --git a/src/platform/update_engine/utils.cc b/src/platform/update_engine/utils.cc
index 85d9e7db559d884414c7016d8fb2f763b08feffb..83096d28378698df786e0b3aebdb54223ffad27b 100644
--- a/src/platform/update_engine/utils.cc
+++ b/src/platform/update_engine/utils.cc
@@ -297,7 +297,7 @@ bool StringHasPrefix(const std::string& str, const std::string& prefix) {
return 0 == str.compare(0, prefix.size(), prefix);
}
-const std::string BootDevice() {
+const string BootDevice() {
string proc_cmdline;
if (!ReadFileToString("/proc/cmdline", &proc_cmdline))
return "";
@@ -324,6 +324,21 @@ const std::string BootDevice() {
// TODO(adlr): use findfs to figure out UUID= or LABEL= filesystems
}
+const string BootKernelDevice(const std::string& boot_device) {
+ // Currntly this assumes the last digit of the boot device is
+ // 3, 5, or 7, and changes it to 2, 4, or 6, respectively, to
+ // get the kernel device.
+ string ret = boot_device;
+ if (ret.empty())
+ return ret;
+ char last_char = ret[ret.size() - 1];
+ if (last_char == '3' || last_char == '5' || last_char == '7') {
+ ret[ret.size() - 1] = last_char - 1;
+ return ret;
+ }
+ return "";
+}
+
bool MountFilesystem(const string& device,
const string& mountpoint,
unsigned long mountflags) {
« no previous file with comments | « src/platform/update_engine/utils.h ('k') | src/platform/update_engine/utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698