Commit Graph

273 Commits

Author SHA1 Message Date
Christopher Haster
57fbc52cfc WIP added wip journalling things for dirs 2018-05-19 18:25:47 -05:00
Christopher Haster
c5e2b335d6 Added error when opening multiple files with a statically allocated buffer
Opening multiple files simultaneously is not supported without dynamic memory,
but the previous behaviour would just let the files overwrite each other, which
could lead to bad errors down the line

found by husigeza
v1.3
2018-04-30 03:37:10 -05:00
Christopher Haster
015b86bc51 Fixed issue with trailing dots in file paths
Paths such as the following were causing issues:
/tea/hottea/.
/tea/hottea/..

Unfortunately the existing structure for path lookup didn't make it very
easy to introduce proper handling in this case without duplicating the
entire skip logic for paths. So the lfs_dir_find function had to be
restructured a bit.

One odd side-effect of this is that now lfs_dir_find includes the
initial fetch operation. This kinda breaks the fetch -> op pattern of
the dir functions, but does come with a nice code size reduction.
2018-04-22 07:26:31 -05:00
Christopher Haster
c8323112ee WIP Added tests over entries + attributes 2018-04-16 02:37:32 -05:00
Christopher Haster
9637b96069 Fixed lookahead overflow and removed unbounded lookahead pointers
As pointed out by davidefer, the lookahead pointer modular arithmetic
does not work around integer overflow when the pointer size is not a
multiple of the block count.

To avoid overflow problems, the easy solution is to stop trying to
work around integer overflows and keep the lookahead offset inside the
block device. To make this work, the ack was modified into a resetable
counter that is decremented every block allocation.

As a plus, quite a bit of the allocation logic ended up simplified.
2018-04-11 14:38:25 -05:00
Christopher Haster
7d3c2be49a WIP Fixed big-endian support 2018-04-11 01:29:59 -05:00
Christopher Haster
0e4eb788fe WIP added test config for no inline files 2018-04-11 01:29:59 -05:00
Christopher Haster
6af43aec5b Added lfs_fs_size function for finding a count of used blocks
This has existed for some time in the form of the lfs_traverse
function, however lfs_traverse is relatively unconventional and
has proven to not have been the most intuitive for users.
2018-04-11 01:29:59 -05:00
Christopher Haster
9af404db09 WIP added file/fs set/get attr implementations 2018-04-11 01:29:59 -05:00
Christopher Haster
0347416b89 WIP simplified attribute handling a bit to better match commit regions 2018-04-11 01:29:59 -05:00
Christopher Haster
eb70143469 WIP Clumsy setattrs/getattrs 2018-04-11 01:29:59 -05:00
Christopher Haster
2aee22aa49 WIP custom attributes 2018-04-11 01:29:59 -05:00
Christopher Haster
a82ea60658 WIP added some comments 2018-04-11 01:29:59 -05:00
Christopher Haster
7c0f32dc0b WIP Bumped versions 2018-04-11 01:29:59 -05:00
Christopher Haster
e48a2c488b WIP cleaned up TODOs 2018-04-11 01:29:59 -05:00
Christopher Haster
f37fa75d66 WIP added support for inline files up to 1023 bytes 2018-04-11 01:29:59 -05:00
Christopher Haster
bba71b23f4 WIP Added limits on name/attrs/inline sizes 2018-04-11 01:29:59 -05:00
Christopher Haster
e4a35b78e7 WIP Refactored lfs_dir_set function to umbrella append/update/remove 2018-04-11 01:29:59 -05:00
Christopher Haster
b56d82ff34 WIP Added lfs_dir_get 2018-04-11 01:29:59 -05:00
Christopher Haster
ab9750f5ed WIP moved superblock to entry append 2018-04-11 01:29:59 -05:00
Christopher Haster
2f32222914 WIP fixed bugs 2018-04-11 01:29:59 -05:00
Christopher Haster
7ad2d58ed0 WIP Fixed issue with modifying dir after append in update 2018-04-11 01:29:59 -05:00
Christopher Haster
689159e31d WIP Better implementation of inline files, now with overflowing 2018-04-11 01:29:59 -05:00
Christopher Haster
9a97a97e4c WIP moved asserts out 2018-04-11 01:29:59 -05:00
Christopher Haster
345f7f3235 WIP added hacky taped on inline files 2018-04-11 01:29:59 -05:00
Christopher Haster
a418c2068d WIP Fixed big-endian support 2018-04-11 01:29:59 -05:00
Christopher Haster
d7ed7a41e9 WIP added entry size field 2018-04-11 01:29:59 -05:00
Christopher Haster
960e152261 WIP separated dir_remove for two types of arguments 2018-04-11 01:29:59 -05:00
Christopher Haster
28a5a27bb9 WIP minor improvement to from-memory commits 2018-04-11 01:29:59 -05:00
Christopher Haster
72475f64f6 WIP Allowed taking advantage of empty space earlier in dir search 2018-04-11 01:29:59 -05:00
Christopher Haster
8773d7c81f WIP added callbacks for stuff 2018-04-11 01:29:59 -05:00
Christopher Haster
d636299daf WIP Moved entry tag updates out 2018-04-11 01:29:59 -05:00
Christopher Haster
2d6a37f775 WIP Naive implementation of resizable entries 2018-04-11 01:29:59 -05:00
Christopher Haster
f58408c974 WIP something something flexible updates 2018-04-11 01:29:59 -05:00
Christopher Haster
e1f05ee046 WIP adopted lisp-like dsl for more flexibility 2018-04-11 01:29:59 -05:00
Christopher Haster
f54ad304fc WIP Changed commit DSL to support disk->disk copies 2018-04-11 01:29:59 -05:00
Christopher Haster
2a738463b3 Separated type/struct fields in dir entries
The separation of data-structure vs entry type has been implicit for a
while now, and even taken advantage of to simplify the traverse logic.
2018-04-11 01:29:59 -05:00
Christopher Haster
89a7630d84 Fixed issue with lookahead trusting old lookahead blocks
One of the big simplifications in littlefs's implementation is the
complete lack of tracking free blocks, allowing operations to simply
drop blocks that are no longer in use.

