diff options
author | Christopher Haster <geky@geky.net> | 2023-06-07 05:52:04 +0300 |
---|---|---|
committer | Christopher Haster <geky@geky.net> | 2023-06-07 06:03:00 +0300 |
commit | c5fb3f181beff64de9cb2a7079594dfae29c982a (patch) | |
tree | 399db3d3c39001173b4ceca914095212acf4851f /lfs.c | |
parent | 8610f7c36b6554d65b7502222c76c286e4c8d0e2 (diff) |
Changed fsinfo.minor_version -> fsinfo.disk_version
Version are now returned with major/minor packed into 32-bits,
so 0x00020001 is the current disk version, for example.
1. This needed to change to use a disk_* prefix for consistency with the
defines that already exist for LFS_VERSION/LFS_DISK_VERSION.
2. Encoding the version this way has the nice side effect of making 0 an
invalid value. This is useful for adding a similar config option
that needs to have reasonable default behavior for backwards
compatibility.
In theory this uses more space, but in practice most other config/status
is 32-bits in littlefs. We would be wasting this space for alignment
anyways.
Diffstat (limited to 'lfs.c')
-rw-r--r-- | lfs.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -4424,7 +4424,7 @@ static int lfs_fs_rawstat(lfs_t *lfs, struct lfs_fsinfo *fsinfo) { // if the superblock is up-to-date, we must be on the most recent // minor version of littlefs if (!lfs_gstate_needssuperblock(&lfs->gstate)) { - fsinfo->minor_version = LFS_DISK_VERSION_MINOR; + fsinfo->disk_version = LFS_DISK_VERSION; // otherwise we need to read the minor version on disk } else { @@ -4444,8 +4444,8 @@ static int lfs_fs_rawstat(lfs_t *lfs, struct lfs_fsinfo *fsinfo) { } lfs_superblock_fromle32(&superblock); - // read the minor version - fsinfo->minor_version = (0xffff & (superblock.version >> 0)); + // read the on-disk version + fsinfo->disk_version = superblock.version; } // find the current block usage |