mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-01 00:38:29 +01:00
Changed required alignment of lookahead_size to 64 bits
This is to prepare for future compatibility with other implementations of the allocator's lookahead that are under consideration. The most promising design so far is a sort of segments-list data structure that stores pointer+size pairs, requiring 64-bits of alignment. Changing this now takes advantage of the major version to avoid a compatibility break in the future. If we end up not changing the allocator or don't need 64-bit alignment we can easily drop this requirement without breaking anyone's code.
This commit is contained in:
4
lfs.c
4
lfs.c
@@ -3095,8 +3095,8 @@ static int lfs_init(lfs_t *lfs, const struct lfs_config *cfg) {
|
|||||||
lfs_cache_zero(lfs, &lfs->rcache);
|
lfs_cache_zero(lfs, &lfs->rcache);
|
||||||
lfs_cache_zero(lfs, &lfs->pcache);
|
lfs_cache_zero(lfs, &lfs->pcache);
|
||||||
|
|
||||||
// setup lookahead, must be multiple of 32-bits
|
// setup lookahead, must be multiple of 64-bits
|
||||||
LFS_ASSERT(lfs->cfg->lookahead_size % 4 == 0);
|
LFS_ASSERT(lfs->cfg->lookahead_size % 8 == 0);
|
||||||
LFS_ASSERT(lfs->cfg->lookahead_size > 0);
|
LFS_ASSERT(lfs->cfg->lookahead_size > 0);
|
||||||
if (lfs->cfg->lookahead_buffer) {
|
if (lfs->cfg->lookahead_buffer) {
|
||||||
lfs->free.buffer = lfs->cfg->lookahead_buffer;
|
lfs->free.buffer = lfs->cfg->lookahead_buffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user