]> granicus.if.org Git - esp-idf/commit
nvs: check that storage has at least one free page
authorIvan Grokhotkov <ivan@espressif.com>
Tue, 14 Mar 2017 13:24:56 +0000 (21:24 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Tue, 14 Mar 2017 14:03:39 +0000 (22:03 +0800)
commit5a23ec4dc4dc39189f8de35d0adab522c56fe97d
treee4623c997867b535209b97404a483e19505ed04e
parent817bbb4bf92cff78846a8b0540d045285d04f121
nvs: check that storage has at least one free page

This change adds a check for the free page count to nvs_flash_init.
Under normal operation, NVS keeps at least one free page available,
except for transient states such as freeing up new page. Due to external
factors (such as NVS partition size reduction) this free page could be
lost, making NVS operation impossible. Previously this would cause an
error when performing any nvs_set operation or opening a new namespace.
With this change, an error is returned from nvs_flash_init to indicate
that NVS partition is in such a state.
components/nvs_flash/README.rst
components/nvs_flash/include/nvs.h
components/nvs_flash/include/nvs_flash.h
components/nvs_flash/src/nvs_pagemanager.cpp
components/nvs_flash/test_nvs_host/test_nvs.cpp
docs/api/storage/nvs_flash.rst