Skip to content

Commit 26673e7

Browse files
committed
settings: add ZMS legacy backend for backward compatibility
The legacy ZMS backend is needed by some applications that need to maintain their backward compatibility. Signed-off-by: Riadh Ghaddab <[email protected]>
1 parent 003743a commit 26673e7

File tree

16 files changed

+584
-14
lines changed

16 files changed

+584
-14
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@
818818
/subsys/partition_manager/ @nordicjm @tejlmand
819819
/subsys/pcd/ @nrfconnect/ncs-pluto
820820
/subsys/sdfw_services/ @nrfconnect/ncs-aurora
821+
/subsys/settings/ @nrfconnect/ncs-pluto @rghaddab
821822
/subsys/sdfw_services/services/extmem/ @nrfconnect/ncs-charon
822823
/subsys/sdfw_services/services/suit_service/ @nrfconnect/ncs-charon
823824
/subsys/shell/ @nordic-krch

include/flash_map_pm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define image_scratch mcuboot_scratch
3131

3232
#if (CONFIG_SETTINGS_FCB || CONFIG_SETTINGS_NVS || defined(PM_SETTINGS_STORAGE_ID) ||\
33-
CONFIG_SETTINGS_ZMS)
33+
CONFIG_SETTINGS_ZMS || CONFIG_SETTINGS_ZMS_LEGACY)
3434
#define storage settings_storage
3535
#define storage_partition settings_storage
3636
#elif CONFIG_FILE_SYSTEM_LITTLEFS

samples/common/mcumgr_bt_ota_dfu/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ config MCUMGR_GRP_OS_MCUMGR_PARAMS
6868

6969
endif # MCUMGR_TRANSPORT_BT_REASSEMBLY
7070

71-
if (SETTINGS_FCB || SETTINGS_NVS || SETTINGS_ZMS)
71+
if (SETTINGS_FCB || SETTINGS_NVS || SETTINGS_ZMS || SETTINGS_ZMS_LEGACY)
7272

7373
config MCUMGR_GRP_ZBASIC
7474
default y
7575

7676
config MCUMGR_GRP_ZBASIC_STORAGE_ERASE
7777
default y
7878

79-
endif # (SETTINGS_FCB || SETTINGS_NVS || SETTINGS_ZMS)
79+
endif # (SETTINGS_FCB || SETTINGS_NVS || SETTINGS_ZMS || SETTINGS_ZMS_LEGACY)
8080

8181
if NORDIC_QSPI_NOR
8282

samples/matter/common/src/persistent_storage/persistent_storage_shell.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#if defined(CONFIG_SETTINGS_NVS)
1010
#include <zephyr/fs/nvs.h>
11-
#elif defined(CONFIG_SETTINGS_ZMS)
11+
#elif defined(CONFIG_SETTINGS_ZMS) || defined(CONFIG_SETTINGS_ZMS_LEGACY)
1212
#include <zephyr/fs/zms.h>
1313
#endif
1414
#include <zephyr/settings/settings.h>
@@ -20,7 +20,7 @@ namespace
2020
{
2121
#if defined(CONFIG_SETTINGS_NVS)
2222
nvs_fs *sStorage = nullptr;
23-
#elif defined(CONFIG_SETTINGS_ZMS)
23+
#elif defined(CONFIG_SETTINGS_ZMS) || defined(CONFIG_SETTINGS_ZMS_LEGACY)
2424
zms_fs *sStorage = nullptr;
2525
#endif
2626

@@ -34,7 +34,7 @@ int CalculateFreeSpace()
3434
{
3535
#if defined(CONFIG_SETTINGS_NVS)
3636
return nvs_calc_free_space(sStorage);
37-
#elif defined(CONFIG_SETTINGS_ZMS)
37+
#elif defined(CONFIG_SETTINGS_ZMS) || defined(CONFIG_SETTINGS_ZMS_LEGACY)
3838
return zms_calc_free_space(sStorage);
3939
#endif
4040
}
@@ -135,7 +135,7 @@ bool PersistentStorageShell::Init()
135135

136136
#if defined(CONFIG_SETTINGS_NVS)
137137
sStorage = reinterpret_cast<nvs_fs *>(storage);
138-
#elif defined(CONFIG_SETTINGS_ZMS)
138+
#elif defined(CONFIG_SETTINGS_ZMS) || defined(CONFIG_SETTINGS_ZMS_LEGACY)
139139
sStorage = reinterpret_cast<zms_fs *>(storage);
140140
#endif
141141

samples/matter/lock/src/access/access_storage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifdef CONFIG_LOCK_PRINT_STORAGE_STATUS
1414
#ifdef CONFIG_SETTINGS_NVS
1515
#include <zephyr/fs/nvs.h>
16-
#elif CONFIG_SETTINGS_ZMS
16+
#elif CONFIG_SETTINGS_ZMS || CONFIG_SETTINGS_ZMS_LEGACY
1717
#include <zephyr/fs/zms.h>
1818
#endif /* CONFIG_SETTINGS_NVS */
1919
#include <zephyr/logging/log.h>
@@ -33,7 +33,7 @@ bool GetStorageFreeSpace(size_t &freeBytes)
3333
}
3434
#ifdef CONFIG_SETTINGS_NVS
3535
freeBytes = nvs_calc_free_space(static_cast<nvs_fs *>(storage));
36-
#elif CONFIG_SETTINGS_ZMS
36+
#elif CONFIG_SETTINGS_ZMS || CONFIG_SETTINGS_ZMS_LEGACY
3737
freeBytes = zms_calc_free_space(static_cast<zms_fs *>(storage));
3838
#endif /* CONFIG_SETTINGS_NVS */
3939
return true;

