Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1349, remove unneeded CFE_ES_SYSLOG_APPEND macro #1368

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions modules/es/fsw/src/cfe_es_cds.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,10 +885,9 @@ int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices)
/* Report any errors incurred while freeing the CDS Memory Block */
if (Status != CFE_SUCCESS)
{
CFE_ES_SysLog_snprintf(
LogMessage, sizeof(LogMessage),
"CFE_ES:DeleteCDS-Failed to free CDS Mem Block (Handle=0x%08lX)(Stat=0x%08X)\n",
(unsigned long)RegRecPtr->BlockOffset, (unsigned int)Status);
snprintf(LogMessage, sizeof(LogMessage),
"Failed to free CDS Mem Block (Handle=0x%08lX)(Stat=0x%08X)\n",
(unsigned long)RegRecPtr->BlockOffset, (unsigned int)Status);
}
else
{
Expand All @@ -899,9 +898,8 @@ int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices)

if (Status != CFE_SUCCESS)
{
CFE_ES_SysLog_snprintf(LogMessage, sizeof(LogMessage),
"CFE_ES:DeleteCDS-Failed to update CDS Registry (Stat=0x%08X)\n",
(unsigned int)Status);
snprintf(LogMessage, sizeof(LogMessage), "Failed to update CDS Registry (Stat=0x%08X)\n",
(unsigned int)Status);
}
}
}
Expand All @@ -922,7 +920,7 @@ int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices)
/* Output the message to syslog once the CDS registry resource is unlocked */
if (LogMessage[0] != 0)
{
CFE_ES_SYSLOG_APPEND(LogMessage);
CFE_ES_WriteToSysLog("%s(): %s", __func__, LogMessage);
}

return Status;
Expand Down
34 changes: 10 additions & 24 deletions modules/es/fsw/src/cfe_es_cds_mempool.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,12 @@ int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite)
Status = CFE_ES_GenPoolGetBlockSize(&CDS->Pool, &BlockSize, CDSRegRecPtr->BlockOffset);
if (Status != CFE_SUCCESS)
{
CFE_ES_SysLog_snprintf(LogMessage, sizeof(LogMessage),
"CFE_ES:CDSBlkWrite-Invalid Handle or Block Descriptor.\n");
snprintf(LogMessage, sizeof(LogMessage), "Invalid Handle or Block Descriptor.\n");
}
else if (BlockSize <= sizeof(CFE_ES_CDS_BlockHeader_t) || BlockSize != CDSRegRecPtr->BlockSize)
{
CFE_ES_SysLog_snprintf(LogMessage, sizeof(LogMessage),
"CFE_ES:CDSBlkWrite-Block size %lu invalid, expected %lu\n",
(unsigned long)BlockSize, (unsigned long)CDSRegRecPtr->BlockSize);
snprintf(LogMessage, sizeof(LogMessage), "Block size %lu invalid, expected %lu\n", (unsigned long)BlockSize,
(unsigned long)CDSRegRecPtr->BlockSize);
Status = CFE_ES_CDS_INVALID_SIZE;
}
else
Expand All @@ -227,20 +225,18 @@ int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite)
Status = CFE_ES_CDS_CacheFlush(&CDS->Cache);
if (Status != CFE_SUCCESS)
{
CFE_ES_SysLog_snprintf(
LogMessage, sizeof(LogMessage),
"CFE_ES:CDSBlkWrite-Err writing header data to CDS (Stat=0x%08x) @Offset=0x%08lx\n",
(unsigned int)CDS->Cache.AccessStatus, (unsigned long)CDSRegRecPtr->BlockOffset);
snprintf(LogMessage, sizeof(LogMessage),
"Err writing header data to CDS (Stat=0x%08x) @Offset=0x%08lx\n",
(unsigned int)CDS->Cache.AccessStatus, (unsigned long)CDSRegRecPtr->BlockOffset);
}
else
{
Status = CFE_PSP_WriteToCDS(DataToWrite, UserDataOffset, UserDataSize);
if (Status != CFE_PSP_SUCCESS)
{
CFE_ES_SysLog_snprintf(
LogMessage, sizeof(LogMessage),
"CFE_ES:CDSBlkWrite-Err writing user data to CDS (Stat=0x%08x) @Offset=0x%08lx\n",
(unsigned int)Status, (unsigned long)UserDataOffset);
snprintf(LogMessage, sizeof(LogMessage),
"Err writing user data to CDS (Stat=0x%08x) @Offset=0x%08lx\n", (unsigned int)Status,
(unsigned long)UserDataOffset);
}
}
}
Expand All @@ -255,7 +251,7 @@ int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite)
/* Do the actual syslog if something went wrong */
if (LogMessage[0] != 0)
{
CFE_ES_SYSLOG_APPEND(LogMessage);
CFE_ES_WriteToSysLog("%s(): %s", __func__, LogMessage);
}

return Status;
Expand All @@ -271,17 +267,13 @@ int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite)
int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle)
{
CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars;
char LogMessage[CFE_ES_MAX_SYSLOG_MSG_SIZE];
int32 Status;
uint32 CrcOfCDSData;
size_t BlockSize;
size_t UserDataSize;
size_t UserDataOffset;
CFE_ES_CDS_RegRec_t * CDSRegRecPtr;

/* Validate the handle before doing anything */
LogMessage[0] = 0;

CDSRegRecPtr = CFE_ES_LocateCDSBlockRecordByID(Handle);

/*
Expand Down Expand Up @@ -345,12 +337,6 @@ int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle)

CFE_ES_UnlockCDS();

/* Do the actual syslog if something went wrong */
if (LogMessage[0] != 0)
{
CFE_ES_SYSLOG_APPEND(LogMessage);
}

return Status;
}

Expand Down
20 changes: 0 additions & 20 deletions modules/es/fsw/src/cfe_es_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,6 @@
*/
#define CFE_ES_SYSLOG_READ_BUFFER_SIZE (3 * CFE_ES_MAX_SYSLOG_MSG_SIZE)

/**
* \brief Self-synchronized macro to call CFE_ES_SysLogAppend_Unsync
*
* Calls CFE_ES_SysLogAppend_Unsync() with appropriate synchronization.
* It will acquire the shared data lock and release it after appending the log.
*
* This is implemented as a macro such that the "__func__" and "__LINE__" directives
* will reflect the actual place that the append was done, rather than where this
* wrapper was defined.
*
* \sa CFE_ES_SysLogAppend_Unsync()
*/
#define CFE_ES_SYSLOG_APPEND(LogString) \
{ \
CFE_ES_LockSharedData(__func__, __LINE__); \
CFE_ES_SysLogAppend_Unsync(LogString); \
CFE_ES_UnlockSharedData(__func__, __LINE__); \
OS_printf("%s", LogString); \
}

/**
* \brief Indicates no context information Error Logs
*
Expand Down