update_engine: Cleanup of HardwareInterface - const/override
Made most of the members of HardwareInterface 'const' and
used C++11's override on implementations to guard against method
signature changes.
BUG=None
TEST=Ran all unit tests
Change-Id: I33eecb0e6a0fc662da75fbf8d9953f0bb09cb08d
Reviewed-on: https://chromium-review.googlesource.com/187483
Tested-by: Alex Vakulenko <[email protected]>
Reviewed-by: Alex Vakulenko <[email protected]>
Commit-Queue: Alex Vakulenko <[email protected]>
diff --git a/hardware_interface.h b/hardware_interface.h
index 58157d0..f55d700 100644
--- a/hardware_interface.h
+++ b/hardware_interface.h
@@ -19,18 +19,18 @@
class HardwareInterface {
public:
// Returns the currently booted kernel partition. "/dev/sda2", for example.
- virtual const std::string BootKernelDevice() = 0;
+ virtual std::string BootKernelDevice() const = 0;
// Returns the currently booted rootfs partition. "/dev/sda3", for example.
- virtual const std::string BootDevice() = 0;
+ virtual std::string BootDevice() const = 0;
// Returns a list of all kernel partitions available (whether bootable or not)
- virtual std::vector<std::string> GetKernelDevices() = 0;
+ virtual std::vector<std::string> GetKernelDevices() const = 0;
// Is the specified kernel partition currently bootable, based on GPT flags?
// Returns success.
virtual bool IsKernelBootable(const std::string& kernel_device,
- bool* bootable) = 0;
+ bool* bootable) const = 0;
// Mark the specified kernel partition unbootable in GPT flags. We mark
// the other kernel as bootable inside postinst, not inside the UE.
@@ -38,23 +38,23 @@
virtual bool MarkKernelUnbootable(const std::string& kernel_device) = 0;
// Returns true if this is an official Chrome OS build, false otherwise.
- virtual bool IsOfficialBuild() = 0;
+ virtual bool IsOfficialBuild() const = 0;
// Returns true if the boot mode is normal or if it's unable to
// determine the boot mode. Returns false if the boot mode is
// developer.
- virtual bool IsNormalBootMode() = 0;
+ virtual bool IsNormalBootMode() const = 0;
// Returns the HWID or an empty string on error.
- virtual std::string GetHardwareClass() = 0;
+ virtual std::string GetHardwareClass() const = 0;
// Returns the firmware version or an empty string if the system is
// not running chrome os firmware.
- virtual std::string GetFirmwareVersion() = 0;
+ virtual std::string GetFirmwareVersion() const = 0;
// Returns the ec version or an empty string if the system is not
// running a custom chrome os ec.
- virtual std::string GetECVersion() = 0;
+ virtual std::string GetECVersion() const = 0;
virtual ~HardwareInterface() {}
};