File tree Expand file tree Collapse file tree 4 files changed +34
-11
lines changed
TESTS/kvstore/static_tests Expand file tree Collapse file tree 4 files changed +34
-11
lines changed Original file line number Diff line number Diff line change @@ -910,6 +910,7 @@ static void iterator_close_right_after_iterator_open()
910
910
utest::v1::status_t greentea_failure_handler (const Case *const source, const failure_t reason)
911
911
{
912
912
greentea_case_failure_abort_handler (source, reason);
913
+ UnityConcludeTest ();
913
914
return STATUS_CONTINUE;
914
915
}
915
916
Original file line number Diff line number Diff line change @@ -134,6 +134,8 @@ int _storage_config_FILESYSTEM_NO_RBP();
134
134
int _storage_config_tdb_external_common ();
135
135
int _storage_config_filesystem_common ();
136
136
137
+ static const char *filesystemstore_folder_path = NULL ;
138
+
137
139
using namespace mbed ;
138
140
139
141
@@ -881,6 +883,9 @@ int _storage_config_FILESYSTEM()
881
883
#if !SECURESTORE_ENABLED
882
884
return MBED_ERROR_UNSUPPORTED;
883
885
#endif
886
+
887
+ filesystemstore_folder_path = STR (MBED_CONF_STORAGE_FILESYSTEM_FOLDER_PATH);
888
+
884
889
bd_size_t internal_rbp_size = MBED_CONF_STORAGE_FILESYSTEM_RBP_INTERNAL_SIZE;
885
890
bd_addr_t internal_start_address = MBED_CONF_STORAGE_FILESYSTEM_INTERNAL_BASE_ADDRESS;
886
891
@@ -962,6 +967,12 @@ int _storage_config_FILESYSTEM()
962
967
963
968
int _storage_config_FILESYSTEM_NO_RBP ()
964
969
{
970
+ #if !SECURESTORE_ENABLED
971
+ return MBED_ERROR_UNSUPPORTED;
972
+ #endif
973
+
974
+ filesystemstore_folder_path = STR (MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_FOLDER_PATH);
975
+
965
976
bd_size_t size = MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_EXTERNAL_SIZE;
966
977
bd_addr_t address = MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_EXTERNAL_BASE_ADDRESS;
967
978
const char *mount_point = STR (MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_MOUNT_POINT);
@@ -1062,6 +1073,11 @@ int _storage_config_default()
1062
1073
#endif
1063
1074
}
1064
1075
1076
+ const char *get_filesystemstore_folder_path ()
1077
+ {
1078
+ return filesystemstore_folder_path;
1079
+ }
1080
+
1065
1081
MBED_WEAK int kv_init_storage_config ()
1066
1082
{
1067
1083
Original file line number Diff line number Diff line change 20
20
extern "C" {
21
21
#endif
22
22
23
- #if MBED_CONF_STORAGE_STORAGE_TYPE == FILESYSTEM
24
- #define FSST_FOLDER_PATH MBED_CONF_STORAGE_FILESYSTEM_FOLDER_PATH
25
- #elif MBED_CONF_STORAGE_STORAGE_TYPE == FILESYSTEM_NO_RBP
26
- #define FSST_FOLDER_PATH MBED_CONF_STORAGE_FILESYSTEM_NO_RBP_FOLDER_PATH
27
- #endif
28
-
29
23
#ifndef MBED_CONF_STORAGE_STORAGE
30
24
#define MBED_CONF_STORAGE_STORAGE USER_DEFINED
31
25
#endif
@@ -41,6 +35,13 @@ extern "C" {
41
35
*/
42
36
int kv_init_storage_config ();
43
37
38
+ /**
39
+ * @brief A getter for filesystemstore folder path configuration
40
+ *
41
+ * @returns string with the file folder path or NULL if not set
42
+ */
43
+ const char * get_filesystemstore_folder_path ();
44
+
44
45
#ifdef __cplusplus
45
46
} // closing brace for extern "C"
46
47
#endif
Original file line number Diff line number Diff line change 17
17
*/
18
18
19
19
#include " FileSystemStore.h"
20
+ #include " kv_config.h"
20
21
#include " Dir.h"
21
22
#include " File.h"
22
23
#include " BlockDevice.h"
31
32
#define FSST_REVISION 1
32
33
#define FSST_MAGIC 0x46535354 // "FSST" hex 'magic' signature
33
34
34
- #ifndef FSST_FOLDER_PATH
35
- #define FSST_FOLDER_PATH " kvstore" // default FileSystemStore folder path on fs
36
- #endif
35
+ #define FSST_DEFAULT_FOLDER_PATH " kvstore" // default FileSystemStore folder path on fs
37
36
38
37
static const uint32_t supported_flags = mbed::KVStore::WRITE_ONCE_FLAG;
39
38
@@ -73,9 +72,15 @@ int FileSystemStore::init()
73
72
int status = MBED_SUCCESS;
74
73
75
74
_mutex.lock ();
75
+ const char *temp_path = get_filesystemstore_folder_path ();
76
+ if (temp_path == NULL ) {
77
+ _cfg_fs_path_size = strlen (FSST_DEFAULT_FOLDER_PATH);
78
+ _cfg_fs_path = string_ndup (FSST_DEFAULT_FOLDER_PATH, _cfg_fs_path_size);
79
+ } else {
80
+ _cfg_fs_path_size = strlen (temp_path);
81
+ _cfg_fs_path = string_ndup (temp_path, _cfg_fs_path_size);
82
+ }
76
83
77
- _cfg_fs_path_size = strlen (FSST_FOLDER_PATH);
78
- _cfg_fs_path = string_ndup (FSST_FOLDER_PATH, _cfg_fs_path_size);
79
84
_full_path_key = new char [_cfg_fs_path_size + KVStore::MAX_KEY_SIZE + 1 ];
80
85
memset (_full_path_key, 0 , (_cfg_fs_path_size + KVStore::MAX_KEY_SIZE + 1 ));
81
86
strncpy (_full_path_key, _cfg_fs_path, _cfg_fs_path_size);
You can’t perform that action at this time.
0 commit comments