Using dbr_field_type instead of field_type in SR_get_array #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Copied from slac-epics#2
Currently, autosave requests for long links (e.g., an input link with $ at the end) will never have any values in their sav files. This is because in SR_get_array, paddr->field_type is passed as as dbrType to dbGet.
https://github.com/slac-epics/autosave/blob/a98b30c7af7d7d93506786a7de61a75d31d15664/asApp/src/dbrestore.c#L1301C26-L1301C43
For DBF_INLINKS, DBF_OUTLINKS, and DBF_FWDLINKS, dbGet calls getLinkValue which also takes in dbrType as input. If you instead pass the DBF value for any link, you fall into this case that returns an error code and does not set your buffer to the value of the PV
https://github.com/slac-epics/epics-base/blob/308e234c41f59b9103b6d309f3256262a3175da2/modules/database/src/ioc/db/dbAccess.c#L819-L821
I have modified SR_get_array to instead use dbr_field_type, which is the value that I believe dbGet expects. For most types, dbr_field_type and field_type are the same, but not for links, which are mapped to DBR_STRING, and DBF_MENU and DBF_DEVICE, which are both mapped to DBR_ENUM.
https://github.com/slac-epics/epics-base/blob/308e234c41f59b9103b6d309f3256262a3175da2/modules/database/src/ioc/db/dbAccess.c#L75-L94