-
Notifications
You must be signed in to change notification settings - Fork 28
ZMS updates for v1.0.0 #510
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
base: main
Are you sure you want to change the base?
Conversation
|
You can find the documentation preview for this PR here. |
78aaa37 to
f26ed91
Compare
b26f996 to
5391f43
Compare
| * 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. |
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.
| * 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. |
5081e9b to
921a13f
Compare
ec9400e to
9f66652
Compare
6762082 to
af73b85
Compare
af73b85 to
7f65146
Compare
| if BM_STORAGE_BACKEND_NATIVE_SIM | ||
|
|
||
| config BM_STORAGE_BACKEND_NATIVE_SIM_ASYNC | ||
| bool "Asynchronous execution of storage operations" |
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.
why is there no help text ?
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.
The prompt already gives enough information.
|
|
||
| config BM_STORAGE_BACKEND_NATIVE_SIM | ||
| bool "Bare Metal native simulator storage backend" | ||
| depends on BOARD_NATIVE_SIM |
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.
why is there no help text ?
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.
I added a clarification to this one so that it's even more obvious that it should be used only for integration tests.
674738a to
2534e48
Compare
a9889f6 to
f0dd258
Compare
* 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]>
f0dd258 to
9067575
Compare
* 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]>
9067575 to
7f3767c
Compare
| static void wait_for_write(void) | ||
| { | ||
| while (fs.ongoing_writes) { | ||
| while (!write_notif) { |
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.
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.
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.
The user should rely on events, rather than polling some internal flag.
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.
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.
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.
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?
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.
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(); |
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.
Is there a reason why you changed this behavior, relying on the event handlers instead of the fs->ongoing_writes variable ?
This PR merges the following changes:
#504
#490
#502
#488