Function esp_idf_sys::nvs_get_stats
source · pub unsafe extern "C" fn nvs_get_stats(
part_name: *const c_char,
nvs_stats: *mut nvs_stats_t,
) -> esp_err_t
Expand description
@brief Fill structure nvs_stats_t. It provides info about used memory the partition.
This function calculates to runtime the number of used entries, free entries, total entries, and amount namespace in partition.
\code{c} // Example of nvs_get_stats() to get the number of used entries and free entries: nvs_stats_t nvs_stats; nvs_get_stats(NULL, &nvs_stats); printf(“Count: UsedEntries = (%d), FreeEntries = (%d), AllEntries = (%d)\n”, nvs_stats.used_entries, nvs_stats.free_entries, nvs_stats.total_entries); \endcode
@param[in] part_name Partition name NVS in the partition table. If pass a NULL than will use NVS_DEFAULT_PART_NAME (“nvs”).
@param[out] nvs_stats Returns filled structure nvs_states_t. It provides info about used memory the partition.
@return - ESP_OK if the changes have been written successfully. Return param nvs_stats will be filled. - ESP_ERR_NVS_PART_NOT_FOUND if the partition with label “name” is not found. Return param nvs_stats will be filled 0. - ESP_ERR_NVS_NOT_INITIALIZED if the storage driver is not initialized. Return param nvs_stats will be filled 0. - ESP_ERR_INVALID_ARG if nvs_stats equal to NULL. - ESP_ERR_INVALID_STATE if there is page with the status of INVALID. Return param nvs_stats will be filled not with correct values because not all pages will be counted. Counting will be interrupted at the first INVALID page.