From 0e118c6070c158a8de35927f75c2f0cba68cdaa7 Mon Sep 17 00:00:00 2001 From: Jakob Hasse Date: Fri, 18 Sep 2020 15:38:40 +0800 Subject: [PATCH] NVS: put wild functions into namespace --- components/nvs_flash/src/nvs_partition_lookup.cpp | 4 ++++ components/nvs_flash/src/nvs_partition_lookup.hpp | 4 ++++ components/nvs_flash/src/nvs_partition_manager.cpp | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/components/nvs_flash/src/nvs_partition_lookup.cpp b/components/nvs_flash/src/nvs_partition_lookup.cpp index 579d8948bb..e9d27256fa 100644 --- a/components/nvs_flash/src/nvs_partition_lookup.cpp +++ b/components/nvs_flash/src/nvs_partition_lookup.cpp @@ -7,6 +7,8 @@ namespace nvs { +namespace partition_lookup { + esp_err_t lookup_nvs_partition(const char* label, NVSPartition **p) { 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 +} // partition_lookup + } // nvs diff --git a/components/nvs_flash/src/nvs_partition_lookup.hpp b/components/nvs_flash/src/nvs_partition_lookup.hpp index 3d9c1249a3..62a8e8b6fe 100644 --- a/components/nvs_flash/src/nvs_partition_lookup.hpp +++ b/components/nvs_flash/src/nvs_partition_lookup.hpp @@ -7,12 +7,16 @@ namespace nvs { +namespace partition_lookup { + esp_err_t lookup_nvs_partition(const char* label, NVSPartition **p); #ifdef CONFIG_NVS_ENCRYPTION esp_err_t lookup_nvs_encrypted_partition(const char* label, nvs_sec_cfg_t* cfg, NVSPartition **p); #endif // CONFIG_NVS_ENCRYPTION +} // partition_lookup + } // nvs #endif // NVS_PARTITION_LOOKUP_HPP_ diff --git a/components/nvs_flash/src/nvs_partition_manager.cpp b/components/nvs_flash/src/nvs_partition_manager.cpp index 3bf14ea33f..87283767c0 100644 --- a/components/nvs_flash/src/nvs_partition_manager.cpp +++ b/components/nvs_flash/src/nvs_partition_manager.cpp @@ -50,7 +50,7 @@ esp_err_t NVSPartitionManager::init_partition(const char *partition_label) assert(SPI_FLASH_SEC_SIZE != 0); 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) { goto error; @@ -125,9 +125,9 @@ esp_err_t NVSPartitionManager::secure_init_partition(const char *part_name, nvs_ NVSPartition *p; esp_err_t result; if (cfg != nullptr) { - result = lookup_nvs_encrypted_partition(part_name, cfg, &p); + result = partition_lookup::lookup_nvs_encrypted_partition(part_name, cfg, &p); } else { - result = lookup_nvs_partition(part_name, &p); + result = partition_lookup::lookup_nvs_partition(part_name, &p); } if (result != ESP_OK) {