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/include/cryptsetupInterface.hpp b/include/cryptsetupInterface.hpp
index 8cc0469..49076dd 100644
--- a/include/cryptsetupInterface.hpp
+++ b/include/cryptsetupInterface.hpp
@@ -15,7 +15,12 @@
{
public:
virtual ~CryptsetupInterface() = default;
+ CryptsetupInterface() = default;
+ CryptsetupInterface(const CryptsetupInterface&) = delete;
+ CryptsetupInterface& operator=(const CryptsetupInterface&) = delete;
+ CryptsetupInterface(CryptsetupInterface&&) = delete;
+ CryptsetupInterface& operator=(CryptsetupInterface&&) = delete;
/** @brief Wrapper around crypt_format.
* @details Used for mocking purposes.
*
@@ -105,8 +110,7 @@
*
* @returns 0 on success or negative errno value otherwise.
*/
- virtual int cryptKeyslotDestroy(struct crypt_device* cd,
- const int keyslot) = 0;
+ virtual int cryptKeyslotDestroy(struct crypt_device* cd, int keyslot) = 0;
/** @breif Wapper around crypt_keyslot_max
* @details Used for mocking purposes.
@@ -138,8 +142,14 @@
class Cryptsetup : public CryptsetupInterface
{
public:
- ~Cryptsetup() = default;
+ ~Cryptsetup() override = default;
+ Cryptsetup() = default;
+ Cryptsetup(const Cryptsetup&) = delete;
+ Cryptsetup& operator=(const Cryptsetup&) = delete;
+
+ Cryptsetup(Cryptsetup&&) = delete;
+ Cryptsetup& operator=(Cryptsetup&&) = delete;
int cryptFormat(struct crypt_device* cd, const char* type,
const char* cipher, const char* cipherMode,
const char* uuid, const char* volumeKey,
@@ -222,7 +232,7 @@
*/
struct crypt_device* init(const char* device)
{
- struct crypt_device* cryptDev;
+ struct crypt_device* cryptDev = nullptr;
int retval = crypt_init(&cryptDev, device);
if (retval < 0)
{
diff --git a/include/erase.hpp b/include/erase.hpp
index 8224003..33489ea 100644
--- a/include/erase.hpp
+++ b/include/erase.hpp
@@ -14,7 +14,6 @@
*/
Erase(std::string_view inDevPath) : devPath(inDevPath)
{}
- virtual ~Erase() = default;
/** @brief finds the size of the linux block device in bytes
* @return size of a block device using the devPath
diff --git a/include/estoraged.hpp b/include/estoraged.hpp
index d77c7f9..791134d 100644
--- a/include/estoraged.hpp
+++ b/include/estoraged.hpp
@@ -26,7 +26,7 @@
/** @class eStoraged
* @brief eStoraged object to manage a LUKS encrypted storage device.
*/
-class eStoraged : eStoragedInherit
+class EStoraged : eStoragedInherit
{
public:
/** @brief Constructor for eStoraged
@@ -40,7 +40,7 @@
* @param[in] fsInterface - (optional) pointer to FilesystemInterface
* object
*/
- eStoraged(sdbusplus::bus::bus& bus, const char* path,
+ EStoraged(sdbusplus::bus::bus& bus, const char* path,
const std::string& devPath, const std::string& luksName,
std::unique_ptr<CryptsetupInterface> cryptInterface =
std::make_unique<Cryptsetup>(),
diff --git a/include/filesystemInterface.hpp b/include/filesystemInterface.hpp
index 0f276a7..12495cd 100644
--- a/include/filesystemInterface.hpp
+++ b/include/filesystemInterface.hpp
@@ -17,6 +17,13 @@
public:
virtual ~FilesystemInterface() = default;
+ FilesystemInterface() = default;
+ FilesystemInterface(const FilesystemInterface&) = delete;
+ FilesystemInterface& operator=(const FilesystemInterface&) = delete;
+
+ FilesystemInterface(FilesystemInterface&&) = delete;
+ FilesystemInterface& operator=(FilesystemInterface&&) = delete;
+
/** @brief Runs the mkfs command to create the filesystem.
* @details Used for mocking purposes.
*
@@ -86,11 +93,18 @@
class Filesystem : public FilesystemInterface
{
public:
- ~Filesystem() = default;
+ ~Filesystem() override = default;
+ Filesystem() = default;
+ Filesystem(const Filesystem&) = delete;
+ Filesystem& operator=(const Filesystem&) = delete;
+
+ Filesystem(Filesystem&&) = delete;
+ Filesystem& operator=(Filesystem&&) = delete;
int runMkfs(const std::string& logicalVolume) override
{
std::string mkfsCommand("mkfs.ext4 /dev/mapper/" + logicalVolume);
+ // calling 'system' uses a command processor //NOLINTNEXTLINE
return system(mkfsCommand.c_str());
}