Skip to content

Commit

Permalink
Fix #110, #149, update identifier names
Browse files Browse the repository at this point in the history
Renames all remaining identifiers that did not have an appropriate
name per the coding standards.  Specifically, this is anything
that did not start with CF prefix (#149) and anything that
ended with an underscore only (#110).
  • Loading branch information
jphickey committed Jan 6, 2022
1 parent b6de205 commit 6213a5b
Show file tree
Hide file tree
Showing 18 changed files with 392 additions and 389 deletions.
35 changes: 18 additions & 17 deletions fsw/src/cf_cfdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ int32 CF_CFDP_InitEngine(void)
** \endreturns
**
*************************************************************************/
int CF_CFDP_CycleTx_(CF_CListNode_t *node, void *context)
int CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context)
{
CF_CFDP_CycleTx_args_t *args = (CF_CFDP_CycleTx_args_t *)context;
CF_Transaction_t *t = container_of(node, CF_Transaction_t, cl_node);
Expand Down Expand Up @@ -1246,7 +1246,7 @@ void CF_CFDP_CycleTx(CF_Channel_t *c)
CF_MoveTransaction(t, CF_QueueIdx_TXA);
/* args is ok, still { c, 0 } */
entry_jump:
CF_CList_Traverse(c->qs[CF_QueueIdx_TXA], CF_CFDP_CycleTx_, &args);
CF_CList_Traverse(c->qs[CF_QueueIdx_TXA], CF_CFDP_CycleTxFirstActive, &args);
}
}

