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

Add typedef and nonzero base for resource identifiers #894

Closed
jphickey opened this issue Sep 22, 2020 · 0 comments · Fixed by #896 or #916
Closed

Add typedef and nonzero base for resource identifiers #894

jphickey opened this issue Sep 22, 2020 · 0 comments · Fixed by #896 or #916
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

Is your feature request related to a problem? Please describe.
App IDs, Task IDs, Library IDs, and other resources are all represented by a basic uint32 identifier, which starts at 0.

Describe the solution you'd like
There should be a separate typedef for these identifiers, and 0 should be reserved as an "undefined" value (like OSAL) such that:

  • Control structures and globals which are memset() to zero will not alias valid entries if they contain IDs.
  • Alleviates the need for a separate RecordUsed boolean - 0 can indicate an unused entry, nonzero indicates a used entry

This makes everything consistent as well as being simpler and safer.

Additional context
Type should initially be a uint32 which makes this backward compatible for apps.
After this change IDs can no longer be directly used as array indices. This has already been removed/fixed in CFE itself in previous PRs.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Sep 22, 2020
jphickey added a commit to jphickey/cFE that referenced this issue Sep 22, 2020
Add a new typedef "CFE_ES_ResourceID_t" that can
replace uint32 for all ID storage and manipulation.
Initially this is just an alias to uint32 for
backward compatibility.

Convert all APIs that accept an ID to use the new
typedef.

This also reserves the value "0" as an undefined ID,
and gives a separate base value for each resource type.
Therefore even though the type is still uint32, the
different resource IDs can still be distingushed.
jphickey added a commit to jphickey/cFE that referenced this issue Sep 22, 2020
Add a new typedef "CFE_ES_ResourceID_t" that can
replace uint32 for all ID storage and manipulation.
Initially this is just an alias to uint32 for
backward compatibility.

Convert all APIs that accept an ID to use the new
typedef.

This also reserves the value "0" as an undefined ID,
and gives a separate base value for each resource type.
Therefore even though the type is still uint32, the
different resource IDs can still be distingushed.
jphickey added a commit to jphickey/cFE that referenced this issue Sep 22, 2020
Add a new typedef "CFE_ES_ResourceID_t" that can
replace uint32 for all ID storage and manipulation.
Initially this is just an alias to uint32 for
backward compatibility.

Convert all APIs that accept an ID to use the new
typedef.

This also reserves the value "0" as an undefined ID,
and gives a separate base value for each resource type.
Therefore even though the type is still uint32, the
different resource IDs can still be distingushed.
yammajamma added a commit that referenced this issue Sep 29, 2020
@skliper skliper added this to the 7.0.0 milestone Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants