-
Notifications
You must be signed in to change notification settings - Fork 8.4k
subsys: fs: fcb: struct flash_sector usually const #80268
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
subsys: fs: fcb: struct flash_sector usually const #80268
Conversation
8d068c2 to
82f8700
Compare
|
I am able to reproduce the CI error on local: But not sure how to improve! |
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
|
Needs rebase. |
de-nordic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but you're the author? 🙂 |
Generally, the flash_sector array is known at compile time and is immutable, therefore developers may like to store it in ROM. The only function that requires a mutable struct flash_sector seems to be flash_area_get_sectors(), allowing the developer to store a mutable sector definition in persistent RAM rather than ROM. An example of this approach is in setting_fcb.c. Signed-off-by: JP Hutchins <[email protected]>
82f8700 to
5ea63d0
Compare
|
Any insight on these compliance check problems? They are present on lines that are not modified by this PR. |
I guess CI does not like name of variable to be the same as type used to define it. |
|
ya most of these files hadn't been touched in many years, and the coding guidelines check has been introduced since then. Luckily the fix should be pretty straightforward |
| struct flash_sector test_fcb_sector[] = { | ||
| [0] = { | ||
| .fs_off = 0, | ||
| .fs_size = SECTOR_SIZE | ||
| }, | ||
| [1] = { | ||
| .fs_off = SECTOR_SIZE, | ||
| .fs_size = SECTOR_SIZE | ||
| }, | ||
| [2] = { | ||
| .fs_off = 2 * SECTOR_SIZE, | ||
| .fs_size = SECTOR_SIZE | ||
| }, | ||
| [3] = { | ||
| .fs_off = 3 * SECTOR_SIZE, | ||
| .fs_size = SECTOR_SIZE | ||
| } | ||
| }; | ||
|
|
||
| const struct flash_sector test_fcb_sector[] = { | ||
| [0] = {.fs_off = 0, .fs_size = SECTOR_SIZE}, | ||
| [1] = {.fs_off = SECTOR_SIZE, .fs_size = SECTOR_SIZE}, | ||
| [2] = {.fs_off = 2 * SECTOR_SIZE, .fs_size = SECTOR_SIZE}, | ||
| [3] = {.fs_off = 3 * SECTOR_SIZE, .fs_size = SECTOR_SIZE}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated change? same in another couple of files, PRs should nto change unrelated code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JPHutchins If you did run clang format on the code, please do not do that. At least not with other changes.
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
|
Any movement here? |
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |

Generally, the flash_sector array is known at compile time and is immutable, therefore developers may like to store it in ROM. The only function that requires a mutable struct flash_sector seems to be flash_area_get_sectors(), allowing the developer to store a mutable sector definition in persistent RAM rather than ROM. An example of this approach is in setting_fcb.c.