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

Unified Diff: utils.cc

Issue 6098008: AU: Include a bit flag (bit 31) in error codes to indicate non-normal boot mode. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: review Created 9 years, 11 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 | « utils.h ('k') | utils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils.cc
diff --git a/utils.cc b/utils.cc
index 95b5ec9ad785d8dbbb1b0a17ad8131cc3b73a065..7206171e89e4dd24534fb975fa9554931c217410 100644
--- a/utils.cc
+++ b/utils.cc
@@ -25,6 +25,7 @@
#include <base/rand_util.h>
#include <base/string_util.h>
#include <base/logging.h>
+#include <cros_boot_mode/boot_mode.h>
#include <rootdev/rootdev.h>
#include "update_engine/file_writer.h"
@@ -50,6 +51,15 @@ bool IsOOBEComplete() {
return file_util::PathExists(FilePath(kOOBECompletedMarker));
}
+bool IsNormalBootMode() {
+ cros_boot_mode::BootMode mode;
+ mode.Initialize(false, // unsupported_is_developer
+ true); // use_bootloader
+ bool normal = mode.mode() == cros_boot_mode::BootMode::kNormal;
+ LOG_IF(INFO, !normal) << "Boot mode not normal: " << mode.mode_text();
+ return normal;
+}
+
bool WriteFile(const char* path, const char* data, int data_len) {
DirectFileWriter writer;
TEST_AND_RETURN_FALSE_ERRNO(0 == writer.Open(path,
« no previous file with comments | « utils.h ('k') | utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698