ignore fault

This commit is contained in:
Robin Müller 2022-10-24 15:41:29 +02:00
parent 2df66c9304
commit 4db124c680
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 12 additions and 24 deletions

View File

@ -31,9 +31,8 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig,
LocalPool::~LocalPool() = default; LocalPool::~LocalPool() = default;
ReturnValue_t LocalPool::addData(store_address_t* storageId, const uint8_t* data, size_t size, ReturnValue_t LocalPool::addData(store_address_t* storageId, const uint8_t* data, size_t size) {
bool ignoreFault) { ReturnValue_t status = reserveSpace(size, storageId);
ReturnValue_t status = reserveSpace(size, storageId, ignoreFault);
if (status == returnvalue::OK) { if (status == returnvalue::OK) {
write(*storageId, data, size); 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, ReturnValue_t LocalPool::getFreeElement(store_address_t* storageId, const size_t size,
uint8_t** pData, bool ignoreFault) { uint8_t** pData) {
ReturnValue_t status = reserveSpace(size, storageId, ignoreFault); ReturnValue_t status = reserveSpace(size, storageId);
if (status == returnvalue::OK) { if (status == returnvalue::OK) {
*pData = &store[storageId->poolIndex][getRawPosition(*storageId)]; *pData = &store[storageId->poolIndex][getRawPosition(*storageId)];
} else { } 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); ReturnValue_t status = getSubPoolIndex(size, &storeId->poolIndex);
if (status != returnvalue::OK) { if (status != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1

View File

@ -86,11 +86,9 @@ class LocalPool : public SystemObject, public StorageManagerIF {
/** /**
* Documentation: See StorageManagerIF.h * Documentation: See StorageManagerIF.h
*/ */
ReturnValue_t addData(store_address_t* storeId, const uint8_t* data, size_t size, ReturnValue_t addData(store_address_t* storeId, const uint8_t* data, size_t size) override;
bool ignoreFault) override;
ReturnValue_t getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData, ReturnValue_t getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData) override;
bool ignoreFault) override;
ReturnValue_t getData(store_address_t storeId, const uint8_t** packet_ptr, size_t* size) 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. // the fully qualified path with the using directive.
using StorageManagerIF::getFreeElement; using StorageManagerIF::getFreeElement;
using StorageManagerIF::getData; using StorageManagerIF::getData;
using StorageManagerIF::addData;
using StorageManagerIF::modifyData; using StorageManagerIF::modifyData;
protected: protected:
@ -146,7 +143,7 @@ class LocalPool : public SystemObject, public StorageManagerIF {
* @return - returnvalue::OK on success, * @return - returnvalue::OK on success,
* - the return codes of #getPoolIndex or #findEmpty otherwise. * - 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: private:
/** /**
@ -190,6 +187,8 @@ class LocalPool : public SystemObject, public StorageManagerIF {
std::vector<std::vector<size_type>> sizeLists = std::vector<std::vector<size_type>> sizeLists =
std::vector<std::vector<size_type>>(NUMBER_OF_SUBPOOLS); std::vector<std::vector<size_type>>(NUMBER_OF_SUBPOOLS);
bool ignoreFault = false;
//! A variable to determine whether higher n pools are used if //! A variable to determine whether higher n pools are used if
//! the store is full. //! the store is full.
bool spillsToHigherPools = false; bool spillsToHigherPools = false;

View File

@ -66,12 +66,7 @@ class StorageManagerIF {
* @return Returns @returnvalue::OK if data was added. * @return Returns @returnvalue::OK if data was added.
* @returnvalue::FAILED if data could not be added, storageId is unchanged then. * @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, virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size) = 0;
bool ignoreFault) = 0;
virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size) {
return addData(storageId, data, size, false);
}
/** /**
* @brief With deleteData, the storageManager frees the memory region * @brief With deleteData, the storageManager frees the memory region
@ -186,12 +181,7 @@ class StorageManagerIF {
* @return Returns @returnvalue::OK if data was added. * @return Returns @returnvalue::OK if data was added.
* @returnvalue::FAILED if data could not be added, storageId is unchanged then. * @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, virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr) = 0;
bool ignoreFault) = 0;
virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr) {
return getFreeElement(storageId, size, dataPtr, false);
}
[[nodiscard]] virtual bool hasDataAtId(store_address_t storeId) const = 0; [[nodiscard]] virtual bool hasDataAtId(store_address_t storeId) const = 0;