Add OSAL hooks for persistent group membership storage#50
Conversation
af9b5c6 to
f37f587
Compare
- Add OSAL API for group membership storage - Add stub group storage functions to OSAL backends - Call group storage hooks from CSMP group handling
f37f587 to
7c1ac3f
Compare
| if((devconfig == NULL) || (csmp_handle == NULL)) | ||
| return -2; | ||
|
|
||
| initGroups(); |
There was a problem hiding this comment.
All app initialization are currently done in sample_data_init().
csmpservice.c is focused on handling csmp service and not recommended to do data inits for TLVs. Pls move this to sample_data_init() as discussed in the review discussion.
| * | ||
| * @return int 0 is success | ||
| */ | ||
| int initGroups(); |
There was a problem hiding this comment.
Pls move this to sample_data_init() as discussed in the review discussion.
| static uint32_t m_GroupIds[CSMP_GROUP_NUM_TYPES] = {0}; | ||
| static bool m_bLastMatchValid; | ||
|
|
||
| int initGroups() |
There was a problem hiding this comment.
Pls perform initialization in sample_data_init() as discussed in the review discussion.
| *****************************************************************************/ | ||
| osal_basetype_t osal_copy_firmware(uint8_t source_slotid, uint8_t dest_slotid, Csmp_Slothdr *slots); | ||
|
|
||
| /**************************************************************************** |
There was a problem hiding this comment.
The PR primarily intends to define dummy OSAL APIs proposed to persist group information for Group management TLVs (viz., 55,56,57,58) for all platforms.
Note: Per current agent design, platform specific implementation for TLV handlers are made under sample/tlvs/linux_tlvs.c/currenttime_get() - for Linux CurrentTime_TLV18 GET for example.
OSAL APIs are typically defined for abstracting platform infra related operations. There could be exceptions for some APIs consumed by TLV handlers as well.
Please give the current approach a thought of whether an OSAL API will be defined or platform specific TLV handlers will be defined to persist group information.
Summary
This PR adds OSAL-level hooks for storing and restoring CSMP group membership information.
The CSMP Internet-Draft specifies:
This PR prepares the codebase for that requirement by adding the OSAL interface and calling it from the relevant CSMP group handling code paths.
Changes
osal_read_groups()andosal_write_groups()to the OSAL interface.Motivation
Group membership information should be persisted according to the CSMP specification.
The CSMP layer should not implement platform-specific storage directly. By adding OSAL hooks, each platform can later provide its own persistent storage implementation while keeping the CSMP logic portable.
Out of scope
This PR does not implement actual persistent storage for the existing platforms.
The current backend functions return
OSAL_FAILUREas stubs. Platform-specific storage support can be added in follow-up PRs.Related issue
Fixes #49