Skip to content

Commit

Permalink
Fix #1015, resolve discrepancies between idmap API and unit tests
Browse files Browse the repository at this point in the history
Ensures correlation between the test cases and documented return
values for the OSAL idmap API.
  • Loading branch information
jphickey committed May 27, 2021
1 parent 6776050 commit bf8426e
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 99 deletions.
21 changes: 11 additions & 10 deletions src/os/inc/osapi-idmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,11 @@ static inline bool OS_ObjectIdDefined(osal_id_t object_id)
* @param[out] buffer Buffer in which to store the name
* @param[in] buffer_size Size of the output storage buffer
*
* @returns #OS_SUCCESS if successful
* #OS_ERR_INVALID_ID if the passed-in ID is not a valid OSAL ID
* #OS_INVALID_POINTER if the passed-in buffer is invalid
* #OS_ERR_NAME_TOO_LONG if the name will not fit in the buffer provided
* @returns Execution status, see @ref OSReturnCodes
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
* @retval #OS_ERR_INVALID_ID if the passed-in ID is not a valid OSAL ID
* @retval #OS_INVALID_POINTER if the passed-in buffer is invalid
* @retval #OS_ERR_NAME_TOO_LONG if the name will not fit in the buffer provided
*/
int32 OS_GetResourceName(osal_id_t object_id, char *buffer, size_t buffer_size);

Expand Down Expand Up @@ -194,9 +195,10 @@ osal_objtype_t OS_IdentifyObject(osal_id_t object_id);
* @param[in] object_id The object ID to operate on
* @param[out] *ArrayIndex The Index to return
*
* @return Execution status, see @ref OSReturnCodes
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
* @retval #OS_ERR_INCORRECT_OBJ_TYPE @copybrief OS_ERR_INCORRECT_OBJ_TYPE
* @returns Execution status, see @ref OSReturnCodes
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
* @retval #OS_ERR_INVALID_ID if the object_id argument is not valid
* @retval #OS_INVALID_POINTER if the ArrayIndex is NULL
*/
int32 OS_ConvertToArrayIndex(osal_id_t object_id, osal_index_t *ArrayIndex);

Expand Down Expand Up @@ -225,9 +227,8 @@ int32 OS_ConvertToArrayIndex(osal_id_t object_id, osal_index_t *ArrayIndex);
* @param[in] object_id The object ID to operate on
* @param[out] *ArrayIndex The Index to return
*
* @return Execution status, see @ref OSReturnCodes
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
* @retval #OS_ERR_INCORRECT_OBJ_TYPE @copybrief OS_ERR_INCORRECT_OBJ_TYPE
* @returns Execution status, see @ref OSReturnCodes
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
* @retval #OS_ERR_INVALID_ID if the object_id argument is not valid
* @retval #OS_INVALID_POINTER if the ArrayIndex is NULL
* */
Expand Down
2 changes: 1 addition & 1 deletion src/os/shared/src/osapi-idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ int32 OS_ObjectIdTransactionInit(OS_lock_mode_t lock_mode, osal_objtype_t idtype
*/
if (OS_GetMaxForObjectType(idtype) == 0)
{
return OS_ERR_INCORRECT_OBJ_TYPE;
return OS_ERR_INVALID_ID;
}

token->lock_mode = lock_mode;
Expand Down
Loading

0 comments on commit bf8426e

Please sign in to comment.