Merge pull request 'fixes for file system' (#57) from mueller/fs-fixes into develop
Reviewed-on: #57 Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
This commit is contained in:
commit
7bab6e6c15
@ -6,6 +6,8 @@
|
|||||||
#include "../memory/scratchApi.h"
|
#include "../memory/scratchApi.h"
|
||||||
#include "../memory/SdCardManager.h"
|
#include "../memory/SdCardManager.h"
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
CoreController::CoreController(object_id_t objectId):
|
CoreController::CoreController(object_id_t objectId):
|
||||||
ExtendedControllerBase(objectId, objects::NO_OBJECT, 5) {
|
ExtendedControllerBase(objectId, objects::NO_OBJECT, 5) {
|
||||||
}
|
}
|
||||||
@ -27,10 +29,18 @@ LocalPoolDataSetBase* CoreController::getDataSetHandle(sid_t sid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::initialize() {
|
ReturnValue_t CoreController::initialize() {
|
||||||
ReturnValue_t result = sdCardInit();
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
try {
|
||||||
|
result = sdCardInit();
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "CoreController::initialize: SD card init failed" << std::endl;
|
sif::warning << "CoreController::initialize: SD card init failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(const std::filesystem::filesystem_error& e) {
|
||||||
|
sif::error << "CoreController::initialize: sdCardInit failed with exception " << e.what()
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
|
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "CoreController::initialize: Setting up alloc failure "
|
sif::warning << "CoreController::initialize: Setting up alloc failure "
|
||||||
@ -103,10 +113,15 @@ ReturnValue_t CoreController::sdCardSetup(SdCardManager& sdcMan,
|
|||||||
return sdcMan.mountSdCard(sdCard);
|
return sdcMan.mountSdCard(sdCard);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(std::filesystem::exists(mountString)) {
|
||||||
sif::info << "SD card " << sdString << " already on and mounted at " <<
|
sif::info << "SD card " << sdString << " already on and mounted at " <<
|
||||||
mountString << std::endl;
|
mountString << std::endl;
|
||||||
return SdCardManager::ALREADY_MOUNTED;
|
return SdCardManager::ALREADY_MOUNTED;
|
||||||
}
|
}
|
||||||
|
sif::error << "SD card mounted but expected mount point " << mountString << " not found!"
|
||||||
|
<< std::endl;
|
||||||
|
return SdCardManager::MOUNT_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
|
@ -218,6 +218,11 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
|
|||||||
else if(sdCard == sd::SdCard::SLOT_1) {
|
else if(sdCard == sd::SdCard::SLOT_1) {
|
||||||
mountPoint = SD_1_MOUNT_POINT;
|
mountPoint = SD_1_MOUNT_POINT;
|
||||||
}
|
}
|
||||||
|
if(not filesystem::exists(mountPoint)) {
|
||||||
|
sif::error << "SdCardManager::unmountSdCard: Default mount point " << mountPoint <<
|
||||||
|
"does not exist" << std::endl;
|
||||||
|
return UNMOUNT_ERROR;
|
||||||
|
}
|
||||||
if(filesystem::is_empty(mountPoint)) {
|
if(filesystem::is_empty(mountPoint)) {
|
||||||
// The mount point will always exist, but if it is empty, that is strong hint that
|
// The mount point will always exist, but if it is empty, that is strong hint that
|
||||||
// the SD card was not mounted properly. Still proceed with operation.
|
// the SD card was not mounted properly. Still proceed with operation.
|
||||||
|
1
fsfw_hal
1
fsfw_hal
@ -1 +0,0 @@
|
|||||||
Subproject commit ecc445afa7b027f2c7f059e941862119bd6f3764
|
|
@ -3,9 +3,11 @@
|
|||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
void utility::handleSystemError(int retcode, std::string function) {
|
void utility::handleSystemError(int retcode, std::string function) {
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
sif::warning << function << ": System call failed with code " << retcode;
|
sif::warning << function << ": System call failed with code " << retcode << ": " <<
|
||||||
|
strerror(retcode) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user