Skip to content

Commit

Permalink
Fix nasa#110, nasa#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 (nasa#149) and anything that
ended with an underscore only (nasa#110).
  • Loading branch information
jphickey committed Jan 11, 2022
1 parent c0b1f53 commit 252817b
Show file tree
Hide file tree
Showing 18 changed files with 387 additions and 384 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
6 changes: 3 additions & 3 deletions fsw/src/cf_cfdp_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t)

nak->scope_start = 0;
cret = CF_ChunkList_ComputeGaps(&t->chunks->chunks,
(t->chunks->chunks.count < t->chunks->chunks.CF_max_chunks)
? t->chunks->chunks.CF_max_chunks
: (t->chunks->chunks.CF_max_chunks - 1),
(t->chunks->chunks.count < t->chunks->chunks.max_chunks)
? t->chunks->chunks.max_chunks
: (t->chunks->chunks.max_chunks - 1),
t->fsize, 0, CF_CFDP_R2_GapCompute, &args);

if (!cret)
Expand Down
16 changes: 8 additions & 8 deletions fsw/src/cf_chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void CF_Chunks_EraseChunk(CF_ChunkList_t *chunks, CF_ChunkIdx_t erase_index)
*************************************************************************/
void CF_Chunks_InsertChunk(CF_ChunkList_t *chunks, CF_ChunkIdx_t index_before, const CF_Chunk_t *chunk)
{
CF_Assert(chunks->count < chunks->CF_max_chunks);
CF_Assert(chunks->count < chunks->max_chunks);
CF_Assert(index_before <= chunks->count);

if (chunks->count && (index_before != chunks->count))
Expand Down Expand Up @@ -155,7 +155,7 @@ CF_ChunkIdx_t CF_Chunks_FindInsertPosition(CF_ChunkList_t *chunks, const CF_Chun
int CF_Chunks_CombinePrevious(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t *chunk)
{
int ret = 0;
CF_Assert(i <= chunks->CF_max_chunks);
CF_Assert(i <= chunks->max_chunks);

CF_ChunkOffset_t chunk_end = chunk->offset + chunk->size;

Expand Down Expand Up @@ -292,7 +292,7 @@ void CF_Chunks_Insert(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t
int combined = CF_Chunks_CombinePrevious(chunks, i, chunk);
if (!combined)
{
if (chunks->count < chunks->CF_max_chunks)
if (chunks->count < chunks->max_chunks)
{
CF_Chunks_InsertChunk(chunks, i, chunk);
}
Expand Down Expand Up @@ -395,11 +395,11 @@ const CF_Chunk_t *CF_ChunkList_GetFirstChunk(const CF_ChunkList_t *chunks)
** chunks must not be NULL. chunks_mem must not be NULL.
**
*************************************************************************/
void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t CF_max_chunks, CF_Chunk_t *chunks_mem)
void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t max_chunks, CF_Chunk_t *chunks_mem)
{
CF_Assert(CF_max_chunks > 0);
chunks->CF_max_chunks = CF_max_chunks;
chunks->chunks = chunks_mem;
CF_Assert(max_chunks > 0);
chunks->max_chunks = max_chunks;
chunks->chunks = chunks_mem;
CF_ChunkListReset(chunks);
}

Expand All @@ -413,7 +413,7 @@ void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t CF_max_chunks, CF_Ch
void CF_ChunkListReset(CF_ChunkList_t *chunks)
{
chunks->count = 0;
memset(chunks->chunks, 0, sizeof(*chunks->chunks) * chunks->CF_max_chunks);
memset(chunks->chunks, 0, sizeof(*chunks->chunks) * chunks->max_chunks);
}

/************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/cf_chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef struct CF_Chunk
typedef struct CF_ChunkList
{
CF_ChunkIdx_t count;
CF_ChunkIdx_t CF_max_chunks;
CF_ChunkIdx_t max_chunks;
CF_Chunk_t *chunks;
} CF_ChunkList_t;

Expand All @@ -61,7 +61,7 @@ static inline CF_ChunkOffset_t CF_Chunk_MAX(CF_ChunkOffset_t a, CF_ChunkOffset_t
}
}

void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t CF_max_chunks, CF_Chunk_t *chunks_mem);
void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t max_chunks, CF_Chunk_t *chunks_mem);
void CF_ChunkListAdd(CF_ChunkList_t *chunks, CF_ChunkOffset_t offset, CF_ChunkSize_t size);
void CF_ChunkListReset(CF_ChunkList_t *chunks);
/* CF_ChunkList_RemoveFromFirst -
Expand Down
Loading

0 comments on commit 252817b

Please sign in to comment.