-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
nvs: support iteration over namespace by index (IDFGH-9782) #11118
Conversation
Thanks for your contribution. |
Users of the nvs API are likely to have `nvs_handle_t` in all cases, but not all of them carry around the partition name and namespace name (as they aren't needed after creating an `nvs_handle_t`). Allow this common case to use nvs iteration without them tracking additional data by using the `nvs_handle_t` to locate the namespace index and the partition name by introducing an alterate to `nvs_entry_find` called `nvs_entry_find_in_handle`, which operates similarly except that it is given a `nvs_handle_t` instead of partition and namespace strings. This is somewhat more limited than the `nvs_entry_find` API as one cannot examine all keys in a given partition.
sha=2850cc67b8ace5051b7c4b7f0a255c30eb6e8eb5 |
* nvs_release_iterator(it); | ||
* \endcode | ||
* | ||
* @param[in] handle Handle obtained from nvs_open function. |
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.
Over here Doxygen complains that the argument name (handle) doesn't match the argument name in function declaration (c_handle). I'll fix this to use handle
name in the declaration, consistent with the rest of the functions.
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.
Ah, whoops, ya. I originally wrote this change for the esp-idf 4.x and then ported it to 5.x. Seems I didn't fully fix the doxygen comments after that.
Users of the nvs API are likely to have
nvs_handle_t
in all cases, but not all of them carry around the partition name and namespace name (as they aren't needed after creating annvs_handle_t
).Allow this common case to use nvs iteration without them tracking additional data by using the
nvs_handle_t
to locate the namespace index and the partition name by introducing an alternative tonvs_entry_find
callednvs_entry_find_in_handle
, which operates similarly except that it is given anvs_handle_t
instead of partition and namespace strings.This is somewhat more limited than the
nvs_entry_find
API as one cannot examine all keys in a given partition.