Added lfsr_fs_cksum

This just exposes the gcksum to the user, but exposing the gcksum allows
the user to store it externally for an extra layer of protection against
filesystem corruption.

As far as I'm aware this is the only real way to protect against global
rollback issues, which is a problem for any filesystem with logs (aka
any powerloss-resilient filesystem).

This required a comically small amount of code:

           code          stack          ctx
  before: 38492           2624          640
  after:  38500 (+0.0%)   2624 (+0.0%)  640 (+0.0%)
This commit is contained in:
Christopher Haster
2025-01-19 12:35:48 -06:00
parent a80694b9a7
commit 109bd4e0ab
3 changed files with 86 additions and 7 deletions
+6
View File
@@ -14519,6 +14519,12 @@ int lfsr_fs_ckdata(lfs_t *lfs) {
return lfsr_fs_ck(lfs, LFS_T_CKMETA | LFS_T_CKDATA);
}
// get the filesystem checksum
int lfsr_fs_cksum(lfs_t *lfs, uint32_t *cksum) {
*cksum = lfs->gcksum;
return 0;
}
// low-level filesystem gc
//
// runs the traversal until all work is completed, which may take