blob: 2b45df3f73c89f3e21efd275e1b6e3a09430ba19 [file] [log] [blame]
adlr@google.com3defe6a2009-12-04 20:57:17 +00001// 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 Reyesf9714432010-05-04 10:21:23 -070010#include "update_engine/install_plan.h"
adlr@google.com3defe6a2009-12-04 20:57:17 +000011
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
18namespace chromeos_update_engine {
19
20class SetBootableFlagAction;
21
22template<>
23class ActionTraits<SetBootableFlagAction> {
24 public:
25 // Takes the device path as input.
Andrew de los Reyesf9714432010-05-04 10:21:23 -070026 typedef InstallPlan InputObjectType;
adlr@google.com3defe6a2009-12-04 20:57:17 +000027 // Passes the device path as output
Andrew de los Reyesf9714432010-05-04 10:21:23 -070028 typedef InstallPlan OutputObjectType;
adlr@google.com3defe6a2009-12-04 20:57:17 +000029};
30
31class 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.com3defe6a2009-12-04 20:57:17 +000049
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__