Skip to content
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

fs: zms: multiple style fixes from previous PR review #80628

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rghaddab
Copy link
Contributor

This resolves some addressed comments in this PR #77930 as well as this PR #80407

de-nordic
de-nordic previously approved these changes Oct 30, 2024
@Laczen Laczen removed their request for review October 30, 2024 16:03
Copy link
Collaborator

@tomi-font tomi-font left a comment

Choose a reason for hiding this comment

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

Not fully done reviewing everything, but dumping what I have already. Starting to look real good!

subsys/fs/zms/Kconfig Outdated Show resolved Hide resolved
subsys/fs/zms/Kconfig Outdated Show resolved Hide resolved
subsys/fs/zms/Kconfig Outdated Show resolved Hide resolved
subsys/fs/zms/Kconfig Outdated Show resolved Hide resolved
subsys/fs/zms/Kconfig Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
doc/services/storage/zms/zms.rst Outdated Show resolved Hide resolved
This resolves some addressed comments in this PR zephyrproject-rtos#77930
as well as this PR zephyrproject-rtos#80407

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
* @retval -ERRNO Negative errno code on error
*
* @retval 0 on success.
* @retval -EDEADLK if the detected file system is not ZMS.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using a deadlock error code for that seems quite wrong to me. Can you change that to something else?

*
* @retval 0 on success.
* @retval -EDEADLK if the detected file system is not ZMS.
* @retval -ENOEXEC if ZMS version is not supported.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe EPROTONOSUPPORT (or ENOTSUP) would be more appropriate here?

*
* @retval 0 on success.
* @retval -EDEADLK if the detected file system is not ZMS.
* @retval -ENOEXEC if ZMS version is not supported.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* @retval -ENOEXEC if ZMS version is not supported.
* @retval -ENOEXEC if the ZMS version is not supported.

* @retval -ERRNO Negative errno code on error
*
* @retval 0 on success.
* @retval -EACCES if ZMS is still not initialized.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here do you mean that the passed fs is not mounted?
If so:

Suggested change
* @retval -EACCES if ZMS is still not initialized.
* @retval -EACCES if `fs` is not mounted.

Otherwise:

Suggested change
* @retval -EACCES if ZMS is still not initialized.
* @retval -EACCES if ZMS is not initialized.

*
* @return Number of bytes written. On success, it will be equal to the number of bytes requested
* to be written or 0.
* When a rewrite of the same data already stored is attempted, nothing is written to flash,
* thus 0 is returned. On error, returns negative value of error codes defined in `errno.h`.
* @retval >=0 on success, number of bytes written.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's be more explicit?

Suggested change
* @retval >=0 on success, number of bytes written.
* @retval Number of bytes written (`len` or 0) on success.

* @retval -EACCES if ZMS is still not initialized.
* @retval -ENXIO if there is a device error.
* @retval -EIO if there is a memory read/write error.
* @retval -EINVAL if len is in invalid value
Copy link
Collaborator

@tomi-font tomi-font Nov 7, 2024

Choose a reason for hiding this comment

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

Suggested change
* @retval -EINVAL if len is in invalid value
* @retval -EINVAL if `len` is an invalid value.

or

Suggested change
* @retval -EINVAL if len is in invalid value
* @retval -EINVAL if `len` is invalid.

* @retval -ENXIO if there is a device error.
* @retval -EIO if there is a memory read/write error.
* @retval -EINVAL if len is in invalid value
* @retval -ENOSPC if no space is left on device.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* @retval -ENOSPC if no space is left on device.
* @retval -ENOSPC if no space is left on the device.

*
* @return Number of bytes read. On success, it will be equal to the number of bytes requested
* to be read or less than that if the stored data has a smaller size than the requested one.
* On error, returns negative value of error codes defined in `errno.h`.
* @retval >=0 on success, number of bytes read.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can it actually be 0? (And same for the following functions.)

Suggested change
* @retval >=0 on success, number of bytes read.
* @retval Number of bytes read (> 0) on success.

* @retval >=0 on success, number of bytes read.
* @retval -EACCES if ZMS is still not initialized.
* @retval -EIO if there is a memory read/write error.
* @retval -ENOENT if there is no entry with the given id and history counter.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* @retval -ENOENT if there is no entry with the given id and history counter.
* @retval -ENOENT if there is no entry with the given ID and history counter.
Suggested change
* @retval -ENOENT if there is no entry with the given id and history counter.
* @retval -ENOENT if there is no entry with the given `id` and history counter.

All the information regarding the effectively available free space in ZMS can be found
in the documentation. See :ref:`free-space`.
We recommend choosing a storage partition that can hold double the size of the key-value pairs
in the documentation. See `Available space for user data <#Available-space-for-user-data-key-value-pairs>`_.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This link actually doesn't work (could the documentation build be made to fail in such case @kartben?).
I think it's due to the uppercase. The label doesn't have any.

Suggested change
in the documentation. See `Available space for user data <#Available-space-for-user-data-key-value-pairs>`_.
in the documentation. See `Available space for user data <available-space-for-user-data-key-value-pairs>`_.

Ditto for line 282.

@@ -395,7 +376,7 @@ functionality: :ref:`NVS <nvs_api>` and :ref:`FCB <fcb_api>`.
Which one to use in your application will depend on your needs and the hardware you are using,
and this section provides information to help make a choice.

- If you are using a non-erasable technology device like RRAM or MRAM, :ref:`ZMS <zms_api>` is definitely the
- If you are using devices that do not require an erase operation like RRAM or MRAM, :ref:`ZMS <zms_api>` is definitely the
best fit for your storage subsystem as it is designed to avoid emulating erase operation using
large block writes for these devices and replaces it with a single write call.
- For devices with large write_block_size and/or needs a sector size that is different than the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- For devices with large write_block_size and/or needs a sector size that is different than the
- For devices that have a large ``write_block_size`` and/or need a sector size that is different than the

properties are correct (sector_size, sector_count ...) then calling the zms_init function to
make the storage ready.

To mount the filesystem some elements in the zms_fs structure must be initialized.
To mount the filesystem some elements in the ``zms_fs`` structure must be initialized.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
To mount the filesystem some elements in the ``zms_fs`` structure must be initialized.
To mount the filesystem the following elements in the ``zms_fs`` structure must be initialized:

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

Successfully merging this pull request may close these issues.

4 participants