Skip to content

Commit

Permalink
Merge pull request #576 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate: 2020-08-19
  • Loading branch information
astrogeco authored Aug 25, 2020
2 parents ff5b38d + a1d09b2 commit 9c74b1b
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 154 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ The autogenerated OSAL user's guide can be viewed at <https://github.com/nasa/cF

## Version History

### Development Build: 5.1.0-rc1+dev12

- Removes internal functions that are no longer used or defined but whose prototypes and stubs were still present in OS_ObjectIdMap
- Removes repetitive clearing of the global ID and unlocking global table and replaces these with common implementation in the idmap source file. This moves deleting tables to be similar to creating tables and provides
a common location for additional table-deletion-related logic.
- Propagates return code from OS_TaskRegister_Impl(). If this routine fails then return the error to the caller, which also prevents the task from starting.
- See <https://github.com/nasa/osal/pull/576>

### Development Build: 5.1.0-rc1+dev5

- Adds OSAL network APIs missing functional tests as well as tests for OS_TimedRead and OS_TimedWrite
Expand All @@ -30,7 +38,6 @@ The autogenerated OSAL user's guide can be viewed at <https://github.com/nasa/cF
- Added new macros to `osapi-version` to report baseline and build number
- The coverage binaries are now correctly installed for CPU1 and CPU2 as opposed to installed twice to CPU2 but not at all for CPU1.
- Fixes a typo in ut_assert README and clarifies stub documentation.

- See <https://github.com/nasa/osal/pull/529>

### Development Build: 5.0.21
Expand Down
6 changes: 3 additions & 3 deletions src/os/inc/osapi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
/*
* Development Build Macro Definitions
*/
#define OS_BUILD_NUMBER 5
#define OS_BUILD_BASELINE "v5.1.0-rc1+dev"
#define OS_BUILD_NUMBER 12
#define OS_BUILD_BASELINE "v5.1.0-rc1"

/*
* Version Macro Definitions
Expand All @@ -51,7 +51,7 @@
* @details Baseline git tag + Number of commits since baseline. @n
* See @ref cfsversions for format differences between development and release versions.
*/
#define OS_VERSION OS_BUILD_BASELINE OS_STR(OS_BUILD_NUMBER)
#define OS_VERSION OS_BUILD_BASELINE "+dev" OS_STR(OS_BUILD_NUMBER)

/*! @brief Development Build Version String.
* @details Reports the current development build's baseline, number, and name. Also includes a note about the latest official version. @n
Expand Down
31 changes: 13 additions & 18 deletions src/os/shared/inc/os-shared-idmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,24 +205,6 @@ uint32 OS_GetMaxForObjectType(uint32 idtype);
------------------------------------------------------------------*/
uint32 OS_GetBaseForObjectType(uint32 idtype);

/*----------------------------------------------------------------
Function: OS_ObjectIdMap
Purpose: Convert an object serial number into a 32-bit OSAL ID of the given type
Returns: OS_SUCCESS on success, or relevant error code
------------------------------------------------------------------*/
int32 OS_ObjectIdMap(uint32 idtype, uint32 idvalue, uint32 *result);

/*----------------------------------------------------------------
Function: OS_ObjectIdUnMap
Purpose: Convert a 32-bit OSAL ID of the expected type into an object serial number
Returns: OS_SUCCESS on success, or relevant error code
------------------------------------------------------------------*/
int32 OS_ObjectIdUnMap(uint32 id, uint32 idtype, uint32 *idvalue);

/*----------------------------------------------------------------
Function: OS_ObjectIdFindByName
Expand Down Expand Up @@ -296,6 +278,19 @@ int32 OS_ObjectIdAllocateNew(uint32 idtype, const char *name, uint32 *array_inde
------------------------------------------------------------------*/
int32 OS_ObjectIdFinalizeNew(int32 operation_status, OS_common_record_t *record, uint32 *outid);

/*----------------------------------------------------------------
Function: OS_ObjectIdFinalizeDelete
Purpose: Completes a delete operation
If the operation was successful, the OSAL ID is deleted and returned to the pool
If the operation was unsuccessful, no operation is performed.
The global table is unlocked for future operations
Returns: OS_SUCCESS on success, or relevant error code
------------------------------------------------------------------*/
int32 OS_ObjectIdFinalizeDelete(int32 operation_status, OS_common_record_t *record);


