Check in a clang-tidy
This should've been done when we first created the repo, but better late
than never.
Signed-off-by: Ed Tanous <edtanous@google.com>
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: I68da1d13167ec94f9d008dea307c9f23a991d42c
diff --git a/src/estoraged.cpp b/src/estoraged.cpp
index 4f7fc40..b52a5f4 100644
--- a/src/estoraged.cpp
+++ b/src/estoraged.cpp
@@ -9,11 +9,11 @@
#include <libcryptsetup.h>
#include <openssl/rand.h>
-#include <stdlib.h>
#include <phosphor-logging/lg2.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <cstdlib>
#include <filesystem>
#include <iostream>
#include <string_view>
@@ -26,7 +26,7 @@
using sdbusplus::xyz::openbmc_project::Common::Error::ResourceNotFound;
using sdbusplus::xyz::openbmc_project::Common::Error::UnsupportedRequest;
-void eStoraged::formatLuks(std::vector<uint8_t> password, FilesystemType type)
+void EStoraged::formatLuks(std::vector<uint8_t> password, FilesystemType type)
{
std::string msg = "OpenBMC.0.1.DriveFormat";
lg2::info("Starting format", "REDFISH_MESSAGE_ID", msg);
@@ -53,7 +53,7 @@
mountFilesystem();
}
-void eStoraged::erase(EraseMethod inEraseMethod)
+void EStoraged::erase(EraseMethod inEraseMethod)
{
std::cerr << "Erasing encrypted eMMC" << std::endl;
lg2::info("Starting erase", "REDFISH_MESSAGE_ID",
@@ -115,7 +115,7 @@
}
}
-void eStoraged::lock()
+void EStoraged::lock()
{
std::string msg = "OpenBMC.0.1.DriveLock";
lg2::info("Starting lock", "REDFISH_MESSAGE_ID", msg);
@@ -124,7 +124,7 @@
deactivateLuksDev();
}
-void eStoraged::unlock(std::vector<uint8_t> password)
+void EStoraged::unlock(std::vector<uint8_t> password)
{
std::string msg = "OpenBMC.0.1.DriveUnlock";
lg2::info("Starting unlock", "REDFISH_MESSAGE_ID", msg);
@@ -141,24 +141,25 @@
mountFilesystem();
}
-void eStoraged::changePassword(std::vector<uint8_t>, std::vector<uint8_t>)
+void EStoraged::changePassword(std::vector<uint8_t> /*oldPassword*/,
+ std::vector<uint8_t> /*newPassword*/)
{
std::cerr << "Changing password for encrypted eMMC" << std::endl;
lg2::info("Starting change password", "REDFISH_MESSAGE_ID",
std::string("OpenBMC.0.1.DrivePasswordChanged"));
}
-bool eStoraged::isLocked() const
+bool EStoraged::isLocked() const
{
return locked();
}
-std::string_view eStoraged::getMountPoint() const
+std::string_view EStoraged::getMountPoint() const
{
return mountPoint;
}
-void eStoraged::formatLuksDev(struct crypt_device* cd,
+void EStoraged::formatLuksDev(struct crypt_device* cd,
std::vector<uint8_t> password)
{
lg2::info("Formatting device {DEV}", "DEV", devPath, "REDFISH_MESSAGE_ID",
@@ -206,7 +207,7 @@
std::string("OpenBMC.0.1.FormatLuksDevSuccess"));
}
-void eStoraged::activateLuksDev(struct crypt_device* cd,
+void EStoraged::activateLuksDev(struct crypt_device* cd,
std::vector<uint8_t> password)
{
lg2::info("Activating LUKS dev {DEV}", "DEV", devPath, "REDFISH_MESSAGE_ID",
@@ -241,11 +242,11 @@
std::string("OpenBMC.0.1.ActivateLuksDevSuccess"));
}
-void eStoraged::createFilesystem()
+void EStoraged::createFilesystem()
{
/* Run the command to create the filesystem. */
int retval = fsIface->runMkfs(containerName);
- if (retval)
+ if (retval != 0)
{
lg2::error("Failed to create filesystem: {RETVAL}", "RETVAL", retval,
"REDFISH_MESSAGE_ID",
@@ -257,7 +258,7 @@
std::string("OpenBMC.0.1.CreateFilesystemSuccess"));
}
-void eStoraged::mountFilesystem()
+void EStoraged::mountFilesystem()
{
/*
* Create directory for the filesystem, if it's not already present. It
@@ -281,7 +282,7 @@
std::string luksContainer("/dev/mapper/" + containerName);
int retval = fsIface->doMount(luksContainer.c_str(), mountPoint.c_str(),
"ext4", 0, nullptr);
- if (retval)
+ if (retval != 0)
{
lg2::error("Failed to mount filesystem: {RETVAL}", "RETVAL", retval,
"REDFISH_MESSAGE_ID",
@@ -302,10 +303,10 @@
std::string("OpenBMC.0.1.MountFilesystemSuccess"));
}
-void eStoraged::unmountFilesystem()
+void EStoraged::unmountFilesystem()
{
int retval = fsIface->doUnmount(mountPoint.c_str());
- if (retval)
+ if (retval != 0)
{
lg2::error("Failed to unmount filesystem: {RETVAL}", "RETVAL", retval,
"REDFISH_MESSAGE_ID",
@@ -328,7 +329,7 @@
std::string("OpenBMC.0.1.MountFilesystemSuccess"));
}
-void eStoraged::deactivateLuksDev()
+void EStoraged::deactivateLuksDev()
{
lg2::info("Deactivating LUKS device {DEV}", "DEV", devPath,
"REDFISH_MESSAGE_ID",