Skip to content

Conversation

@MirkoCovizzi
Copy link
Contributor

@MirkoCovizzi MirkoCovizzi commented Nov 25, 2025

This PR merges the following changes:

#504
#490
#502
#488

@MirkoCovizzi MirkoCovizzi self-assigned this Nov 25, 2025
@github-actions github-actions bot added the doc-required PR must not be merged without tech writer approval. label Nov 25, 2025
@github-actions
Copy link

You can find the documentation preview for this PR here.

@MirkoCovizzi MirkoCovizzi force-pushed the zms-release branch 3 times, most recently from 78aaa37 to f26ed91 Compare November 25, 2025 21:03
@MirkoCovizzi MirkoCovizzi added this to the v1.0.0 milestone Nov 25, 2025
@MirkoCovizzi MirkoCovizzi force-pushed the zms-release branch 8 times, most recently from b26f996 to 5391f43 Compare November 25, 2025 23:09
@MirkoCovizzi MirkoCovizzi marked this pull request as ready for review November 25, 2025 23:09
@MirkoCovizzi MirkoCovizzi requested review from a team and rghaddab as code owners November 25, 2025 23:09
Comment on lines 147 to 150
* The ``bm_zms_register`` function.
The event handler configuration is now done with the struct :c:struct:`bm_zms_fs_config`.

* Removed the selection of the :kconfig:option:`CONFIG_EXPERIMENTAL` Kconfig option.
Copy link

Choose a reason for hiding this comment

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

Suggested change
* The ``bm_zms_register`` function.
The event handler configuration is now done with the struct :c:struct:`bm_zms_fs_config`.
* Removed the selection of the :kconfig:option:`CONFIG_EXPERIMENTAL` Kconfig option.
* The ``bm_zms_register`` function.
The event handler configuration is now done with the struct :c:struct:`bm_zms_fs_config`.
* The selection of the :kconfig:option:`CONFIG_EXPERIMENTAL` Kconfig option.

@MirkoCovizzi MirkoCovizzi force-pushed the zms-release branch 5 times, most recently from 5081e9b to 921a13f Compare November 26, 2025 11:23
@MirkoCovizzi MirkoCovizzi force-pushed the zms-release branch 3 times, most recently from ec9400e to 9f66652 Compare November 26, 2025 15:02
if BM_STORAGE_BACKEND_NATIVE_SIM

config BM_STORAGE_BACKEND_NATIVE_SIM_ASYNC
bool "Asynchronous execution of storage operations"

Choose a reason for hiding this comment

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

why is there no help text ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The prompt already gives enough information.


config BM_STORAGE_BACKEND_NATIVE_SIM
bool "Bare Metal native simulator storage backend"
depends on BOARD_NATIVE_SIM

Choose a reason for hiding this comment

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

why is there no help text ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a clarification to this one so that it's even more obvious that it should be used only for integration tests.

@MirkoCovizzi MirkoCovizzi force-pushed the zms-release branch 5 times, most recently from 674738a to 2534e48 Compare November 27, 2025 09:40
@MirkoCovizzi MirkoCovizzi requested a review from a team as a code owner November 27, 2025 09:55
@MirkoCovizzi MirkoCovizzi force-pushed the zms-release branch 2 times, most recently from a9889f6 to f0dd258 Compare November 27, 2025 12:19
* Removes `bm_zms_register` and moves the event
  handler configuration into `bm_zms_fs_config`.

* Renames the `bm_zms_cb_t` type to `bm_zms_evt_handler_t`.

Signed-off-by: Mirko Covizzi <[email protected]>
Fixes a bug where `BM_ZMS_EVT_CLEAR` events would
not be propagated because the event handler was
being nullified before sending the event.

Signed-off-by: Mirko Covizzi <[email protected]>
* Updates the sample to wait for event notifications.

* Adds a mount and clear at the beginning of the sample
  to reset the state of the storage partition in case
  of errors.

Signed-off-by: Mirko Covizzi <[email protected]>
Adds native sim backend, to be used for ztests.

Signed-off-by: Mirko Covizzi <[email protected]>
* Updates the ztest to include the native_sim board target.

* Fixes some configuration bugs in the test suite.

* Fixes a bug where `bm_zms_clear` was not waited on
  until completion.

* Refactor to wait for notifications.

* Other cleanups.

Signed-off-by: Mirko Covizzi <[email protected]>
* Doxygen cleanups.

* Adds notes regarding event propagation.

Signed-off-by: Mirko Covizzi <[email protected]>
* Adds a sections that explains how to clear the storage
  system.

* Updates some other parts of the documentation.

Signed-off-by: Mirko Covizzi <[email protected]>
Removes experimental flagging.

Signed-off-by: Mirko Covizzi <[email protected]>
* Adds build only step.

* Bumps RunsOn runner.

Signed-off-by: Mirko Covizzi <[email protected]>
static void wait_for_write(void)
{
while (fs.ongoing_writes) {
while (!write_notif) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you change this to rely on event handler instead of the fs structure ?
fs.ongoing_write is still a reliable variable to verify if a write is still ongoing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#490 (review)

The user should rely on events, rather than polling some internal flag.

Copy link
Contributor

Choose a reason for hiding this comment

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

The sample is here to show the user all the different features of bm_zms.
The event handler is there in case the user wants to rely on it and defines a global variable to signal the write events. But that's up to the user to choose how is he going to use it.
However the internal flag is there to signal the user that the write has finished if for example the user doesn't want to implement an event_handler but wants only to make sure that all writes finished.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think in the end it is about what we want to showcase as the preferred way to the users. For other BM related libraries and BLE services, we are using a event based approach. Thus I think it makes sense to have it event based here as well, although polling is also an option that is available. Thoughts @lemrey?

Copy link
Contributor

@lemrey lemrey Nov 28, 2025

Choose a reason for hiding this comment

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

Asynchronous operation completion should be signalled using events, and polling, when supported, should be exposed via the API, for example with a _is_busy() call. Instance structures are typically opaque, and the user should not care about or rely on specific flags in internal structures to interact with a library. Providing a dedicated API for polling is better because it maintains the instance structure opaque, and abstracts the meaning "being busy" so that the user doesn't need to know which flags (or which combination of flags) represents a certain state (busy).

zassert_true(len == sizeof(wr_buf), "bm_zms_write failed");

wait_for_ongoing_writes(fs);
wait_for_write();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why you changed this behavior, relying on the event handlers instead of the fs->ongoing_writes variable ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-required PR must not be merged without tech writer approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants