forked from Imagelibrary/littlefs
Rename SHRINKIFCHEAP to SHRINKNONRELOCATING
This commit is contained in:
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -388,7 +388,7 @@ jobs:
|
|||||||
python3 --version
|
python3 --version
|
||||||
- name: test-no-intrinsics
|
- name: test-no-intrinsics
|
||||||
run: |
|
run: |
|
||||||
CFLAGS="$CFLAGS -DLFS_SHRINKIFCHEAP" make test
|
CFLAGS="$CFLAGS -DLFS_SHRINKNONRELOCATING" make test
|
||||||
|
|
||||||
# run with all trace options enabled to at least make sure these
|
# run with all trace options enabled to at least make sure these
|
||||||
# all compile
|
# all compile
|
||||||
|
|||||||
6
lfs.c
6
lfs.c
@@ -5233,7 +5233,7 @@ static int lfs_fs_gc_(lfs_t *lfs) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LFS_READONLY
|
#ifndef LFS_READONLY
|
||||||
#ifdef LFS_SHRINKIFCHEAP
|
#ifdef LFS_SHRINKNONRELOCATING
|
||||||
static int lfs_shrink_checkblock(void * data, lfs_block_t block) {
|
static int lfs_shrink_checkblock(void * data, lfs_block_t block) {
|
||||||
lfs_size_t threshold = *((lfs_size_t *) data);
|
lfs_size_t threshold = *((lfs_size_t *) data);
|
||||||
if (block >= threshold) {
|
if (block >= threshold) {
|
||||||
@@ -5251,11 +5251,11 @@ static int lfs_fs_grow_(lfs_t *lfs, lfs_size_t block_count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef LFS_SHRINKIFCHEAP
|
#ifndef LFS_SHRINKNONRELOCATING
|
||||||
// shrinking is not supported
|
// shrinking is not supported
|
||||||
LFS_ASSERT(block_count >= lfs->block_count);
|
LFS_ASSERT(block_count >= lfs->block_count);
|
||||||
#endif
|
#endif
|
||||||
#ifdef LFS_SHRINKIFCHEAP
|
#ifdef LFS_SHRINKNONRELOCATING
|
||||||
lfs_block_t threshold = block_count;
|
lfs_block_t threshold = block_count;
|
||||||
err = lfs_fs_traverse_(lfs, lfs_shrink_checkblock, &threshold, true);
|
err = lfs_fs_traverse_(lfs, lfs_shrink_checkblock, &threshold, true);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
2
lfs.h
2
lfs.h
@@ -766,7 +766,7 @@ int lfs_fs_gc(lfs_t *lfs);
|
|||||||
// Grows the filesystem to a new size, updating the superblock with the new
|
// Grows the filesystem to a new size, updating the superblock with the new
|
||||||
// block count.
|
// block count.
|
||||||
//
|
//
|
||||||
// If LFS_SHRINKIFCHEAP is defined, this function will also accept
|
// If LFS_SHRINKNONRELOCATING is defined, this function will also accept
|
||||||
// block_counts smaller than the current configuration, after checking
|
// block_counts smaller than the current configuration, after checking
|
||||||
// that none of the blocks that are being removed are in use.
|
// that none of the blocks that are being removed are in use.
|
||||||
// Note that littlefs's pseudorandom block allocation means that
|
// Note that littlefs's pseudorandom block allocation means that
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ defines.AFTER_BLOCK_COUNT = [5, 10, 15, 19]
|
|||||||
|
|
||||||
if = "AFTER_BLOCK_COUNT <= BLOCK_COUNT"
|
if = "AFTER_BLOCK_COUNT <= BLOCK_COUNT"
|
||||||
code = '''
|
code = '''
|
||||||
#ifdef LFS_SHRINKIFCHEAP
|
#ifdef LFS_SHRINKNONRELOCATING
|
||||||
lfs_t lfs;
|
lfs_t lfs;
|
||||||
lfs_format(&lfs, cfg) => 0;
|
lfs_format(&lfs, cfg) => 0;
|
||||||
lfs_mount(&lfs, cfg) => 0;
|
lfs_mount(&lfs, cfg) => 0;
|
||||||
@@ -30,7 +30,7 @@ defines.AFTER_BLOCK_COUNT = [5, 7, 10, 12, 15, 17, 20]
|
|||||||
defines.FILES_COUNT = [7, 8, 9, 10]
|
defines.FILES_COUNT = [7, 8, 9, 10]
|
||||||
if = "AFTER_BLOCK_COUNT <= BLOCK_COUNT && FILES_COUNT + 2 < BLOCK_COUNT"
|
if = "AFTER_BLOCK_COUNT <= BLOCK_COUNT && FILES_COUNT + 2 < BLOCK_COUNT"
|
||||||
code = '''
|
code = '''
|
||||||
#ifdef LFS_SHRINKIFCHEAP
|
#ifdef LFS_SHRINKNONRELOCATING
|
||||||
lfs_t lfs;
|
lfs_t lfs;
|
||||||
lfs_format(&lfs, cfg) => 0;
|
lfs_format(&lfs, cfg) => 0;
|
||||||
// create FILES_COUNT files of BLOCK_SIZE - 50 bytes (to avoid inlining)
|
// create FILES_COUNT files of BLOCK_SIZE - 50 bytes (to avoid inlining)
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ defines.BLOCK_COUNT = 'ERASE_COUNT'
|
|||||||
defines.BLOCK_COUNT_2 = ['ERASE_COUNT/2', 'ERASE_COUNT/4', '2']
|
defines.BLOCK_COUNT_2 = ['ERASE_COUNT/2', 'ERASE_COUNT/4', '2']
|
||||||
defines.KNOWN_BLOCK_COUNT = [true, false]
|
defines.KNOWN_BLOCK_COUNT = [true, false]
|
||||||
code = '''
|
code = '''
|
||||||
#ifdef LFS_SHRINKIFCHEAP
|
#ifdef LFS_SHRINKNONRELOCATING
|
||||||
lfs_t lfs;
|
lfs_t lfs;
|
||||||
lfs_format(&lfs, cfg) => 0;
|
lfs_format(&lfs, cfg) => 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user