storage: bm_storage: use errno instead of nrf_error#440
Conversation
|
You can find the documentation preview for this PR here. |
4e7be0e to
bcee21f
Compare
bcee21f to
594ff03
Compare
anhmolt
left a comment
There was a problem hiding this comment.
Could mention in the commit that
NRF_ERROR_INVALID_ADDR and NRF_ERROR_NULL are merged to -EFAULT, and
NRF_ERROR_INVALID_STATE and NRF_ERROR_FORBIDDEN are merged to -EPERM.
Also, is this something we want to do?
594ff03 to
dc0ef45
Compare
There was a problem hiding this comment.
What is this file? Looks like it was generated by nrfutil? It does probably not belong here and will be overwritten on next SoftDevice export.
There was a problem hiding this comment.
Correct, it should not be here. @nordicjm Should this be added to .gitignore or can it be rendered in the build folder or so instead?
dc0ef45 to
7783e7f
Compare
|
|
||
| * Updated to use errno instead of nrf_errors. | ||
|
|
||
|
|
| * 0 on success. | ||
| * A negative errno otherwise. | ||
| */ | ||
| uint32_t result; |
| * @retval 0 on success. | ||
| * @retval -EFAULT If @p storage is @c NULL. | ||
| * @retval -EBUSY If the implementation-specific resource is busy. | ||
| * @retval -EIO If an implementation-specific internal error occurred. |
There was a problem hiding this comment.
I would use EFAULT for generic failures. IO is more for read/write and such.
There was a problem hiding this comment.
We use EFAULT for NULL checks.
There was a problem hiding this comment.
No, not in every library. It is not a standard. For user-space, the standard is -EINVAL for invalid parameters, including NULL pointers.
| * @retval NRF_ERROR_BUSY If the implementation-specific resource is busy. | ||
| * @retval NRF_ERROR_INTERNAL If an implementation-specific internal error occurred. | ||
| * @retval 0 on success. | ||
| * @retval -EFAULT If @p storage is @c NULL. |
There was a problem hiding this comment.
EINVAL? I prefer to use EINVAL here, but I know that we don't really have a standard for this.
There was a problem hiding this comment.
This is the standard in the repo.
There was a problem hiding this comment.
No, it is not a standard. Some libraries in this repo do it this way. But it's ok, it can stay like this, it's not a big deal.
There was a problem hiding this comment.
Ok, I'll leave it as is, as it is like this in many other libraries. If we see the need we can align this treewide in a separate PR.
Fix compliance issue. Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
7783e7f to
cd7a854
Compare
| * @retval NRF_ERROR_FORBIDDEN If the implementation-specific backend has not been initialized. | ||
| * @retval 0 on success. | ||
| * @retval -EPERM If the implementation-specific backend has not been initialized. | ||
| * @retval -EFAULT if src is not 32-bit aligned. |
Use errnos for BM storage as it is not a BLE library or BLE subsystem. Correct return values for BM ZMS. Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
ring_buf_get() returns the size retrieved and will never be negative. Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
cd7a854 to
efb4e74
Compare
Use errnos for BM storage as it is not a BLE library or BLE subsystem.