Expand All @@ -1269,9 +1269,9 @@ void CF_CFDP_CycleTx(CF_Channel_t *c)
*************************************************************************/
int CF_CFDP_DoTick(CF_CListNode_t *node, void *context)
{
int ret = CF_CLIST_CONT; /* CF_CLIST_CONT means don't tick one, keep looking for cur */
tick_args_t *args = (tick_args_t *)context;
CF_Transaction_t *t = container_of(node, CF_Transaction_t, cl_node);
int ret = CF_CLIST_CONT; /* CF_CLIST_CONT means don't tick one, keep looking for cur */
CF_CFDP_Tick_args_t *args = (CF_CFDP_Tick_args_t *)context;
CF_Transaction_t *t = container_of(node, CF_Transaction_t, cl_node);
if (!args->c->cur || (args->c->cur == t))
{
/* found where we left off, so clear that and move on */
Expand Down Expand Up @@ -1321,7 +1321,7 @@ void CF_CFDP_TickTransactions(CF_Channel_t *c)

for (; c->tick_type < CF_TickType_NUM_TYPES; ++c->tick_type)
{
tick_args_t args = {c, fns[c->tick_type], 0, 0};
CF_CFDP_Tick_args_t args = {c, fns[c->tick_type], 0, 0};

do
{
Expand Down Expand Up @@ -1384,8 +1384,8 @@ void CF_CFDP_InitTxnTxFile(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint
** t must not be NULL.
**
*************************************************************************/
static void CF_CFDP_TxFile_(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority,
CF_EntityId_t dest_id)
static void CF_CFDP_TxFile_Initiate(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan,
uint8 priority, CF_EntityId_t dest_id)
{
CFE_EVS_SendEvent(CF_EID_INF_CFDP_S_START_SEND, CFE_EVS_EventType_INFORMATION,
"CF: start class %d tx of file %d:%.*s -> %d:%.*s", cfdp_class + 1,
Expand Down Expand Up @@ -1448,7 +1448,7 @@ int32 CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP
t->history->fnames.src_filename[sizeof(t->history->fnames.src_filename) - 1] = 0;
strncpy(t->history->fnames.dst_filename, dst_filename, sizeof(t->history->fnames.dst_filename) - 1);
t->history->fnames.dst_filename[sizeof(t->history->fnames.dst_filename) - 1] = 0;
CF_CFDP_TxFile_(t, cfdp_class, keep, chan, priority, dest_id);
CF_CFDP_TxFile_Initiate(t, cfdp_class, keep, chan, priority, dest_id);

++c->num_cmd_tx;
t->flags.tx.cmd_tx = 1;
Expand All @@ -1472,9 +1472,9 @@ int32 CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP
** \endreturns
**
*************************************************************************/
static int32 CF_CFDP_PlaybackDir_(CF_Playback_t *p, const char *src_filename, const char *dst_filename,
CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority,
CF_EntityId_t dest_id)
static int32 CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *p, const char *src_filename, const char *dst_filename,
CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority,
CF_EntityId_t dest_id)
{
int32 ret = CFE_SUCCESS;

Expand Down Expand Up @@ -1544,7 +1544,7 @@ int32 CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filename, CF
return -1;
}

return CF_CFDP_PlaybackDir_(p, src_filename, dst_filename, cfdp_class, keep, chan, priority, dest_id);
return CF_CFDP_PlaybackDir_Initiate(p, src_filename, dst_filename, cfdp_class, keep, chan, priority, dest_id);
}

/************************************************************************/
Expand Down Expand Up @@ -1598,7 +1598,8 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p)
pt->history->fnames.src_filename[CF_FILENAME_MAX_LEN - 1] = 0;
pt->history->fnames.dst_filename[CF_FILENAME_MAX_LEN - 1] = 0;

CF_CFDP_TxFile_(pt, p->cfdp_class, p->keep, (c - CF_AppData.engine.channels), p->priority, p->dest_id);
CF_CFDP_TxFile_Initiate(pt, p->cfdp_class, p->keep, (c - CF_AppData.engine.channels), p->priority,
p->dest_id);

pt->p = p;
++p->num_ts;
Expand Down Expand Up @@ -1707,16 +1708,16 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c)
else if (CF_Timer_Expired(&p->interval_timer))
{
/* the timer has expired */
int ret = CF_CFDP_PlaybackDir_(&p->pb, pd->src_dir, pd->dst_dir, pd->cfdp_class, 0, chan_index,
pd->priority, pd->dest_eid);
int ret = CF_CFDP_PlaybackDir_Initiate(&p->pb, pd->src_dir, pd->dst_dir, pd->cfdp_class, 0,
chan_index, pd->priority, pd->dest_eid);
if (!ret)
{
p->timer_set = 0;
}
else
{
/* error occured in playback directory, so reset the timer */
/* an event is sent in CF_CFDP_PlaybackDir_ so there is no reason to
/* an event is sent in CF_CFDP_PlaybackDir_Initiate so there is no reason to
* to have another here */
CF_Timer_InitRelSec(&p->interval_timer, pd->interval_sec);
}
Expand Down
8 changes: 4 additions & 4 deletions fsw/src/cf_cfdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@

#include "cf_cfdp_types.h"

typedef struct CF_CFDP_CycleTx_args_t
typedef struct CF_CFDP_CycleTx_args
{
CF_Channel_t *c;
int ran_one;
} CF_CFDP_CycleTx_args_t;

typedef struct
typedef struct CF_CFDP_Tick_args
{
CF_Channel_t *c; /* IN param */
void (*fn)(CF_Transaction_t *, int *); /* IN param */
int early_exit; /* OUT param */
int cont; /* if 1, then re-traverse the list */
} tick_args_t;
} CF_CFDP_Tick_args_t;

void CF_CFDP_EncodeStart(CF_EncoderState_t *penc, void *msgbuf, CF_Logical_PduBuffer_t *ph, size_t encap_hdr_size,
size_t total_size);
Expand Down Expand Up @@ -110,7 +110,7 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph);
int CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context);

void CF_CFDP_CycleTx(CF_Channel_t *c);
int CF_CFDP_CycleTx_(CF_CListNode_t *node, void *context);
int CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context);
void CF_CFDP_TickTransactions(CF_Channel_t *c);
void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p);
void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c);
Expand Down
54 changes: 27 additions & 27 deletions fsw/src/cf_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void CF_CmdPlaybackDir(CFE_SB_Buffer_t *msg)
** \endreturns
**
*************************************************************************/
int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, chan_action_fn_t fn, void *context)
int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, CF_ChanActionFn_t fn, void *context)
{
int ret = 0;

Expand Down Expand Up @@ -244,7 +244,7 @@ int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, chan_action_fn_t
** \endreturns
**
*************************************************************************/
int CF_DoFreezeThaw(uint8 chan_num, const bool_arg_t *context)
int CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *context)
{
/* no need to bounds check chan_num, done in caller */
CF_AppData.hk.channel_hk[chan_num].frozen = context->barg;
Expand All @@ -260,8 +260,8 @@ int CF_DoFreezeThaw(uint8 chan_num, const bool_arg_t *context)
*************************************************************************/
void CF_CmdFreeze(CFE_SB_Buffer_t *msg)
{
bool_arg_t barg = {1}; /* param is frozen, so 1 means freeze */
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "freeze", (chan_action_fn_t)CF_DoFreezeThaw, &barg));
CF_ChanAction_BoolArg_t barg = {1}; /* param is frozen, so 1 means freeze */
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "freeze", (CF_ChanActionFn_t)CF_DoFreezeThaw, &barg));
}

