fix struct and variable case styles
Fix the following clang-tidy warnings:
```
/data0/jenkins/workspace/ci-repository/openbmc/estoraged/include/sanitize.hpp:41:37: error: invalid case style for struct 'mmc_io_multi_cmd_erase' [readability-identifier-naming,-warnings-as-errors]
41 | struct mmc_io_multi_cmd_erase data) = 0;
/data0/jenkins/workspace/ci-repository/openbmc/estoraged/src/test/include/estoraged_test.hpp:48:30: error: invalid case style for parameter 'cipher_mode' [readability-identifier-naming,-warnings-as-errors]
48 | const char* cipher_mode, const char* uuid,
/data0/jenkins/workspace/ci-repository/openbmc/estoraged/src/test/include/estoraged_test.hpp:49:30: error: invalid case style for parameter 'volume_key' [readability-identifier-naming,-warnings-as-errors]
49 | const char* volume_key, size_t volume_key_size, void* params),
/data0/jenkins/workspace/ci-repository/openbmc/estoraged/src/test/include/estoraged_test.hpp:49:49: error: invalid case style for parameter 'volume_key_size' [readability-identifier-naming,-warnings-as-errors]
49 | const char* volume_key, size_t volume_key_size, void* params),
/data0/jenkins/workspace/ci-repository/openbmc/estoraged/src/test/include/estoraged_test.hpp:55:25: error: invalid case style for parameter 'passphrase_size' [readability-identifier-naming,-warnings-as-errors]
/data0/jenkins/workspace/ci-repository/openbmc/estoraged/src/test/include/estoraged_test.hpp:59:56: error: invalid case style for parameter 'requested_type' [readability-identifier-naming,-warnings-as-errors]
59 | (struct crypt_device * cd, const char* requested_type,
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib4c685db2037514b0517e42369b1d66b49b00e03
diff --git a/include/cryptsetupInterface.hpp b/include/cryptsetupInterface.hpp
index 4f824cd..f537a0f 100644
--- a/include/cryptsetupInterface.hpp
+++ b/include/cryptsetupInterface.hpp
@@ -36,11 +36,11 @@
* @param[in] type - type of device (optional params struct must be of
* this type).
* @param[in] cipher - (e.g. "aes").
- * @params[in cipher_mode - including IV specification (e.g. "xts-plain").
+ * @params[in cipherMode - including IV specification (e.g. "xts-plain").
* @params[in] uuid - requested UUID or NULL if it should be generated.
- * @params[in] volume_key - pre-generated volume key or NULL if it should
+ * @params[in] volumeKey - pre-generated volume key or NULL if it should
* be generated (only for LUKS).
- * @params[in] volume_key_size - size of volume key in bytes.
+ * @params[in] volumeKeySize - size of volume key in bytes.
* @params[in] params - crypt type specific parameters.
*
* @returns 0 on success or negative errno value otherwise.
@@ -68,16 +68,16 @@
const char* passphrase, size_t passphraseSize,
const char* newPassphrase, size_t newPassphraseSize) = 0;
- /** @brief Wrapper around crypt_keyslot_add_by_volume_key.
+ /** @brief Wrapper around crypt_keyslot_add_by_volumeKey.
* @details Used for mocking purposes.
*
* @param[in] cd - crypt device handle.
* @param[in] keyslot - requested keyslot or CRYPT_ANY_SLOT.
- * @param[in] volume_key - provided volume key or NULL if used after
+ * @param[in] volumeKey - provided volume key or NULL if used after
* crypt_format.
- * @param[in] volume_key_size - size of volume_key.
+ * @param[in] volumeKeySize - size of volumeKey.
* @param[in] passphrase - passphrase for new keyslot.
- * @param[in] passphrase_size - size of passphrase.
+ * @param[in] passphraseSize - size of passphrase.
*
* @returns allocated key slot number or negative errno otherwise.
*/
@@ -90,7 +90,7 @@
* @details Used for mocking purposes.
*
* @param[in] cd - crypt device handle.
- * @param[in] requested_type - crypt-type or NULL for all known.
+ * @param[in] requestedType - crypt-type or NULL for all known.
* @param[in] params - crypt type specific parameters (see crypt-type).
*
* @returns 0 on success or negative errno value otherwise.
@@ -106,7 +106,7 @@
* passphrase.
* @param[in] keyslot - requested keyslot to check or CRYPT_ANY_SLOT.
* @param[in] passphrase - passphrase used to unlock volume key.
- * @param[in] passphrase_size - size of passphrase.
+ * @param[in] passphraseSize - size of passphrase.
* @param[in] flags - activation flags.
*
* @returns unlocked key slot number or negative errno otherwise.
diff --git a/include/sanitize.hpp b/include/sanitize.hpp
index 48b49aa..f7fe2a1 100644
--- a/include/sanitize.hpp
+++ b/include/sanitize.hpp
@@ -38,7 +38,7 @@
* @param[in] mmc_io_mutli_cmd - many eMMC cmd
*/
virtual int doIoctlMulti(std::string_view devPath, unsigned long request,
- struct mmc_io_multi_cmd_erase data) = 0;
+ struct MmcIoMultiCmdErase data) = 0;
virtual ~IOCTLWrapperInterface() = default;
IOCTLWrapperInterface() = default;
@@ -56,7 +56,7 @@
int doIoctl(std::string_view devPath, unsigned long request,
struct mmc_ioc_cmd data) override;
int doIoctlMulti(std::string_view devPath, unsigned long request,
- struct mmc_io_multi_cmd_erase data) override;
+ struct MmcIoMultiCmdErase data) override;
~IOCTLWrapperImpl() override = default;
IOCTLWrapperImpl() = default;
@@ -113,7 +113,7 @@
// can't use the real mmc_ioc_multi_cmd b/c of zero length array
// see uapi/linux/mmc/ioctl.h
-struct mmc_io_multi_cmd_erase
+struct MmcIoMultiCmdErase
{
uint64_t num_of_cmds;
struct mmc_ioc_cmd cmds[3]; // NOLINT (c arrays usage)
diff --git a/src/erase/sanitize.cpp b/src/erase/sanitize.cpp
index dbf92f5..c40ca98 100644
--- a/src/erase/sanitize.cpp
+++ b/src/erase/sanitize.cpp
@@ -76,7 +76,7 @@
uint64_t sectorSize = 0x200; // default value see eMMC spec 6.6.34.
// NOTE: 0x200 is only valid for eMMC greater
// then 2 GB
- struct mmc_io_multi_cmd_erase eraseCmd = {};
+ struct MmcIoMultiCmdErase eraseCmd = {};
eraseCmd.num_of_cmds = 3;
eraseCmd.cmds[0].opcode = mmcEraseGroupStart;
@@ -130,7 +130,7 @@
int IOCTLWrapperImpl::doIoctlMulti(std::string_view devPath,
unsigned long request,
- struct mmc_io_multi_cmd_erase data)
+ struct MmcIoMultiCmdErase data)
{
ManagedFd fd = stdplus::fd::open(std::string(devPath).c_str(),
stdplus::fd::OpenAccess::ReadOnly);
diff --git a/src/test/erase/sanitize_test.cpp b/src/test/erase/sanitize_test.cpp
index 4e18148..4015ded 100644
--- a/src/test/erase/sanitize_test.cpp
+++ b/src/test/erase/sanitize_test.cpp
@@ -30,7 +30,7 @@
MOCK_METHOD(int, doIoctlMulti,
(std::string_view devPath, unsigned long request,
- struct estoraged::mmc_io_multi_cmd_erase),
+ struct estoraged::MmcIoMultiCmdErase),
(override));
};
diff --git a/src/test/include/estoraged_test.hpp b/src/test/include/estoraged_test.hpp
index a9dfbc0..2a0ad8e 100644
--- a/src/test/include/estoraged_test.hpp
+++ b/src/test/include/estoraged_test.hpp
@@ -45,18 +45,18 @@
public:
MOCK_METHOD(int, cryptFormat,
(struct crypt_device * cd, const char* type, const char* cipher,
- const char* cipher_mode, const char* uuid,
- const char* volume_key, size_t volume_key_size, void* params),
+ const char* cipherMode, const char* uuid,
+ const char* volumeKey, size_t volumeKeySize, void* params),
(override));
MOCK_METHOD(int, cryptKeyslotAddByVolumeKey,
- (struct crypt_device * cd, int keyslot, const char* volume_key,
- size_t volume_key_size, const char* passphrase,
- size_t passphrase_size),
+ (struct crypt_device * cd, int keyslot, const char* volumeKey,
+ size_t volumeKeySize, const char* passphrase,
+ size_t passphraseSize),
(override));
MOCK_METHOD(int, cryptLoad,
- (struct crypt_device * cd, const char* requested_type,
+ (struct crypt_device * cd, const char* requestedType,
void* params),
(override));
@@ -68,8 +68,7 @@
MOCK_METHOD(int, cryptActivateByPassphrase,
(struct crypt_device * cd, const char* name, int keyslot,
- const char* passphrase, size_t passphrase_size,
- uint32_t flags),
+ const char* passphrase, size_t passphraseSize, uint32_t flags),
(override));
MOCK_METHOD(int, cryptDeactivate,