From 837f0baa37f8e0d4dabefc8a108f1e20fec83ea9 Mon Sep 17 00:00:00 2001 From: Simon D Hughes Date: Thu, 9 Jun 2016 11:13:56 +0100 Subject: [PATCH 1/2] Fix for GCC 5.0 which appears not to define _GNU_SOURCE, define _ANSI_SOURCE and define _POSIX_SOURCE --- storage/cfstore/source/cfstore_config.h | 2 +- storage/cfstore/source/cfstore_fnmatch.h | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/storage/cfstore/source/cfstore_config.h b/storage/cfstore/source/cfstore_config.h index e30e54600f..7a4d2702ec 100644 --- a/storage/cfstore/source/cfstore_config.h +++ b/storage/cfstore/source/cfstore_config.h @@ -23,7 +23,7 @@ #define CFSTORE_CONFIG_BACKEND_UVISOR_ENABLED 0 #define CFSTORE_CONFIG_MBED_OS_VERSION 3 -/* default build config overridden by package manager configuarion +/* default build config overridden by package manager configuration * * __MBED__ * Morpheus build system (mbed-classic) defines the __MBED__ symbol diff --git a/storage/cfstore/source/cfstore_fnmatch.h b/storage/cfstore/source/cfstore_fnmatch.h index afe65f346c..5f8b0f2909 100644 --- a/storage/cfstore/source/cfstore_fnmatch.h +++ b/storage/cfstore/source/cfstore_fnmatch.h @@ -39,18 +39,11 @@ #define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ #define FNM_PERIOD 0x04 /* Period must be matched by period. */ -#if defined(_GNU_SOURCE) || !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) #define FNM_LEADING_DIR 0x08 /* Ignore / after Imatch. */ #define FNM_CASEFOLD 0x10 /* Case insensitive search. */ #define FNM_IGNORECASE FNM_CASEFOLD #define FNM_FILE_NAME FNM_PATHNAME -#endif -//todo: #include -//#include - -//__BEGIN_DECLS int fnmatch(const char *, const char *, int); -//__END_DECLS #endif /* !_FNMATCH_H_ */ From 88b3d838f2d699acce92d6e830dfea898f3fff90 Mon Sep 17 00:00:00 2001 From: Simon D Hughes Date: Thu, 9 Jun 2016 12:29:44 +0100 Subject: [PATCH 2/2] Corrected order of #include files to include local header files first, and minimized cfstore_fnmatch.h content --- TESTS/cfstore/add_del/add_del.cpp | 31 ++++++++-------- TESTS/cfstore/close/close.cpp | 31 ++++++++-------- TESTS/cfstore/create/create.cpp | 33 +++++++++-------- TESTS/cfstore/example1/example1.cpp | 33 ++++++++--------- TESTS/cfstore/example2/example2.cpp | 34 +++++++++--------- TESTS/cfstore/example3/example3.cpp | 32 ++++++++--------- TESTS/cfstore/example4/example4.cpp | 34 +++++++++--------- TESTS/cfstore/example5/example5.cpp | 35 +++++++++--------- TESTS/cfstore/find/find.cpp | 35 +++++++++--------- TESTS/cfstore/find2/find2.cpp | 35 +++++++++--------- TESTS/cfstore/flash/flash.cpp | 32 ++++++++--------- TESTS/cfstore/flush/flush.cpp | 33 +++++++++-------- TESTS/cfstore/flush2/flush2.cpp | 31 ++++++++-------- TESTS/cfstore/init/init.cpp | 33 +++++++++-------- TESTS/cfstore/misc/misc.cpp | 31 ++++++++-------- TESTS/cfstore/open/open.cpp | 33 +++++++++-------- TESTS/cfstore/read/read.cpp | 31 ++++++++-------- TESTS/cfstore/write/write.cpp | 32 ++++++++--------- storage/cfstore/source/cfstore_fnmatch.c | 38 ++++++++++++-------- storage/cfstore/source/cfstore_fnmatch.h | 19 +++------- storage/cfstore/source/cfstore_list.h | 2 ++ storage/cfstore/source/cfstore_test.c | 8 ++--- storage/cfstore/source/cfstore_utest.h | 2 +- storage/cfstore/source/configuration_store.c | 18 +++++----- 24 files changed, 328 insertions(+), 348 deletions(-) diff --git a/TESTS/cfstore/add_del/add_del.cpp b/TESTS/cfstore/add_del/add_del.cpp index 00ab84e7c9..9b74383238 100644 --- a/TESTS/cfstore/add_del/add_del.cpp +++ b/TESTS/cfstore/add_del/add_del.cpp @@ -20,20 +20,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC #include #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -42,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_add_del_test_00(const size_t call_count) @@ -77,21 +77,15 @@ int main() #else -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -//#include -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -101,6 +95,11 @@ int main() #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static char cfstore_add_del_utest_msg_g[CFSTORE_UTEST_MSG_BUF_SIZE]; diff --git a/TESTS/cfstore/close/close.cpp b/TESTS/cfstore/close/close.cpp index 44a0db38e9..5023a64bd2 100644 --- a/TESTS/cfstore/close/close.cpp +++ b/TESTS/cfstore/close/close.cpp @@ -21,20 +21,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -43,6 +38,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_close_test_00(const size_t call_count) @@ -78,18 +78,13 @@ int main() #else -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "cfstore_test.h" #include "cfstore_debug.h" #include "utest/utest.h" @@ -100,6 +95,10 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include + using namespace utest::v1; static char cfstore_close_utest_msg_g[CFSTORE_UTEST_MSG_BUF_SIZE]; diff --git a/TESTS/cfstore/create/create.cpp b/TESTS/cfstore/create/create.cpp index 03fb8603e0..f59fa72575 100644 --- a/TESTS/cfstore/create/create.cpp +++ b/TESTS/cfstore/create/create.cpp @@ -20,20 +20,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -42,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_create_test_00(const size_t call_count) @@ -78,21 +78,15 @@ int main() #else -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" #include "cfstore_debug.h" #include "cfstore_test.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -101,6 +95,11 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; #ifdef CFSTORE_DEBUG diff --git a/TESTS/cfstore/example1/example1.cpp b/TESTS/cfstore/example1/example1.cpp index 6792035f55..a81ab526e2 100644 --- a/TESTS/cfstore/example1/example1.cpp +++ b/TESTS/cfstore/example1/example1.cpp @@ -55,20 +55,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -77,6 +72,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_example1_test_00(const size_t call_count) @@ -109,17 +109,11 @@ int main() } - #else - -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #ifndef YOTTA_CONFIGURATION_STORE_EXAMPLE1_VERSION_STRING /* when built as Configuration-Store example, include greentea support otherwise omit */ @@ -132,14 +126,17 @@ int main() #define CaseNext #endif // YOTTA_CONFIGURATION_STORE_EXAMPLE1_VERSION_STRING -#include -#include #include "cfstore_config.h" -#include +#include "configuration-store/configuration_store.h" #ifdef YOTTA_CFG_CONFIG_UVISOR #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CONFIG_UVISOR */ +#include +#include +#include + + #ifndef YOTTA_CONFIGURATION_STORE_EXAMPLE1_VERSION_STRING using namespace utest::v1; diff --git a/TESTS/cfstore/example2/example2.cpp b/TESTS/cfstore/example2/example2.cpp index 18523686f9..6949c98989 100644 --- a/TESTS/cfstore/example2/example2.cpp +++ b/TESTS/cfstore/example2/example2.cpp @@ -35,20 +35,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -57,6 +52,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_example2_test_00(const size_t call_count) @@ -93,22 +93,15 @@ int main() #else -#include -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -116,6 +109,11 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CONFIG_UVISOR */ +#include +#include +#include +#include +#include using namespace utest::v1; diff --git a/TESTS/cfstore/example3/example3.cpp b/TESTS/cfstore/example3/example3.cpp index 4b7d3dc195..83d86459f0 100644 --- a/TESTS/cfstore/example3/example3.cpp +++ b/TESTS/cfstore/example3/example3.cpp @@ -50,20 +50,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -72,6 +67,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_example3_test_00(const size_t call_count) @@ -108,12 +108,8 @@ int main() #else -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #ifndef YOTTA_CONFIGURATION_STORE_EXAMPLE3_VERSION_STRING /* when built as Configuration-Store example, include greentea support otherwise omit */ @@ -121,19 +117,21 @@ int main() #include "unity/unity.h" #include "greentea-client/test_env.h" #else // YOTTA_CONFIGURATION_STORE_EXAMPLE3_VERSION_STRING -// map utest types for building as stand alone example +/* map utest types for building as stand alone example */ #define control_t void #define CaseNext #endif // YOTTA_CONFIGURATION_STORE_EXAMPLE3_VERSION_STRING -#include -#include #include "cfstore_config.h" -#include +#include "configuration-store/configuration_store.h" + #ifdef YOTTA_CFG_CONFIG_UVISOR #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CONFIG_UVISOR */ +#include +#include +#include #ifndef YOTTA_CONFIGURATION_STORE_EXAMPLE3_VERSION_STRING using namespace utest::v1; diff --git a/TESTS/cfstore/example4/example4.cpp b/TESTS/cfstore/example4/example4.cpp index 6ffbd11bf6..a42fa6526f 100644 --- a/TESTS/cfstore/example4/example4.cpp +++ b/TESTS/cfstore/example4/example4.cpp @@ -20,20 +20,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -42,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_example4_test_00(const size_t call_count) @@ -78,22 +78,15 @@ int main() #else -#include -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -101,6 +94,11 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CONFIG_UVISOR */ +#include +#include +#include +#include +#include using namespace utest::v1; diff --git a/TESTS/cfstore/example5/example5.cpp b/TESTS/cfstore/example5/example5.cpp index 9e234c2ef6..86cbe14980 100644 --- a/TESTS/cfstore/example5/example5.cpp +++ b/TESTS/cfstore/example5/example5.cpp @@ -49,20 +49,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -71,6 +66,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_example5_test_00(const size_t call_count) @@ -106,17 +106,11 @@ int main() #else -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif -//#include -#include +#include "Driver_Common.h" #ifndef YOTTA_CONFIGURATION_STORE_EXAMPLE5_VERSION_STRING /* when built as Configuration-Store example, include greentea support otherwise omit */ @@ -124,13 +118,18 @@ int main() #include "unity/unity.h" #include "greentea-client/test_env.h" #else // YOTTA_CONFIGURATION_STORE_EXAMPLE5_VERSION_STRING -// map utest types for building as stand alone example +/* map utest types for building as stand alone example */ #define control_t void #define CaseNext #endif // YOTTA_CONFIGURATION_STORE_EXAMPLE5_VERSION_STRING #include "cfstore_config.h" -#include +#include "configuration-store/configuration_store.h" + +#include +#include +#include +#include #ifndef YOTTA_CONFIGURATION_STORE_EXAMPLE5_VERSION_STRING diff --git a/TESTS/cfstore/find/find.cpp b/TESTS/cfstore/find/find.cpp index b8b58a926c..4d79a6c209 100644 --- a/TESTS/cfstore/find/find.cpp +++ b/TESTS/cfstore/find/find.cpp @@ -20,20 +20,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -42,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_find_test_00(const size_t call_count) @@ -78,22 +78,15 @@ int main() #else -#include -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -102,6 +95,12 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include +#include + using namespace utest::v1; static char cfstore_find_utest_msg_g[CFSTORE_UTEST_MSG_BUF_SIZE]; diff --git a/TESTS/cfstore/find2/find2.cpp b/TESTS/cfstore/find2/find2.cpp index e0e02fcf5d..d190c5b300 100644 --- a/TESTS/cfstore/find2/find2.cpp +++ b/TESTS/cfstore/find2/find2.cpp @@ -20,20 +20,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -42,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_find2_test_00(const size_t call_count) @@ -78,22 +78,15 @@ int main() #else -#include -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -101,6 +94,12 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include +#include + using namespace utest::v1; static char cfstore_find2_utest_msg_g[CFSTORE_UTEST_MSG_BUF_SIZE]; diff --git a/TESTS/cfstore/flash/flash.cpp b/TESTS/cfstore/flash/flash.cpp index 1f2dc7c6d6..254f53fef1 100644 --- a/TESTS/cfstore/flash/flash.cpp +++ b/TESTS/cfstore/flash/flash.cpp @@ -20,20 +20,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -42,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_flash_test_00(const size_t call_count) @@ -77,12 +77,6 @@ int main() #else - -#include -#include -#include -#include - #if defined CFSTORE_CONFIG_BACKEND_FLASH_ENABLED && CFSTORE_CONFIG_BACKEND_FLASH_ENABLED == 1 #include #include @@ -90,9 +84,8 @@ int main() #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -100,6 +93,11 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; /* Configure secure box. */ diff --git a/TESTS/cfstore/flush/flush.cpp b/TESTS/cfstore/flush/flush.cpp index 177789c336..818ae1d45d 100644 --- a/TESTS/cfstore/flush/flush.cpp +++ b/TESTS/cfstore/flush/flush.cpp @@ -20,20 +20,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -42,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_flush_test_00(const size_t call_count) @@ -78,21 +78,15 @@ int main() -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -100,6 +94,11 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; /* diff --git a/TESTS/cfstore/flush2/flush2.cpp b/TESTS/cfstore/flush2/flush2.cpp index ca868d18af..31becefc3a 100644 --- a/TESTS/cfstore/flush2/flush2.cpp +++ b/TESTS/cfstore/flush2/flush2.cpp @@ -20,20 +20,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -42,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_flush2_test_00(const size_t call_count) @@ -78,20 +78,14 @@ int main() #else - -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "utest/utest.h" #include "unity/unity.h" #include "cfstore_config.h" -#include +#include "configuration-store/configuration_store.h" #include "greentea-client/test_env.h" #include "cfstore_test.h" #include "cfstore_debug.h" @@ -100,6 +94,11 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; /* diff --git a/TESTS/cfstore/init/init.cpp b/TESTS/cfstore/init/init.cpp index 109438a76b..3631f099ce 100644 --- a/TESTS/cfstore/init/init.cpp +++ b/TESTS/cfstore/init/init.cpp @@ -18,20 +18,17 @@ * Test cases to test initialization/uninitialization code. */ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include + #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -40,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_init_test_00(const size_t call_count) @@ -72,25 +74,18 @@ int main() } - #else -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif -//#include -#include +#include "Driver_Common.h" #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -98,6 +93,10 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CONFIG_UVISOR */ +#include +#include +#include +#include using namespace utest::v1; diff --git a/TESTS/cfstore/misc/misc.cpp b/TESTS/cfstore/misc/misc.cpp index 56443c7d67..537463e79e 100644 --- a/TESTS/cfstore/misc/misc.cpp +++ b/TESTS/cfstore/misc/misc.cpp @@ -21,20 +21,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -43,6 +38,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_misc_test_00(const size_t call_count) @@ -79,20 +79,16 @@ int main() #else -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -#include +#include "Driver_Common.h" #include "cfstore_config.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -102,6 +98,10 @@ int main() #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include + using namespace utest::v1; static char cfstore_misc_utest_msg_g[CFSTORE_UTEST_MSG_BUF_SIZE]; @@ -117,7 +117,6 @@ UVISOR_SET_MODE_ACL(UVISOR_ENABLED, cfstore_acl_uvisor_box_misc_g); #endif /* YOTTA_CFG_CFSTORE_UVISOR */ - /* report whether built/configured for flash sync or async mode */ static control_t cfstore_misc_test_00(const size_t call_count) { diff --git a/TESTS/cfstore/open/open.cpp b/TESTS/cfstore/open/open.cpp index 653e25ea6f..cbf18cd68b 100644 --- a/TESTS/cfstore/open/open.cpp +++ b/TESTS/cfstore/open/open.cpp @@ -21,20 +21,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -43,6 +38,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_open_test_00(const size_t call_count) @@ -78,21 +78,15 @@ int main() #else -#include -#include -#include /*rand()*/ -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -101,6 +95,11 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include /*rand()*/ +#include + using namespace utest::v1; static char cfstore_open_utest_msg_g[CFSTORE_UTEST_MSG_BUF_SIZE]; diff --git a/TESTS/cfstore/read/read.cpp b/TESTS/cfstore/read/read.cpp index ff3b4c59a2..fff843bb49 100644 --- a/TESTS/cfstore/read/read.cpp +++ b/TESTS/cfstore/read/read.cpp @@ -20,20 +20,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -42,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_read_test_00(const size_t call_count) @@ -78,20 +78,15 @@ int main() #else -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -100,6 +95,10 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include + using namespace utest::v1; static char cfstore_read_utest_msg_g[CFSTORE_UTEST_MSG_BUF_SIZE]; diff --git a/TESTS/cfstore/write/write.cpp b/TESTS/cfstore/write/write.cpp index 667d24385c..750de913d7 100644 --- a/TESTS/cfstore/write/write.cpp +++ b/TESTS/cfstore/write/write.cpp @@ -20,20 +20,15 @@ #if defined __MBED__ && ! defined TOOLCHAIN_GCC_ARM -#include -#include -#include -#include - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" -#include +#include "Driver_Common.h" #include "cfstore_debug.h" #include "cfstore_test.h" -#include +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -42,6 +37,11 @@ #include "cfstore_uvisor.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include +#include + using namespace utest::v1; static control_t cfstore_write_test_00(const size_t call_count) @@ -78,21 +78,15 @@ int main() #else -#include -#include -#include - - #ifdef TARGET_LIKE_FRDM_K64F_GCC -#include +#include "mbed-drivers/mbed.h" #endif #include "cfstore_config.h" #include "cfstore_test.h" #include "cfstore_debug.h" -//#include -#include -#include +#include "Driver_Common.h" +#include "configuration-store/configuration_store.h" #include "utest/utest.h" #include "unity/unity.h" #include "greentea-client/test_env.h" @@ -101,6 +95,10 @@ int main() #include "uvisor-lib/uvisor-lib.h" #endif /* YOTTA_CFG_CFSTORE_UVISOR */ +#include +#include +#include + using namespace utest::v1; static char cfstore_write_utest_msg_g[CFSTORE_UTEST_MSG_BUF_SIZE]; diff --git a/storage/cfstore/source/cfstore_fnmatch.c b/storage/cfstore/source/cfstore_fnmatch.c index 8ef6ae085f..34a002cf4a 100644 --- a/storage/cfstore/source/cfstore_fnmatch.c +++ b/storage/cfstore/source/cfstore_fnmatch.c @@ -46,12 +46,22 @@ static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94"; * Compares a filename or pathname to a pattern. */ +#include "cfstore_fnmatch.h" #include -#include #include #include #include +/* code copied from the original fnmatch.h */ + +#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ +#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ +#define FNM_PERIOD 0x04 /* Period must be matched by period. */ + +#define FNM_LEADING_DIR 0x08 /* Ignore / after Imatch. */ +#define FNM_CASEFOLD 0x10 /* Case insensitive search. */ + + #define EOS '\0' #define RANGE_MATCH 1 @@ -161,16 +171,16 @@ fnmatch(pattern, string, flags) case EOS: if ((flags & FNM_LEADING_DIR) && *string == '/') return (0); - return (*string == EOS ? 0 : FNM_NOMATCH); + return (*string == EOS ? 0 : CFSTORE_FNM_NOMATCH); case '?': if (*string == EOS) - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); if (*string == '/' && (flags & FNM_PATHNAME)) - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); if (*string == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); ++string; break; case '*': @@ -182,19 +192,19 @@ fnmatch(pattern, string, flags) if (*string == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); /* Optimize for pattern with * at end or before /. */ if (c == EOS) if (flags & FNM_PATHNAME) return ((flags & FNM_LEADING_DIR) || strchr(string, '/') == NULL ? - 0 : FNM_NOMATCH); + 0 : CFSTORE_FNM_NOMATCH); else return (0); else if (c == '/' && flags & FNM_PATHNAME) { if ((string = strchr(string, '/')) == NULL) - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); break; } @@ -206,16 +216,16 @@ fnmatch(pattern, string, flags) break; ++string; } - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); case '[': if (*string == EOS) - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); if (*string == '/' && (flags & FNM_PATHNAME)) - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); if (*string == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); switch (rangematch(pattern, *string, flags, &newp)) { case RANGE_ERROR: @@ -224,7 +234,7 @@ fnmatch(pattern, string, flags) pattern = newp; break; case RANGE_NOMATCH: - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); } ++string; break; @@ -245,7 +255,7 @@ fnmatch(pattern, string, flags) tolower((unsigned char)*string))) ; else - return (FNM_NOMATCH); + return (CFSTORE_FNM_NOMATCH); string++; break; } diff --git a/storage/cfstore/source/cfstore_fnmatch.h b/storage/cfstore/source/cfstore_fnmatch.h index 5f8b0f2909..81ba133cb5 100644 --- a/storage/cfstore/source/cfstore_fnmatch.h +++ b/storage/cfstore/source/cfstore_fnmatch.h @@ -30,20 +30,11 @@ * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 */ -#ifndef _FNMATCH_H_ -#define _FNMATCH_H_ +#ifndef __CFSTORE_FNMATCH_H_ +#define __CFSTORE_FNMATCH_H_ -#define FNM_NOMATCH 1 /* Match failed. */ +#define CFSTORE_FNM_NOMATCH 1 /* Match failed. */ -#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ -#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ -#define FNM_PERIOD 0x04 /* Period must be matched by period. */ +int cfstore_fnmatch(const char *, const char *, int); -#define FNM_LEADING_DIR 0x08 /* Ignore / after Imatch. */ -#define FNM_CASEFOLD 0x10 /* Case insensitive search. */ -#define FNM_IGNORECASE FNM_CASEFOLD -#define FNM_FILE_NAME FNM_PATHNAME - -int fnmatch(const char *, const char *, int); - -#endif /* !_FNMATCH_H_ */ +#endif /* !__CFSTORE_FNMATCH_H_ */ diff --git a/storage/cfstore/source/cfstore_list.h b/storage/cfstore/source/cfstore_list.h index 7b9bd4cf33..8e52da8d1c 100644 --- a/storage/cfstore/source/cfstore_list.h +++ b/storage/cfstore/source/cfstore_list.h @@ -18,6 +18,8 @@ #ifndef _CFSTORE_LIST_H_ #define _CFSTORE_LIST_H_ +#include + /* * Doubly linked list implementation based on the following design * and psuedo-code: diff --git a/storage/cfstore/source/cfstore_test.c b/storage/cfstore/source/cfstore_test.c index b78b25b037..1e0929dde4 100644 --- a/storage/cfstore/source/cfstore_test.c +++ b/storage/cfstore/source/cfstore_test.c @@ -17,15 +17,15 @@ * * test support code implementation file. */ +#include "cfstore_config.h" +#include "cfstore_debug.h" +#include "cfstore_test.h" +#include #include #include #include #include #include -#include "cfstore_config.h" -#include "cfstore_debug.h" -#include "cfstore_test.h" -#include /* ruler for measuring text strings */ diff --git a/storage/cfstore/source/cfstore_utest.h b/storage/cfstore/source/cfstore_utest.h index 45ac78c89d..80a219f2aa 100644 --- a/storage/cfstore/source/cfstore_utest.h +++ b/storage/cfstore/source/cfstore_utest.h @@ -20,9 +20,9 @@ #ifndef __CFSTORE_UTEST_H #define __CFSTORE_UTEST_H -#include #include "cfstore_debug.h" #include "cfstore_test.h" +#include using namespace utest::v1; diff --git a/storage/cfstore/source/configuration_store.c b/storage/cfstore/source/configuration_store.c index c943172e5e..f2ebcf1e17 100644 --- a/storage/cfstore/source/configuration_store.c +++ b/storage/cfstore/source/configuration_store.c @@ -16,11 +16,6 @@ * limitations under the License. */ -#include -#include -#include -#include -#include #include #if defined CFSTORE_CONFIG_MBED_OS_VERSION && CFSTORE_CONFIG_MBED_OS_VERSION == 3 @@ -35,9 +30,16 @@ #include #include #endif /* CFSTORE_CONFIG_BACKEND_FLASH_ENABLED */ -#include + #include "cfstore_debug.h" #include "cfstore_list.h" +#include "configuration-store/configuration_store.h" + +#include +#include +#include +#include +#include #ifdef CFSTORE_DEBUG @@ -2974,11 +2976,11 @@ static int32_t cfstore_find_ex(const char* key_name_query, cfstore_area_hkvt_t * CFSTORE_TP(CFSTORE_TP_FIND, "%s:Found matching key (key_name_query = \"%s\", next->key = \"%s\"),next_key_len=%d\n", __func__, key_name_query, key_name, (int) next_key_len); cfstore_hkvt_dump(next, __func__); return ARM_DRIVER_OK; - } else if(ret != FNM_NOMATCH){ + } else if(ret != CFSTORE_FNM_NOMATCH){ CFSTORE_ERRLOG("%s:Error: fnmatch() error (ret=%" PRId32 ").\n", __func__, ret); return ARM_DRIVER_ERROR; } - /* FNM_NOMATCH => get the next hkvt if any */ + /* CFSTORE_FNM_NOMATCH => get the next hkvt if any */ ret = cfstore_get_next_hkvt(next, next); if(ret == ARM_CFSTORE_DRIVER_ERROR_KEY_NOT_FOUND) { CFSTORE_TP(CFSTORE_TP_FIND, "%s:No more KVs found\n", __func__);