diff --git a/components/nvs_flash/host_test/nvs_host_test/main/test_fixtures.hpp b/components/nvs_flash/host_test/nvs_host_test/main/test_fixtures.hpp index 48b565ecd7..51d30420c7 100644 --- a/components/nvs_flash/host_test/nvs_host_test/main/test_fixtures.hpp +++ b/components/nvs_flash/host_test/nvs_host_test/main/test_fixtures.hpp @@ -29,7 +29,7 @@ public: esp_partition.erase_size = ESP_PARTITION_EMULATED_SECTOR_SIZE; esp_partition.type = ESP_PARTITION_TYPE_DATA; esp_partition.subtype = ESP_PARTITION_SUBTYPE_DATA_NVS; - strncpy(esp_partition.label, partition_name, PART_NAME_MAX_SIZE); + strncpy(esp_partition.label, partition_name, NVS_PART_NAME_MAX_SIZE); p_part = new (std::nothrow) nvs::NVSPartition(&esp_partition); REQUIRE(p_part != nullptr); } @@ -186,7 +186,7 @@ public: esp_partition2.erase_size = ESP_PARTITION_EMULATED_SECTOR_SIZE; esp_partition2.type = ESP_PARTITION_TYPE_DATA; esp_partition2.subtype = ESP_PARTITION_SUBTYPE_DATA_NVS; - strncpy(esp_partition2.label, partition_name2, PART_NAME_MAX_SIZE); + strncpy(esp_partition2.label, partition_name2, NVS_PART_NAME_MAX_SIZE); p_part2 = new (std::nothrow) nvs::NVSPartition(&esp_partition2); REQUIRE(p_part2 != nullptr); } diff --git a/components/nvs_flash/include/nvs.h b/components/nvs_flash/include/nvs.h index 1f4715d64b..e01f628b0d 100644 --- a/components/nvs_flash/include/nvs.h +++ b/components/nvs_flash/include/nvs.h @@ -1,10 +1,9 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ESP_NVS_H -#define ESP_NVS_H +#pragma once #include #include @@ -802,5 +801,3 @@ void nvs_release_iterator(nvs_iterator_t iterator); #ifdef __cplusplus } // extern "C" #endif - -#endif //ESP_NVS_H diff --git a/components/nvs_flash/include/nvs_flash.h b/components/nvs_flash/include/nvs_flash.h index 03eba446c8..b5332fa107 100644 --- a/components/nvs_flash/include/nvs_flash.h +++ b/components/nvs_flash/include/nvs_flash.h @@ -3,8 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef nvs_flash_h -#define nvs_flash_h +#pragma once #ifdef __cplusplus extern "C" { @@ -325,6 +324,3 @@ esp_err_t nvs_flash_read_security_cfg_v2(nvs_sec_scheme_t *scheme_cfg, nvs_sec_c #ifdef __cplusplus } #endif - - -#endif /* nvs_flash_h */ diff --git a/components/nvs_flash/include/nvs_handle.hpp b/components/nvs_flash/include/nvs_handle.hpp index 32f49ab759..eb9ff3c8f5 100644 --- a/components/nvs_flash/include/nvs_handle.hpp +++ b/components/nvs_flash/include/nvs_handle.hpp @@ -1,5 +1,9 @@ -#ifndef NVS_HANDLE_HPP_ -#define NVS_HANDLE_HPP_ +/* + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once #include #include @@ -307,5 +311,3 @@ esp_err_t NVSHandle::get_item(const char *key, T &value) { } } // nvs - -#endif // NVS_HANDLE_HPP_ diff --git a/components/nvs_flash/private_include/nvs_constants.h b/components/nvs_flash/private_include/nvs_constants.h index 0881156393..8be3231e60 100644 --- a/components/nvs_flash/private_include/nvs_constants.h +++ b/components/nvs_flash/private_include/nvs_constants.h @@ -1,12 +1,9 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef NVS_CONSTANTS_H -#define NVS_CONSTANTS_H - -#include "spi_flash_mmap.h" // for SPI_FLASH_SEC_SIZE +#pragma once // constants for the NVS to be used in the regular as well as bootloader implementations @@ -18,7 +15,7 @@ #define NVS_CONST_ESB_WRITTEN 0x1 #define NVS_CONST_ESB_ERASED 0x2 -#define NVS_CONST_PAGE_SIZE SPI_FLASH_SEC_SIZE +#define NVS_CONST_PAGE_SIZE 4096 // Page size is by design assumed to be 4096 bytes #define NVS_CONST_ENTRY_SIZE 32 #define NVS_CONST_ENTRY_COUNT 126 @@ -32,6 +29,8 @@ #define NVS_CONST_NVS_VERSION 0xfe // Decrement to upgrade +#define NVS_ENCRYPT_BLOCK_SIZE 16 // Size of the encryption block in bytes + // Page States // All bits set, default state after flash erase. Page has not been initialized yet. #define NVS_CONST_PAGE_STATE_UNINITIALIZED 0xffffffff @@ -64,5 +63,3 @@ #define NVS_CONST_PAGE_HEADER_OFFSET 0 #define NVS_CONST_PAGE_ENTRY_TABLE_OFFSET (NVS_CONST_PAGE_HEADER_OFFSET + 32) #define NVS_CONST_PAGE_ENTRY_DATA_OFFSET (NVS_CONST_PAGE_ENTRY_TABLE_OFFSET + 32) - -#endif diff --git a/components/nvs_flash/private_include/nvs_internal.h b/components/nvs_flash/private_include/nvs_internal.h index 1bf2cb8c4b..91c753c3f5 100644 --- a/components/nvs_flash/private_include/nvs_internal.h +++ b/components/nvs_flash/private_include/nvs_internal.h @@ -1,10 +1,9 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef NVS_INTERNAL_H -#define NVS_INTERNAL_H +#pragma once #if CONFIG_NVS_ASSERT_ERROR_CHECK #define NVS_ASSERT_OR_RETURN(condition, retcode) assert(condition); @@ -14,5 +13,3 @@ return retcode; \ } #endif // CONFIG_NVS_ASSERT_ERROR_CHECK - -#endif // NVS_INTERNAL_H diff --git a/components/nvs_flash/src/compressed_enum_table.hpp b/components/nvs_flash/src/compressed_enum_table.hpp index e276250d5f..ebc57fd7b9 100644 --- a/components/nvs_flash/src/compressed_enum_table.hpp +++ b/components/nvs_flash/src/compressed_enum_table.hpp @@ -1,11 +1,9 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ - -#ifndef compressed_enum_table_h -#define compressed_enum_table_h +#pragma once #include #include @@ -71,5 +69,3 @@ protected: static const uint32_t VALUE_MASK = (1 << Nbits) - 1; uint32_t mData[WORD_COUNT]; }; - -#endif /* compressed_enum_table_h */ diff --git a/components/nvs_flash/src/intrusive_list.h b/components/nvs_flash/src/intrusive_list.h index 9a8c6f228e..691539e417 100644 --- a/components/nvs_flash/src/intrusive_list.h +++ b/components/nvs_flash/src/intrusive_list.h @@ -1,10 +1,9 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef intrusive_list_h -#define intrusive_list_h +#pragma once #include #include @@ -251,6 +250,3 @@ protected: T* mLast = nullptr; size_t mSize = 0; }; - - -#endif /* intrusive_list_h */ diff --git a/components/nvs_flash/src/nvs_encrypted_partition.cpp b/components/nvs_flash/src/nvs_encrypted_partition.cpp index 653fbefa2c..335c8d42a8 100644 --- a/components/nvs_flash/src/nvs_encrypted_partition.cpp +++ b/components/nvs_flash/src/nvs_encrypted_partition.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/nvs_flash/src/nvs_encrypted_partition.hpp b/components/nvs_flash/src/nvs_encrypted_partition.hpp index 76c0607a0a..00c7bb1bb5 100644 --- a/components/nvs_flash/src/nvs_encrypted_partition.hpp +++ b/components/nvs_flash/src/nvs_encrypted_partition.hpp @@ -1,22 +1,12 @@ -// Copyright 2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once -#ifndef NVS_ENCRYPTED_PARTITION_HPP_ -#define NVS_ENCRYPTED_PARTITION_HPP_ - -#include "mbedtls/aes.h" -#include "nvs_flash.h" +#include "mbedtls/aes.h" // For mbedtls_aes_xts_context +#include "nvs_flash.h" // For nvs_sec_cfg_t #include "nvs_partition.hpp" namespace nvs { @@ -39,5 +29,3 @@ protected: }; } // nvs - -#endif // NVS_ENCRYPTED_PARTITION_HPP_ diff --git a/components/nvs_flash/src/nvs_handle_locked.hpp b/components/nvs_flash/src/nvs_handle_locked.hpp index 8a0f87663a..7a962ebaa3 100644 --- a/components/nvs_flash/src/nvs_handle_locked.hpp +++ b/components/nvs_flash/src/nvs_handle_locked.hpp @@ -1,10 +1,9 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef NVS_HANDLE_LOCKED_HPP_ -#define NVS_HANDLE_LOCKED_HPP_ +#pragma once #include "nvs_handle_simple.hpp" @@ -61,5 +60,3 @@ private: }; } // namespace nvs - -#endif // NVS_HANDLE_LOCKED_HPP_ diff --git a/components/nvs_flash/src/nvs_handle_simple.hpp b/components/nvs_flash/src/nvs_handle_simple.hpp index f7ccb31d27..4d8857214a 100644 --- a/components/nvs_flash/src/nvs_handle_simple.hpp +++ b/components/nvs_flash/src/nvs_handle_simple.hpp @@ -1,10 +1,9 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef NVS_HANDLE_SIMPLE_HPP_ -#define NVS_HANDLE_SIMPLE_HPP_ +#pragma once #include "intrusive_list.h" #include "nvs_storage.hpp" @@ -104,5 +103,3 @@ private: }; } // nvs - -#endif // NVS_HANDLE_SIMPLE_HPP_ diff --git a/components/nvs_flash/src/nvs_item_hash_list.cpp b/components/nvs_flash/src/nvs_item_hash_list.cpp index 21bf8b3153..ab9bcd47cd 100644 --- a/components/nvs_flash/src/nvs_item_hash_list.cpp +++ b/components/nvs_flash/src/nvs_item_hash_list.cpp @@ -1,17 +1,8 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - +/* + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include "nvs_item_hash_list.hpp" namespace nvs diff --git a/components/nvs_flash/src/nvs_item_hash_list.hpp b/components/nvs_flash/src/nvs_item_hash_list.hpp index ead5eeb10f..aadb2c694c 100644 --- a/components/nvs_flash/src/nvs_item_hash_list.hpp +++ b/components/nvs_flash/src/nvs_item_hash_list.hpp @@ -1,11 +1,9 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ - -#ifndef nvs_item_hash_list_h -#define nvs_item_hash_list_h +#pragma once #include "nvs.h" #include "nvs_types.hpp" @@ -62,6 +60,3 @@ protected: }; // class HashList } // namespace nvs - - -#endif /* nvs_item_hash_list_h */ diff --git a/components/nvs_flash/src/nvs_memory_management.hpp b/components/nvs_flash/src/nvs_memory_management.hpp index 54138f8aba..ed92e24419 100644 --- a/components/nvs_flash/src/nvs_memory_management.hpp +++ b/components/nvs_flash/src/nvs_memory_management.hpp @@ -3,14 +3,13 @@ * * SPDX-License-Identifier: Apache-2.0 */ +#pragma once #include #if !ESP_TEE_BUILD #include "esp_heap_caps.h" #endif -#pragma once - /** * @brief Type that is only usable with new (std::nothrow) to avoid exceptions. * diff --git a/components/nvs_flash/src/nvs_page.cpp b/components/nvs_flash/src/nvs_page.cpp index d0049c4f08..70c0016ead 100644 --- a/components/nvs_flash/src/nvs_page.cpp +++ b/components/nvs_flash/src/nvs_page.cpp @@ -9,14 +9,12 @@ #include #include #include "nvs_internal.h" -#include "esp_partition.h" +#include "nvs_memory_management.hpp" namespace nvs { Page::Page() : mPartition(nullptr) { } -const uint32_t nvs::Page::SEC_SIZE = 4096; - uint32_t Page::Header::calculateCrc32() { return esp_rom_crc32_le(0xffffffff, diff --git a/components/nvs_flash/src/nvs_page.hpp b/components/nvs_flash/src/nvs_page.hpp index 953682b157..1d2f7e79f5 100644 --- a/components/nvs_flash/src/nvs_page.hpp +++ b/components/nvs_flash/src/nvs_page.hpp @@ -1,23 +1,15 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef nvs_page_hpp -#define nvs_page_hpp +#pragma once #include "nvs.h" #include "nvs_types.hpp" -#include -#include -#include -#include -#include "compressed_enum_table.hpp" #include "intrusive_list.h" #include "nvs_item_hash_list.hpp" -#include "nvs_memory_management.hpp" #include "partition.hpp" -#include "nvs_constants.h" namespace nvs { @@ -34,7 +26,7 @@ public: static const uint32_t ESB_WRITTEN = NVS_CONST_ESB_WRITTEN; static const uint32_t ESB_ERASED = NVS_CONST_ESB_ERASED; - static const uint32_t SEC_SIZE; + static const uint32_t SEC_SIZE = NVS_CONST_PAGE_SIZE; static const size_t ENTRY_SIZE = NVS_CONST_ENTRY_SIZE; static const size_t ENTRY_COUNT = NVS_CONST_ENTRY_COUNT; @@ -239,6 +231,3 @@ protected: }; // class Page } // namespace nvs - - -#endif /* nvs_page_hpp */ diff --git a/components/nvs_flash/src/nvs_pagemanager.hpp b/components/nvs_flash/src/nvs_pagemanager.hpp index 4a1c19f7ec..8743a281f8 100644 --- a/components/nvs_flash/src/nvs_pagemanager.hpp +++ b/components/nvs_flash/src/nvs_pagemanager.hpp @@ -1,18 +1,9 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#ifndef nvs_pagemanager_hpp -#define nvs_pagemanager_hpp +/* + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once #include #include @@ -74,8 +65,4 @@ protected: uint32_t mSeqNumber; }; // class PageManager - } // namespace nvs - - -#endif /* nvs_pagemanager_hpp */ diff --git a/components/nvs_flash/src/nvs_partition.cpp b/components/nvs_flash/src/nvs_partition.cpp index ec15d58baa..dd2547d518 100644 --- a/components/nvs_flash/src/nvs_partition.cpp +++ b/components/nvs_flash/src/nvs_partition.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/nvs_flash/src/nvs_partition.hpp b/components/nvs_flash/src/nvs_partition.hpp index e8f64afc54..77d7c51c9a 100644 --- a/components/nvs_flash/src/nvs_partition.hpp +++ b/components/nvs_flash/src/nvs_partition.hpp @@ -1,11 +1,10 @@ /* - * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ +#pragma once -#ifndef ESP_PARTITION_HPP_ -#define ESP_PARTITION_HPP_ #include "esp_partition.h" #include "intrusive_list.h" @@ -109,5 +108,3 @@ protected: }; } // nvs - -#endif // ESP_PARTITION_HPP_ diff --git a/components/nvs_flash/src/nvs_partition_lookup.cpp b/components/nvs_flash/src/nvs_partition_lookup.cpp index 604049133a..8f2ac6816a 100644 --- a/components/nvs_flash/src/nvs_partition_lookup.cpp +++ b/components/nvs_flash/src/nvs_partition_lookup.cpp @@ -1,6 +1,11 @@ -#include "esp_partition.h" -#include "nvs_partition_lookup.hpp" +/* + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "nvs_partition_lookup.hpp" // For partition_lookup namespace +#include "esp_partition.h" // For esp_partition_t #ifndef LINUX_TARGET #include "nvs_encrypted_partition.hpp" #endif // ! LINUX_TARGET diff --git a/components/nvs_flash/src/nvs_partition_lookup.hpp b/components/nvs_flash/src/nvs_partition_lookup.hpp index 5dcd5d692c..215288ace4 100644 --- a/components/nvs_flash/src/nvs_partition_lookup.hpp +++ b/components/nvs_flash/src/nvs_partition_lookup.hpp @@ -1,9 +1,13 @@ -#include "esp_err.h" -#include "nvs_partition.hpp" -#include "nvs_flash.h" +/* + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once -#ifndef NVS_PARTITION_LOOKUP_HPP_ -#define NVS_PARTITION_LOOKUP_HPP_ +#include "esp_err.h" +#include "nvs_partition.hpp" // For nvs::Partition +#include "nvs_flash.h" // For nvs_sec_cfg_t namespace nvs { @@ -16,5 +20,3 @@ esp_err_t lookup_nvs_encrypted_partition(const char* label, nvs_sec_cfg_t* cfg, } // 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 8a7e0c6ed0..01851be813 100644 --- a/components/nvs_flash/src/nvs_partition_manager.cpp +++ b/components/nvs_flash/src/nvs_partition_manager.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/nvs_flash/src/nvs_partition_manager.hpp b/components/nvs_flash/src/nvs_partition_manager.hpp index 4b437d81e2..a4ce0c0bd1 100644 --- a/components/nvs_flash/src/nvs_partition_manager.hpp +++ b/components/nvs_flash/src/nvs_partition_manager.hpp @@ -1,10 +1,9 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef NVS_PARTITION_MANAGER_HPP_ -#define NVS_PARTITION_MANAGER_HPP_ +#pragma once #include "nvs_handle_simple.hpp" #include "nvs_storage.hpp" @@ -49,5 +48,3 @@ protected: }; } // nvs - -#endif // NVS_PARTITION_MANAGER_HPP_ diff --git a/components/nvs_flash/src/nvs_storage.hpp b/components/nvs_flash/src/nvs_storage.hpp index 1c63d1c8f0..790cdfa2bd 100644 --- a/components/nvs_flash/src/nvs_storage.hpp +++ b/components/nvs_flash/src/nvs_storage.hpp @@ -1,10 +1,9 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef nvs_storage_hpp -#define nvs_storage_hpp +#pragma once #include #include @@ -175,5 +174,3 @@ struct nvs_opaque_iterator_t intrusive_list::iterator page; nvs_entry_info_t entry_info; }; - -#endif /* nvs_storage_hpp */ diff --git a/components/nvs_flash/src/nvs_test_api.h b/components/nvs_flash/src/nvs_test_api.h index 8ba2c4faa8..09a404c866 100644 --- a/components/nvs_flash/src/nvs_test_api.h +++ b/components/nvs_flash/src/nvs_test_api.h @@ -1,17 +1,8 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - +/* + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #ifdef __cplusplus diff --git a/components/nvs_flash/src/nvs_types.hpp b/components/nvs_flash/src/nvs_types.hpp index 33591a9112..e0890cc197 100644 --- a/components/nvs_flash/src/nvs_types.hpp +++ b/components/nvs_flash/src/nvs_types.hpp @@ -1,10 +1,9 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef nvs_types_h -#define nvs_types_h +#pragma once #include #include @@ -14,6 +13,7 @@ #include "nvs_handle.hpp" #include "compressed_enum_table.hpp" #include "string.h" +#include "nvs_constants.h" namespace nvs { @@ -116,6 +116,7 @@ public: bool checkHeaderConsistency(const uint8_t entryIndex) const; }; -} // namespace nvs +// Safeguard for Item size +static_assert(sizeof(Item) == NVS_CONST_ENTRY_SIZE, "Item size must be 32 bytes"); -#endif /* nvs_types_h */ +} // namespace nvs diff --git a/components/nvs_flash/src/partition.hpp b/components/nvs_flash/src/partition.hpp index e649f84b20..975a3579c1 100644 --- a/components/nvs_flash/src/partition.hpp +++ b/components/nvs_flash/src/partition.hpp @@ -1,11 +1,9 @@ /* - * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ - -#ifndef PARTITION_HPP_ -#define PARTITION_HPP_ +#pragma once #include "esp_err.h" @@ -52,5 +50,3 @@ public: }; } // nvs - -#endif // PARTITION_HPP_ diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 2ed364c1ed..7cdda9b58f 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -479,13 +479,6 @@ components/mbedtls/port/include/sha1_alt.h components/mbedtls/port/include/sha256_alt.h components/mbedtls/port/include/sha512_alt.h components/mbedtls/port/sha/parallel_engine/sha.c -components/nvs_flash/include/nvs_handle.hpp -components/nvs_flash/src/nvs_encrypted_partition.hpp -components/nvs_flash/src/nvs_item_hash_list.cpp -components/nvs_flash/src/nvs_pagemanager.hpp -components/nvs_flash/src/nvs_partition_lookup.cpp -components/nvs_flash/src/nvs_partition_lookup.hpp -components/nvs_flash/src/nvs_test_api.h components/protocomm/include/transports/protocomm_console.h components/protocomm/include/transports/protocomm_httpd.h components/riscv/include/riscv/csr.h