Merge branch 'bugfix/nvs_correct_namespaces' into 'master'

NVS: put wild functions into namespace

See merge request espressif/esp-idf!10514
This commit is contained in:
Ivan Grokhotkov
2020-09-23 22:11:36 +08:00
3 changed files with 11 additions and 3 deletions

View File

@@ -7,6 +7,8 @@
namespace nvs { namespace nvs {
namespace partition_lookup {
esp_err_t lookup_nvs_partition(const char* label, NVSPartition **p) esp_err_t lookup_nvs_partition(const char* label, NVSPartition **p)
{ {
const esp_partition_t* esp_partition = esp_partition_find_first( const esp_partition_t* esp_partition = esp_partition_find_first(
@@ -62,4 +64,6 @@ esp_err_t lookup_nvs_encrypted_partition(const char* label, nvs_sec_cfg_t* cfg,
#endif // CONFIG_NVS_ENCRYPTION #endif // CONFIG_NVS_ENCRYPTION
} // partition_lookup
} // nvs } // nvs

View File

@@ -7,12 +7,16 @@
namespace nvs { namespace nvs {
namespace partition_lookup {
esp_err_t lookup_nvs_partition(const char* label, NVSPartition **p); esp_err_t lookup_nvs_partition(const char* label, NVSPartition **p);
#ifdef CONFIG_NVS_ENCRYPTION #ifdef CONFIG_NVS_ENCRYPTION
esp_err_t lookup_nvs_encrypted_partition(const char* label, nvs_sec_cfg_t* cfg, NVSPartition **p); esp_err_t lookup_nvs_encrypted_partition(const char* label, nvs_sec_cfg_t* cfg, NVSPartition **p);
#endif // CONFIG_NVS_ENCRYPTION #endif // CONFIG_NVS_ENCRYPTION
} // partition_lookup
} // nvs } // nvs
#endif // NVS_PARTITION_LOOKUP_HPP_ #endif // NVS_PARTITION_LOOKUP_HPP_

View File

@@ -50,7 +50,7 @@ esp_err_t NVSPartitionManager::init_partition(const char *partition_label)
assert(SPI_FLASH_SEC_SIZE != 0); assert(SPI_FLASH_SEC_SIZE != 0);
NVSPartition *p = nullptr; NVSPartition *p = nullptr;
esp_err_t result = lookup_nvs_partition(partition_label, &p); esp_err_t result = partition_lookup::lookup_nvs_partition(partition_label, &p);
if (result != ESP_OK) { if (result != ESP_OK) {
goto error; goto error;
@@ -125,9 +125,9 @@ esp_err_t NVSPartitionManager::secure_init_partition(const char *part_name, nvs_
NVSPartition *p; NVSPartition *p;
esp_err_t result; esp_err_t result;
if (cfg != nullptr) { if (cfg != nullptr) {
result = lookup_nvs_encrypted_partition(part_name, cfg, &p); result = partition_lookup::lookup_nvs_encrypted_partition(part_name, cfg, &p);
} else { } else {
result = lookup_nvs_partition(part_name, &p); result = partition_lookup::lookup_nvs_partition(part_name, &p);
} }
if (result != ESP_OK) { if (result != ESP_OK) {