/************************************************************************/
Expand All @@ -273,8 +273,8 @@ void CF_CmdFreeze(CFE_SB_Buffer_t *msg)
*************************************************************************/
void CF_CmdThaw(CFE_SB_Buffer_t *msg)
{
bool_arg_t barg = {0}; /* param is frozen, so 0 means thawed */
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "thaw", (chan_action_fn_t)CF_DoFreezeThaw, &barg));
CF_ChanAction_BoolArg_t barg = {0}; /* param is frozen, so 0 means thawed */
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "thaw", (CF_ChanActionFn_t)CF_DoFreezeThaw, &barg));
}

/************************************************************************/
Expand Down Expand Up @@ -374,7 +374,7 @@ int CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_TsnChanAct
** t must not be NULL. context must not be NULL.
**
*************************************************************************/
void CF_DoSuspRes_(CF_Transaction_t *t, susp_res_arg_t *context)
void CF_DoSuspRes_Txn(CF_Transaction_t *t, CF_ChanAction_SuspResArg_t *context)
{
CF_Assert(t);
if (t->flags.com.suspended == context->action)
Expand All @@ -401,9 +401,9 @@ void CF_DoSuspRes_(CF_Transaction_t *t, susp_res_arg_t *context)
void CF_DoSuspRes(CF_TransactionCmd_t *cmd, uint8 action)
{
/* ok to not bounds check action, because the caller is using it in two places with constant values 0 or 1 */
static const char *msgstr[] = {"resume", "suspend"};
susp_res_arg_t args = {0, action};
int ret = CF_TsnChanAction(cmd, msgstr[action], (CF_TsnChanAction_fn_t)CF_DoSuspRes_, &args);
static const char *msgstr[] = {"resume", "suspend"};
CF_ChanAction_SuspResArg_t args = {0, action};
int ret = CF_TsnChanAction(cmd, msgstr[action], (CF_TsnChanAction_fn_t)CF_DoSuspRes_Txn, &args);

if (!ret && args.same)
{
Expand Down Expand Up @@ -454,7 +454,7 @@ void CF_CmdResume(CFE_SB_Buffer_t *msg)
** t must not be NULL.
**
*************************************************************************/
void CF_CmdCancel_(CF_Transaction_t *t, void *ignored)
void CF_CmdCancel_Txn(CF_Transaction_t *t, void *ignored)
{
CF_CFDP_CancelTransaction(t);
}
Expand All @@ -468,7 +468,7 @@ void CF_CmdCancel_(CF_Transaction_t *t, void *ignored)
*************************************************************************/
void CF_CmdCancel(CFE_SB_Buffer_t *msg)
{
CF_CmdCond(CF_TsnChanAction((CF_TransactionCmd_t *)msg, "cancel", CF_CmdCancel_, NULL));
CF_CmdCond(CF_TsnChanAction((CF_TransactionCmd_t *)msg, "cancel", CF_CmdCancel_Txn, NULL));
}

/************************************************************************/
Expand All @@ -478,7 +478,7 @@ void CF_CmdCancel(CFE_SB_Buffer_t *msg)
** msg must not be NULL.
**
*************************************************************************/
void CF_CmdAbandon_(CF_Transaction_t *t, void *ignored)
void CF_CmdAbandon_Txn(CF_Transaction_t *t, void *ignored)
{
CF_CFDP_ResetTransaction(t, 0);
}
Expand All @@ -492,7 +492,7 @@ void CF_CmdAbandon_(CF_Transaction_t *t, void *ignored)
*************************************************************************/
void CF_CmdAbandon(CFE_SB_Buffer_t *msg)
{
CF_CmdCond(CF_TsnChanAction((CF_TransactionCmd_t *)msg, "abandon", CF_CmdAbandon_, NULL));
CF_CmdCond(CF_TsnChanAction((CF_TransactionCmd_t *)msg, "abandon", CF_CmdAbandon_Txn, NULL));
}

/************************************************************************/
Expand All @@ -506,7 +506,7 @@ void CF_CmdAbandon(CFE_SB_Buffer_t *msg)
** \endreturns
**
*************************************************************************/
int CF_DoEnableDisableDequeue(uint8 chan_num, const bool_arg_t *context)
int CF_DoEnableDisableDequeue(uint8 chan_num, const CF_ChanAction_BoolArg_t *context)
{
/* no need to bounds check chan_num, done in caller */
CF_AppData.config_table->chan[chan_num].dequeue_enabled = context->barg;
Expand All @@ -522,8 +522,8 @@ int CF_DoEnableDisableDequeue(uint8 chan_num, const bool_arg_t *context)
*************************************************************************/
void CF_CmdEnableDequeue(CFE_SB_Buffer_t *msg)
{
bool_arg_t barg = {1};
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "enable_dequeue", (chan_action_fn_t)CF_DoEnableDisableDequeue,
CF_ChanAction_BoolArg_t barg = {1};
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "enable_dequeue", (CF_ChanActionFn_t)CF_DoEnableDisableDequeue,
&barg));
}

Expand All @@ -536,9 +536,9 @@ void CF_CmdEnableDequeue(CFE_SB_Buffer_t *msg)
*************************************************************************/
void CF_CmdDisableDequeue(CFE_SB_Buffer_t *msg)
{
bool_arg_t barg = {0};
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "disable_dequeue", (chan_action_fn_t)CF_DoEnableDisableDequeue,
&barg));
CF_ChanAction_BoolArg_t barg = {0};
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "disable_dequeue",
(CF_ChanActionFn_t)CF_DoEnableDisableDequeue, &barg));
}

