adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_SET_BOOTABLE_FLAG_ACTION_H__ |
| 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_SET_BOOTABLE_FLAG_ACTION_H__ |
| 7 | |
| 8 | #include <string> |
| 9 | #include "update_engine/action.h" |
Andrew de los Reyes | f971443 | 2010-05-04 10:21:23 -0700 | [diff] [blame] | 10 | #include "update_engine/install_plan.h" |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 11 | |
| 12 | // This class takes in a device via the input pipe. The device is the |
| 13 | // partition (e.g. /dev/sda1), not the full device (e.g. /dev/sda). |
| 14 | // It will make that device bootable by editing the partition table |
| 15 | // in the root device. Currently, this class doesn't support extended |
| 16 | // partitions. |
| 17 | |
| 18 | namespace chromeos_update_engine { |
| 19 | |
| 20 | class SetBootableFlagAction; |
| 21 | |
| 22 | template<> |
| 23 | class ActionTraits<SetBootableFlagAction> { |
| 24 | public: |
| 25 | // Takes the device path as input. |
Andrew de los Reyes | f971443 | 2010-05-04 10:21:23 -0700 | [diff] [blame] | 26 | typedef InstallPlan InputObjectType; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 27 | // Passes the device path as output |
Andrew de los Reyes | f971443 | 2010-05-04 10:21:23 -0700 | [diff] [blame] | 28 | typedef InstallPlan OutputObjectType; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | class SetBootableFlagAction : public Action<SetBootableFlagAction> { |
| 32 | public: |
| 33 | SetBootableFlagAction() {} |
| 34 | typedef ActionTraits<SetBootableFlagAction>::InputObjectType |
| 35 | InputObjectType; |
| 36 | typedef ActionTraits<SetBootableFlagAction>::OutputObjectType |
| 37 | OutputObjectType; |
| 38 | void PerformAction(); |
| 39 | |
| 40 | // This is a synchronous action, and thus TerminateProcessing() should |
| 41 | // never be called |
| 42 | void TerminateProcessing() { CHECK(false); } |
| 43 | |
| 44 | // Debugging/logging |
| 45 | static std::string StaticType() { return "SetBootableFlagAction"; } |
| 46 | std::string Type() const { return StaticType(); } |
| 47 | |
| 48 | private: |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 49 | |
| 50 | DISALLOW_COPY_AND_ASSIGN(SetBootableFlagAction); |
| 51 | }; |
| 52 | |
| 53 | } // namespace chromeos_update_engine |
| 54 | |
| 55 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_SET_BOOTABLE_FLAG_ACTION_H__ |