From ac96f1420c3cf286a531fbb450abee28706c6a61 Mon Sep 17 00:00:00 2001 From: Patrick Kappl Date: Sat, 6 Jul 2024 13:49:05 +0000 Subject: [PATCH] Rename storage to memory --- Sts1CobcSw/FileSystem/LfsFlash.cpp | 4 ++-- ...fsStorageDevice.hpp => LfsMemoryDevice.hpp} | 0 Sts1CobcSw/FileSystem/LfsRam.cpp | 18 +++++++++--------- Sts1CobcSw/FileSystem/LfsWrapper.hpp | 2 +- Tests/UnitTests/LfsRam.test.cpp | 4 ++-- Tests/UnitTests/LfsWrapper.test.cpp | 2 +- Tests/UnitTests/LfsWrapperExecutable.test.cpp | 2 +- iwyu.imp | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) rename Sts1CobcSw/FileSystem/{LfsStorageDevice.hpp => LfsMemoryDevice.hpp} (100%) diff --git a/Sts1CobcSw/FileSystem/LfsFlash.cpp b/Sts1CobcSw/FileSystem/LfsFlash.cpp index 39b0f98e..e4ba8652 100644 --- a/Sts1CobcSw/FileSystem/LfsFlash.cpp +++ b/Sts1CobcSw/FileSystem/LfsFlash.cpp @@ -1,7 +1,7 @@ //! @file -//! @brief Implement a flash storage device for littlefs. +//! @brief Implement a flash memory device for littlefs. -#include // IWYU pragma: associated +#include // IWYU pragma: associated #include #include diff --git a/Sts1CobcSw/FileSystem/LfsStorageDevice.hpp b/Sts1CobcSw/FileSystem/LfsMemoryDevice.hpp similarity index 100% rename from Sts1CobcSw/FileSystem/LfsStorageDevice.hpp rename to Sts1CobcSw/FileSystem/LfsMemoryDevice.hpp diff --git a/Sts1CobcSw/FileSystem/LfsRam.cpp b/Sts1CobcSw/FileSystem/LfsRam.cpp index 2ed0012c..b5e8c058 100644 --- a/Sts1CobcSw/FileSystem/LfsRam.cpp +++ b/Sts1CobcSw/FileSystem/LfsRam.cpp @@ -1,9 +1,9 @@ //! @file -//! @brief Simulate a storage device for littlefs in RAM. +//! @brief Simulate a memory device for littlefs in RAM. //! //! This is useful for testing the file system without using a real flash memory. -#include // IWYU pragma: associated +#include // IWYU pragma: associated #include #include @@ -30,9 +30,9 @@ auto Sync(lfs_config const * config) -> int; constexpr auto pageSize = 256; constexpr auto sectorSize = 4 * 1024; -constexpr auto storageSize = 128 * 1024 * 1024; +constexpr auto memorySize = 128 * 1024 * 1024; -auto storage = std::vector(); +auto memory = std::vector(); auto readBuffer = std::array{}; auto programBuffer = decltype(readBuffer){}; auto lookaheadBuffer = std::array{}; // NOLINT(*magic-numbers) @@ -50,7 +50,7 @@ lfs_config const lfsConfig = lfs_config{.context = nullptr, .read_size = pageSize, .prog_size = pageSize, .block_size = sectorSize, - .block_count = storageSize / sectorSize, + .block_count = memorySize / sectorSize, .block_cycles = 200, .cache_size = readBuffer.size(), .lookahead_size = lookaheadBuffer.size(), @@ -67,7 +67,7 @@ lfs_config const lfsConfig = lfs_config{.context = nullptr, auto Initialize() -> void { - storage.resize(storageSize, 0xFF_b); // NOLINT(*magic-numbers*) + memory.resize(memorySize, 0xFF_b); // NOLINT(*magic-numbers*) } @@ -78,7 +78,7 @@ auto Read(lfs_config const * config, lfs_size_t size) -> int { auto start = static_cast(blockNo * config->block_size + offset); - std::copy_n(storage.begin() + start, size, static_cast(buffer)); + std::copy_n(memory.begin() + start, size, static_cast(buffer)); return 0; } @@ -89,7 +89,7 @@ auto Program(lfs_config const * config, lfs_size_t size) -> int { auto start = static_cast(blockNo * config->block_size + offset); - std::copy_n(static_cast(buffer), size, storage.begin() + start); + std::copy_n(static_cast(buffer), size, memory.begin() + start); return 0; } @@ -97,7 +97,7 @@ auto Program(lfs_config const * config, auto Erase(lfs_config const * config, lfs_block_t blockNo) -> int { auto start = static_cast(blockNo * config->block_size); - std::fill_n(storage.begin() + start, config->block_size, 0xFF_b); // NOLINT(*magic-numbers*) + std::fill_n(memory.begin() + start, config->block_size, 0xFF_b); // NOLINT(*magic-numbers*) return 0; } diff --git a/Sts1CobcSw/FileSystem/LfsWrapper.hpp b/Sts1CobcSw/FileSystem/LfsWrapper.hpp index 1395bdb9..f1d714de 100644 --- a/Sts1CobcSw/FileSystem/LfsWrapper.hpp +++ b/Sts1CobcSw/FileSystem/LfsWrapper.hpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include diff --git a/Tests/UnitTests/LfsRam.test.cpp b/Tests/UnitTests/LfsRam.test.cpp index 254cc3d9..42da8b06 100644 --- a/Tests/UnitTests/LfsRam.test.cpp +++ b/Tests/UnitTests/LfsRam.test.cpp @@ -1,11 +1,11 @@ -#include +#include #include #include -TEST_CASE("RAM storage device") +TEST_CASE("RAM memory device") { sts1cobcsw::fs::Initialize(); auto lfs = lfs_t{}; diff --git a/Tests/UnitTests/LfsWrapper.test.cpp b/Tests/UnitTests/LfsWrapper.test.cpp index d5a9251e..f096b48f 100644 --- a/Tests/UnitTests/LfsWrapper.test.cpp +++ b/Tests/UnitTests/LfsWrapper.test.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/Tests/UnitTests/LfsWrapperExecutable.test.cpp b/Tests/UnitTests/LfsWrapperExecutable.test.cpp index 7aa87437..021b29a7 100644 --- a/Tests/UnitTests/LfsWrapperExecutable.test.cpp +++ b/Tests/UnitTests/LfsWrapperExecutable.test.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include // #include diff --git a/iwyu.imp b/iwyu.imp index 0826322c..44931419 100644 --- a/iwyu.imp +++ b/iwyu.imp @@ -63,7 +63,7 @@ { include: ["\"Sts1CobcSw/Edu/Types.hpp\"", "public", "", "public"] }, { include: ["\"Sts1CobcSw/FileSystem/ErrorsAndResult.hpp\"", "public", "", "public"] }, { include: ["\"Sts1CobcSw/FileSystem/FileSystem.hpp\"", "public", "", "public"] }, - { include: ["\"Sts1CobcSw/FileSystem/LfsStorageDevice.hpp\"", "public", "", "public"] }, + { include: ["\"Sts1CobcSw/FileSystem/LfsMemoryDevice.hpp\"", "public", "", "public"] }, { include: ["\"Sts1CobcSw/FileSystem/LfsWrapper.hpp\"", "public", "", "public"] }, { include: ["\"Sts1CobcSw/Hal/GpioPin.hpp\"", "public", "", "public"] }, { include: ["\"Sts1CobcSw/Hal/IoNames.hpp\"", "public", "", "public"] },