/************************************************************************/
Expand All @@ -548,7 +548,7 @@ void CF_CmdDisableDequeue(CFE_SB_Buffer_t *msg)
** context must not be NULL.
**
*************************************************************************/
int CF_DoEnableDisablePolldir(uint8 chan_num, const bool_msg_arg_t *context)
int CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolMsgArg_t *context)
{
int ret = 0;
/* no need to bounds check chan_num, done in caller */
Expand Down Expand Up @@ -583,8 +583,8 @@ int CF_DoEnableDisablePolldir(uint8 chan_num, const bool_msg_arg_t *context)
*************************************************************************/
void CF_CmdEnablePolldir(CFE_SB_Buffer_t *msg)
{
bool_msg_arg_t barg = {(CF_UnionArgsCmd_t *)msg, 1};
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "enable_polldir", (chan_action_fn_t)CF_DoEnableDisablePolldir,
CF_ChanAction_BoolMsgArg_t barg = {(CF_UnionArgsCmd_t *)msg, 1};
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "enable_polldir", (CF_ChanActionFn_t)CF_DoEnableDisablePolldir,
&barg));
}

Expand All @@ -597,9 +597,9 @@ void CF_CmdEnablePolldir(CFE_SB_Buffer_t *msg)
*************************************************************************/
void CF_CmdDisablePolldir(CFE_SB_Buffer_t *msg)
{
bool_msg_arg_t barg = {(CF_UnionArgsCmd_t *)msg, 0};
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "disable_polldir", (chan_action_fn_t)CF_DoEnableDisablePolldir,
&barg));
CF_ChanAction_BoolMsgArg_t barg = {(CF_UnionArgsCmd_t *)msg, 0};
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "disable_polldir",
(CF_ChanActionFn_t)CF_DoEnableDisablePolldir, &barg));
}

