Commit Graph

5 Commits

Author SHA1 Message Date
Marcin Niestroj
2d3365200c settings: file: drop CONFIG_SETTINGS_FILE_DIR
There is already CONFIG_SETTINGS_FILE_PATH, which is set to full file path,
while CONFIG_SETTINGS_FILE_DIR is required to be set to its parent
directory. This is redundant, as parent directory path can be easily found
out either during runtime or optionally during buildtime by CMake.

CONFIG_SETTINGS_FILE_DIR was actually introduced recently after Zephyr 3.2
release as a replacement of deprecated CONFIG_SETTINGS_FS_DIR. This means,
that there is no need to deprecate it for 3.3 release and dropping it
should be fine. Adjust 3.3 release notes accordingly, so that
CONFIG_SETTINGS_FILE_PATH will be used directly.

This patch stops using deprecated CONFIG_SETTINGS_FS_DIR. There is actually
no value in respecting it, as setting anything other than parent directory
of CONFIG_SETTINGS_FS_FILE makes no sense.

There is actually one use of CONFIG_SETTINGS_FILE_DIR in file backend
tests, to derive directory for files containing tested settings.
CONFIG_SETTINGS_FILE_PATH is not used there, so it makes little sense to
derive directory name from it. Instead, just use hardcoded "/settings"
subdirectory, as this was the default value of CONFIG_SETTINGS_FILE_DIR.

Deriving parent directory can be done either in runtime or in
buildtime (e.g. using some helper CMake function). Doing it in runtime
however allows to create directory recursively (which this patch actually
implements), e.g. for some more nested FS tree structure. Additionally it
will simplify migration of settings configuration from Kconfig to
device-tree (yet to be developed feature).

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-14 14:11:03 +01:00
Marcin Niestroj
ffa622b5b9 tests: settings: file: merge file_littlefs
There is little point in keeping separate:
 * tests/subsys/settings/file
 * tests/subsys/settings/file_littlefs

directories, `file_littlefs` is just a thin layer used to setup test suites
for tests implemented in `file` directory.

Merge both directories together. Support for new FS can be added by simply
adding:
 * new `settings_setup_<FS_OF_CHOICE>.c` which implements
   `config_setup_fs()` function
 * expanding `testcase.yaml` to add new tests with
   `CONFIG_FILE_SYSTEM_<FS_OF_CHOICE>=y` extra config option

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-13 18:45:30 +01:00
Marcin Niestroj
eca7bd12a4 tests: settings: file: remove unused c2_var_count
This variable is just a copy-paste from FCB backend tests and actually has
no use in File backend tests.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-08 17:38:35 +09:00
Marcin Niestroj
673b0665d3 tests: settings: file: remove declarations of ZTEST() routines
Remove declarations of ZTEST() routines in header file, because there is
simply no value in having it.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-06 09:45:50 -05:00
Marcin Niestroj
daee6cb4a9 settings: file: change FS (or file system) wording to File
Currently there is inconsistency in repository file names, APIs, Kconfig
options and documentation around file / file-system backend for settings
storage, as both "file" and "FS (file system)" are used. As an example,
there is `CONFIG_SETTINGS_FS` Kconfig option, but the file that implements
this settings backend is called `settings_file.c`. Another example are
names of static functions that implement settings storage API:
`settings_file_load()`, `settings_file_save()` and
`settings_fs_storage_get()`.

This backend is actually storing all settings in a single file, so it makes
sense to use "File" as the name of backend, instead of a more general
"FS" (which would make sense if several files would be used to store
settings).

Fix inconsistency in used wording in the tree and unify it to "settings
file backend". This naming is more precise to how the implementation looks.
It will also make it easier to grep through the codebase and analyze
existing code.

Deprecate settings_mount_fs_backend() function and all Kconfig options
starting with `CONFIG_SETTINGS_FS`.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-11-24 09:36:31 +01:00