Commit Graph

273 Commits

Author SHA1 Message Date
Christopher Haster
16318d003f Merge pull request #58 from dpgeorge/file-open-no-malloc
Added possibility to open multiple files with LFS_NO_MALLOC enabled
2018-07-17 20:31:20 -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
f94d233deb Merge pull request #74 from FreddieChopin/cxx-guards
Add C++ guards to public headers
v1.4
2018-07-13 10:55:16 -05:00
Freddie Chopin
577d777c20 Add C++ guards to public headers
Fixes #53
Fixes #32
2018-07-13 09:34:49 +02: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
c72d25203c Merge pull request #73 from FreddieChopin/fix-format-specifiers
Use PRIu32 and PRIx32 format specifiers to fix warnings
2018-07-12 16:54:13 -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
5a17fa42e4 Fixed script issue with bash expansion inside makefile parameter
This was causing code sizes to be reported with several of the logging
functions still built in. A useful number, but not the minimum
achievable code size.
2018-07-10 17:18:45 -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
4a86370327 Added quality of life improvements for main.c/test.c issues
1. Added check for main.c and test.c to decide compilation target
2. Added step to remove test.c after successful test completion

The test.c file, which contains the expanded test main, is useful when
debugging why tests are failing. However, keeping the test.c file around
causes problems when a later attempt is made to compile a larger project
containing the littlefs directory.

Under (hopefully) normal operation, tests always pass. So it should be ok
to remove the test.c file after a successful test run. Hopefully this
behaviour doesn't cause too much confusion for contributors using the
tests.

On the other side of things, compiling the library with no main ends
(successfully) with the "main not found" error message. By defaulting
to lfs.a if neither test.c/main.c is avoid this in the common cases

found by armijnhemel and Sim4n6
2018-07-10 11:17:50 -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
Christopher Haster
2947006660 WIP removed old move logic 2018-07-09 11:47:04 -05:00
Christopher Haster
d5f0e236b8 WIP fixed bug with globals poisoning from dirs
Needs to be cleaned up
2018-07-08 14:21:29 -05:00
Christopher Haster
0d3350665e WIP Fixed issues around wrong ids after bad commits 2018-07-04 01:35:04 -05:00
Christopher Haster
ba4f17173f Merge pull request #57 from dpgeorge/fix-warnings
Fix some compiler warnings: shadowed variable and unused parameters
2018-07-02 12:01:34 -05:00
Damien George
51346b8bf4 Fixed shadowed variable warnings
- Fixed shadowed variable warnings in lfs_dir_find.
- Fixed unused parameter warnings when LFS_NO_MALLOC is enabled.
- Added extra warning flags to CFLAGS.
- Updated tests so they don't shadow the "size" variable for -Wshadow
2018-07-02 10:29:19 -05:00
Christopher Haster
5064cf82fd WIP switched back to deorphan for remove
Utilizing moves wouldn't have worked for rename anyways, and it requires
additional code for much less traveled code path (directory removes)
2018-07-01 22:29:42 -05:00
Christopher Haster
93a2e0bbe5 Merge pull request #62 from ARMmbed/license-bsd-3
v1.4 - Change license to BSD-3-Clause
2018-06-21 13:10:57 -05:00
Christopher Haster
6beff502e9 Changed license to BSD-3-Clause
For better compatibility with GPL v2

With permissions from:
- aldot
- Sim4n6
- jrast
2018-06-21 11:41:43 -05:00
Christopher Haster
ff13345e96 WIP Restructured tags for better support for global things 2018-05-29 20:08:42 -05:00
Christopher Haster
82948861d2 WIP TEMP move work 2018-05-29 12:35:23 -05:00
Christopher Haster
e9bf206c54 WIP Adopted ISDIR as internal error for root as argument 2018-05-29 01:22:09 -05:00
Christopher Haster
2223bef125 WIP Restructured metadata dir structures 2018-05-29 01:11:26 -05:00
Christopher Haster
d56f326dfb WIP better structure for dir/file lists 2018-05-29 00:51:21 -05:00
Christopher Haster
09b69c5b2a WIP name updates 2018-05-28 19:49:20 -05:00
Christopher Haster
a848b0ebbd WIP almost got move working 2018-05-28 17:46:32 -05:00
Christopher Haster
6cda0442ea WIP made basic tests pass
(format/dirs/files/seek/truncate/interspersed/paths)
2018-05-28 09:43:51 -05:00
Christopher Haster
0e0f015fbd WIP WIP yes two wips 2018-05-28 02:08:16 -05:00
Christopher Haster
fbd25ac533 WIP minor change to fix rename issue 2018-05-27 11:46:22 -05:00
Christopher Haster
de0b719b56 WIP progress so far 2018-05-27 10:15:28 -05:00
Christopher Haster
ca9e43158d WIP fixed enough things to pass basic file testing 2018-05-26 13:50:06 -05:00
Christopher Haster
cd045ed2eb WIP Moved move things into a better place 2018-05-25 19:22:19 -05:00
Christopher Haster
39267fd8b2 WIP file stuff 2018-05-22 23:57:19 -05:00
Christopher Haster
6c2c7e3f3d WIP more progressed 2018-05-22 21:58:14 -05:00
Christopher Haster
2759f012c0 WIP progressed more 2018-05-21 00:56:20 -05:00
Christopher Haster
f4d6ca5552 WIP fixed up dir find 2018-05-20 14:01:11 -05:00