mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-02 08:48:29 +01:00
Compare commits
5 Commits
v2.0.1
...
fix-inline
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c363d2666 | ||
|
|
f35fb8c148 | ||
|
|
0a1f706ca2 | ||
|
|
fdd239fe21 | ||
|
|
780ef2fce4 |
@@ -136,6 +136,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
- STAGE=test
|
- STAGE=test
|
||||||
- NAME=littlefs-migration
|
- NAME=littlefs-migration
|
||||||
|
if: branch !~ -prefix$
|
||||||
install:
|
install:
|
||||||
- sudo apt-get install libfuse-dev
|
- sudo apt-get install libfuse-dev
|
||||||
- git clone --depth 1 https://github.com/geky/littlefs-fuse -b v2-alpha v2
|
- git clone --depth 1 https://github.com/geky/littlefs-fuse -b v2-alpha v2
|
||||||
|
|||||||
19
lfs.c
19
lfs.c
@@ -29,7 +29,7 @@ static inline void lfs_cache_drop(lfs_t *lfs, lfs_cache_t *rcache) {
|
|||||||
|
|
||||||
static inline void lfs_cache_zero(lfs_t *lfs, lfs_cache_t *pcache) {
|
static inline void lfs_cache_zero(lfs_t *lfs, lfs_cache_t *pcache) {
|
||||||
// zero to avoid information leak
|
// zero to avoid information leak
|
||||||
memset(pcache->buffer, 0xff, lfs->cfg->prog_size);
|
memset(pcache->buffer, 0xff, lfs->cfg->cache_size);
|
||||||
pcache->block = 0xffffffff;
|
pcache->block = 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,21 +80,6 @@ static int lfs_bd_read(lfs_t *lfs,
|
|||||||
diff = lfs_min(diff, rcache->off-off);
|
diff = lfs_min(diff, rcache->off-off);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size >= hint && off % lfs->cfg->read_size == 0 &&
|
|
||||||
size >= lfs->cfg->read_size) {
|
|
||||||
// bypass cache?
|
|
||||||
diff = lfs_aligndown(diff, lfs->cfg->read_size);
|
|
||||||
int err = lfs->cfg->read(lfs->cfg, block, off, data, diff);
|
|
||||||
if (err) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
data += diff;
|
|
||||||
off += diff;
|
|
||||||
size -= diff;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// load to cache, first condition can no longer fail
|
// load to cache, first condition can no longer fail
|
||||||
LFS_ASSERT(block < lfs->cfg->block_count);
|
LFS_ASSERT(block < lfs->cfg->block_count);
|
||||||
rcache->block = block;
|
rcache->block = block;
|
||||||
@@ -2749,7 +2734,7 @@ lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file,
|
|||||||
|
|
||||||
if ((file->flags & LFS_F_INLINE) &&
|
if ((file->flags & LFS_F_INLINE) &&
|
||||||
lfs_max(file->pos+nsize, file->ctz.size) >
|
lfs_max(file->pos+nsize, file->ctz.size) >
|
||||||
lfs_min(LFS_ATTR_MAX, lfs_min(
|
lfs_min(0x3fe, lfs_min(
|
||||||
lfs->cfg->cache_size, lfs->cfg->block_size/8))) {
|
lfs->cfg->cache_size, lfs->cfg->block_size/8))) {
|
||||||
// inline file doesn't fit anymore
|
// inline file doesn't fit anymore
|
||||||
file->off = file->pos;
|
file->off = file->pos;
|
||||||
|
|||||||
Reference in New Issue
Block a user