/littlefs-2.7.6/ |
D | Makefile | 2 ifneq ($(wildcard test.c main.c),) 10 SRC += $(wildcard *.c bd/*.c) 11 OBJ := $(SRC:.c=.o) 12 DEP := $(SRC:.c=.d) 13 ASM := $(SRC:.c=.s) 16 override CFLAGS += -O0 -g3 18 override CFLAGS += -Os 21 override CFLAGS += -m$(WORD) 24 override CFLAGS += -DLFS_YES_TRACE 26 override CFLAGS += -I. [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 | .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 …]
|
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 | lfs.h | 4 * Copyright (c) 2017, Arm Limited. All rights reserved. 5 * SPDX-License-Identifier: BSD-3-Clause 14 extern "C" 22 // Major (top-nibble), incremented on backwards incompatible changes 23 // Minor (bottom-nibble), incremented on feature additions 28 // Version of On-disk data structures 29 // Major (top-nibble), incremented on backwards incompatible changes 30 // Minor (bottom-nibble), incremented on feature additions 73 LFS_ERR_IO = -5, // Error during device operation 74 LFS_ERR_CORRUPT = -84, // Corrupted [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 | lfs_util.h | 4 * Copyright (c) 2017, Arm Limited. All rights reserved. 5 * SPDX-License-Identifier: BSD-3-Clause 11 // LFS_CONFIG as a header file to include (-DLFS_CONFIG=lfs_config.h). 59 extern "C" 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 131 // expensive basic C implementation for debugging purposes 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() [all …]
|
D | lfs_util.c | 4 * Copyright (c) 2017, Arm Limited. All rights reserved. 5 * SPDX-License-Identifier: BSD-3-Clause
|
D | LICENSE.md | 1 Copyright (c) 2017, Arm Limited. All rights reserved. 6 - Redistributions of source code must retain the above copyright notice, this 8 - Redistributions in binary form must reproduce the above copyright notice, this 11 - Neither the name of ARM nor the names of its contributors may be used to
|
/littlefs-2.7.6/scripts/ |
D | readmdir.py | 123 mask = 0x7ff & ~((1 << prefix)-1) 128 type, prefix//4, self.type & ((1 << prefix)-1)) 182 while len(block) - off >= 4: 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)))): 276 f.write("%-8s %-8s %-13s %4s %4s" % ( 283 f.write("%08x: %08x %-13s %4s %4s" % ( 287 f.write(" %-23s %-8s\n" % ( [all …]
|
D | test.py | 27 ./scripts/explode_asserts.py $$< -o $$@ 31 -include tests/*.d 34 %.test: %.test.o $(foreach f,$(subst /,.,$(SRC:.c=.o)),%.$f) 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), [all …]
|
D | readtree.py | 35 blocks[id(data[-1])] = block 107 print("%-47s%s" % ("littlefs v%s.%s" % version, 112 print("gstate 0x%s" % ''.join('%02x' % c for c in gstate)) 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',
|
D | explode_asserts.py | 91 printf("%c", s[i]); 188 'op': ['strcmp', 'memcmp', '->'], 376 help="Input C file after cpp.") 377 parser.add_argument('-o', '--output', required=True, 378 help="Output C file.") 379 parser.add_argument('-p', '--pattern', action='append', 381 parser.add_argument('--maxwidth', default=MAXWIDTH, type=int,
|
/littlefs-2.7.6/tests/ |
D | test_evil.toml | 6 [[case]] # invalid tail-pointer test 9 in = "lfs.c" 14 // change tail-pointer to invalid pointers 31 in = "lfs.c" 76 in = "lfs.c" 123 [[case]] # invalid pointer in CTZ skip-list test 125 in = "lfs.c" 134 char c = 'c'; 135 lfs_file_write(&lfs, &file, &c, 1) => 1; 139 // change pointer in CTZ skip-list to be invalid [all …]
|
D | test_exhaustion.toml | 32 char c = 'a' + (rand() % 26); 33 lfs_ssize_t res = lfs_file_write(&lfs, &file, &c, 1); 59 char c = 'a' + (rand() % 26); 62 assert(r == c); 114 char c = 'a' + (rand() % 26); 115 lfs_ssize_t res = lfs_file_write(&lfs, &file, &c, 1); 141 char c = 'a' + (rand() % 26); 144 assert(r == c); 167 # These are a sort of high-level litmus test for wear-leveling. One definition 168 # of wear-leveling is that increasing a block device's space translates directly [all …]
|
D | test_move.toml | 7 lfs_mkdir(&lfs, "c") => 0; 17 lfs_rename(&lfs, "a/hello", "c/hello") => 0; 30 lfs_dir_open(&lfs, &dir, "c") => 0; 46 lfs_file_open(&lfs, &file, "c/hello", LFS_O_RDONLY) => 0; 75 in = "lfs.c" 81 lfs_mkdir(&lfs, "c") => 0; 91 lfs_rename(&lfs, "a/hello", "c/hello") => 0; 102 int off = LFS_BLOCK_SIZE-1; 104 off -= 1; 106 memset(&bbuffer[off-3], LFS_BLOCK_SIZE, 3); [all …]
|
D | test_seek.toml | 27 lfs_soff_t pos = -1; 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; 121 lfs_file_seek(&lfs, &file, -size, LFS_SEEK_END) >= 0 => 1; 229 lfs_file_seek(&lfs, &file, -((COUNT+SKIP)*size), 233 lfs_file_seek(&lfs, &file, -((COUNT+2*SKIP)*size), 262 uint8_t c; 263 lfs_file_read(&lfs, &file, &c, 1) => 1; 264 c => buffer[k++ % 26]; [all …]
|
D | test_alloc.toml | 3 if = 'LFS_BLOCK_CYCLES == -1' 7 define.SIZE = '(((LFS_BLOCK_SIZE-8)*(LFS_BLOCK_COUNT-6)) / FILES)' 50 define.SIZE = '(((LFS_BLOCK_SIZE-8)*(LFS_BLOCK_COUNT-6)) / FILES)' 89 define.SIZE = '(((LFS_BLOCK_SIZE-8)*(LFS_BLOCK_COUNT-6)) / FILES)' 97 for (int c = 0; c < CYCLES; c++) { 144 define.SIZE = '(((LFS_BLOCK_SIZE-8)*(LFS_BLOCK_COUNT-6)) / FILES)' 151 for (int c = 0; c < CYCLES; c++) { 230 define.SIZE = '(((LFS_BLOCK_SIZE-8)*(LFS_BLOCK_COUNT-4)) / 3)' 327 in = "lfs.c" 348 filesize -= 3*LFS_BLOCK_SIZE; [all …]
|
D | test_orphans.toml | 2 in = "lfs.c" 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 81 sprintf(&full_path[2*d], "/%c", alpha[rand() % FILES]); 104 assert(strcmp(info.name, &full_path[2*(DEPTH-1)+1]) == 0); 108 for (int d = DEPTH-1; d >= 0; d--) {
|
D | test_relocations.toml | 12 while (LFS_BLOCK_COUNT - lfs_fs_size(&lfs) > 16) { 39 if (j == ITERATIONS-1) { 78 while (LFS_BLOCK_COUNT - lfs_fs_size(&lfs) > 16) { 150 # TODO fix this case, caused by non-DAG trees 170 sprintf(&full_path[2*d], "/%c", alpha[rand() % FILES]); 193 assert(strcmp(info.name, &full_path[2*(DEPTH-1)+1]) == 0); 197 for (int d = DEPTH-1; d >= 0; d--) { 212 # TODO fix this case, caused by non-DAG trees 232 sprintf(&full_path[2*d], "/%c", alpha[rand() % FILES]); 255 assert(strcmp(info.name, &full_path[2*(DEPTH-1)+1]) == 0); [all …]
|
/littlefs-2.7.6/bd/ |
D | lfs_filebd.c | 4 * Copyright (c) 2017, Arm Limited. All rights reserved. 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() [all …]
|
D | lfs_filebd.h | 4 * Copyright (c) 2017, Arm Limited. All rights reserved. 5 * SPDX-License-Identifier: BSD-3-Clause 14 extern "C" 28 // 8-bit erase value to use for simulating erases. -1 does not simulate 29 // erases, which can speed up testing by avoiding all the extra block-device 70 } /* extern "C" */
|
D | lfs_rambd.h | 4 * Copyright (c) 2017, Arm Limited. All rights reserved. 5 * SPDX-License-Identifier: BSD-3-Clause 14 extern "C" 28 // 8-bit erase value to simulate erasing with. -1 indicates no erase 72 } /* extern "C" */
|
D | lfs_testbd.h | 5 * Copyright (c) 2017, Arm Limited. All rights reserved. 6 * SPDX-License-Identifier: BSD-3-Clause 17 extern "C" 30 // some real-world circumstances such as progs not sticking (prog-noop), 31 // a readonly disk (erase-noop), and ECC failures (read-error). 33 // Not that read-noop is not allowed. Read _must_ return a consistent (but 49 // 8-bit erase value to use for simulating erases. -1 does not simulate 50 // erases, which can speed up testing by avoiding all the extra block-device 62 // the program with exit. Simulates power-loss. 0 disables. 138 } /* extern "C" */
|
D | lfs_rambd.c | 4 * Copyright (c) 2017, Arm Limited. All rights reserved. 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() [all …]
|