scripts/ci/license_allow_list.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Apache-2.0: |
4848
^nrf/modules/openthread/
4949
^nrf/samples/net/http_server/src/main.c
5050
^nrf/tests/subsys/suit/common/tls_config/user-tls-conf.h
51+
^nrf/subsys/settings/
5152
curl: "^nrf/ext/"
5253
MIT: "^nrf/ext/"
5354
BSD-3-CLAUSE: |

subsys/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ add_subdirectory_ifdef(CONFIG_MGMT_SUITFU mgmt/suitfu)
6868
add_subdirectory_ifdef(CONFIG_DULT dult)
6969
add_subdirectory_ifdef(CONFIG_NRF_COMPRESS nrf_compress)
7070
add_subdirectory(mgmt/mcumgr)
71+
add_subdirectory_ifdef(CONFIG_SETTINGS settings)

subsys/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ rsource "suit/Kconfig"
4343
rsource "dult/Kconfig"
4444
rsource "nrf_compress/Kconfig"
4545
rsource "mcuboot_ids/Kconfig"
46+
rsource "settings/Kconfig"
4647
endmenu

subsys/partition_manager/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if (CONFIG_BOARD_HAS_NRF5_BOOTLOADER)
5353
ncs_add_partition_manager_config(pm.yml.nrf5_mbr)
5454
endif()
5555

56-
if (CONFIG_SETTINGS_FCB OR CONFIG_SETTINGS_NVS OR CONFIG_SETTINGS_ZMS)
56+
if (CONFIG_SETTINGS_FCB OR CONFIG_SETTINGS_NVS OR CONFIG_SETTINGS_ZMS OR CONFIG_SETTINGS_ZMS_LEGACY)
5757
ncs_add_partition_manager_config(pm.yml.settings)
5858
endif()
5959

@@ -65,7 +65,7 @@ if (CONFIG_NVS AND NOT CONFIG_SETTINGS_NVS)
6565
ncs_add_partition_manager_config(pm.yml.nvs)
6666
endif()
6767

68-
if (CONFIG_ZMS AND NOT CONFIG_SETTINGS_ZMS)
68+
if (CONFIG_ZMS AND NOT (CONFIG_SETTINGS_ZMS OR CONFIG_SETTINGS_ZMS_LEGACY))
6969
ncs_add_partition_manager_config(pm.yml.zms)
7070
endif()
7171

subsys/partition_manager/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ rsource "Kconfig.template.partition_region"
5353
endif
5454

5555

56-
if SETTINGS_FCB || SETTINGS_NVS || SETTINGS_ZMS
56+
if SETTINGS_FCB || SETTINGS_NVS || SETTINGS_ZMS || SETTINGS_ZMS_LEGACY
5757
partition=SETTINGS_STORAGE
5858
partition-size=0x2000
5959
rsource "Kconfig.template.partition_config"
@@ -75,7 +75,7 @@ rsource "Kconfig.template.partition_config"
7575
rsource "Kconfig.template.partition_region"
7676
endif
7777

78-
if ZMS && !SETTINGS_ZMS
78+
if ZMS && !(SETTINGS_ZMS || SETTINGS_ZMS_LEGACY)
7979
partition=ZMS_STORAGE
8080
partition-size=0x6000
8181
rsource "Kconfig.template.partition_config"

0 commit comments

Comments
 (0)