/*----------------------------------------------------------------
Function: OS_ObjectIdRefcountDecr
Expand Down
10 changes: 2 additions & 8 deletions src/os/shared/src/osapi-binsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,8 @@ int32 OS_BinSemDelete (uint32 sem_id)
{
return_code = OS_BinSemDelete_Impl(local_id);

/* Free the entry in the master table now while still locked */
if (return_code == OS_SUCCESS)
{
/* Only need to clear the ID as zero is the "unused" flag */
record->active_id = 0;
}

OS_Unlock_Global(LOCAL_OBJID_TYPE);
/* Complete the operation via the common routine */
return_code = OS_ObjectIdFinalizeDelete(return_code, record);
}

return return_code;
Expand Down
10 changes: 2 additions & 8 deletions src/os/shared/src/osapi-countsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,8 @@ int32 OS_CountSemDelete (uint32 sem_id)
{
return_code = OS_CountSemDelete_Impl(local_id);

/* Free the entry in the master table now while still locked */
if (return_code == OS_SUCCESS)
{
/* Only need to clear the ID as zero is the "unused" flag */
record->active_id = 0;
}

OS_Unlock_Global(LOCAL_OBJID_TYPE);
/* Complete the operation via the common routine */
return_code = OS_ObjectIdFinalizeDelete(return_code, record);
}

return return_code;
Expand Down
10 changes: 2 additions & 8 deletions src/os/shared/src/osapi-dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,8 @@ int32 OS_DirectoryClose(uint32 dir_id)
{
return_code = OS_DirClose_Impl(local_id);

/* Free the entry in the master table now while still locked */
if (return_code == OS_SUCCESS)
{
/* Only need to clear the ID as zero is the "unused" flag */
record->active_id = 0;
}

OS_Unlock_Global(LOCAL_OBJID_TYPE);
/* Complete the operation via the common routine */
return_code = OS_ObjectIdFinalizeDelete(return_code, record);
}

return return_code;
Expand Down
10 changes: 2 additions & 8 deletions src/os/shared/src/osapi-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,8 @@ int32 OS_close (uint32 filedes)
{
return_code = OS_GenericClose_Impl(local_id);

/* Free the entry in the master table now while still locked */
if (return_code == OS_SUCCESS)
{
/* Only need to clear the ID as zero is the "unused" flag */
record->active_id = 0;
}

OS_Unlock_Global(LOCAL_OBJID_TYPE);
/* Complete the operation via the common routine */
return_code = OS_ObjectIdFinalizeDelete(return_code, record);
}

return return_code;
Expand Down
22 changes: 22 additions & 0 deletions src/os/shared/src/osapi-idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,28 @@ int32 OS_ObjectIdFinalizeNew(int32 operation_status, OS_common_record_t *record,
return operation_status;
} /* end OS_ObjectIdFinalizeNew */

/*----------------------------------------------------------------
Function: OS_ObjectIdFinalizeDelete
Purpose: Helper routine, not part of OSAL public API.
See description in prototype
------------------------------------------------------------------*/
int32 OS_ObjectIdFinalizeDelete(int32 operation_status, OS_common_record_t *record)
{
uint32 idtype = OS_ObjectIdToType_Impl(record->active_id);

/* Clear the OSAL ID if successful - this returns the record to the pool */
if (operation_status == OS_SUCCESS)
{
record->active_id = 0;
}

/* Either way we must unlock the object type */
OS_Unlock_Global(idtype);

return operation_status;
}


/*----------------------------------------------------------------
*
Expand Down
10 changes: 2 additions & 8 deletions src/os/shared/src/osapi-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,8 @@ int32 OS_ModuleUnload ( uint32 module_id )
*/
return_code = OS_ModuleUnload_Impl(local_id);

if (return_code == OS_SUCCESS)
{
/* Clear the ID to zero */
record->active_id = 0;
}

/* Unlock the global from OS_ObjectIdGetAndLock() */
OS_Unlock_Global(LOCAL_OBJID_TYPE);
/* Complete the operation via the common routine */
return_code = OS_ObjectIdFinalizeDelete(return_code, record);
}

return return_code;
Expand Down
10 changes: 2 additions & 8 deletions src/os/shared/src/osapi-mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,8 @@ int32 OS_MutSemDelete (uint32 sem_id)
{
return_code = OS_MutSemDelete_Impl(local_id);

/* Free the entry in the master table now while still locked */
if (return_code == OS_SUCCESS)
{
/* Only need to clear the ID as zero is the "unused" flag */
record->active_id = 0;
}

OS_Unlock_Global(LOCAL_OBJID_TYPE);
/* Complete the operation via the common routine */
return_code = OS_ObjectIdFinalizeDelete(return_code, record);
}

