Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/emubd
AgeCommit message (Collapse)Author
2018-10-21Merge remote-tracking branch 'origin/master' into v2-rebase-part2Christopher Haster
2018-10-18Added allocation randomization for dynamic wear-levelingChristopher Haster
This implements the second step of full dynamic wear-leveling, block allocation randomization. This is the key part the uniformly distributes wear across the filesystem, even through reboots. The entropy actually comes from the filesystem itself, by xoring together all of the CRCs in the metadata-pairs on the filesystem. While this sounds like a ridiculous operation, it's easy to do when we already scan the metadata-pairs at mount time. This gives us a random number we can use for block allocation. Unfortunately it's not a great general purpose random generator as the output only changes every filesystem write. Fortunately that's exactly when we need our allocator. --- Additionally, the randomization created a mess for the testing framework. Fortunately, this method of randomization is deterministic. A very useful property for reproducing bugs.
2018-09-27If stats file doesn't exist lfs_emubd_create will fail.Chris
This will create default stats file if it doesn't exist.
2018-07-13Add C++ guards to public headersFreddie Chopin
Fixes #53 Fixes #32
2018-07-11Use PRIu32 and PRIx32 format specifiers to fix warningsFreddie Chopin
When using "%d" or "%x" with uint32_t types, arm-none-eabi-gcc reports warnings like below: -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- In file included from lfs.c:8: lfs_util.h:45:12: warning: format '%d' expects argument of type 'int', but argument 4 has type 'lfs_block_t' {aka 'long unsigned int'} [-Wformat=] printf("lfs debug:%d: " fmt "\n", __LINE__, __VA_ARGS__) ^~~~~~~~~~~~~~~~ lfs.c:2512:21: note: in expansion of macro 'LFS_DEBUG' LFS_DEBUG("Found partial move %d %d", ^~~~~~~~~ lfs.c:2512:55: note: format string is defined here LFS_DEBUG("Found partial move %d %d", ~^ %ld -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- Fix this by replacing "%d" and "%x" with `"%" PRIu32` and `"%" PRIx32`.
2018-06-21Changed license to BSD-3-Clauselicense-bsd-3Christopher Haster
For better compatibility with GPL v2 With permissions from: - aldot - Sim4n6 - jrast
2018-02-04Silence shadow warningsBernhard Reutner-Fischer
2018-01-23Fixed incorrect reliance on errno in emubdChristopher Haster
When running the tests, the emubd erase function relied on the value of errno to not change over a possible call to unlink. Annoyingly, I've only seen this cause problems on a couple of specific Travis instances while self-hosting littlefs on top of littlefs-fuse.
2017-11-16Fixed issue with committing directories to bad-blocks that are stuckChristopher Haster
This is only an issue in the weird case that are worn down block is left in the odd state of not being able to change the data that resides on the block. That being said, this does pop up often when simulating wear on block devices. Currently, directory commits checked if the write succeeded by crcing the block to avoid the additional RAM cost for another buffer. However, before this commit, directory commits just checked if the block crc was valid, rather than comparing to the expected crc. This would usually work, unless the block was stuck in a state with valid crc. The fix is to simply compare with the expected crc to find errors.
2017-10-13Updated copyrightChristopher Haster
Due to employee contract Per ARM license remains under Apache 2.0
2017-07-08Adopted the Apache 2.0 licenseChristopher Haster
2017-06-29Fixed missing erase during file relocationChristopher Haster
This was an easy fix, but highlighted the fact that the current testing framework doesn't detect when a block is written to without an associated erase. Added a quick solution that creates an empty file during an erase.
2017-06-28Added internal check of data written to diskChristopher Haster
Before, the littlefs relied on the underlying block device to report corruption that occurs when writing data to disk. This requirement is easy to miss or implement incorrectly, since the error detection is only required when a block becomes corrupted, which is very unlikely to happen until late in the block device's lifetime. The littlefs can detect corruption itself by reading back written data. This requires a bit of care to reuse the available buffers, and may rely on checksums to avoid additional RAM requirements. This does have a runtime penalty with the extra read operations, but should make the littlefs much more robust to different implementations.
2017-05-15Added support for handling corrupted blocksChristopher Haster
This provides a limited form of wear leveling. While wear is not actually balanced across blocks, the filesystem can recover from corrupted blocks and extend the lifetime of a device nearly as much as dynamic wear leveling. For use-cases where wear is important, it would be better to use a full form of dynamic wear-leveling at the block level. (or consider a logging filesystem). Corrupted block handling was simply added on top of the existing logic in place for the filesystem, so it's a bit more noodly than it may have to be, but it gets the work done.
2017-04-24Adopted more conventional buffer parameter orderingChristopher Haster
Adopted buffer followed by size. The other order was original chosen due to some other functions with a more complicated parameter list. This convention is important, as the bd api is one of the main apis facing porting efforts.
2017-04-22Simplified configChristopher Haster
Before, the lfs had multiple paths to determine config options: - lfs_config struct passed during initialization - lfs_bd_info struct passed during block device initialization - compile time options This allowed different developers to provide their own needs to the filesystem, such as the block device capabilities and the higher level user's own tweaks. However, this comes with additional complexity and action required when the configurations are incompatible. For now, this has been reduced to all information (including block device function pointers) being passed through the lfs_config struct. We just defer more complicated handling of configuration options to the top level user. This simplifies configuration handling and gives the top level user the responsibility to handle configuration, which they probably would have wanted to do anyways.
2017-04-18Added proper handling of orphansChristopher Haster
Unfortunately, threading all dir blocks in a linked-list did not come without problems. While it's possible to atomically add a dir to the linked list (by adding the new dir into the linked-list position immediately after it's parent, requiring only one atomic update to the parent block), it is not easy to make sure the linked-list is in a state that always allows atomic removal of dirs. The simple solution is to allow this non-atomic removal, with an additional step to remove any orphans that could have been created by a power-loss. This deorphan step is only run if the normal allocator has failed.
2017-03-26Added file read/write tests and some framework updatesChristopher Haster
2017-03-26Added a rudimentary test frameworkChristopher Haster
Tests can be found in 'tests/test_blah.sh' Tests can be run with 'make test'
2017-03-26Restructured the major interfaces of the filesystemChristopher Haster
2017-03-20Added better handling for metadata pairsChristopher Haster
The core algorithim that backs this filesystem's goal of fault tolerance is the alternating of "metadata pairs". Backed by a simple core function for reading and writing, makes heavy use of c99 designated initializers for passing info about multiple chunks in an erase block.
2017-02-27Initial commit of progress, minimal formatting niave free listChristopher Haster
2017-02-25Initial commit of block device interface and emulated block deviceChristopher Haster