mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-02 00:38:28 +01:00
Compare commits
1 Commits
fix-inline
...
fix-read-h
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c64bf1a17b |
11
lfs.c
11
lfs.c
@@ -84,9 +84,12 @@ static int lfs_bd_read(lfs_t *lfs,
|
|||||||
LFS_ASSERT(block < lfs->cfg->block_count);
|
LFS_ASSERT(block < lfs->cfg->block_count);
|
||||||
rcache->block = block;
|
rcache->block = block;
|
||||||
rcache->off = lfs_aligndown(off, lfs->cfg->read_size);
|
rcache->off = lfs_aligndown(off, lfs->cfg->read_size);
|
||||||
rcache->size = lfs_min(lfs_alignup(off+hint, lfs->cfg->read_size),
|
rcache->size = lfs_min(
|
||||||
lfs_min(lfs->cfg->block_size - rcache->off,
|
lfs_min(
|
||||||
lfs->cfg->cache_size));
|
lfs_alignup(off+hint, lfs->cfg->read_size),
|
||||||
|
lfs->cfg->block_size)
|
||||||
|
- rcache->off,
|
||||||
|
lfs->cfg->cache_size);
|
||||||
int err = lfs->cfg->read(lfs->cfg, rcache->block,
|
int err = lfs->cfg->read(lfs->cfg, rcache->block,
|
||||||
rcache->off, rcache->buffer, rcache->size);
|
rcache->off, rcache->buffer, rcache->size);
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -2734,7 +2737,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(0x3fe, lfs_min(
|
lfs_min(LFS_ATTR_MAX, 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