return return_code;
Expand Down
10 changes: 2 additions & 8 deletions src/os/shared/src/osapi-queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,8 @@ int32 OS_QueueDelete (uint32 queue_id)
{
return_code = OS_QueueDelete_Impl(local_id);

/* Free the entry in the master table now while still locked */
if (return_code == OS_SUCCESS)
{
/* Only need to clear the ID as zero is the "unused" flag */
record->active_id = 0;
}

OS_Unlock_Global(LOCAL_OBJID_TYPE);
/* Complete the operation via the common routine */
return_code = OS_ObjectIdFinalizeDelete(return_code, record);
}

return return_code;
Expand Down
27 changes: 9 additions & 18 deletions src/os/shared/src/osapi-task.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
* User defined include files
*/
#include "os-shared-task.h"
#include "os-shared-common.h"
#include "os-shared-idmap.h"


Expand Down Expand Up @@ -116,9 +117,10 @@ static int32 OS_TaskPrepare(uint32 task_id, osal_task_entry *entrypt)

if (return_code == OS_SUCCESS)
{
OS_TaskRegister_Impl(task_id);
return_code = OS_TaskRegister_Impl(task_id);
}
else

if (return_code != OS_SUCCESS)
{
*entrypt = NULL;
}
Expand Down Expand Up @@ -269,24 +271,14 @@ int32 OS_TaskDelete (uint32 task_id)

return_code = OS_TaskDelete_Impl(local_id);

/* Free the entry in the master table now while still locked */
if (return_code == OS_SUCCESS)
{
/* Only need to clear the ID as zero is the "unused" flag */
record->active_id = 0;
}
else
{
delete_hook = NULL;
}

OS_Unlock_Global(LOCAL_OBJID_TYPE);
/* Complete the operation via the common routine */
return_code = OS_ObjectIdFinalizeDelete(return_code, record);
}

/*
** Call the thread Delete hook if there is one.
*/
if (delete_hook != NULL)
if (return_code == OS_SUCCESS && delete_hook != NULL)
{
delete_hook();
}
Expand All @@ -312,9 +304,8 @@ void OS_TaskExit()
task_id = OS_TaskGetId_Impl();
if (OS_ObjectIdGetById(OS_LOCK_MODE_GLOBAL, LOCAL_OBJID_TYPE, task_id, &local_id, &record) == OS_SUCCESS)
{
/* Only need to clear the ID as zero is the "unused" flag */
record->active_id = 0;
OS_Unlock_Global(LOCAL_OBJID_TYPE);
/* Complete the operation via the common routine */
OS_ObjectIdFinalizeDelete(OS_SUCCESS, record);
}

/* call the implementation */
Expand Down
6 changes: 2 additions & 4 deletions src/os/shared/src/osapi-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,10 @@ int32 OS_TimerDelete(uint32 timer_id)
local->next_ref = local_id;
local->prev_ref = local_id;

/* Clear the ID to zero */
record->active_id = 0;

OS_TimeBaseUnlock_Impl(local->timebase_ref);

OS_Unlock_Global(OS_OBJECT_TYPE_OS_TIMECB);
/* Complete the operation via the common routine */
return_code = OS_ObjectIdFinalizeDelete(return_code, record);
}

/*
Expand Down
10 changes: 2 additions & 8 deletions src/os/shared/src/osapi-timebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,8 @@ int32 OS_TimeBaseDelete(uint32 timer_id)
{
return_code = OS_TimeBaseDelete_Impl(local_id);

/* Free the entry in the master table now while still locked */
if (return_code == OS_SUCCESS)
{
/* Clear the ID to zero */
record->active_id = 0;
}

OS_Unlock_Global(OS_OBJECT_TYPE_OS_TIMEBASE);
/* Complete the operation via the common routine */
return_code = OS_ObjectIdFinalizeDelete(return_code, record);
}

return return_code;
Expand Down
5 changes: 2 additions & 3 deletions src/unit-test-coverage/shared/src/coveragetest-task.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,8 @@ void Test_OS_TaskExit(void)

OS_TaskExit();

/* TaskExit should have cleared the active_id */
UtAssert_True(utrec.active_id == 0, "utrec.active_id (%lu) == 0",
(unsigned long)utrec.active_id);
/* TaskExit should have called OS_ObjectIdFinalizeDelete to clear the active_id */
UtAssert_STUB_COUNT(OS_ObjectIdFinalizeDelete, 1);
}
void Test_OS_TaskDelay(void)
{
Expand Down
Loading

0 comments on commit 9c74b1b

Please sign in to comment.