/littlefs-2.7.6/ |
D | lfs_util.h | 134 static inline uint32_t lfs_max(uint32_t a, uint32_t b) { in lfs_max() argument 135 return (a > b) ? a : b; in lfs_max() 138 static inline uint32_t lfs_min(uint32_t a, uint32_t b) { in lfs_min() argument 139 return (a < b) ? a : b; in lfs_min() 143 static inline uint32_t lfs_aligndown(uint32_t a, uint32_t alignment) { in lfs_aligndown() argument 144 return a - (a % alignment); in lfs_aligndown() 147 static inline uint32_t lfs_alignup(uint32_t a, uint32_t alignment) { in lfs_alignup() argument 148 return lfs_aligndown(a + alignment-1, alignment); in lfs_alignup() 152 static inline uint32_t lfs_npw2(uint32_t a) { in lfs_npw2() argument 154 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 were 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 | lfs.c | 341 static inline void lfs_gstate_xor(lfs_gstate_t *a, const lfs_gstate_t *b) { in lfs_gstate_xor() argument 343 ((uint32_t*)a)[i] ^= ((const uint32_t*)b)[i]; in lfs_gstate_xor() 347 static inline bool lfs_gstate_iszero(const lfs_gstate_t *a) { in lfs_gstate_iszero() argument 349 if (((uint32_t*)a)[i] != 0) { in lfs_gstate_iszero() 356 static inline bool lfs_gstate_hasorphans(const lfs_gstate_t *a) { in lfs_gstate_hasorphans() argument 357 return lfs_tag_size(a->tag); in lfs_gstate_hasorphans() 360 static inline uint8_t lfs_gstate_getorphans(const lfs_gstate_t *a) { in lfs_gstate_getorphans() argument 361 return lfs_tag_size(a->tag); in lfs_gstate_getorphans() 364 static inline bool lfs_gstate_hasmove(const lfs_gstate_t *a) { in lfs_gstate_hasmove() argument 365 return lfs_tag_type1(a->tag); in lfs_gstate_hasmove() [all …]
|
D | Makefile | 1 TARGET = lfs.a 55 %.a: $(OBJ)
|
D | .gitignore | 4 *.a
|
/littlefs-2.7.6/tests/ |
D | test_move.toml | 5 lfs_mkdir(&lfs, "a") => 0; 9 lfs_file_open(&lfs, &file, "a/hello", LFS_O_CREAT | LFS_O_WRONLY) => 0; 17 lfs_rename(&lfs, "a/hello", "c/hello") => 0; 21 lfs_dir_open(&lfs, &dir, "a") => 0; 44 lfs_file_open(&lfs, &file, "a/hello", LFS_O_RDONLY) => LFS_ERR_NOENT; 79 lfs_mkdir(&lfs, "a") => 0; 83 lfs_file_open(&lfs, &file, "a/hello", LFS_O_CREAT | LFS_O_WRONLY) => 0; 91 lfs_rename(&lfs, "a/hello", "c/hello") => 0; 96 lfs_dir_open(&lfs, &dir, "a") => 0; 112 lfs_dir_open(&lfs, &dir, "a") => 0; [all …]
|
D | test_exhaustion.toml | 1 [[case]] # test running a filesystem to exhaustion 32 char c = 'a' + (rand() % 26); 59 char c = 'a' + (rand() % 26); 85 [[case]] # test running a filesystem to exhaustion 114 char c = 'a' + (rand() % 26); 141 char c = 'a' + (rand() % 26); 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 172 [[case]] # wear-level test running a filesystem to exhaustion 205 char c = 'a' + (rand() % 26); [all …]
|
D | test_evil.toml | 35 // make a dir 58 // test that accessing our bad dir fails, note there's a number 81 // make a file 104 // test that accessing our bad file fails, note there's a number 129 // make a file 165 // test that accessing our bad file fails, note there's a number
|
D | test_alloc.toml | 2 # note for these to work there are a number constraints on the device geometry 326 [[case]] # what if we have a bad block during an allocation scan? 347 // now fill all but a couple of blocks of the filesystem with data 363 // but mark the head of our file as a "bad block", this is force our 464 // shorten file to try a second chained dir 493 // create one block hole for half a directory 630 // rewrite one file with a hole of one block 643 // try to allocate a directory, should fail!
|
D | test_orphans.toml | 15 // makes a lot of assumptions about the remove operation. 42 // this mkdir should both create a dir and deorphan, so size
|
D | test_relocations.toml | 16 // make a child dir to use in bounded space 82 // make a child dir to use in bounded space 148 # almost every tree operation needs a relocation
|
/littlefs-2.7.6/scripts/ |
D | readtree.py | 59 gstate = bytes((a or 0) ^ (b or 0) 60 for a,b in it.zip_longest(gstate, ngstate.data))
|
D | test.py | 749 directory of tests, a specific file, a suite by name, and even a \
|