mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-10-30 16:15:40 +01:00
Merge pull request #584 from colin-foster-in-advantage/block_size_mount_fail
Fail mount when the block size changes
This commit is contained in:
14
lfs.c
14
lfs.c
@@ -3769,6 +3769,20 @@ static int lfs_rawmount(lfs_t *lfs, const struct lfs_config *cfg) {
|
||||
|
||||
lfs->attr_max = superblock.attr_max;
|
||||
}
|
||||
|
||||
if (superblock.block_count != lfs->cfg->block_count) {
|
||||
LFS_ERROR("Invalid block count (%"PRIu32" != %"PRIu32")",
|
||||
superblock.block_count, lfs->cfg->block_count);
|
||||
err = LFS_ERR_INVAL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (superblock.block_size != lfs->cfg->block_size) {
|
||||
LFS_ERROR("Invalid block size (%"PRIu32" != %"PRIu32")",
|
||||
superblock.block_count, lfs->cfg->block_count);
|
||||
err = LFS_ERR_INVAL;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
// has gstate?
|
||||
|
||||
Reference in New Issue
Block a user