boot/bootutil: Remove direct accesses to flash_area::fa_xyz #1929
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.
I plan on working towards building a Rust API for bootutil, and I would like to pass an opaque
struct flash_area
to bootutil, so that this struct can be fully managed from the rust side, with only a fewextern "C"
functions that will need to be defined on the rust side before linking.This PR removes the few direct accesses to
flash_area::fa_id
,flash_area::fa_off
andflash_area::fa_size
that are present in bootutil, and replaces them with the correspondingflash_area_get_XYZ
functions.Currently, however, one can only use an opaque
struct flash_area
if they enable the new flash sector API (MCUBOOT_USE_FLASH_AREA_GET_SECTORS
), since otherwiseloader.c
will attempt to create an array ofstruct flash_area
. I thus do not know how we could ensure that no additional mentions offlash_area::fa_XYZ
will sneak back into the code.One option would be to create a
bootutil_shared.h
file, which would contain the minimal expected subset offlash_map_backend.h
, and progressively have files include it, until theflash_map_backend.h
only needs to provide thestruct flash_area
for whenMCUBOOT_USE_FLASH_AREA_GET_SECTORS
isn't toggled on.