196 Commits

Author SHA1 Message Date
Christopher Haster
74477526f6 WIP Fixed minor memory leak 2018-08-10 10:36:16 -05:00
Christopher Haster
24eaf86b0e WIP Added allocation randomization for dynamic wear-leveling 2018-08-09 12:16:46 -05:00
Christopher Haster
67bbee56f5 WIP added framework for full dynamic wear-leveling 2018-08-08 22:20:37 -05:00
Christopher Haster
efc491facb WIP Fixed issue with big-endian ctz lists intertwined in commit logic 2018-08-08 09:37:43 -05:00
Christopher Haster
fd9e609eb7 WIP Changed name of lfs_crc to match more common API 2018-08-07 14:59:44 -05:00
Christopher Haster
88f15a8d41 WIP fixed issues with expanding directories in tests
(Some where legitimate test failures)
2018-08-07 14:44:26 -05:00
Christopher Haster
5422566b6a WIP Added expading superblocks and root entries 2018-08-06 20:07:09 -05:00
Christopher Haster
f96e8c130d WIP Made naming consistent for internal functions 2018-08-04 23:57:43 -05:00
Christopher Haster
78b460a907 Merge remote-tracking branch 'origin/master' into v2-alpha 2018-08-04 22:01:44 -05:00
Christopher Haster
4f0d248e09 WIP Changed name of upper-limits from blah_size to blah_max 2018-08-04 20:24:01 -05:00
Christopher Haster
2f73652937 WIP Documented custom attribute API and changed behaviour around
nonexisting attributes
2018-08-04 20:23:51 -05:00
Christopher Haster
c3480c8c92 WIP Added test for global state stealing 2018-08-04 18:55:04 -05:00
Christopher Haster
2bcec45c1b WIP cleaned up config options 2018-08-04 16:04:24 -05:00
Christopher Haster
a98affc951 WIP Added support for cache_size as alternative to read_size and
prog_size
2018-08-04 14:48:27 -05:00
Christopher Haster
e7c4465bf5 WIP simplified and aligned globals
by storing deorphaned in the globals tag itself
2018-08-03 21:07:04 -05:00
Christopher Haster
597249eea0 WIP Added files to dir list and squished the lists together
Now with better tracking of changes to long lasting metadata pairs
2018-08-03 21:06:59 -05:00
Christopher Haster
67cf4e10f4 WIP fixed several TODOs 2018-08-01 06:43:46 -05:00
Christopher Haster
14469059bc WIP Removed redundant lfs_scan 2018-08-01 01:05:04 -05:00
Christopher Haster
3bb37d4aaf WIP Reimplemented big-endian support on top of new structures 2018-08-01 18:50:54 -05:00
Christopher Haster
a703859615 WIP added deorphan bit to globals 2018-07-31 19:41:12 -05:00
Christopher Haster
10f063571a WIP Fixed ENOSPC issues with zero-granularity blocks 2018-07-30 21:12:00 -05:00
Christopher Haster
7f41aa05a9 WIP Cleaned up file config usage 2018-07-30 16:19:09 -05:00
Christopher Haster
b8290e306c WIP removed lfs parameter to lfs traverse 2018-07-30 14:41:17 -05:00
Christopher Haster
c74bcec184 WIP fixed corruption tests 2018-07-30 14:23:51 -05:00
Christopher Haster
868099836d WIP Fixed deorphan test 2018-07-30 09:10:04 -05:00
Christopher Haster
c3c15d7636 Added support for custom attributes 2 2018-07-30 08:15:58 -05:00
Christopher Haster
3a70619f41 WIP Added support for custom attributes 1 2018-07-29 15:28:41 -05:00
Christopher Haster
22e3d33ada Picked up path corner case fixes 2018-07-28 12:07:18 -05:00
Christopher Haster
439a76e3e1 WIP Refactor file/dir iteration for dir update checks 2018-07-28 09:47:57 -05:00
Freddie Chopin
0422c55b81 Fix memory leaks in lfs_mount and lfs_format
Squashed:
- Change lfs_deinit() return to void to simplify error handling
- Move lfs_deinit() before lfs_init()
- Fix memory leaks in lfs_init()
- Fix memory leaks in lfs_format()
- Fix memory leaks in lfs_mount()
2018-07-19 16:54:38 -05:00
Christopher Haster
11ad3a2414 Merge pull request #76 from ARMmbed/fix-corrupt-read
Add handling for corrupt as initial state of blocks
2018-07-17 20:32:33 -05:00
Damien George
961fab70c3 Added file config structure and lfs_file_opencfg
The optional config structure options up the possibility of adding
file-level configuration in a backwards compatible manner.

