fs: littlefs: define default disk version in Kconfig
This makes it possible to set the disk version when Devicetree is not used for configuration. Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
This commit is contained in:
parent
6fd0363f46
commit
151ca3a31f
2 changed files with 11 additions and 1 deletions
|
@ -125,4 +125,11 @@ config FS_LITTLEFS_DISK_VERSION
|
|||
to maintain backward compatibility with existing littlefs
|
||||
with the same major disk version.
|
||||
|
||||
config FS_LITTLEFS_DISK_VERSION_NUMBER
|
||||
hex "Default littlefs disk version"
|
||||
default 0
|
||||
depends on FS_LITTLEFS_DISK_VERSION
|
||||
help
|
||||
Set to 0 to use the latest littlefs disk version (LFS_DISK_VERSION).
|
||||
|
||||
endif # FILE_SYSTEM_LITTLEFS
|
||||
|
|
|
@ -792,9 +792,12 @@ static int littlefs_init_cfg(struct fs_littlefs *fs, int flags)
|
|||
#ifdef CONFIG_FS_LITTLEFS_DISK_VERSION
|
||||
uint32_t disk_version = lcp->disk_version;
|
||||
|
||||
if (disk_version == 0) {
|
||||
disk_version = CONFIG_FS_LITTLEFS_DISK_VERSION_NUMBER;
|
||||
if (disk_version == 0) {
|
||||
disk_version = LFS_DISK_VERSION;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_FS_LITTLEFS_DISK_VERSION */
|
||||
|
||||
/* No, you don't get to override this. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue