diff --git a/fsw/inc/fm_msg.h b/fsw/inc/fm_msg.h index 2b55a55..e6e51d6 100644 --- a/fsw/inc/fm_msg.h +++ b/fsw/inc/fm_msg.h @@ -67,6 +67,20 @@ typedef struct CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ } FM_ResetCmd_t; +/** + * \brief Copy/Move File command payload structure + * + * Contains a source and target file name and an overwrite flag + * + * Used by #FM_COPY_CC, #FM_MOVE_CC + */ +typedef struct +{ + uint16 Overwrite; /**< \brief Allow overwrite */ + char Source[OS_MAX_PATH_LEN]; /**< \brief Source filename */ + char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */ +} FM_OvwSourceTargetFilename_Payload_t; + /** * \brief Copy File command packet structure * @@ -76,9 +90,7 @@ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - uint16 Overwrite; /**< \brief Allow overwrite */ - char Source[OS_MAX_PATH_LEN]; /**< \brief Source filename */ - char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */ + FM_OvwSourceTargetFilename_Payload_t Payload; /**< \brief Command payload */ } FM_CopyFileCmd_t; /** @@ -90,11 +102,21 @@ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - uint16 Overwrite; /**< \brief Allow overwrite */ - char Source[OS_MAX_PATH_LEN]; /**< \brief Source filename */ - char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */ + FM_OvwSourceTargetFilename_Payload_t Payload; /**< \brief Command payload */ + } FM_MoveFileCmd_t; +/** + * \brief Source and Target filename command payload structure + * + * Used by #FM_RENAME_CC, #FM_DECOMPRESS_CC + */ +typedef struct +{ + char Source[OS_MAX_PATH_LEN]; /**< \brief Source filename */ + char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */ +} FM_SourceTargetFileName_Payload_t; + /** * \brief Rename File command packet structure * @@ -104,10 +126,19 @@ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - char Source[OS_MAX_PATH_LEN]; /**< \brief Source filename */ - char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */ + FM_SourceTargetFileName_Payload_t Payload; /**< \brief Command payload */ } FM_RenameFileCmd_t; +/** + * \brief Single filename command payload structure + * + * Used by #FM_DELETE_CC + */ +typedef struct +{ + char Filename[OS_MAX_PATH_LEN]; /**< \brief Delete filename */ +} FM_SingleFilename_Payload_t; + /** * \brief Delete File command packet structure * @@ -115,10 +146,21 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - char Filename[OS_MAX_PATH_LEN]; /**< \brief Delete filename */ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + + FM_SingleFilename_Payload_t Payload; /**< \brief Command Payload */ } FM_DeleteFileCmd_t; +/** + * \brief Single directory command payload structure + * + * Used by #FM_DELETE_ALL_CC, #FM_CREATE_DIR_CC, #FM_DELETE_DIR_CC + */ +typedef struct +{ + char Directory[OS_MAX_PATH_LEN]; /**< \brief Directory name */ +} FM_DirectoryName_Payload_t; + /** * \brief Delete All command packet structure * @@ -126,8 +168,9 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - char Directory[OS_MAX_PATH_LEN]; /**< \brief Directory name */ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + + FM_DirectoryName_Payload_t Payload; /**< \brief Command Payload */ } FM_DeleteAllCmd_t; /** @@ -137,11 +180,23 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - char Source[OS_MAX_PATH_LEN]; /**< \brief Source filename */ - char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + + FM_SourceTargetFileName_Payload_t Payload; /**< \brief Command Payload */ } FM_DecompressCmd_t; +/** + * \brief Two source, one target filename command payload structure + * + * Used by #FM_CONCAT_CC + */ +typedef struct +{ + char Source1[OS_MAX_PATH_LEN]; /**< \brief Source 1 filename */ + char Source2[OS_MAX_PATH_LEN]; /**< \brief Source 2 filename */ + char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */ +} FM_TwoSourceOneTarget_Payload_t; + /** * \brief Concatenate Files command packet structure * @@ -151,11 +206,20 @@ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - char Source1[OS_MAX_PATH_LEN]; /**< \brief Source 1 filename */ - char Source2[OS_MAX_PATH_LEN]; /**< \brief Source 2 filename */ - char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */ + FM_TwoSourceOneTarget_Payload_t Payload; /**< \brief Command Payload */ } FM_ConcatCmd_t; +/** + * \brief Filename and CRC command payload structure + * + * Used by #FM_GET_FILE_INFO_CC + */ +typedef struct +{ + char Filename[OS_MAX_PATH_LEN]; /**< \brief Filename */ + uint32 FileInfoCRC; /**< \brief File info CRC method */ +} FM_FilenameAndCRC_Payload_t; + /** * \brief Get File Info command packet structure * @@ -165,8 +229,7 @@ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - char Filename[OS_MAX_PATH_LEN]; /**< \brief Filename */ - uint32 FileInfoCRC; /**< \brief File info CRC method */ + FM_FilenameAndCRC_Payload_t Payload; /**< \brief Command Payload */ } FM_GetFileInfoCmd_t; /** @@ -188,7 +251,7 @@ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - char Directory[OS_MAX_PATH_LEN]; /**< \brief Directory name */ + FM_DirectoryName_Payload_t Payload; /**< \brief Command Payload */ } FM_CreateDirCmd_t; /** @@ -200,37 +263,59 @@ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - char Directory[OS_MAX_PATH_LEN]; /**< \brief Directory name */ + FM_DirectoryName_Payload_t Payload; /**< \brief Command Payload */ } FM_DeleteDirCmd_t; /** - * \brief Get DIR List to File command packet structure + * \brief Get Directory and output to file command payload * - * For command details see #FM_GET_DIR_FILE_CC + * Contains a directory and output file name, with optional flags + * Used by #FM_GET_DIR_FILE_CC */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - char Directory[OS_MAX_PATH_LEN]; /**< \brief Directory name */ char Filename[OS_MAX_PATH_LEN]; /**< \brief Filename */ uint8 GetSizeTimeMode; /**< \brief Option to query size, time, and mode of files (CPU intensive) */ uint8 Spare01[3]; /**< \brief Padding to 32 bit boundary */ -} FM_GetDirFileCmd_t; +} FM_GetDirectoryToFile_Payload_t; /** - * \brief Get DIR List to Packet command packet structure + * \brief Get DIR List to File command packet structure * - * For command details see #FM_GET_DIR_PKT_CC + * For command details see #FM_GET_DIR_FILE_CC */ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + FM_GetDirectoryToFile_Payload_t Payload; /**< \brief Command Payload */ +} FM_GetDirFileCmd_t; + +/** + * \brief Get Directory and output to message command payload + * + * Contains a directory and position offset, with optional flags + * Used by #FM_GET_DIR_PKT_CC + */ +typedef struct +{ char Directory[OS_MAX_PATH_LEN]; /**< \brief Directory name */ uint32 DirListOffset; /**< \brief Index of 1st dir entry to put in packet */ uint8 GetSizeTimeMode; /**< \brief Option to query size, time, and mode of files (CPU intensive) */ uint8 Spare01[3]; /**< \brief Padding to 32 bit boundary */ +} FM_GetDirectoryToPkt_Payload_t; + +/** + * \brief Get DIR List to Packet command packet structure + * + * For command details see #FM_GET_DIR_PKT_CC + */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + + FM_GetDirectoryToPkt_Payload_t Payload; /**< \brief Command Payload */ } FM_GetDirPktCmd_t; /** @@ -243,6 +328,17 @@ typedef struct CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ } FM_MonitorFilesystemSpaceCmd_t; +/** + * \brief Table Index and State command payload structure + * + * Used by #FM_SET_TABLE_STATE_CC + */ +typedef struct +{ + uint32 TableEntryIndex; /**< \brief Table entry index */ + uint32 TableEntryState; /**< \brief New table entry state */ +} FM_TableIndexAndState_Payload_t; + /** * \brief Set Table State command packet structure * @@ -252,10 +348,20 @@ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - uint32 TableEntryIndex; /**< \brief Table entry index */ - uint32 TableEntryState; /**< \brief New table entry state */ + FM_TableIndexAndState_Payload_t Payload; /**< \brief Command Payload */ } FM_SetTableStateCmd_t; +/** + * \brief File name and mode command payload structure + * + * Used by #FM_SET_FILE_PERM_CC + */ +typedef struct +{ + char FileName[OS_MAX_PATH_LEN]; /**< \brief File name of the permissions to set */ + uint32 Mode; /**< \brief Permissions, passed directly to OS_chmod */ +} FM_FilenameAndMode_Payload_t; + /** * \brief Set Permissions for a file * @@ -265,8 +371,7 @@ typedef struct { CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - char FileName[OS_MAX_PATH_LEN]; /**< \brief File name of the permissions to set */ - uint32 Mode; /**< \brief Permissions, passed directly to OS_chmod */ + FM_FilenameAndMode_Payload_t Payload; } FM_SetPermCmd_t; /**\}*/ @@ -294,17 +399,25 @@ typedef struct } FM_DirListEntry_t; /** - * \brief Get Directory Listing telemetry packet + * \brief Get Directory Listing telemetry payload */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ - char DirName[OS_MAX_PATH_LEN]; /**< \brief Directory Name */ uint32 TotalFiles; /**< \brief Number of files in the directory */ uint32 PacketFiles; /**< \brief Number of files in this packet */ uint32 FirstFile; /**< \brief Index into directory files of first packet file */ FM_DirListEntry_t FileList[FM_DIR_LIST_PKT_ENTRIES]; /**< \brief Directory listing file data */ +} FM_DirListPkt_Payload_t; + +/** + * \brief Get Directory Listing telemetry packet + */ +typedef struct +{ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ + + FM_DirListPkt_Payload_t Payload; /**< \brief Telemetry Payload */ } FM_DirListPkt_t; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -330,12 +443,10 @@ typedef struct /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** - * \brief Get File Info telemetry packet + * \brief Get File Info telemetry payload */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ - uint8 FileStatus; /**< \brief Status indicating whether the file is open or closed */ uint8 CRC_Computed; /**< \brief Flag indicating whether a CRC was computed or not */ uint8 Spare[2]; /**< \brief Structure padding */ @@ -344,6 +455,16 @@ typedef struct uint32 LastModifiedTime; /**< \brief Last Modification Time of File */ uint32 Mode; /**< \brief Mode of the file (Permissions) */ char Filename[OS_MAX_PATH_LEN]; /**< \brief Name of File */ +} FM_FileInfoPkt_Payload_t; + +/** + * \brief Get File Info telemetry packet + */ +typedef struct +{ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ + + FM_FileInfoPkt_Payload_t Payload; /**< \brief Telemetry Payload */ } FM_FileInfoPkt_t; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -361,6 +482,15 @@ typedef struct char AppName[OS_MAX_API_NAME]; /**< \brief Application that opened file */ } FM_OpenFilesEntry_t; +/** + * \brief Get Open Files telemetry payload + */ +typedef struct +{ + uint32 NumOpenFiles; /**< \brief Number of files opened via cFE */ + FM_OpenFilesEntry_t OpenFilesList[OS_MAX_NUM_OPEN_FILES]; /**< \brief List of files opened via cFE */ +} FM_OpenFilesPkt_Payload_t; + /** * \brief Get Open Files telemetry packet */ @@ -368,8 +498,7 @@ typedef struct { CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ - uint32 NumOpenFiles; /**< \brief Number of files opened via cFE */ - FM_OpenFilesEntry_t OpenFilesList[OS_MAX_NUM_OPEN_FILES]; /**< \brief List of files opened via cFE */ + FM_OpenFilesPkt_Payload_t Payload; /**< \brief Telemetry Payload */ } FM_OpenFilesPkt_t; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -389,6 +518,14 @@ typedef struct uint64 Bytes; /**< \brief Byte count from last check/poll, 0 if unknown */ } FM_MonitorReportEntry_t; +/** + * \brief Monitor filesystem telemetry payload + */ +typedef struct +{ + FM_MonitorReportEntry_t FileSys[FM_TABLE_ENTRY_COUNT]; /**< \brief Array of file system free space entries */ +} FM_MonitorReportPkt_Payload_t; + /** * \brief Monitor filesystem telemetry packet */ @@ -396,7 +533,7 @@ typedef struct { CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ - FM_MonitorReportEntry_t FileSys[FM_TABLE_ENTRY_COUNT]; /**< \brief Array of file system free space entries */ + FM_MonitorReportPkt_Payload_t Payload; /**< \brief Telemetry Payload */ } FM_MonitorReportPkt_t; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -406,12 +543,10 @@ typedef struct /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** - * \brief Housekeeping telemetry packet + * \brief Housekeeping telemetry payload */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ - uint8 CommandCounter; /**< \brief Application command counter */ uint8 CommandErrCounter; /**< \brief Application command error counter */ uint8 Spare; /**< \brief Placeholder for unused command warning counter */ @@ -426,6 +561,16 @@ typedef struct uint8 ChildCurrentCC; /**< \brief Command code currently executing */ uint8 ChildPreviousCC; /**< \brief Command code previously executed */ +} FM_HousekeepingPkt_Payload_t; + +/** + * \brief Housekeeping telemetry packet + */ +typedef struct +{ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ + + FM_HousekeepingPkt_Payload_t Payload; /**< \brief Telemetry Payload */ } FM_HousekeepingPkt_t; /**\}*/ diff --git a/fsw/src/fm_app.c b/fsw/src/fm_app.c index 5023cbb..d6650cd 100644 --- a/fsw/src/fm_app.c +++ b/fsw/src/fm_app.c @@ -389,8 +389,9 @@ void FM_ProcessCmd(const CFE_SB_Buffer_t *BufPtr) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void FM_ReportHK(const CFE_MSG_CommandHeader_t *Msg) { - const char *CmdText = "HK Request"; - bool Result = true; + const char * CmdText = "HK Request"; + bool Result = true; + FM_HousekeepingPkt_Payload_t *PayloadPtr; /* Verify command packet length */ Result = FM_IsValidCmdPktLength(&Msg->Msg, sizeof(FM_HousekeepingCmd_t), FM_HK_REQ_ERR_EID, CmdText); @@ -405,22 +406,24 @@ void FM_ReportHK(const CFE_MSG_CommandHeader_t *Msg) CFE_MSG_Init(&FM_GlobalData.HousekeepingPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(FM_HK_TLM_MID), sizeof(FM_HousekeepingPkt_t)); + PayloadPtr = &FM_GlobalData.HousekeepingPkt.Payload; + /* Report application command counters */ - FM_GlobalData.HousekeepingPkt.CommandCounter = FM_GlobalData.CommandCounter; - FM_GlobalData.HousekeepingPkt.CommandErrCounter = FM_GlobalData.CommandErrCounter; + PayloadPtr->CommandCounter = FM_GlobalData.CommandCounter; + PayloadPtr->CommandErrCounter = FM_GlobalData.CommandErrCounter; - FM_GlobalData.HousekeepingPkt.NumOpenFiles = FM_GetOpenFilesData(NULL); + PayloadPtr->NumOpenFiles = FM_GetOpenFilesData(NULL); /* Report child task command counters */ - FM_GlobalData.HousekeepingPkt.ChildCmdCounter = FM_GlobalData.ChildCmdCounter; - FM_GlobalData.HousekeepingPkt.ChildCmdErrCounter = FM_GlobalData.ChildCmdErrCounter; - FM_GlobalData.HousekeepingPkt.ChildCmdWarnCounter = FM_GlobalData.ChildCmdWarnCounter; + PayloadPtr->ChildCmdCounter = FM_GlobalData.ChildCmdCounter; + PayloadPtr->ChildCmdErrCounter = FM_GlobalData.ChildCmdErrCounter; + PayloadPtr->ChildCmdWarnCounter = FM_GlobalData.ChildCmdWarnCounter; - FM_GlobalData.HousekeepingPkt.ChildQueueCount = FM_GlobalData.ChildQueueCount; + PayloadPtr->ChildQueueCount = FM_GlobalData.ChildQueueCount; /* Report current and previous commands executed by the child task */ - FM_GlobalData.HousekeepingPkt.ChildCurrentCC = FM_GlobalData.ChildCurrentCC; - FM_GlobalData.HousekeepingPkt.ChildPreviousCC = FM_GlobalData.ChildPreviousCC; + PayloadPtr->ChildCurrentCC = FM_GlobalData.ChildCurrentCC; + PayloadPtr->ChildPreviousCC = FM_GlobalData.ChildPreviousCC; CFE_SB_TimeStampMsg(&FM_GlobalData.HousekeepingPkt.TlmHeader.Msg); CFE_SB_TransmitMsg(&FM_GlobalData.HousekeepingPkt.TlmHeader.Msg, true); diff --git a/fsw/src/fm_child.c b/fsw/src/fm_child.c index bba0e61..35e2e78 100644 --- a/fsw/src/fm_child.c +++ b/fsw/src/fm_child.c @@ -809,6 +809,8 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs) osal_id_t FileHandle = OS_OBJECT_ID_UNDEFINED; int32 Status = 0; + FM_FileInfoPkt_Payload_t *ReportPtr; + /* Report current child task activity */ FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode; @@ -826,14 +828,16 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs) CFE_MSG_Init(&FM_GlobalData.FileInfoPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(FM_FILE_INFO_TLM_MID), sizeof(FM_FileInfoPkt_t)); + ReportPtr = &FM_GlobalData.FileInfoPkt.Payload; + /* Report directory or filename state, name, size and time */ - FM_GlobalData.FileInfoPkt.FileStatus = (uint8)CmdArgs->FileInfoState; - strncpy(FM_GlobalData.FileInfoPkt.Filename, CmdArgs->Source1, OS_MAX_PATH_LEN - 1); - FM_GlobalData.FileInfoPkt.Filename[OS_MAX_PATH_LEN - 1] = '\0'; + ReportPtr->FileStatus = (uint8)CmdArgs->FileInfoState; + strncpy(ReportPtr->Filename, CmdArgs->Source1, OS_MAX_PATH_LEN - 1); + ReportPtr->Filename[OS_MAX_PATH_LEN - 1] = '\0'; - FM_GlobalData.FileInfoPkt.FileSize = CmdArgs->FileInfoSize; - FM_GlobalData.FileInfoPkt.LastModifiedTime = CmdArgs->FileInfoTime; - FM_GlobalData.FileInfoPkt.Mode = CmdArgs->Mode; + ReportPtr->FileSize = CmdArgs->FileInfoSize; + ReportPtr->LastModifiedTime = CmdArgs->FileInfoTime; + ReportPtr->Mode = CmdArgs->Mode; /* Validate CRC algorithm */ if (CmdArgs->FileInfoCRC != FM_IGNORE_CRC) @@ -895,8 +899,8 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs) OS_close(FileHandle); /* Add CRC to telemetry packet */ - FM_GlobalData.FileInfoPkt.CRC_Computed = true; - FM_GlobalData.FileInfoPkt.CRC = CurrentCRC; + ReportPtr->CRC_Computed = true; + ReportPtr->CRC = CurrentCRC; } else if (BytesRead < 0) { @@ -933,7 +937,7 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs) } } - FM_GlobalData.FileInfoPkt.CRC = CurrentCRC; + ReportPtr->CRC = CurrentCRC; } /* Timestamp and send file info telemetry packet */ @@ -1148,6 +1152,8 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs) int32 FilesTillSleep = FM_CHILD_STAT_SLEEP_FILECOUNT; int32 Status; + FM_DirListPkt_Payload_t *ReportPtr; + memset(&DirEntry, 0, sizeof(DirEntry)); /* Report current child task activity */ @@ -1180,9 +1186,11 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs) CFE_MSG_Init(&FM_GlobalData.DirListPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(FM_DIR_LIST_TLM_MID), sizeof(FM_DirListPkt_t)); - strncpy(FM_GlobalData.DirListPkt.DirName, CmdArgs->Source1, OS_MAX_PATH_LEN - 1); - FM_GlobalData.DirListPkt.DirName[OS_MAX_PATH_LEN - 1] = '\0'; - FM_GlobalData.DirListPkt.FirstFile = CmdArgs->DirListOffset; + ReportPtr = &FM_GlobalData.DirListPkt.Payload; + + strncpy(ReportPtr->DirName, CmdArgs->Source1, OS_MAX_PATH_LEN - 1); + ReportPtr->DirName[OS_MAX_PATH_LEN - 1] = '\0'; + ReportPtr->FirstFile = CmdArgs->DirListOffset; StillProcessing = true; while (StillProcessing == true) @@ -1199,16 +1207,16 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs) (strcmp(OS_DIRENTRY_NAME(DirEntry), FM_PARENT_DIRECTORY) != 0)) { /* Do not count the "." and ".." directory entries */ - FM_GlobalData.DirListPkt.TotalFiles++; + ReportPtr->TotalFiles++; /* Start collecting directory entries at command specified offset */ /* Stop collecting directory entries when telemetry packet is full */ - if ((FM_GlobalData.DirListPkt.TotalFiles > FM_GlobalData.DirListPkt.FirstFile) && - (FM_GlobalData.DirListPkt.PacketFiles < FM_DIR_LIST_PKT_ENTRIES)) + if ((ReportPtr->TotalFiles > ReportPtr->FirstFile) && + (ReportPtr->PacketFiles < FM_DIR_LIST_PKT_ENTRIES)) { /* Create a shorthand access to the packet list entry */ - ListIndex = FM_GlobalData.DirListPkt.PacketFiles; - ListEntry = &FM_GlobalData.DirListPkt.FileList[ListIndex]; + ListIndex = ReportPtr->PacketFiles; + ListEntry = &ReportPtr->FileList[ListIndex]; EntryLength = strlen(OS_DIRENTRY_NAME(DirEntry)); @@ -1227,7 +1235,7 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs) FM_ChildSleepStat(LogicalName, ListEntry, &FilesTillSleep, CmdArgs->GetSizeTimeMode); /* Add another entry to the telemetry packet */ - FM_GlobalData.DirListPkt.PacketFiles++; + ReportPtr->PacketFiles++; } else { diff --git a/fsw/src/fm_cmds.c b/fsw/src/fm_cmds.c index 872e766..4fc3fe0 100644 --- a/fsw/src/fm_cmds.c +++ b/fsw/src/fm_cmds.c @@ -39,6 +39,14 @@ #include +/** + * \brief Internal Macro to access the internal payload structure of a message + * + * This is done as a macro so it can be applied consistently to all + * message processing functions, based on the way FM defines its messages. + */ +#define FM_GET_CMD_PAYLOAD(ptr, type) (&((const type *)(ptr))->Payload) + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* FM command handler -- NOOP */ @@ -102,11 +110,12 @@ bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_CopyFileCmd_t * CmdPtr = (FM_CopyFileCmd_t *)BufPtr; FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Copy File"; bool CommandResult = false; + const FM_OvwSourceTargetFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_CopyFileCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_CopyFileCmd_t), FM_COPY_PKT_ERR_EID, CmdText); @@ -169,11 +178,12 @@ bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_MoveFileCmd_t * CmdPtr = (FM_MoveFileCmd_t *)BufPtr; FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Move File"; bool CommandResult = false; + const FM_OvwSourceTargetFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_MoveFileCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_MoveFileCmd_t), FM_MOVE_PKT_ERR_EID, CmdText); @@ -237,11 +247,12 @@ bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_RenameFileCmd_t * CmdPtr = (FM_RenameFileCmd_t *)BufPtr; FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Rename File"; bool CommandResult = false; + const FM_SourceTargetFileName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_RenameFileCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_RenameFileCmd_t), FM_RENAME_PKT_ERR_EID, CmdText); @@ -292,11 +303,12 @@ bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_DeleteFileCmd_t * CmdPtr = (FM_DeleteFileCmd_t *)BufPtr; FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Delete File"; bool CommandResult = false; + const FM_SingleFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DeleteFileCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DeleteFileCmd_t), FM_DELETE_PKT_ERR_EID, CmdText); @@ -338,12 +350,13 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_DeleteAllCmd_t * CmdPtr = (FM_DeleteAllCmd_t *)BufPtr; const char * CmdText = "Delete All Files"; char DirWithSep[OS_MAX_PATH_LEN] = "\0"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult = false; + const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DeleteAllCmd_t); + /* Verify message length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DeleteAllCmd_t), FM_DELETE_ALL_PKT_ERR_EID, CmdText); @@ -393,11 +406,12 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_DecompressCmd_t * CmdPtr = (FM_DecompressCmd_t *)BufPtr; const char * CmdText = "Decompress File"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult = false; + const FM_SourceTargetFileName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DecompressCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DecompressCmd_t), FM_DECOM_PKT_ERR_EID, CmdText); @@ -446,11 +460,12 @@ bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_ConcatCmd_t * CmdPtr = (FM_ConcatCmd_t *)BufPtr; const char * CmdText = "Concat Files"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult = false; + const FM_TwoSourceOneTarget_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_ConcatCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_ConcatCmd_t), FM_CONCAT_PKT_ERR_EID, CmdText); @@ -507,12 +522,13 @@ bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_GetFileInfoCmd_t * CmdPtr = (FM_GetFileInfoCmd_t *)BufPtr; const char * CmdText = "Get File Info"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult = false; uint32 FilenameState = FM_NAME_IS_INVALID; + const FM_FilenameAndCRC_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_GetFileInfoCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetFileInfoCmd_t), FM_GET_FILE_INFO_PKT_ERR_EID, CmdText); @@ -572,6 +588,8 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr) bool CommandResult = false; uint32 NumOpenFiles = 0; + FM_OpenFilesPkt_Payload_t *ReportPtr = &FM_GlobalData.OpenFilesPkt.Payload; + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetOpenFilesCmd_t), FM_GET_OPEN_FILES_PKT_ERR_EID, CmdText); @@ -582,8 +600,9 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr) sizeof(FM_OpenFilesPkt_t)); /* Get list of open files and count */ - NumOpenFiles = FM_GetOpenFilesData(FM_GlobalData.OpenFilesPkt.OpenFilesList); - FM_GlobalData.OpenFilesPkt.NumOpenFiles = NumOpenFiles; + NumOpenFiles = FM_GetOpenFilesData(ReportPtr->OpenFilesList); + + ReportPtr->NumOpenFiles = NumOpenFiles; /* Timestamp and send open files telemetry packet */ CFE_SB_TimeStampMsg(&FM_GlobalData.OpenFilesPkt.TlmHeader.Msg); @@ -604,11 +623,12 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_CreateDirCmd_t * CmdPtr = (FM_CreateDirCmd_t *)BufPtr; FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Create Directory"; bool CommandResult = false; + const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_CreateDirCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_CreateDirCmd_t), FM_CREATE_DIR_PKT_ERR_EID, CmdText); @@ -650,11 +670,12 @@ bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_DeleteDirCmd_t * CmdPtr = (FM_DeleteDirCmd_t *)BufPtr; FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Delete Directory"; bool CommandResult = false; + const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DeleteDirCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DeleteDirCmd_t), FM_DELETE_DIR_PKT_ERR_EID, CmdText); @@ -696,13 +717,14 @@ bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_GetDirFileCmd_t * CmdPtr = (FM_GetDirFileCmd_t *)BufPtr; const char * CmdText = "Directory List to File"; char DirWithSep[OS_MAX_PATH_LEN] = "\0"; char Filename[OS_MAX_PATH_LEN] = "\0"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult = false; + const FM_GetDirectoryToFile_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_GetDirFileCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetDirFileCmd_t), FM_GET_DIR_FILE_PKT_ERR_EID, CmdText); @@ -775,12 +797,13 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_GetDirPktCmd_t * CmdPtr = (FM_GetDirPktCmd_t *)BufPtr; const char * CmdText = "Directory List to Packet"; char DirWithSep[OS_MAX_PATH_LEN] = "\0"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult = false; + const FM_GetDirectoryToPkt_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_GetDirPktCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetDirPktCmd_t), FM_GET_DIR_PKT_PKT_ERR_EID, CmdText); @@ -862,7 +885,7 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr) /* Process enabled file system table entries */ MonitorPtr = FM_GlobalData.MonitorTablePtr->Entries; - ReportPtr = FM_GlobalData.MonitorReportPkt.FileSys; + ReportPtr = FM_GlobalData.MonitorReportPkt.Payload.FileSys; for (i = 0; i < FM_TABLE_ENTRY_COUNT; i++) { if (MonitorPtr->Type != FM_MonitorTableEntry_Type_UNUSED) @@ -927,9 +950,10 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_SetTableStateCmd_t *CmdPtr = (FM_SetTableStateCmd_t *)BufPtr; - const char * CmdText = "Set Table State"; - bool CommandResult = false; + const char *CmdText = "Set Table State"; + bool CommandResult = false; + + const FM_TableIndexAndState_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_SetTableStateCmd_t); /* Verify command packet length */ CommandResult = @@ -997,12 +1021,13 @@ bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr) bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr) { - FM_SetPermCmd_t * CmdPtr = (FM_SetPermCmd_t *)BufPtr; FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Set Permissions"; bool CommandResult = false; bool FilenameState = FM_NAME_IS_INVALID; + const FM_FilenameAndMode_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_SetPermCmd_t); + /* Verify command packet length */ CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_SetPermCmd_t), FM_SET_PERM_ERR_EID, CmdText); diff --git a/unit-test/fm_app_tests.c b/unit-test/fm_app_tests.c index 849b95a..ecdc67e 100644 --- a/unit-test/fm_app_tests.c +++ b/unit-test/fm_app_tests.c @@ -349,6 +349,8 @@ void Test_FM_AppInit_TableInitSuccess(void) * *******************************/ void Test_FM_ReportHK_ReturnPktLengthTrue(void) { + FM_HousekeepingPkt_Payload_t *ReportPtr; + /* Arrange */ UT_SetDefaultReturnValue(UT_KEY(FM_IsValidCmdPktLength), true); UT_SetDefaultReturnValue(UT_KEY(FM_GetOpenFilesData), 0); @@ -374,15 +376,17 @@ void Test_FM_ReportHK_ReturnPktLengthTrue(void) UtAssert_STUB_COUNT(FM_GetOpenFilesData, 1); UtAssert_STUB_COUNT(CFE_SB_TimeStampMsg, 1); UtAssert_STUB_COUNT(CFE_SB_TransmitMsg, 1); - UtAssert_INT32_EQ(FM_GlobalData.HousekeepingPkt.CommandCounter, FM_GlobalData.CommandCounter); - UtAssert_INT32_EQ(FM_GlobalData.HousekeepingPkt.CommandErrCounter, FM_GlobalData.CommandErrCounter); - UtAssert_INT32_EQ(FM_GlobalData.HousekeepingPkt.NumOpenFiles, 0); - UtAssert_INT32_EQ(FM_GlobalData.HousekeepingPkt.ChildCmdCounter, FM_GlobalData.ChildCmdCounter); - UtAssert_INT32_EQ(FM_GlobalData.HousekeepingPkt.ChildCmdErrCounter, FM_GlobalData.ChildCmdErrCounter); - UtAssert_INT32_EQ(FM_GlobalData.HousekeepingPkt.ChildCmdWarnCounter, FM_GlobalData.ChildCmdWarnCounter); - UtAssert_INT32_EQ(FM_GlobalData.HousekeepingPkt.ChildQueueCount, FM_GlobalData.ChildQueueCount); - UtAssert_INT32_EQ(FM_GlobalData.HousekeepingPkt.ChildCurrentCC, FM_GlobalData.ChildCurrentCC); - UtAssert_INT32_EQ(FM_GlobalData.HousekeepingPkt.ChildPreviousCC, FM_GlobalData.ChildPreviousCC); + + ReportPtr = &FM_GlobalData.HousekeepingPkt.Payload; + UtAssert_INT32_EQ(ReportPtr->CommandCounter, FM_GlobalData.CommandCounter); + UtAssert_INT32_EQ(ReportPtr->CommandErrCounter, FM_GlobalData.CommandErrCounter); + UtAssert_INT32_EQ(ReportPtr->NumOpenFiles, 0); + UtAssert_INT32_EQ(ReportPtr->ChildCmdCounter, FM_GlobalData.ChildCmdCounter); + UtAssert_INT32_EQ(ReportPtr->ChildCmdErrCounter, FM_GlobalData.ChildCmdErrCounter); + UtAssert_INT32_EQ(ReportPtr->ChildCmdWarnCounter, FM_GlobalData.ChildCmdWarnCounter); + UtAssert_INT32_EQ(ReportPtr->ChildQueueCount, FM_GlobalData.ChildQueueCount); + UtAssert_INT32_EQ(ReportPtr->ChildCurrentCC, FM_GlobalData.ChildCurrentCC); + UtAssert_INT32_EQ(ReportPtr->ChildPreviousCC, FM_GlobalData.ChildPreviousCC); } void Test_FM_ReportHK_ReturnPktLengthFalse(void) diff --git a/unit-test/fm_child_tests.c b/unit-test/fm_child_tests.c index c4ff195..606a473 100644 --- a/unit-test/fm_child_tests.c +++ b/unit-test/fm_child_tests.c @@ -1598,6 +1598,8 @@ void Test_FM_ChildDirListPktCmd_OSDirOpenNotSuccess(void) void Test_FM_ChildDirListPktCmd_OSDirReadNotSuccess(void) { + FM_DirListPkt_Payload_t *ReportPtr; + /* Arrange */ FM_ChildQueueEntry_t queue_entry = { .CommandCode = FM_GET_DIR_PKT_CC, .Source1 = "dummy_source1", .Source2 = "dummy_source2"}; @@ -1615,11 +1617,15 @@ void Test_FM_ChildDirListPktCmd_OSDirReadNotSuccess(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_CMD_EID); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.PacketFiles, 0); + + ReportPtr = &FM_GlobalData.DirListPkt.Payload; + UtAssert_UINT32_EQ(ReportPtr->PacketFiles, 0); } void Test_FM_ChildDirListPktCmd_DirEntryNameThisDirectory(void) { + FM_DirListPkt_Payload_t *ReportPtr; + /* Arrange */ FM_ChildQueueEntry_t queue_entry = { .CommandCode = FM_GET_DIR_PKT_CC, .Source1 = "dummy_source1", .Source2 = "dummy_source2"}; @@ -1639,11 +1645,15 @@ void Test_FM_ChildDirListPktCmd_DirEntryNameThisDirectory(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_CMD_EID); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.PacketFiles, 0); + + ReportPtr = &FM_GlobalData.DirListPkt.Payload; + UtAssert_UINT32_EQ(ReportPtr->PacketFiles, 0); } void Test_FM_ChildDirListPktCmd_DirEntryNameParentDirectory(void) { + FM_DirListPkt_Payload_t *ReportPtr; + /* Arrange */ FM_ChildQueueEntry_t queue_entry = { .CommandCode = FM_GET_DIR_PKT_CC, .Source1 = "dummy_source1", .Source2 = "dummy_source2"}; @@ -1663,11 +1673,15 @@ void Test_FM_ChildDirListPktCmd_DirEntryNameParentDirectory(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_CMD_EID); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.PacketFiles, 0); + + ReportPtr = &FM_GlobalData.DirListPkt.Payload; + UtAssert_UINT32_EQ(ReportPtr->PacketFiles, 0); } void Test_FM_ChildDirListPktCmd_DirListOffsetNotExceeded(void) { + FM_DirListPkt_Payload_t *ReportPtr; + /* Arrange */ FM_ChildQueueEntry_t queue_entry = { .CommandCode = FM_GET_DIR_PKT_CC, .Source1 = "dummy_source1", .Source2 = "dummy_source2", .DirListOffset = 1}; @@ -1688,13 +1702,16 @@ void Test_FM_ChildDirListPktCmd_DirListOffsetNotExceeded(void) UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_CMD_EID); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.FirstFile, 1); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.TotalFiles, 1); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.PacketFiles, 0); + ReportPtr = &FM_GlobalData.DirListPkt.Payload; + UtAssert_UINT32_EQ(ReportPtr->FirstFile, 1); + UtAssert_UINT32_EQ(ReportPtr->TotalFiles, 1); + UtAssert_UINT32_EQ(ReportPtr->PacketFiles, 0); } void Test_FM_ChildDirListPktCmd_DirListOffsetExceeded(void) { + FM_DirListPkt_Payload_t *ReportPtr; + /* Arrange */ FM_ChildQueueEntry_t queue_entry = { .CommandCode = FM_GET_DIR_PKT_CC, .Source1 = "dummy_source1", .Source2 = "dummy_source2"}; @@ -1719,13 +1736,16 @@ void Test_FM_ChildDirListPktCmd_DirListOffsetExceeded(void) UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_CMD_EID); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.FirstFile, 0); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.TotalFiles, sizeof(direntry) / sizeof(direntry[0])); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.PacketFiles, FM_DIR_LIST_PKT_ENTRIES); + ReportPtr = &FM_GlobalData.DirListPkt.Payload; + UtAssert_UINT32_EQ(ReportPtr->FirstFile, 0); + UtAssert_UINT32_EQ(ReportPtr->TotalFiles, sizeof(direntry) / sizeof(direntry[0])); + UtAssert_UINT32_EQ(ReportPtr->PacketFiles, FM_DIR_LIST_PKT_ENTRIES); } void Test_FM_ChildDirListPktCmd_PathAndEntryLengthGreaterMaxPathLength(void) { + FM_DirListPkt_Payload_t *ReportPtr; + /* Arrange */ FM_ChildQueueEntry_t queue_entry = {.CommandCode = FM_DELETE_ALL_CC, .Source1 = "dummy_source1", @@ -1747,9 +1767,10 @@ void Test_FM_ChildDirListPktCmd_PathAndEntryLengthGreaterMaxPathLength(void) UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_WARNING_EID); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.FirstFile, 0); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.TotalFiles, 1); - UtAssert_UINT32_EQ(FM_GlobalData.DirListPkt.PacketFiles, 0); + ReportPtr = &FM_GlobalData.DirListPkt.Payload; + UtAssert_UINT32_EQ(ReportPtr->FirstFile, 0); + UtAssert_UINT32_EQ(ReportPtr->TotalFiles, 1); + UtAssert_UINT32_EQ(ReportPtr->PacketFiles, 0); } /* **************** diff --git a/unit-test/fm_cmds_tests.c b/unit-test/fm_cmds_tests.c index 495d525..17c4d33 100644 --- a/unit-test/fm_cmds_tests.c +++ b/unit-test/fm_cmds_tests.c @@ -188,8 +188,12 @@ void add_FM_ResetCountersCmd_tests(void) void Test_FM_CopyFileCmd_Success(void) { - strncpy(UT_CmdBuf.CopyFileCmd.Source, "src1", sizeof(UT_CmdBuf.CopyFileCmd.Source) - 1); - strncpy(UT_CmdBuf.CopyFileCmd.Target, "tgt", sizeof(UT_CmdBuf.CopyFileCmd.Target) - 1); + FM_OvwSourceTargetFilename_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.CopyFileCmd.Payload; + + strncpy(CmdPtr->Source, "src1", sizeof(CmdPtr->Source) - 1); + strncpy(CmdPtr->Target, "tgt", sizeof(CmdPtr->Target) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -305,7 +309,11 @@ void Test_FM_CopyFileCmd_NoOverwriteTargetExists(void) void Test_FM_CopyFileCmd_OverwriteFileOpen(void) { - UT_CmdBuf.CopyFileCmd.Overwrite = 1; + FM_OvwSourceTargetFilename_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.CopyFileCmd.Payload; + + CmdPtr->Overwrite = 1; FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -491,7 +499,11 @@ void Test_FM_MoveFileCmd_NoOverwriteTargetExists(void) void Test_FM_MoveFileCmd_OverwriteFileOpen(void) { - UT_CmdBuf.MoveFileCmd.Overwrite = 1; + FM_OvwSourceTargetFilename_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.MoveFileCmd.Payload; + + CmdPtr->Overwrite = 1; FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -562,8 +574,12 @@ void add_FM_MoveFileCmd_tests(void) void Test_FM_RenameFileCmd_Success(void) { - strncpy(UT_CmdBuf.RenameFileCmd.Source, "src1", sizeof(UT_CmdBuf.RenameFileCmd.Source) - 1); - strncpy(UT_CmdBuf.RenameFileCmd.Target, "tgt", sizeof(UT_CmdBuf.RenameFileCmd.Target) - 1); + FM_SourceTargetFileName_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.RenameFileCmd.Payload; + + strncpy(CmdPtr->Source, "src1", sizeof(CmdPtr->Source) - 1); + strncpy(CmdPtr->Target, "tgt", sizeof(CmdPtr->Target) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -797,7 +813,11 @@ void add_FM_DeleteFileCmd_tests(void) void Test_FM_DeleteAllFilesCmd_Success(void) { - strncpy(UT_CmdBuf.DeleteAllCmd.Directory, "dir", sizeof(UT_CmdBuf.DeleteAllCmd.Directory) - 1); + FM_DirectoryName_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.DeleteAllCmd.Payload; + + strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -859,7 +879,11 @@ void Test_FM_DeleteAllFilesCmd_DirNoExist(void) void Test_FM_DeleteAllFilesCmd_NoChildTask(void) { - strncpy(UT_CmdBuf.DeleteAllCmd.Directory, "dir", sizeof(UT_CmdBuf.DeleteAllCmd.Directory) - 1); + FM_DirectoryName_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.DeleteAllCmd.Payload; + + strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -1024,9 +1048,13 @@ void add_FM_DecompressFileCmd_tests(void) void Test_FM_ConcatFilesCmd_Success(void) { - strncpy(UT_CmdBuf.ConcatCmd.Source1, "src1", sizeof(UT_CmdBuf.ConcatCmd.Source1) - 1); - strncpy(UT_CmdBuf.ConcatCmd.Source2, "src2", sizeof(UT_CmdBuf.ConcatCmd.Source2) - 1); - strncpy(UT_CmdBuf.ConcatCmd.Target, "tgt", sizeof(UT_CmdBuf.ConcatCmd.Target) - 1); + FM_TwoSourceOneTarget_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.ConcatCmd.Payload; + + strncpy(CmdPtr->Source1, "src1", sizeof(CmdPtr->Source1) - 1); + strncpy(CmdPtr->Source2, "src2", sizeof(CmdPtr->Source2) - 1); + strncpy(CmdPtr->Target, "tgt", sizeof(CmdPtr->Target) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -1173,7 +1201,11 @@ void add_FM_ConcatFilesCmd_tests(void) void Test_FM_GetFileInfoCmd_Success(void) { - strncpy(UT_CmdBuf.GetFileInfoCmd.Filename, "file", sizeof(UT_CmdBuf.GetFileInfoCmd.Filename) - 1); + FM_FilenameAndCRC_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.GetFileInfoCmd.Payload; + + strncpy(CmdPtr->Filename, "file", sizeof(CmdPtr->Filename) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -1323,7 +1355,11 @@ void add_FM_GetOpenFilesCmd_tests(void) void Test_FM_CreateDirectoryCmd_Success(void) { - strncpy(UT_CmdBuf.CreateDirCmd.Directory, "dir", sizeof(UT_CmdBuf.CreateDirCmd.Directory) - 1); + FM_DirectoryName_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.CreateDirCmd.Payload; + + strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -1423,7 +1459,11 @@ void add_FM_CreateDirectoryCmd_tests(void) void Test_FM_DeleteDirectoryCmd_Success(void) { - strncpy(UT_CmdBuf.DeleteDirCmd.Directory, "dir", sizeof(UT_CmdBuf.DeleteDirCmd.Directory) - 1); + FM_DirectoryName_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.DeleteDirCmd.Payload; + + strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -1523,8 +1563,12 @@ void add_FM_DeleteDirectoryCmd_tests(void) void Test_FM_GetDirListFileCmd_Success(void) { - strncpy(UT_CmdBuf.GetDirFileCmd.Filename, "file", sizeof(UT_CmdBuf.GetDirFileCmd.Filename) - 1); - strncpy(UT_CmdBuf.GetDirFileCmd.Directory, "dir", sizeof(UT_CmdBuf.GetDirFileCmd.Directory) - 1); + FM_GetDirectoryToFile_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.GetDirFileCmd.Payload; + + strncpy(CmdPtr->Filename, "file", sizeof(CmdPtr->Filename) - 1); + strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -1546,8 +1590,12 @@ void Test_FM_GetDirListFileCmd_Success(void) void Test_FM_GetDirListFileCmd_SuccessDefaultPath(void) { - strncpy(UT_CmdBuf.GetDirFileCmd.Directory, "dir", sizeof(UT_CmdBuf.GetDirFileCmd.Directory) - 1); - UT_CmdBuf.GetDirFileCmd.Filename[0] = '\0'; + FM_GetDirectoryToFile_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.GetDirFileCmd.Payload; + + strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1); + CmdPtr->Filename[0] = '\0'; FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -1611,8 +1659,12 @@ void Test_FM_GetDirListFileCmd_SourceNotExist(void) void Test_FM_GetDirListFileCmd_TargetFileOpen(void) { - strncpy(UT_CmdBuf.GetDirFileCmd.Filename, "file", sizeof(UT_CmdBuf.GetDirFileCmd.Filename) - 1); - strncpy(UT_CmdBuf.GetDirFileCmd.Directory, "dir", sizeof(UT_CmdBuf.GetDirFileCmd.Directory) - 1); + FM_GetDirectoryToFile_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.GetDirFileCmd.Payload; + + strncpy(CmdPtr->Filename, "file", sizeof(CmdPtr->Filename) - 1); + strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -1635,8 +1687,12 @@ void Test_FM_GetDirListFileCmd_TargetFileOpen(void) void Test_FM_GetDirListFileCmd_NoChildTask(void) { - strncpy(UT_CmdBuf.GetDirFileCmd.Filename, "file", sizeof(UT_CmdBuf.GetDirFileCmd.Filename) - 1); - strncpy(UT_CmdBuf.GetDirFileCmd.Directory, "dir", sizeof(UT_CmdBuf.GetDirFileCmd.Directory) - 1); + FM_GetDirectoryToFile_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.GetDirFileCmd.Payload; + + strncpy(CmdPtr->Filename, "file", sizeof(CmdPtr->Filename) - 1); + strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -1683,7 +1739,11 @@ void add_FM_GetDirListFileCmd_tests(void) void Test_FM_GetDirListPktCmd_Success(void) { - strncpy(UT_CmdBuf.GetDirPktCmd.Directory, "dir", sizeof(UT_CmdBuf.GetDirPktCmd.Directory) - 1); + FM_GetDirectoryToPkt_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.GetDirPktCmd.Payload; + + strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1); FM_GlobalData.ChildWriteIndex = 0; FM_GlobalData.ChildQueue[0].CommandCode = 0; @@ -1793,8 +1853,11 @@ void UT_Handler_MonitorSpace(void *UserObj, UT_EntryKey_t FuncKey, const UT_Stub void Test_FM_MonitorFilesystemSpaceCmd_Success(void) { + FM_MonitorReportPkt_Payload_t *ReportPtr; + int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; + snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command"); FM_MonitorTable_t DummyTable; @@ -1836,12 +1899,14 @@ void Test_FM_MonitorFilesystemSpaceCmd_Success(void) UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 1); - UtAssert_UINT32_EQ(FM_GlobalData.MonitorReportPkt.FileSys[0].Bytes, 2000); - UtAssert_UINT32_EQ(FM_GlobalData.MonitorReportPkt.FileSys[0].Blocks, 20); - UtAssert_UINT32_EQ(FM_GlobalData.MonitorReportPkt.FileSys[1].Bytes, 1000); - UtAssert_UINT32_EQ(FM_GlobalData.MonitorReportPkt.FileSys[1].Blocks, 10); - UtAssert_UINT32_EQ(FM_GlobalData.MonitorReportPkt.FileSys[2].Bytes, 0); - UtAssert_UINT32_EQ(FM_GlobalData.MonitorReportPkt.FileSys[2].Blocks, 0); + + ReportPtr = &FM_GlobalData.MonitorReportPkt.Payload; + UtAssert_UINT32_EQ(ReportPtr->FileSys[0].Bytes, 2000); + UtAssert_UINT32_EQ(ReportPtr->FileSys[0].Blocks, 20); + UtAssert_UINT32_EQ(ReportPtr->FileSys[1].Bytes, 1000); + UtAssert_UINT32_EQ(ReportPtr->FileSys[1].Blocks, 10); + UtAssert_UINT32_EQ(ReportPtr->FileSys[2].Bytes, 0); + UtAssert_UINT32_EQ(ReportPtr->FileSys[2].Blocks, 0); } void Test_FM_MonitorFilesystemSpaceCmd_BadLength(void) @@ -1887,9 +1952,12 @@ void Test_FM_MonitorFilesystemSpaceCmd_NullFreeSpaceTable(void) void Test_FM_MonitorFilesystemSpaceCmd_ImplCallFails(void) { + FM_MonitorReportPkt_Payload_t *ReportPtr; + int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; char ExpectedEventString2[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; + snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "Could not get file system free space for %%s. Returned 0x%%08X"); snprintf(ExpectedEventString2, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command"); @@ -1922,15 +1990,19 @@ void Test_FM_MonitorFilesystemSpaceCmd_ImplCallFails(void) UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 1); - UtAssert_ZERO(FM_GlobalData.MonitorReportPkt.FileSys[0].Blocks); - UtAssert_ZERO(FM_GlobalData.MonitorReportPkt.FileSys[0].Bytes); + ReportPtr = &FM_GlobalData.MonitorReportPkt.Payload; + UtAssert_ZERO(ReportPtr->FileSys[0].Blocks); + UtAssert_ZERO(ReportPtr->FileSys[0].Bytes); } void Test_FM_MonitorFilesystemSpaceCmd_NotImpl(void) { + FM_MonitorReportPkt_Payload_t *ReportPtr; + int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; char ExpectedEventString2[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; + snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "Could not get file system free space for %%s. Returned 0x%%08X"); snprintf(ExpectedEventString2, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command"); @@ -1962,8 +2034,9 @@ void Test_FM_MonitorFilesystemSpaceCmd_NotImpl(void) UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 1); - UtAssert_ZERO(FM_GlobalData.MonitorReportPkt.FileSys[0].Blocks); - UtAssert_ZERO(FM_GlobalData.MonitorReportPkt.FileSys[0].Bytes); + ReportPtr = &FM_GlobalData.MonitorReportPkt.Payload; + UtAssert_ZERO(ReportPtr->FileSys[0].Blocks); + UtAssert_ZERO(ReportPtr->FileSys[0].Bytes); } void add_FM_MonitorFilesystemSpaceCmd_tests(void) @@ -1990,8 +2063,12 @@ void add_FM_MonitorFilesystemSpaceCmd_tests(void) void Test_FM_SetTableStateCmd_Success(void) { - UT_CmdBuf.SetTableStateCmd.TableEntryState = FM_TABLE_ENTRY_ENABLED; - UT_CmdBuf.SetTableStateCmd.TableEntryIndex = 0; + FM_TableIndexAndState_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload; + + CmdPtr->TableEntryState = FM_TABLE_ENTRY_ENABLED; + CmdPtr->TableEntryIndex = 0; int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; @@ -2023,8 +2100,12 @@ void Test_FM_SetTableStateCmd_Success(void) void Test_FM_SetTableStateCmd_BadLength(void) { - UT_CmdBuf.SetTableStateCmd.TableEntryState = FM_TABLE_ENTRY_ENABLED; - UT_CmdBuf.SetTableStateCmd.TableEntryIndex = 0; + FM_TableIndexAndState_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload; + + CmdPtr->TableEntryState = FM_TABLE_ENTRY_ENABLED; + CmdPtr->TableEntryIndex = 0; UT_SetDefaultReturnValue(UT_KEY(FM_IsValidCmdPktLength), false); @@ -2040,8 +2121,12 @@ void Test_FM_SetTableStateCmd_BadLength(void) void Test_FM_SetTableStateCmd_NullFreeSpaceTable(void) { - UT_CmdBuf.SetTableStateCmd.TableEntryState = FM_TABLE_ENTRY_ENABLED; - UT_CmdBuf.SetTableStateCmd.TableEntryIndex = 0; + FM_TableIndexAndState_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload; + + CmdPtr->TableEntryState = FM_TABLE_ENTRY_ENABLED; + CmdPtr->TableEntryIndex = 0; int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; @@ -2071,8 +2156,12 @@ void Test_FM_SetTableStateCmd_NullFreeSpaceTable(void) void Test_FM_SetTableStateCmd_TableEntryIndexTooLarge(void) { - UT_CmdBuf.SetTableStateCmd.TableEntryState = FM_TABLE_ENTRY_ENABLED; - UT_CmdBuf.SetTableStateCmd.TableEntryIndex = FM_TABLE_ENTRY_COUNT; + FM_TableIndexAndState_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload; + + CmdPtr->TableEntryState = FM_TABLE_ENTRY_ENABLED; + CmdPtr->TableEntryIndex = FM_TABLE_ENTRY_COUNT; int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; @@ -2106,8 +2195,12 @@ void Test_FM_SetTableStateCmd_TableEntryIndexTooLarge(void) void Test_FM_SetTableStateCmd_BadNewState(void) { - UT_CmdBuf.SetTableStateCmd.TableEntryState = 55; - UT_CmdBuf.SetTableStateCmd.TableEntryIndex = 0; + FM_TableIndexAndState_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload; + + CmdPtr->TableEntryState = 55; + CmdPtr->TableEntryIndex = 0; int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; @@ -2141,8 +2234,12 @@ void Test_FM_SetTableStateCmd_BadNewState(void) void Test_FM_SetTableStateCmd_BadCurrentState(void) { - UT_CmdBuf.SetTableStateCmd.TableEntryState = FM_TABLE_ENTRY_DISABLED; - UT_CmdBuf.SetTableStateCmd.TableEntryIndex = 0; + FM_TableIndexAndState_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload; + + CmdPtr->TableEntryState = FM_TABLE_ENTRY_DISABLED; + CmdPtr->TableEntryIndex = 0; int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; @@ -2197,7 +2294,11 @@ void add_FM_SetTableStateCmd_tests(void) void Test_FM_SetPermissionsCmd_Success(void) { - strncpy(UT_CmdBuf.SetPermCmd.FileName, "file", sizeof(UT_CmdBuf.SetPermCmd.FileName) - 1); + FM_FilenameAndMode_Payload_t *CmdPtr; + + CmdPtr = &UT_CmdBuf.SetPermCmd.Payload; + + strncpy(CmdPtr->FileName, "file", sizeof(CmdPtr->FileName) - 1); UT_SetDefaultReturnValue(UT_KEY(FM_IsValidCmdPktLength), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);