However, this means the lookahead buffer can easily contain outdated
blocks that were previously deleted. This is usually fine, as littlefs
will rescan the storage if it can't find a free block in the lookahead
buffer, but after changes that caused littlefs to more conservatively
respect the alloc acks (e611cf5), any scanned blocks after an ack would
be incorrectly trusted.

The fix is to eagerly scan ahead in the lookahead when we allocate so
that alloc acks are better able to discredit old lookahead blocks. Since
usually alloc acks are tightly coupled to allocations of one or two blocks,
this allows littlefs to properly rescan every set of allocations.

This may still be a concern if there is a long series of worn out
blocks, but in the worst case littlefs will conservatively avoid using
blocks it's not sure about.

Found by davidefer
2018-04-09 14:37:35 -05:00
Christopher Haster
43eac3083b Renamed test_parallel tests to test_interespersed
The name test_parallel gave off the incorrect impression that these
tests are multithreaded.
2018-04-08 17:31:09 -05:00
Christopher Haster
dbc3cb1798 Fixed Travis rate-limit issue with Github requests
Using credentials avoids rate-limiting based on Travis's IP address
2018-04-08 17:31:09 -05:00
Christopher Haster
93ece2e87a Removed outdated note about moves and powerloss 2018-04-08 17:31:05 -05:00
Christopher Haster
d9c076d909 Removed the uninitialized read for invalid superblocks 2018-03-19 00:39:40 -05:00
Christopher Haster
58f3bb1f08 Merge pull request #37 from jrast/patch-1
Added a note about the callback functions
2018-03-13 00:13:44 -05:00
Christopher Haster
f72f6d6a05 Removed out of date note about endianness 2018-03-12 21:27:39 -05:00
Juerg Rast
5c4ee2109d Added a note about the callback functions
Added a short section about the callback functions, based on the answers
to issue #35 and #36
2018-03-12 21:26:40 -05:00
Christopher Haster
155224600a Fixed Travis issue with deploy stage in PRs 2018-03-12 19:57:57 -05:00
Christopher Haster
9ee112a7cb Fixed issue updating dir struct when extended dir chain
Like most of the lfs_dir_t functions, lfs_dir_append is responsible for
updating the lfs_dir_t struct if the underlying directory block is
moved. This property makes handling worn out blocks much easier by
removing the amount of state that needs to be considered during a
directory update.

However, extending the dir chain is a bit of a corner case. It's not
changing the old block, but callers of lfs_dir_append do assume the
"entry" will reside in "dir" after lfs_dir_append completes.

This issue only occurs when creating files, since mkdir does not use
the entry after lfs_dir_append. Unfortunately, the tests against
extending the directory chain were all made using mkdir.

Found by schouleu
2018-02-28 23:14:41 -06:00
Christopher Haster
d9c36371e7 Fixed handling of root as target for create operations
Before this patch, when calling lfs_mkdir or lfs_file_open with root
as the target, littlefs wouldn't find the path properly and happily
run into undefined behaviour.

The fix is to populate a directory entry for root in the lfs_dir_find
function. As an added plus, this allowed several special cases around
root to be completely dropped.
2018-02-28 23:13:02 -06:00
Christopher Haster
1476181bd1 Added LFS_CONFIG for user provided configuration of the utils
Suggested by sn00pster, LFS_CONFIG is an opt-in user provided
configuration file that will override the util implementation in
lfs_util.h. This is useful for allowing system-specific overrides
without needing to rely on git merges or other forms of patching
for updates.
2018-02-22 13:39:24 -06:00
Christopher Haster
b2124a5ae5 Fixed multiple deploy steps in Travis 2018-02-20 17:55:30 -06:00