/littlefs-2.7.6/tests/ |
D | test_alloc.toml | 3 if = 'LFS_BLOCK_CYCLES == -1' 7 define.SIZE = '(((LFS_BLOCK_SIZE-8)*(LFS_BLOCK_COUNT-6)) / FILES)' 25 for (lfs_size_t i = 0; i < SIZE; i += size) { 39 for (lfs_size_t i = 0; i < SIZE; i += size) { 50 define.SIZE = '(((LFS_BLOCK_SIZE-8)*(LFS_BLOCK_COUNT-6)) / FILES)' 66 for (int i = 0; i < SIZE; i += size) { 78 for (int i = 0; i < SIZE; i += size) { 89 define.SIZE = '(((LFS_BLOCK_SIZE-8)*(LFS_BLOCK_COUNT-6)) / FILES)' 110 for (int i = 0; i < SIZE; i += size) { 124 for (int i = 0; i < SIZE; i += size) { [all …]
|
D | test_files.toml | 33 for (lfs_size_t i = 0; i < SIZE; i += CHUNKSIZE) { 34 lfs_size_t chunk = lfs_min(CHUNKSIZE, SIZE-i); 48 for (lfs_size_t i = 0; i < SIZE; i += CHUNKSIZE) { 49 lfs_size_t chunk = lfs_min(CHUNKSIZE, SIZE-i); 72 for (lfs_size_t i = 0; i < SIZE1; i += CHUNKSIZE) { 73 lfs_size_t chunk = lfs_min(CHUNKSIZE, SIZE1-i); 87 for (lfs_size_t i = 0; i < SIZE1; i += CHUNKSIZE) { 88 lfs_size_t chunk = lfs_min(CHUNKSIZE, SIZE1-i); 102 for (lfs_size_t i = 0; i < SIZE2; i += CHUNKSIZE) { 103 lfs_size_t chunk = lfs_min(CHUNKSIZE, SIZE2-i); [all …]
|
D | test_relocations.toml | 12 while (LFS_BLOCK_COUNT - lfs_fs_size(&lfs) > 16) { 22 for (int i = 0; i < COUNT; i++) { 23 sprintf(path, "child/test%03d_loooooooooooooooooong_name", i); 31 for (int i = 0; i < COUNT; i++) { 32 sprintf(path, "test%03d_loooooooooooooooooong_name", i); 39 if (j == ITERATIONS-1) { 43 for (int i = 0; i < COUNT; i++) { 44 sprintf(path, "child/test%03d_loooooooooooooooooong_name", i); 54 for (int i = 0; i < COUNT; i++) { 55 sprintf(path, "test%03d_loooooooooooooooooong_name", i); [all …]
|
D | test_badblocks.toml | 2 if = 'LFS_BLOCK_CYCLES == -1' 7 define.LFS_ERASE_VALUE = [0x00, 0xff, -1] 19 lfs_testbd_setwear(&cfg, badblock-1, 0) => 0; 25 for (int i = 1; i < 10; i++) { 27 buffer[j] = '0'+i; 34 buffer[j+NAMEMULT+1] = '0'+i; 41 for (int j = 0; j < i*FILEMULT; j++) { 50 for (int i = 1; i < 10; i++) { 52 buffer[j] = '0'+i; 60 buffer[j+NAMEMULT+1] = '0'+i; [all …]
|
D | test_seek.toml | 27 lfs_soff_t pos = -1; 29 for (int i = 0; i < SKIP; i++) { 56 lfs_file_seek(&lfs, &file, -size, LFS_SEEK_CUR) => pos; 60 lfs_file_seek(&lfs, &file, -size, LFS_SEEK_END) >= 0 => 1; 96 lfs_soff_t pos = -1; 98 for (int i = 0; i < SKIP; i++) { 121 lfs_file_seek(&lfs, &file, -size, LFS_SEEK_END) >= 0 => 1; 154 for (unsigned i = 0; i < sizeof(offsets) / sizeof(offsets[0]); i++) { 155 lfs_soff_t off = offsets[i]; 229 lfs_file_seek(&lfs, &file, -((COUNT+SKIP)*size), [all …]
|
D | test_exhaustion.toml | 22 for (uint32_t i = 0; i < FILES; i++) { 24 sprintf(path, "roadrunner/test%d", i); 25 srand(cycle * i); 51 for (uint32_t i = 0; i < FILES; i++) { 53 sprintf(path, "roadrunner/test%d", i); 54 srand(cycle * i); 75 for (uint32_t i = 0; i < FILES; i++) { 77 sprintf(path, "roadrunner/test%d", i); 104 for (uint32_t i = 0; i < FILES; i++) { 106 sprintf(path, "test%d", i); [all …]
|
D | test_dirs.toml | 23 for (int i = 0; i < N; i++) { 24 sprintf(path, "dir%03d", i); 37 for (int i = 0; i < N; i++) { 38 sprintf(path, "dir%03d", i); 54 for (int i = 0; i < N; i++) { 55 sprintf(path, "removeme%03d", i); 68 for (int i = 0; i < N; i++) { 69 sprintf(path, "removeme%03d", i); 79 for (int i = 0; i < N; i++) { 80 sprintf(path, "removeme%03d", i); [all …]
|
D | test_truncate.toml | 103 size = lfs_min(lfs.cfg->cache_size, sizeof(buffer)/2); 120 lfs_size_t trunc = size - qsize; 135 trunc -= qsize; 141 lfs_file_read(&lfs, &file, rb, size) => trunc - qsize; 142 memcmp(rb, wb + qsize, trunc - qsize) => 0; 298 // mid-file shrinking truncate 303 // mid-file expanding truncate 318 for (unsigned i = 0; i < COUNT; i++) { 319 sprintf(path, "hairyhead%d", i); 325 for (lfs_off_t j = 0; j < startsizes[i]; j += size) { [all …]
|
D | test_superblocks.toml | 35 for (int i = 0; i < N; i++) { 46 // one last check after power-cycle 62 for (int i = 0; i < N; i++) { 66 assert(err == 0 || (err == LFS_ERR_NOENT && i == 0)); 82 // one last check after power-cycle 101 for (int i = 0; i < N; i++) { 104 assert(err == 0 || (err == LFS_ERR_NOENT && i == 0)); 121 // one last check after power-cycle
|
D | test_orphans.toml | 14 // to the linked-list entry, which should orphan the orphan. Note this 23 int off = LFS_BLOCK_SIZE-1; 25 off -= 1; 27 memset(&bbuffer[off-3], LFS_BLOCK_SIZE, 3); 61 # TODO fix this case, caused by non-DAG trees 77 for (int i = 0; i < CYCLES; i++) { 104 assert(strcmp(info.name, &full_path[2*(DEPTH-1)+1]) == 0); 108 for (int d = DEPTH-1; d >= 0; d--) {
|
D | test_evil.toml | 6 [[case]] # invalid tail-pointer test 14 // change tail-pointer to invalid pointers 123 [[case]] # invalid pointer in CTZ skip-list test 133 for (int i = 0; i < SIZE; i++) { 139 // change pointer in CTZ skip-list to be invalid 212 [[case]] # metadata-pair threaded-list loop test 218 // change tail-pointer to point to ourself 231 [[case]] # metadata-pair threaded-list 2-length loop test 250 // change tail-pointer to point to root 261 [[case]] # metadata-pair threaded-list 1-length child loop test [all …]
|
/littlefs-2.7.6/ |
D | lfs.c | 5 * SPDX-License-Identifier: BSD-3-Clause 10 #define LFS_BLOCK_NULL ((lfs_block_t)-1) 11 #define LFS_BLOCK_INLINE ((lfs_block_t)-2) 18 rcache->block = LFS_BLOCK_NULL; in lfs_cache_drop() 23 memset(pcache->buffer, 0xff, lfs->cfg->cache_size); in lfs_cache_zero() 24 pcache->block = LFS_BLOCK_NULL; in lfs_cache_zero() 32 if (block >= lfs->cfg->block_count || in lfs_bd_read() 33 off+size > lfs->cfg->block_size) { in lfs_bd_read() 40 if (pcache && block == pcache->block && in lfs_bd_read() 41 off < pcache->off + pcache->size) { in lfs_bd_read() [all …]
|
D | lfs_util.c | 5 * SPDX-License-Identifier: BSD-3-Clause 24 for (size_t i = 0; i < size; i++) { in lfs_crc() local 25 crc = (crc >> 4) ^ rtable[(crc ^ (data[i] >> 0)) & 0xf]; in lfs_crc() 26 crc = (crc >> 4) ^ rtable[(crc ^ (data[i] >> 4)) & 0xf]; in lfs_crc()
|
D | README.md | 3 A little fail-safe filesystem designed for microcontrollers. 6 | | | .---._____ 7 .-----. | | 8 --|o |---| littlefs | 9 --| |---| | 10 '-----' '----------' 14 **Power-loss resilience** - littlefs is designed to handle random power 15 failures. All file operations have strong copy-on-write guarantees and if 18 **Dynamic wear leveling** - littlefs is designed with flash in mind, and 22 **Bounded RAM/ROM** - littlefs is designed to work with a small amount of [all …]
|
D | DESIGN.md | 3 A little fail-safe filesystem designed for microcontrollers. 6 | | | .---._____ 7 .-----. | | 8 --|o |---| littlefs | 9 --| |---| | 10 '-----' '----------' 16 filesystem that is resilient to power-loss and flash wear without using 19 This document covers the high-level design of littlefs, how it is different 21 low-level details covering every bit on disk, check out [SPEC.md](SPEC.md). 25 The embedded systems littlefs targets are usually 32-bit microcontrollers with [all …]
|
D | Makefile | 16 override CFLAGS += -O0 -g3 18 override CFLAGS += -Os 21 override CFLAGS += -m$(WORD) 24 override CFLAGS += -DLFS_YES_TRACE 26 override CFLAGS += -I. 27 override CFLAGS += -std=c99 -Wall -pedantic 28 override CFLAGS += -Wextra -Wshadow -Wjump-misses-init -Wundef 29 # Remove missing-field-initializers because of GCC bug 30 override CFLAGS += -Wno-missing-field-initializers 33 override TFLAGS += -v [all …]
|
D | lfs_util.h | 5 * SPDX-License-Identifier: BSD-3-Clause 11 // LFS_CONFIG as a header file to include (-DLFS_CONFIG=lfs_config.h). 14 // provided by the config file. To start, I would suggest copying lfs_util.h 65 // macros must not have side-effects as the macros can be removed for a smaller 130 // toolchain-specific implementations. LFS_NO_INTRINSICS falls back to a more 133 // Min/max functions for unsigned 32-bit numbers 144 return a - (a % alignment); in lfs_aligndown() 148 return lfs_aligndown(a + alignment-1, alignment); in lfs_alignup() 154 return 32 - __builtin_clz(a-1); in lfs_npw2() 158 a -= 1; in lfs_npw2() [all …]
|
D | SPEC.md | 10 | | | .---._____ 11 .-----. | | 12 --|o |---| littlefs | 13 --| |---| | 14 '-----' '----------' 20 - littlefs is a block-based filesystem. The disk is divided into an array of 23 - Block pointers are stored in 32 bits, with the special value `0xffffffff` 26 - In addition to the logical block size (which usually matches the erase 31 - By default, all values in littlefs are stored in little-endian byte order. 49 The high-level layout of a metadata block is fairly simple: [all …]
|
D | .travis.yml | 4 - CFLAGS=-Werror 5 - MAKEFLAGS=-j 11 - $HOME/.cache/apt 14 _: &install-common 16 - sudo apt-get install python3 python3-pip 17 - sudo pip3 install toml 18 # setup a ram-backed disk to speed up reentrant tests 19 - mkdir disks 20 - sudo mount -t tmpfs -o size=100m tmpfs disks 21 - export TFLAGS="$TFLAGS --disk=disks/disk" [all …]
|
/littlefs-2.7.6/bd/ |
D | lfs_filebd.c | 5 * SPDX-License-Identifier: BSD-3-Clause 21 (void*)cfg, cfg->context, in lfs_filebd_createcfg() 22 (void*)(uintptr_t)cfg->read, (void*)(uintptr_t)cfg->prog, in lfs_filebd_createcfg() 23 (void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync, in lfs_filebd_createcfg() 24 cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count, in lfs_filebd_createcfg() 25 path, (void*)bdcfg, bdcfg->erase_value); in lfs_filebd_createcfg() 26 lfs_filebd_t *bd = cfg->context; in lfs_filebd_createcfg() 27 bd->cfg = bdcfg; in lfs_filebd_createcfg() 30 bd->fd = open(path, O_RDWR | O_CREAT, 0666); in lfs_filebd_createcfg() 31 if (bd->fd < 0) { in lfs_filebd_createcfg() [all …]
|
D | lfs_rambd.c | 5 * SPDX-License-Identifier: BSD-3-Clause 16 (void*)cfg, cfg->context, in lfs_rambd_createcfg() 17 (void*)(uintptr_t)cfg->read, (void*)(uintptr_t)cfg->prog, in lfs_rambd_createcfg() 18 (void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync, in lfs_rambd_createcfg() 19 cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count, in lfs_rambd_createcfg() 20 (void*)bdcfg, bdcfg->erase_value, bdcfg->buffer); in lfs_rambd_createcfg() 21 lfs_rambd_t *bd = cfg->context; in lfs_rambd_createcfg() 22 bd->cfg = bdcfg; in lfs_rambd_createcfg() 25 if (bd->cfg->buffer) { in lfs_rambd_createcfg() 26 bd->buffer = bd->cfg->buffer; in lfs_rambd_createcfg() [all …]
|
/littlefs-2.7.6/scripts/ |
D | readmdir.py | 123 mask = 0x7ff & ~((1 << prefix)-1) 128 type, prefix//4, self.type & ((1 << prefix)-1)) 173 self.rev, = struct.unpack('<I', block[0:4]) 182 while len(block) - off >= 4: 183 ntag, = struct.unpack('>I', block[off:off+4]) 222 # id could have change, I know this is messy and slow 240 return not ((other.rev - self.rev) & 0x80000000) 258 tag.id <= gtag.id - gdiff): 259 if tag.is_('create') and tag.id == gtag.id - gdiff: 266 (int(gmask) & int(gtag.chid(gtag.id - gdiff)))): [all …]
|
D | explode_asserts.py | 89 for (size_t i = 0; i < size && i < {maxwidth}; i++) {{ 90 if (s[i] >= ' ' && s[i] <= '~') {{ 91 printf("%c", s[i]); 93 printf("\\\\x%02x", s[i]); 188 'op': ['strcmp', 'memcmp', '->'], 368 for i in range(p.off, len(p.tokens)): 369 outf.write(p.tokens[i][1]) 377 parser.add_argument('-o', '--output', required=True, 379 parser.add_argument('-p', '--pattern', action='append', 381 parser.add_argument('--maxwidth', default=MAXWIDTH, type=int,
|
D | test.py | 27 ./scripts/explode_asserts.py $$< -o $$@ 31 -include tests/*.d 35 $(CC) $(CFLAGS) $^ $(LFLAGS) -o $@ 50 'LFS_BLOCK_CYCLES': -1, 217 print('truncate --size=0', disk) 223 # simulate power-loss after n cycles? 231 ncmd.extend(['-ex', 'r']) 233 ncmd.extend(['-ex', 'up 2']) 236 '-ex', 'b %s:%d' % (self.suite.path, self.code_lineno), 237 '-ex', 'r']) [all …]
|
D | readtree.py | 35 blocks[id(data[-1])] = block 107 print("%-47s%s" % ("littlefs v%s.%s" % version, 113 tag = Tag(struct.unpack('<I', gstate[0:4].ljust(4, b'\xff'))[0]) 122 for i, dir in enumerate(dirs): 130 ' -> {%#x, %#x}' % struct.unpack('<II', mdir.tail.data) 144 ' ' if j == len(dir)-1 else 145 'v' if k == len(lines)-1 else 177 parser.add_argument('-l', '--log', action='store_true', 179 parser.add_argument('-a', '--all', action='store_true', 181 parser.add_argument('-T', '--no-truncate', action='store_true',
|