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

Feature/metadata #2

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Feature/metadata #2

wants to merge 8 commits into from

Conversation

agrayzel
Copy link
Member

@agrayzel agrayzel commented Aug 23, 2023

What:
Adds memory allocation for a metadata struct corresponding to each variable we are saving in permanent memory.

Why:
This is being done in conjunction with an updated configuration system. The hope is to eventually store metadata which can allow us to determine if the data is invalid without needing to have a separate persistent dataValid array.

Next steps:
The intention of this system is to provide the persistent memory with a way to verify its validity. The metadata struct has a pSelf member, which is intended to be its address in memory. By checking that this is true for all members in the persistent memory, and that the following metadata object is the expected distance (sizeof(metadata) + metadata.sizeofVar) we can verify that the data in permmemory has been properly initialized. Once this step has been taken, we can verify that the current sizes of the variables match what we expect them to with the permanent memory, and if needed write a function to re-define those pointers to restore as much valid data as possible from the persistent memory.

@agrayzel agrayzel marked this pull request as draft August 23, 2023 17:01
@Joshpolansky
Copy link
Member

This looks good so far. Still need to add the rest of the meta data support including validation of data

In testing this does not appear to be working. In the watch window
the addresses of the metadata are nearly 2MB away from the addresses
of the working variables
Comment on lines 69 to 73
if(Persistence->Internal.WorkingVariableInfo[i].pMetadata->variableSize == Persistence->Internal.WorkingVariableInfo[i].sizeofWorkingVariable
&&Persistence->Internal.WorkingVariableInfo[i+1].pMetadata != 0){
*(BOOL*)Persistence->IN.pDataValid = 0;
return (UINT)PERSIST_ERR_DATAMOVED_CHANGED;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change, it should be removed for this PR and revisited later.

Comment on lines +60 to +63
DTGetTime_typ getTime;

getTime.enable = 0;
DTGetTime(&getTime);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like it is being used. Should be either removed or be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants