DawnLiu66 opened a new pull request, #22225:
URL: https://github.com/apache/nuttx/pull/22225
## Summary
Bump the default `CONFIG_FS_LITTLEFS_VERSION` from `v2.5.1` to `v2.11.2`
and regenerate the local patches against it, so that
`CONFIG_FS_LITTLEFS_GETPATH` and `CONFIG_FS_LITTLEFS_ATTR_UPDATE` keep
working on the new version.
- `lfs_getpath.patch` adds `lfs_file_path()`. It is taken from the
"littlefs: add lfs_file_path for absolute path retrieval" commit by
v-yanxingyu <[email protected]>. The `lfs_dir_path()` helper of the
old patch had no callers and is dropped.
- `lfs_getsetattr.patch` adds `lfs_file_getattr()`/`lfs_file_setattr()`.
It is taken from the "littlefs: Add lfs_file_getattr and
lfs_file_setattr" commit by zhouliang3 <[email protected]>.
- `lfs_util.patch` is removed. littlefs 2.10 added the `LFS_DEFINES` hook,
and `lfs_nuttx_defines.h` already maps `LFS_MALLOC`/`LFS_FREE` to
`fs_heap`. `FS_LITTLEFS_HAS_LFS_DEFINES` therefore no longer depends on
`!FS_LITTLEFS_LOCAL_PATCHES`.
Both regenerated patches apply cleanly to the v2.11.2 tarball with
`git apply` (Make) and `patch -p2` (CMake).
## Impact
- New feature: NO.
- User adaptation: NO for most users. Boards that set
`CONFIG_FS_LITTLEFS_VERSION` explicitly are not affected.
- Build: YES. The build downloads littlefs v2.11.2 instead of v2.5.1.
- Hardware: NO.
- Documentation: YES. `Documentation/os/filesystem/littlefs.rst` describes
the version, the local patches and the on-disk version.
- Security: NO.
- Compatibility: littlefs v2.11.2 formats new volumes with on-disk version
2.1 (`LFS_DISK_VERSION 0x00020001`); v2.5.1 wrote 2.0. Existing 2.0
volumes still mount, and the superblock is upgraded to 2.1 on the first
write, after which littlefs v2.5.1 and older can no longer mount it. To
keep writing 2.0, for example when an older bootloader reads the volume,
enable `CONFIG_FS_LITTLEFS_MULTI_VERSION` and set
`CONFIG_FS_LITTLEFS_DISK_VERSION=0x00020000`.
## Testing
I confirm that changes are verified on local setup and works as intended:
- Build Host: Ubuntu 22.04 x86_64, gcc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0,
master `7876a93a947`.
- Target: `sim:nsh` with `CONFIG_MTD`, `CONFIG_RAMMTD` and
`CONFIG_FS_LITTLEFS`. Verified on sim only, no real hardware.
- `./tools/checkpatch.sh -m -g master..HEAD`: all checks pass.
- Make and CMake builds pass, `ostest` exits with status 0.
- With `CONFIG_FS_LITTLEFS_VERSION="v2.10.1"` the build passes, the local
patches are skipped and `GETPATH`/`ATTR_UPDATE` are not offered.
A small test program on `sim:nsh` formats and mounts littlefs on
`/dev/rammtd`, then checks write, `FIOC_FILEPATH`, `fstat()`, `chmod()`,
`utimensat()`, and the data and attributes after a remount. Both runs have
`CONFIG_FS_LITTLEFS_GETPATH=y` and `CONFIG_FS_LITTLEFS_ATTR_UPDATE=y`.
Testing logs before change (littlefs v2.5.1):
```
mount(forceformat) ret=0 errno=0 -> ok
open+write fd=3 written=14 -> ok
FIOC_FILEPATH ret=0 path=/lfs/d/f.txt -> ok
fstat ret=0 size=14 mode=644 -> ok
chmod 0600 ret=0 mode=600 errno=0 -> ok
utimensat mtime ret=0 mtime=1000000000 errno=0 -> ok
remount ret=0 errno=0 -> ok
read after remount read=14 data=hello littlefs -> ok
attrs after remount mode=600 mtime=1000000000 -> ok
fslfs: 0 check(s) failed
```
Testing logs after change (littlefs v2.11.2):
```
mount(forceformat) ret=0 errno=0 -> ok
open+write fd=3 written=14 -> ok
FIOC_FILEPATH ret=0 path=/lfs/d/f.txt -> ok
fstat ret=0 size=14 mode=644 -> ok
chmod 0600 ret=0 mode=600 errno=0 -> ok
utimensat mtime ret=0 mtime=1000000000 errno=0 -> ok
remount ret=0 errno=0 -> ok
read after remount read=14 data=hello littlefs -> ok
attrs after remount mode=600 mtime=1000000000 -> ok
fslfs: 0 check(s) failed
```
## PR verification Self-Check
* [x] This PR introduces only one functional change.
* [x] I have updated all required description fields above.
* [x] My PR adheres to Contributing Guidelines and Documentation (git commit
title and message, coding standard, etc).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]