| 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
|
|
|