From 4db124c6805d0778f1857a9d6bf6b25c1c37c587 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 24 Oct 2022 15:41:29 +0200 Subject: [PATCH] ignore fault --- src/fsfw/storagemanager/LocalPool.cpp | 11 +++++------ src/fsfw/storagemanager/LocalPool.h | 11 +++++------ src/fsfw/storagemanager/StorageManagerIF.h | 14 ++------------ 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/fsfw/storagemanager/LocalPool.cpp b/src/fsfw/storagemanager/LocalPool.cpp index 7d37507a..b62c19b6 100644 --- a/src/fsfw/storagemanager/LocalPool.cpp +++ b/src/fsfw/storagemanager/LocalPool.cpp @@ -31,9 +31,8 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig, LocalPool::~LocalPool() = default; -ReturnValue_t LocalPool::addData(store_address_t* storageId, const uint8_t* data, size_t size, - bool ignoreFault) { - ReturnValue_t status = reserveSpace(size, storageId, ignoreFault); +ReturnValue_t LocalPool::addData(store_address_t* storageId, const uint8_t* data, size_t size) { + ReturnValue_t status = reserveSpace(size, storageId); if (status == returnvalue::OK) { write(*storageId, data, size); } @@ -49,8 +48,8 @@ ReturnValue_t LocalPool::getData(store_address_t packetId, const uint8_t** packe } ReturnValue_t LocalPool::getFreeElement(store_address_t* storageId, const size_t size, - uint8_t** pData, bool ignoreFault) { - ReturnValue_t status = reserveSpace(size, storageId, ignoreFault); + uint8_t** pData) { + ReturnValue_t status = reserveSpace(size, storageId); if (status == returnvalue::OK) { *pData = &store[storageId->poolIndex][getRawPosition(*storageId)]; } else { @@ -167,7 +166,7 @@ void LocalPool::clearStore() { } } -ReturnValue_t LocalPool::reserveSpace(size_t size, store_address_t* storeId, bool ignoreFault) { +ReturnValue_t LocalPool::reserveSpace(size_t size, store_address_t* storeId) { ReturnValue_t status = getSubPoolIndex(size, &storeId->poolIndex); if (status != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/src/fsfw/storagemanager/LocalPool.h b/src/fsfw/storagemanager/LocalPool.h index 1472ee25..bb88842b 100644 --- a/src/fsfw/storagemanager/LocalPool.h +++ b/src/fsfw/storagemanager/LocalPool.h @@ -86,11 +86,9 @@ class LocalPool : public SystemObject, public StorageManagerIF { /** * Documentation: See StorageManagerIF.h */ - ReturnValue_t addData(store_address_t* storeId, const uint8_t* data, size_t size, - bool ignoreFault) override; + ReturnValue_t addData(store_address_t* storeId, const uint8_t* data, size_t size) override; - ReturnValue_t getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData, - bool ignoreFault) override; + ReturnValue_t getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData) override; ReturnValue_t getData(store_address_t storeId, const uint8_t** packet_ptr, size_t* size) override; @@ -135,7 +133,6 @@ class LocalPool : public SystemObject, public StorageManagerIF { // the fully qualified path with the using directive. using StorageManagerIF::getFreeElement; using StorageManagerIF::getData; - using StorageManagerIF::addData; using StorageManagerIF::modifyData; protected: @@ -146,7 +143,7 @@ class LocalPool : public SystemObject, public StorageManagerIF { * @return - returnvalue::OK on success, * - the return codes of #getPoolIndex or #findEmpty otherwise. */ - virtual ReturnValue_t reserveSpace(size_t size, store_address_t* address, bool ignoreFault); + virtual ReturnValue_t reserveSpace(size_t size, store_address_t* address); private: /** @@ -190,6 +187,8 @@ class LocalPool : public SystemObject, public StorageManagerIF { std::vector> sizeLists = std::vector>(NUMBER_OF_SUBPOOLS); + bool ignoreFault = false; + //! A variable to determine whether higher n pools are used if //! the store is full. bool spillsToHigherPools = false; diff --git a/src/fsfw/storagemanager/StorageManagerIF.h b/src/fsfw/storagemanager/StorageManagerIF.h index 2845e581..5d804e44 100644 --- a/src/fsfw/storagemanager/StorageManagerIF.h +++ b/src/fsfw/storagemanager/StorageManagerIF.h @@ -66,12 +66,7 @@ class StorageManagerIF { * @return Returns @returnvalue::OK if data was added. * @returnvalue::FAILED if data could not be added, storageId is unchanged then. */ - virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size, - bool ignoreFault) = 0; - - virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size) { - return addData(storageId, data, size, false); - } + virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size) = 0; /** * @brief With deleteData, the storageManager frees the memory region @@ -186,12 +181,7 @@ class StorageManagerIF { * @return Returns @returnvalue::OK if data was added. * @returnvalue::FAILED if data could not be added, storageId is unchanged then. */ - virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr, - bool ignoreFault) = 0; - - virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr) { - return getFreeElement(storageId, size, dataPtr, false); - } + virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr) = 0; [[nodiscard]] virtual bool hasDataAtId(store_address_t storeId) const = 0;