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

Unified Diff: active_main_firmware.cc

Issue 3530001: first cut: establishes base helper classes and main (Closed) Base URL: http://git.chromium.org/git/cros_boot_mode.git
Patch Set: truncation is bad, m'kay. . . 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « active_main_firmware.h ('k') | boot_mode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: active_main_firmware.cc
diff --git a/active_main_firmware.cc b/active_main_firmware.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c44cfa9e5160cd0b456b6e2839efcee418a29dd9
--- /dev/null
+++ b/active_main_firmware.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ActiveMainFirmware implementation
+
+#include "active_main_firmware.h"
+
+#include <sys/types.h>
+
+#include "helpers.h"
+
+namespace cros_boot_mode {
+
+const char *ActiveMainFirmware::kActiveMainFirmwareText[] = {
+ "recovery",
+ "a",
+ "b",
+};
+
+const char *ActiveMainFirmware::c_str() const {
+ return (value() >= 0 ? kActiveMainFirmwareText[value()] : "unsupported");
+}
+
+const size_t ActiveMainFirmware::kActiveMainFirmwareCount =
+ sizeof(kActiveMainFirmwareText) / sizeof(*kActiveMainFirmwareText);
+
+ActiveMainFirmware::ActiveMainFirmware() { }
+ActiveMainFirmware::~ActiveMainFirmware() { }
+
+int ActiveMainFirmware::Process(const char *contents, size_t length) {
+ int volume = helpers::to_int(contents, length);
+ if (volume >= 0 &&
+ volume < static_cast<int>(kActiveMainFirmwareCount))
+ return volume;
+ return kUnsupported;
+}
+
+} // namespace cros_boot_mode
« no previous file with comments | « active_main_firmware.h ('k') | boot_mode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698