Also adds possibility to open multiple files with LFS_NO_MALLOC
enabled thanks to dpgeorge

Also bumped minor version to v1.5
2018-07-17 18:32:18 -05:00
Christopher Haster
236d46ad17 Fixed move handling when caught in update 2018-07-17 18:31:30 -05:00
Christopher Haster
041e90a1ca Added handling for corrupt as initial state of blocks
Before this, littlefs incorrectly assumed corrupt blocks were only the result
of our own modification. This would be fine for most cases of freshly
erased storage, but for storage with block-level ECC this wasn't always
true.

Fortunately, it's quite easy for littlefs to handle this case correctly,
as long as corrupt storage always reports that it is corrupt, which for
most forms of ECC is the case unless we perform a write on the storage.

found by rojer
2018-07-16 15:33:52 -05:00
Christopher Haster
f1719e3310 WIP cleaned up commit logic 2018-07-14 04:26:05 -05:00
Christopher Haster
37cf030445 WIP cleaned up commit logic 2018-07-13 22:51:43 -05:00
Christopher Haster
7ec75a55f2 WIP additional cleanup around attributes 2018-07-13 12:42:30 -05:00
Christopher Haster
dcfe94412a WIP other minor adjustments 2018-07-12 20:43:55 -05:00
Christopher Haster
6a99f6c8fc WIP Changed internal API to return tags over pointers 2018-07-12 20:22:06 -05:00
Christopher Haster
e6d49feb4a WIP renamed tag related things 2018-07-12 19:07:56 -05:00
Christopher Haster
f6347db3da WIP moved things around in get/traverse functions 2018-07-12 18:11:18 -05:00
Christopher Haster
48cc58e25c WIP Tweaked results from find-like functions 2018-07-11 07:18:30 -05:00
Christopher Haster
92d957ab40 WIP Consolidated get functions into one 2018-07-11 05:52:50 -05:00
Freddie Chopin
7e67f9324e Use PRIu32 and PRIx32 format specifiers to fix warnings
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-07-11 12:32:21 +02:00
Christopher Haster
5152b973f0 WIP Moved findscan into fetch as primitive 2018-07-11 04:00:34 -05:00
Christopher Haster
eed1eec5fd Fixed information leaks through reused caches
As a shortcut, littlefs never bother to zero any of the buffers is used.
It didn't need to because it would always write out the entirety of the
data it needed.

Unfortunately, this, combined with the extra padding used to align
buffers to the nearest prog size, would lead to uninitialized data
getting written out to disk.

This means unrelated file data could be written to different parts of
storage, or worse, information leaked from the malloc calls could be
written out to disk unnecessarily.

found by rojer
2018-07-10 11:18:46 -05:00
Christopher Haster
43e6aadef6 WIP consolidated find/parent scanning functions 2018-07-09 17:29:40 -05:00
Christopher Haster
0276e00fac WIP reclaimed 0x3ff as invalid id 2018-07-09 14:53:55 -05:00
Christopher Haster
5b9755f141 WIP restructured tags for more flexible bit encoding 2018-07-09 14:13:31 -05:00
Christopher Haster
f5488f7192 WIP changed type to be retrieved from name not struct 2018-07-09 13:09:23 -05:00