Please sign in to comment.
subsys/settings: change processing to const char
The settings module processes the variable name by splitting it up in a set of variables. This PR removes the splitting up and keeps the variable name as one string. It is an alternative to #16609 The possibility is introduced to register handler including a separator, or to register a handler for each variable. The ability is introduced to load a subtree from flash or even to load a single item. Two ways to operate on variable and settings_handler names are provided: settings_name_steq(const char *name, const char *key, const char **next) which checks if name starts with key, returns 1/0 if it does/does not the remaining part of name is in next. settings_name_split(const char *name, char *argv, const char **next) which splits up name in a part before "/"" that is found in argv and the remaining part that is in next. A mutex is added to make settings thread-safe The settings_handlers list is stored in reverse alphabetical order, this allows registration of e.g. bt and bt/mesh in separate handlers, the bt handler itself should not contain any handling of bt/mesh. A settings_deregister() method is added. Settings_handlers can now be added/removed when required. This saves RAM when settings_handlers are not needed. Tests have been updated to reflect changes in the settings api. Updates after meeting: 1. Removed settings_deregister 2. Changed settings_name_split() in settings_name_next: int settings_name_next(const char *name, const char **next): returns the number of characters before the first separator. This can then be used to read the correct number of characters from name using strncpy for processing. 3. New functional test added Update in settings.h: settings_name_next() changed position -> index Added some comments in settings.h (settings_name_steq()) Updated tests to reflect change to settings_name_next() and pointer value comparison. The functional test can now also run on qemu_x86. Corrected some documentation in header. Changed registration of handlers to be non ordered. Changed handler lookup to handle non ordered list of handlers, this improves handler matching in case different length names are compared and also makes it easier to add rom based handlers as they will not be ordered. Signed-off-by: Laczen JMS <firstname.lastname@example.org>
- Loading branch information...
Showing with 749 additions and 150 deletions.
- +82 −22 include/settings/settings.h
- +114 −44 subsys/settings/src/settings.c
- +5 −4 subsys/settings/src/settings_fcb.c
- +5 −4 subsys/settings/src/settings_file.c
- +9 −6 subsys/settings/src/settings_line.c
- +6 −6 subsys/settings/src/settings_priv.h
- +9 −24 subsys/settings/src/settings_runtime.c
- +20 −4 subsys/settings/src/settings_store.c
- +41 −24 tests/subsys/settings/fcb/src/settings_test_fcb.c
- +3 −2 tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c
- +18 −0 tests/subsys/settings/functional/CMakeLists.txt
- +25 −0 tests/subsys/settings/functional/native_posix.overlay
- +25 −0 tests/subsys/settings/functional/nrf52840_pca10056.overlay
- +25 −0 tests/subsys/settings/functional/nrf52_pca10040.overlay
- +12 −0 tests/subsys/settings/functional/prj.conf
- +11 −0 tests/subsys/settings/functional/prj_native_posix.conf
- +11 −0 tests/subsys/settings/functional/prj_qemu_x86.conf
- +312 −0 tests/subsys/settings/functional/src/settings_basic_test.c
- +4 −0 tests/subsys/settings/functional/testcase.yaml
- +12 −10 tests/subsys/settings/nffs/src/settings_test_nffs.c
Oops, something went wrong.