/littlefs-latest/ |
D | lfs_util.h | 126 static inline uint32_t lfs_max(uint32_t a, uint32_t b) { in lfs_max() argument 127 return (a > b) ? a : b; in lfs_max() 130 static inline uint32_t lfs_min(uint32_t a, uint32_t b) { in lfs_min() argument 131 return (a < b) ? a : b; in lfs_min() 135 static inline uint32_t lfs_aligndown(uint32_t a, uint32_t alignment) { in lfs_aligndown() argument 136 return a - (a % alignment); in lfs_aligndown() 139 static inline uint32_t lfs_alignup(uint32_t a, uint32_t alignment) { in lfs_alignup() argument 140 return lfs_aligndown(a + alignment-1, alignment); in lfs_alignup() 144 static inline uint32_t lfs_npw2(uint32_t a) { in lfs_npw2() argument 146 return 32 - __builtin_clz(a-1); in lfs_npw2() [all …]
|
D | DESIGN.md | 15 in the context of microcontrollers. The question was: How would you build a 40 reactive, with no concept of a shutdown routine. This presents a big challenge 42 leave a device unrecoverable. 47 If a power loss corrupts any persistent data structures, this can cause the 49 recover from a power loss during any write operation. 51 1. **Wear leveling** - Writing to flash is destructive. If a filesystem 54 used to store frequently updated metadata and cause a device's early death. 62 where possible. For RAM we have a stronger requirement, all RAM usage is 64 size or number of files. This creates a unique challenge as even presumably 72 power-loss resilience and wear leveling, we can narrow these down to a handful [all …]
|
D | SPEC.md | 20 - littlefs is a block-based filesystem. The disk is divided into an array of 24 representing a null block address. 27 block size), littlefs also uses a program block size and read block size. 35 Metadata pairs form the backbone of littlefs and provide a system for 36 distributed atomic updates. Even the superblock is stored in a metadata pair. 38 As their name suggests, a metadata pair is stored in two blocks, with one block 39 providing a backup during erase cycles in case power is lost. These two blocks 40 are not necessarily sequential and may be anywhere on disk, so a "pointer" to a 43 On top of this, each metadata block behaves as an appendable log, containing a 49 The high-level layout of a metadata block is fairly simple: [all …]
|
D | README.md | 22 **Bounded RAM/ROM** - littlefs is designed to work with a small amount of 30 Here's a simple example that updates a file named `boot_count` every time 97 littlefs takes in a configuration structure that defines how the filesystem 105 simultaneously. With the `lfs_t` and configuration struct, a user can 106 format a block device or mount the filesystem. 108 Once mounted, the littlefs provides a full set of POSIX-like file and 121 All littlefs calls have the potential to return a negative error code. The 126 user may return a `LFS_ERR_CORRUPT` error if the implementation already can 139 At a high level, littlefs is a block based filesystem that uses small logs to 142 In littlefs, these ingredients form a sort of two-layered cake, with the small [all …]
|
D | Makefile | 7 TARGET ?= $(BUILDDIR)/liblfs.a 33 TEST_A := $(TESTS:%.toml=$(BUILDDIR)/%.t.a.c) \ 34 $(TEST_SRC:%.c=$(BUILDDIR)/%.t.a.c) 35 TEST_C := $(TEST_A:%.t.a.c=%.t.c) 50 BENCH_A := $(BENCHES:%.toml=$(BUILDDIR)/%.b.a.c) \ 51 $(BENCH_SRC:%.c=$(BUILDDIR)/%.b.a.c) 52 BENCH_C := $(BENCH_A:%.b.a.c=%.b.c) 475 $(BUILDDIR)/liblfs.a: $(OBJ) 528 $(BUILDDIR)/%.c: %.a.c 531 $(BUILDDIR)/%.c: $(BUILDDIR)/%.a.c [all …]
|
D | lfs.c | 409 static inline void lfs_gstate_xor(lfs_gstate_t *a, const lfs_gstate_t *b) { in lfs_gstate_xor() argument 411 ((uint32_t*)a)[i] ^= ((const uint32_t*)b)[i]; in lfs_gstate_xor() 415 static inline bool lfs_gstate_iszero(const lfs_gstate_t *a) { in lfs_gstate_iszero() argument 417 if (((uint32_t*)a)[i] != 0) { in lfs_gstate_iszero() 425 static inline bool lfs_gstate_hasorphans(const lfs_gstate_t *a) { in lfs_gstate_hasorphans() argument 426 return lfs_tag_size(a->tag); in lfs_gstate_hasorphans() 429 static inline uint8_t lfs_gstate_getorphans(const lfs_gstate_t *a) { in lfs_gstate_getorphans() argument 430 return lfs_tag_size(a->tag) & 0x1ff; in lfs_gstate_getorphans() 433 static inline bool lfs_gstate_hasmove(const lfs_gstate_t *a) { in lfs_gstate_hasmove() argument 434 return lfs_tag_type1(a->tag); in lfs_gstate_hasmove() [all …]
|
D | .gitignore | 4 *.a 13 liblfs.a
|
D | .gitattributes | 1 # GitHub really wants to mark littlefs as a python project, telling it to
|
/littlefs-latest/tests/ |
D | test_move.toml | 6 lfs_mkdir(&lfs, "a") => 0; 11 lfs_file_open(&lfs, &file, "a/hello", LFS_O_CREAT | LFS_O_WRONLY) => 0; 19 lfs_rename(&lfs, "a/hello", "c/hello") => 0; 25 lfs_dir_open(&lfs, &dir, "a") => 0; 48 lfs_file_open(&lfs, &file, "a/hello", LFS_O_RDONLY) => LFS_ERR_NOENT; 87 lfs_mkdir(&lfs, "a") => 0; 92 lfs_file_open(&lfs, &file, "a/hello", LFS_O_CREAT | LFS_O_WRONLY) => 0; 100 lfs_rename(&lfs, "a/hello", "c/hello") => 0; 107 lfs_dir_open(&lfs, &dir, "a") => 0; 123 lfs_dir_open(&lfs, &dir, "a") => 0; [all …]
|
D | test_exhaustion.toml | 1 # test running a filesystem to exhaustion 36 char c = 'a' + (TEST_PRNG(&prng) % 26); 65 char c = 'a' + (TEST_PRNG(&prng) % 26); 93 # test running a filesystem to exhaustion 126 char c = 'a' + (TEST_PRNG(&prng) % 26); 155 char c = 'a' + (TEST_PRNG(&prng) % 26); 183 # These are a sort of high-level litmus test for wear-leveling. One definition 184 # of wear-leveling is that increasing a block device's space translates directly 188 # wear-level test running a filesystem to exhaustion 225 char c = 'a' + (TEST_PRNG(&prng) % 26); [all …]
|
D | test_paths.toml | 1350 # test trailing dots, these get a bit weird 1355 # - littlefs: remove("a/.") => 0 1356 # - POSIX: remove("a/.") => EBUSY 2019 # - littlefs: stat("a/missing/..") => 0 2020 # - POSIX: stat("a/missing/..") => ENOENT 2024 # - littlefs: rename("a/b/..", "c") => 0 2025 # - POSIX: rename("a/b/..", "c") => EBUSY 3199 // here's a weird one, what happens if our rename is also a noop? 3350 // here's a weird one, what happens if our rename is also a noop? 3592 // here's a weird one, what happens if our rename is also a noop? [all …]
|
D | test_evil.toml | 37 // make a dir 61 // test that accessing our bad dir fails, note there's a number 88 // make a file 113 // test that accessing our bad file fails, note there's a number 140 // make a file 178 // test that accessing our bad file fails, note there's a number
|
D | test_compat.toml | 3 # Note, these tests are a bit special. They expect to be linked against two 18 # there may be a better way to do this, but oh well, explicit aliases works 61 # test we can mount in a new version 91 # test we can read dirs in a new version 149 # test we can read files in a new version 239 # test we can read files in dirs in a new version 356 # test we can write dirs in a new version 421 # test we can write files in a new version 543 # test we can write files in dirs in a new version 1295 # test that we fail to mount after a major version bump [all …]
|
D | test_alloc.toml | 2 # note for these to work there are a number constraints on the device geometry 422 # what if we have a bad block during an allocation scan? 447 // now fill all but a couple of blocks of the filesystem with data 463 // but mark the head of our file as a "bad block", this is force our 573 // shorten file to try a second chained dir 603 // create one block hole for half a directory 749 // rewrite one file with a hole of one block 762 // try to allocate a directory, should fail!
|
D | test_powerloss.toml | 1 # There are already a number of tests that test general operations under 5 # only a revision count 127 // imitate a partial prog, value should not matter, if littlefs
|
D | test_relocations.toml | 19 // make a child dir to use in bounded space 97 // make a child dir to use in bounded space 170 # almost every tree operation needs a relocation
|
D | test_superblocks.toml | 35 # mount/unmount from interpretting a previous superblock block_count 445 // same size is a noop 489 // same size is a noop
|
D | test_orphans.toml | 16 // makes a lot of assumptions about the remove operation. 45 // this mkdir should both create a dir and deorphan, so size
|
D | test_bd.toml | 4 # Note we use 251, a prime, in places to avoid aliasing powers of 2.
|
/littlefs-latest/scripts/ |
D | cov.py | 112 def __new__(cls, a=0, b=None): argument 113 if isinstance(a, Frac) and b is None: 114 return a 115 if isinstance(a, str) and b is None: 116 a, b = a.split('/', 1) 118 b = a 119 return super().__new__(cls, Int(a), Int(b)) 122 return '%s/%s' % (self.a, self.b) 125 return float(self.a) 129 t = self.a.x/self.b.x if self.b.x else 1.0 [all …]
|
D | summary.py | 169 def __new__(cls, a=0, b=None): argument 170 if isinstance(a, Frac) and b is None: 171 return a 172 if isinstance(a, str) and b is None: 173 a, b = a.split('/', 1) 175 b = a 176 return super().__new__(cls, Int(a), Int(b)) 179 return '%s/%s' % (self.a, self.b) 182 return float(self.a) 186 t = self.a.x/self.b.x if self.b.x else 1.0 [all …]
|
D | plotmpl.py | 1215 next(a for a in subparser._actions 1216 if '--output' in a.option_strings).required = False 1217 next(a for a in subparser._actions 1218 if '--width' in a.option_strings).type = float 1219 next(a for a in subparser._actions 1220 if '--height' in a.option_strings).type = float
|
D | readtree.py | 59 gstate = bytes((a or 0) ^ (b or 0) 60 for a,b in it.zip_longest(gstate, ngstate.data))
|
D | plot.py | 1534 next(a for a in subparser._actions 1535 if '--width' in a.option_strings).type = float 1536 next(a for a in subparser._actions 1537 if '--height' in a.option_strings).type = float
|
D | perf.py | 503 abs(a_+delta - a) 505 for a, _ in syms[s])
|