/************************************************************************/
Expand Down Expand Up @@ -698,7 +698,7 @@ int CF_DoPurgeQueue(uint8 chan_num, CF_UnionArgsCmd_t *cmd)
*************************************************************************/
void CF_CmdPurgeQueue(CFE_SB_Buffer_t *msg)
{
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "purge_queue", (chan_action_fn_t)CF_DoPurgeQueue, msg));
CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "purge_queue", (CF_ChanActionFn_t)CF_DoPurgeQueue, msg));
}

/************************************************************************/
Expand Down
36 changes: 18 additions & 18 deletions fsw/src/cf_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@
#include "cf_app.h"
#include "cf_utils.h"

typedef int (*chan_action_fn_t)(uint8 chan_num, void *context);
typedef int (*CF_ChanActionFn_t)(uint8 chan_num, void *context);

typedef struct
typedef struct CF_ChanAction_BoolArg
{
uint8 barg;
} bool_arg_t;
bool barg;
} CF_ChanAction_BoolArg_t;

typedef CF_TraverseAllTransactions_fn_t CF_TsnChanAction_fn_t;

typedef struct
typedef struct CF_ChanAction_SuspResArg
{
int same; /* out param -- indicates at least one action was set to its current value */
uint8 action;
} susp_res_arg_t;
int same; /* out param -- indicates at least one action was set to its current value */
bool action;
} CF_ChanAction_SuspResArg_t;

typedef struct
typedef struct CF_ChanAction_BoolMsgArg
{
const CF_UnionArgsCmd_t *msg;
uint8 barg;
} bool_msg_arg_t;
bool barg;
} CF_ChanAction_BoolMsgArg_t;

/************************************************************************/
/** \brief Increment the command accepted counter.
Expand Down Expand Up @@ -88,24 +88,24 @@ void CF_CmdNoop(CFE_SB_Buffer_t *msg);
void CF_CmdReset(CFE_SB_Buffer_t *msg);
void CF_CmdTxFile(CFE_SB_Buffer_t *msg);
void CF_CmdPlaybackDir(CFE_SB_Buffer_t *msg);
int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, chan_action_fn_t fn, void *context);
int CF_DoFreezeThaw(uint8 chan_num, const bool_arg_t *context);
int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, CF_ChanActionFn_t fn, void *context);
int CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *context);
void CF_CmdFreeze(CFE_SB_Buffer_t *msg);
void CF_CmdThaw(CFE_SB_Buffer_t *msg);
CF_Transaction_t *CF_FindTransactionBySequenceNumberAllChannels(CF_TransactionSeq_t ts, CF_EntityId_t eid);
int CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_TsnChanAction_fn_t fn, void *context);
void CF_DoSuspRes_(CF_Transaction_t *t, susp_res_arg_t *context);
void CF_DoSuspRes_Txn(CF_Transaction_t *t, CF_ChanAction_SuspResArg_t *context);
void CF_DoSuspRes(CF_TransactionCmd_t *cmd, uint8 action);
void CF_CmdSuspend(CFE_SB_Buffer_t *msg);
void CF_CmdResume(CFE_SB_Buffer_t *msg);
void CF_CmdCancel_(CF_Transaction_t *t, void *ignored);
void CF_CmdCancel_Txn(CF_Transaction_t *t, void *ignored);
void CF_CmdCancel(CFE_SB_Buffer_t *msg);
void CF_CmdAbandon_(CF_Transaction_t *t, void *ignored);
void CF_CmdAbandon_Txn(CF_Transaction_t *t, void *ignored);
void CF_CmdAbandon(CFE_SB_Buffer_t *msg);
int CF_DoEnableDisableDequeue(uint8 chan_num, const bool_arg_t *context);
int CF_DoEnableDisableDequeue(uint8 chan_num, const CF_ChanAction_BoolArg_t *context);
void CF_CmdEnableDequeue(CFE_SB_Buffer_t *msg);
void CF_CmdDisableDequeue(CFE_SB_Buffer_t *msg);
int CF_DoEnableDisablePolldir(uint8 chan_num, const bool_msg_arg_t *context);
int CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolMsgArg_t *context);
void CF_CmdEnablePolldir(CFE_SB_Buffer_t *msg);
void CF_CmdDisablePolldir(CFE_SB_Buffer_t *msg);
int CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c);
Expand Down
Loading

0 comments on commit 6213a5b

Please sign in to comment.