From 6515cd05f17240c5d42d80638a55ce3b5ba4d1bf Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Thu, 26 Jun 2025 14:58:06 +1000 Subject: [PATCH] extmod/vfs_lfsx: Allow overriding the LFS2 on-disk version format. Back in LFS2 version 2.6 they updated the on-disk version from 2.0 to 2.1 which broke back compatibility (aka older versions could no long read new version disk format), see https://github.com/littlefs-project/littlefs/releases/tag/v2.6.0 Then in LFS2 v2.7 an optional `config->disk_version` was added to force the library to use an older disk format instead, see: https://github.com/littlefs-project/littlefs/releases/tag/v2.7.0 This commit simply exposes `config->disk_version` as a compile time option if LFS2_MULTIVERSION is set, otherwise there is no change in behavior. This is Useful for compatibility with older LFS versions. Note: LFS2_MULTIVERSION needs to be defined at the make / CFLAGS level, setting it in mpconfigboard.h doesn't work as it's not included in the `lfs2.c` file in any way. Signed-off-by: Andrew Leech --- extmod/vfs_lfsx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extmod/vfs_lfsx.c b/extmod/vfs_lfsx.c index 372037784b484..bbdd21cfb9176 100644 --- a/extmod/vfs_lfsx.c +++ b/extmod/vfs_lfsx.c @@ -104,6 +104,12 @@ static void MP_VFS_LFSx(init_config)(MP_OBJ_VFS_LFSx * self, mp_obj_t bdev, size config->read_buffer = m_new(uint8_t, config->cache_size); config->prog_buffer = m_new(uint8_t, config->cache_size); config->lookahead_buffer = m_new(uint8_t, config->lookahead_size); + #ifdef LFS2_MULTIVERSION + // This can be set to override the on-disk lfs version. + // eg. for compat with lfs2 < v2.6 add the following to make: + // CFLAGS += '-DLFS2_MULTIVERSION=0x00020000' + config->disk_version = LFS2_MULTIVERSION; + #endif #endif } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy