Function esp_idf_sys::nvs_open

source ·
pub unsafe extern "C" fn nvs_open(
    namespace_name: *const c_char,
    open_mode: nvs_open_mode_t,
    out_handle: *mut nvs_handle_t,
) -> esp_err_t
Expand description

@brief Open non-volatile storage with a given namespace from the default NVS partition

Multiple internal ESP-IDF and third party application modules can store their key-value pairs in the NVS module. In order to reduce possible conflicts on key names, each module can use its own namespace. The default NVS partition is the one that is labelled “nvs” in the partition table.

@param[in] namespace_name Namespace name. Maximum length is (NVS_KEY_NAME_MAX_SIZE-1) characters. Shouldn’t be empty. @param[in] open_mode NVS_READWRITE or NVS_READONLY. If NVS_READONLY, will open a handle for reading only. All write requests will be rejected for this handle. @param[out] out_handle If successful (return code is zero), handle will be returned in this argument.

@return - ESP_OK if storage handle was opened successfully - ESP_FAIL if there is an internal error; most likely due to corrupted NVS partition (only if NVS assertion checks are disabled) - ESP_ERR_NVS_NOT_INITIALIZED if the storage driver is not initialized - ESP_ERR_NVS_PART_NOT_FOUND if the partition with label “nvs” is not found - ESP_ERR_NVS_NOT_FOUND id namespace doesn’t exist yet and mode is NVS_READONLY - ESP_ERR_NVS_INVALID_NAME if namespace name doesn’t satisfy constraints - ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures - ESP_ERR_NVS_NOT_ENOUGH_SPACE if there is no space for a new entry or there are too many different namespaces (maximum allowed different namespaces: 254) - ESP_ERR_NOT_ALLOWED if the NVS partition is read-only and mode is NVS_READWRITE - ESP_ERR_INVALID_ARG if out_handle is equal to NULL - other error codes from the underlying storage driver