Skip to content

Commit 9f18c44

Browse files
authored
Merge pull request ARMmbed#13908 from LDong-Arm/kvstore_libraries
Restructure KVStore to one library per store type
2 parents 86ee300 + 479b704 commit 9f18c44

File tree

39 files changed

+165
-64
lines changed

39 files changed

+165
-64
lines changed

TESTS/configs/baremetal.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
"system-storage",
2626
"SecureStore",
2727
"storage",
28+
"kvstore",
29+
"tdbstore",
30+
"filesystemstore",
2831
"kv-global-api",
2932
"direct-access-devicekey",
3033
"kv-config",

UNITTESTS/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ set(unittest-includes-base
122122
"${PROJECT_SOURCE_DIR}/../storage/kvstore/include"
123123
"${PROJECT_SOURCE_DIR}/../storage/kvstore/kv_config"
124124
"${PROJECT_SOURCE_DIR}/../storage/kvstore/kv_config/include"
125+
"${PROJECT_SOURCE_DIR}/../storage/kvstore/tdbstore/include"
126+
"${PROJECT_SOURCE_DIR}/../storage/kvstore/filesystemstore/include"
127+
"${PROJECT_SOURCE_DIR}/../storage/kvstore/kvstore_global_api/include"
125128
"${PROJECT_SOURCE_DIR}/../drivers"
126129
"${PROJECT_SOURCE_DIR}/../drivers/include"
127130
"${PROJECT_SOURCE_DIR}/../drivers/include/drivers"

drivers/device_key/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ target_sources(mbed-device_key
1717
target_link_libraries(mbed-device_key
1818
INTERFACE
1919
mbed-storage-kvstore
20+
mbed-storage-tdbstore
21+
mbed-storage-kv-global-api
2022
)

drivers/device_key/source/DeviceKey.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#include "mbedtls/cmac.h"
2222
#include "mbedtls/platform.h"
2323
#include "kvstore/KVStore.h"
24-
#include "kvstore/TDBStore.h"
25-
#include "kvstore/KVMap.h"
24+
#include "tdbstore/TDBStore.h"
25+
#include "kvstore_global_api/KVMap.h"
2626
#include "kv_config/kv_config.h"
2727
#include "mbed_wait_api.h"
2828
#include <stdlib.h>

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ target_link_libraries(mbed-psa
2424
INTERFACE
2525
mbed-mbedtls
2626
mbed-storage-kvstore
27+
mbed-storage-tdbstore
28+
mbed-storage-kv-global-api
29+
mbed-device_key
2730
)

storage/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ add_library(mbed-storage-littlefs INTERFACE)
1818
add_library(mbed-storage-fat INTERFACE)
1919

2020
add_library(mbed-storage-kvstore INTERFACE)
21+
add_library(mbed-storage-tdbstore INTERFACE)
22+
add_library(mbed-storage-filesystemstore INTERFACE)
23+
add_library(mbed-storage-securestore INTERFACE)
24+
add_library(mbed-storage-kv-config INTERFACE)
25+
add_library(mbed-storage-direct-access-devicekey INTERFACE)
26+
add_library(mbed-storage-kv-global-api INTERFACE)
2127

2228

2329
add_subdirectory(blockdevice)
@@ -29,8 +35,3 @@ target_include_directories(mbed-storage
2935
INTERFACE
3036
.
3137
)
32-
33-
target_compile_definitions(mbed-storage
34-
INTERFACE
35-
MBED_CONF_FILESYSTEM_PRESENT=1
36-
)

storage/filesystem/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ target_sources(mbed-storage-filesystem
1818
source/File.cpp
1919
source/FileSystem.cpp
2020
)
21+
22+
target_compile_definitions(mbed-storage
23+
INTERFACE
24+
MBED_CONF_FILESYSTEM_PRESENT=1
25+
)

storage/kvstore/CMakeLists.txt

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,16 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
add_subdirectory(direct_access_devicekey)
5-
add_subdirectory(kv_config)
4+
add_subdirectory(tdbstore)
5+
add_subdirectory(filesystemstore)
66
add_subdirectory(securestore)
7+
add_subdirectory(kv_config)
8+
add_subdirectory(direct_access_devicekey)
9+
add_subdirectory(kvstore_global_api)
710

811
target_include_directories(mbed-storage-kvstore
912
INTERFACE
1013
.
11-
./include
12-
./include/kvstore
13-
)
14-
15-
target_sources(mbed-storage-kvstore
16-
INTERFACE
17-
source/FileSystemStore.cpp
18-
source/KVMap.cpp
19-
source/TDBStore.cpp
20-
source/kvstore_global_api.cpp
21-
)
22-
23-
target_link_libraries(mbed-storage-kvstore
24-
INTERFACE
25-
mbed-device_key
26-
mbed-storage-blockdevice
27-
mbed-storage-filesystem
28-
mbed-storage-fat
29-
mbed-storage-littlefs
30-
mbed-storage-flashiap
31-
mbed-storage-sd
14+
include
15+
include/kvstore
3216
)
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
target_include_directories(mbed-storage-kvstore
4+
target_include_directories(mbed-storage-direct-access-devicekey
55
INTERFACE
66
.
7-
./include
8-
./include/direct_access_devicekey
7+
include
8+
include/direct_access_devicekey
99
)
1010

11-
target_sources(mbed-storage-kvstore
11+
target_sources(mbed-storage-direct-access-devicekey
1212
INTERFACE
1313
source/DirectAccessDevicekey.cpp
1414
)
15+
16+
target_link_libraries(mbed-storage-direct-access-devicekey
17+
INTERFACE
18+
mbed-storage-kvstore
19+
mbed-storage-kv-config
20+
)

storage/kvstore/tests/TESTS/direct_access_devicekey/tdb/main.cpp renamed to storage/kvstore/direct_access_devicekey/tests/TESTS/direct_access_devicekey/tdb/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
#include <string.h>
2525
#include "DeviceKey.h"
2626
#include "kvstore/KVStore.h"
27-
#include "kvstore/KVMap.h"
27+
#include "kvstore_global_api/KVMap.h"
2828
#include "kv_config/kv_config.h"
29-
#include "kvstore/TDBStore.h"
29+
#include "tdbstore/TDBStore.h"
3030
#include "FlashIAP.h"
3131
#include "FlashIAPBlockDevice.h"
3232
#include "direct_access_devicekey/DirectAccessDevicekey.h"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
target_include_directories(mbed-storage-filesystemstore
5+
INTERFACE
6+
.
7+
include
8+
include/filesystemstore
9+
)
10+
11+
target_sources(mbed-storage-filesystemstore
12+
INTERFACE
13+
source/FileSystemStore.cpp
14+
)
15+
16+
target_link_libraries(mbed-storage-filesystemstore
17+
INTERFACE
18+
mbed-storage-kvstore
19+
mbed-storage-filesystem
20+
mbed-storage-kv-config
21+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "filesystemstore"
3+
}

storage/kvstore/source/FileSystemStore.cpp renamed to storage/kvstore/filesystemstore/source/FileSystemStore.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19-
#include "kvstore/FileSystemStore.h"
19+
#include "filesystemstore/FileSystemStore.h"
2020
#include "kv_config/kv_config.h"
2121
#include "filesystem/Dir.h"
2222
#include "filesystem/File.h"

storage/kvstore/tests/UNITTESTS/FileSystemStore/moduletest.cpp renamed to storage/kvstore/filesystemstore/tests/UNITTESTS/FileSystemStore/moduletest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include "gtest/gtest.h"
1818
#include "blockdevice/HeapBlockDevice.h"
19-
#include "kvstore/FileSystemStore.h"
19+
#include "filesystemstore/FileSystemStore.h"
2020
#include "littlefs/LittleFileSystem.h"
2121
#include "mbed_error.h"
2222
#include <stdlib.h>
@@ -34,7 +34,7 @@ class FileSystemStoreModuleTest : public testing::Test {
3434
virtual void SetUp()
3535
{
3636
fs = new LittleFileSystem("kvstore", &heap);
37-
if(fs->mount(&heap) != MBED_SUCCESS) {
37+
if (fs->mount(&heap) != MBED_SUCCESS) {
3838
EXPECT_EQ(fs->reformat(&heap), MBED_SUCCESS);
3939
}
4040
store = new FileSystemStore(fs);

storage/kvstore/tests/UNITTESTS/FileSystemStore/unittest.cmake renamed to storage/kvstore/filesystemstore/tests/UNITTESTS/FileSystemStore/unittest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set(unittest-includes ${unittest-includes}
1010

1111
set(unittest-sources
1212
../storage/blockdevice/source/HeapBlockDevice.cpp
13-
../storage/kvstore/source/FileSystemStore.cpp
13+
../storage/kvstore/filesystemstore/source/FileSystemStore.cpp
1414
../storage/filesystem/littlefs/source/LittleFileSystem.cpp
1515
../storage/filesystem/source/Dir.cpp
1616
../storage/filesystem/source/File.cpp
Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
target_include_directories(mbed-storage-kvstore
4+
target_include_directories(mbed-storage-kv-config
55
INTERFACE
66
.
7-
./include
8-
./include/kv_config
7+
include
8+
include/kv_config
99
)
1010

11-
target_sources(mbed-storage-kvstore
11+
target_sources(mbed-storage-kv-config
1212
INTERFACE
1313
source/kv_config.cpp
1414
)
15+
16+
target_link_libraries(mbed-storage-kv-config
17+
INTERFACE
18+
mbed-storage-kvstore
19+
mbed-storage-blockdevice
20+
mbed-storage-tdbstore
21+
mbed-storage-filesystemstore
22+
mbed-storage-securestore
23+
mbed-storage-littlefs
24+
mbed-storage-fat
25+
mbed-storage-flashiap
26+
mbed-storage-sd
27+
)

storage/kvstore/kv_config/source/kv_config.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
#include "kv_config.h"
1818
#include "kvstore/KVStore.h"
19-
#include "kvstore/KVMap.h"
19+
#include "kvstore_global_api/KVMap.h"
2020
#include "blockdevice/BlockDevice.h"
2121
#include "filesystem/FileSystem.h"
22-
#include "kvstore/FileSystemStore.h"
22+
#include "filesystemstore/FileSystemStore.h"
2323
#include "blockdevice/SlicingBlockDevice.h"
2424
#include "fat/FATFileSystem.h"
2525
#include "littlefs/LittleFileSystem.h"
26-
#include "kvstore/TDBStore.h"
26+
#include "tdbstore/TDBStore.h"
2727
#include "mbed_error.h"
2828
#include "drivers/FlashIAP.h"
2929
#include "blockdevice/FlashSimBlockDevice.h"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
target_include_directories(mbed-storage-kv-global-api
5+
INTERFACE
6+
.
7+
include
8+
include/kvstore_global_api
9+
)
10+
11+
target_sources(mbed-storage-kv-global-api
12+
INTERFACE
13+
source/KVMap.cpp
14+
source/kvstore_global_api.cpp
15+
)
16+
17+
target_link_libraries(mbed-storage-kv-global-api
18+
INTERFACE
19+
mbed-storage-kvstore
20+
mbed-storage-kv-config
21+
mbed-storage-blockdevice
22+
mbed-storage-filesystem
23+
)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "kv-global-api",
3+
"requires": ["kvstore"]
4+
}

storage/kvstore/source/KVMap.cpp renamed to storage/kvstore/kvstore_global_api/source/KVMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#include "kvstore/KVStore.h"
18-
#include "kvstore/KVMap.h"
18+
#include "kvstore_global_api/KVMap.h"
1919
#include "kv_config/kv_config.h"
2020
#include <stdlib.h>
2121
#include "string.h"

storage/kvstore/source/kvstore_global_api.cpp renamed to storage/kvstore/kvstore_global_api/source/kvstore_global_api.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
#include "kvstore_global_api.h"
16+
#include "kvstore_global_api/kvstore_global_api.h"
1717

1818
#include "kv_config/kv_config.h"
19-
#include "kvstore/KVMap.h"
19+
#include "kvstore_global_api/KVMap.h"
2020
#include "kvstore/KVStore.h"
2121
#include "mbed_error.h"
2222

storage/kvstore/mbed_lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"name": "kv-global-api"
2+
"name": "kvstore"
33
}
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
target_include_directories(mbed-storage-kvstore
4+
target_include_directories(mbed-storage-securestore
55
INTERFACE
66
.
7-
./include
8-
./include/securestore
7+
include
8+
include/securestore
99
)
1010

11-
target_sources(mbed-storage-kvstore
11+
target_sources(mbed-storage-securestore
1212
INTERFACE
1313
source/SecureStore.cpp
1414
)
15+
16+
target_link_libraries(mbed-storage-securestore
17+
INTERFACE
18+
mbed-storage-kvstore
19+
mbed-device_key
20+
)

storage/kvstore/tests/TESTS/securestore/whitebox/main.cpp renamed to storage/kvstore/securestore/tests/TESTS/securestore/whitebox/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818

1919
#include "securestore/SecureStore.h"
20-
#include "kvstore/TDBStore.h"
20+
#include "tdbstore/TDBStore.h"
2121
#ifdef MBED_CONF_RTOS_PRESENT
2222
#include "Thread.h"
2323
#endif
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
target_include_directories(mbed-storage-tdbstore
5+
INTERFACE
6+
.
7+
include
8+
include/tdbstore
9+
)
10+
11+
target_sources(mbed-storage-tdbstore
12+
INTERFACE
13+
source/TDBStore.cpp
14+
)
15+
16+
target_link_libraries(mbed-storage-tdbstore
17+
INTERFACE
18+
mbed-storage-kvstore
19+
mbed-storage-blockdevice
20+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "tdbstore"
3+
}

storage/kvstore/source/TDBStore.cpp renamed to storage/kvstore/tdbstore/source/TDBStore.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// ----------------------------------------------------------- Includes -----------------------------------------------------------
1818

19-
#include "kvstore/TDBStore.h"
19+
#include "tdbstore/TDBStore.h"
2020

2121
#include <algorithm>
2222
#include <string.h>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

0 commit comments

Comments
 (0)