Skip to content

Commit

Permalink
fs: littlefs: define default disk version in Kconfig
Browse files Browse the repository at this point in the history
This makes it possible to set the disk version when Devicetree is not
used for configuration.

Signed-off-by: Xudong Zheng <[email protected]>
  • Loading branch information
xudongzheng committed Jan 18, 2025
1 parent 327a389 commit 6c91685
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions subsys/fs/Kconfig.littlefs
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,11 @@ config FS_LITTLEFS_MULTIVERSION
to maintain backward compatibility with existing littlefs
with the same major disk version.

config FS_LITTLEFS_DISK_VERSION
hex "Default littlefs disk version"
default 0
depends on FS_LITTLEFS_MULTIVERSION
help
Set to 0 to use the latest littlefs disk version (LFS_DISK_VERSION).

endif # FILE_SYSTEM_LITTLEFS
5 changes: 4 additions & 1 deletion subsys/fs/littlefs_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,10 @@ static int littlefs_init_cfg(struct fs_littlefs *fs, int flags)
uint32_t disk_version = lcp->disk_version;

if (disk_version == 0) {
disk_version = LFS_DISK_VERSION;
disk_version = CONFIG_FS_LITTLEFS_DISK_VERSION;
if (disk_version == 0) {
disk_version = LFS_DISK_VERSION;
}
}
#endif /* CONFIG_FS_LITTLEFS_MULTIVERSION */

Expand Down

0 comments on commit 6c91685

Please sign in to comment.