Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/fsfw into mueller/master

This commit is contained in:
Robin Müller 2021-07-15 01:24:30 +02:00
commit 62e0465b3d
3 changed files with 32 additions and 7 deletions

View File

@ -79,7 +79,9 @@ public:
static void setCreateDirectoryCommand(CommandMessage* message, static void setCreateDirectoryCommand(CommandMessage* message,
store_address_t storeId); store_address_t storeId);
static void setDeleteDirectoryCommand(CommandMessage* message, static void setDeleteDirectoryCommand(CommandMessage* message,
store_address_t storeId); store_address_t storeId, bool deleteRecursively);
static store_address_t getDeleteDirectoryCommand(const CommandMessage* message,
bool& deleteRecursively);
static void setSuccessReply(CommandMessage* message); static void setSuccessReply(CommandMessage* message);
static void setFailureReply(CommandMessage* message, static void setFailureReply(CommandMessage* message,

View File

@ -45,7 +45,7 @@ public:
virtual MessageQueueId_t getCommandQueue() const = 0; virtual MessageQueueId_t getCommandQueue() const = 0;
/** /**
* Generic function to append to file. * @brief Generic function to append to file.
* @param dirname Directory of the file * @param dirname Directory of the file
* @param filename The filename of the file * @param filename The filename of the file
* @param data The data to write to the file * @param data The data to write to the file
@ -62,12 +62,12 @@ public:
uint16_t packetNumber, void* args = nullptr) = 0; uint16_t packetNumber, void* args = nullptr) = 0;
/** /**
* Generic function to create a new file. * @brief Generic function to create a new file.
* @param repositoryPath * @param repositoryPath
* @param filename * @param filename
* @param data * @param data
* @param size * @param size
* @param args Any other arguments which an implementation might require. * @param args Any other arguments which an implementation might require
* @return * @return
*/ */
virtual ReturnValue_t createFile(const char* repositoryPath, virtual ReturnValue_t createFile(const char* repositoryPath,
@ -75,14 +75,30 @@ public:
size_t size = 0, void* args = nullptr) = 0; size_t size = 0, void* args = nullptr) = 0;
/** /**
* Generic function to delete a file. * @brief Generic function to delete a file.
* @param repositoryPath * @param repositoryPath
* @param filename * @param filename
* @param args * @param args Any other arguments which an implementation might require
* @return * @return
*/ */
virtual ReturnValue_t deleteFile(const char* repositoryPath, virtual ReturnValue_t deleteFile(const char* repositoryPath,
const char* filename, void* args = nullptr) = 0; const char* filename, void* args = nullptr) = 0;
/**
* @brief Generic function to create a directory
* @param repositoryPath
* @param args Any other arguments which an implementation might require
* @return
*/
virtual ReturnValue_t createDirectory(const char* repositoryPath, void* args = nullptr) = 0;
/**
* @brief Generic function to remove a directory
* @param repositoryPath
* @param args Any other arguments which an implementation might require
*/
virtual ReturnValue_t removeDirectory(const char* repositoryPath,
bool deleteRecurively = false, void* args = nullptr) = 0;
}; };

View File

@ -34,8 +34,9 @@ void GenericFileSystemMessage::setReportFileAttributesReply(CommandMessage *mess
} }
void GenericFileSystemMessage::setDeleteDirectoryCommand(CommandMessage* message, void GenericFileSystemMessage::setDeleteDirectoryCommand(CommandMessage* message,
store_address_t storeId) { store_address_t storeId, bool deleteRecursively) {
message->setCommand(CMD_DELETE_DIRECTORY); message->setCommand(CMD_DELETE_DIRECTORY);
message->setParameter(deleteRecursively);
message->setParameter2(storeId.raw); message->setParameter2(storeId.raw);
} }
@ -133,6 +134,12 @@ bool GenericFileSystemMessage::getReadReply(const CommandMessage *message,
return message->getParameter(); return message->getParameter();
} }
store_address_t GenericFileSystemMessage::getDeleteDirectoryCommand(const CommandMessage *message,
bool &deleteRecursively) {
deleteRecursively = message->getParameter();
return getStoreId(message);
}
ReturnValue_t GenericFileSystemMessage::clear(CommandMessage* message) { ReturnValue_t GenericFileSystemMessage::clear(CommandMessage* message) {
switch(message->getCommand()) { switch(message->getCommand()) {
case(CMD_CREATE_FILE): case(CMD_CREATE_FILE):