Commit Graph

156 Commits

Author SHA1 Message Date
Christopher Haster
21ef0b7169 WIP added some comments 2018-04-03 09:37:14 -05:00
Christopher Haster
fec133dfba WIP Bumped versions 2018-04-03 08:38:25 -05:00
Christopher Haster
9b4530f8de WIP cleaned up TODOs 2018-04-03 08:29:28 -05:00
Christopher Haster
3a12b40fff WIP added support for inline files up to 1023 bytes 2018-04-03 08:28:09 -05:00
Christopher Haster
12aa4bde06 WIP Added limits on name/attrs/inline sizes 2018-04-01 15:36:29 -05:00
Christopher Haster
09c7df83db WIP Refactored lfs_dir_set function to umbrella append/update/remove 2018-03-27 22:49:21 -05:00
Christopher Haster
5387f52de5 WIP Added lfs_dir_get 2018-03-23 18:36:02 -05:00
Christopher Haster
c5b11d2a62 WIP moved superblock to entry append 2018-03-23 16:11:36 -05:00
Christopher Haster
66cdab8327 WIP fixed bugs 2018-03-23 05:29:18 -05:00
Christopher Haster
8aba03d25f WIP Fixed issue with modifying dir after append in update 2018-03-18 20:37:13 -05:00
Christopher Haster
9064fa6dbb WIP Better implementation of inline files, now with overflowing 2018-03-17 20:32:16 -05:00
Christopher Haster
fcc5c764e4 WIP moved asserts out 2018-03-17 12:10:09 -05:00
Christopher Haster
37f799d8a2 WIP added hacky taped on inline files 2018-03-17 10:29:41 -05:00
Christopher Haster
04b1103de1 WIP Fixed big-endian support 2018-03-15 23:25:21 -05:00
Christopher Haster
87df75d009 WIP added entry size field 2018-03-15 23:25:09 -05:00
Christopher Haster
1ea3d04d9c WIP separated dir_remove for two types of arguments 2018-03-15 23:24:50 -05:00
Christopher Haster
126f6d334e WIP minor improvement to from-memory commits 2018-03-12 22:29:21 -05:00
Christopher Haster
385b74944d WIP Allowed taking advantage of empty space earlier in dir search 2018-03-12 22:29:21 -05:00
Christopher Haster
3a10f5c29b WIP added callbacks for stuff 2018-03-12 22:29:21 -05:00
Christopher Haster
96cca2f5b6 WIP Moved entry tag updates out 2018-03-12 22:29:21 -05:00
Christopher Haster
32f43462ea WIP Naive implementation of resizable entries 2018-03-12 22:29:21 -05:00
Christopher Haster
efc634f3ed WIP something something flexible updates 2018-03-12 22:29:21 -05:00
Christopher Haster
2f7adc3461 WIP adopted lisp-like dsl for more flexibility 2018-03-12 22:29:21 -05:00
Christopher Haster
e934a22c3a WIP Changed commit DSL to support disk->disk copies 2018-03-12 22:29:21 -05:00
Christopher Haster
5937fd79dd 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-03-12 22:29:21 -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
Christopher Haster
949015ad52 Merge pull request #28 from geky/configurables
Add better general support in lfs_utils.h
2018-02-19 17:29:48 -06:00
Christopher Haster
67daf9e2c5 Added cross-compile targets for testing
Using gcc cross compilers and qemu:
- make test CC="arm-linux-gnueabi-gcc --static -mthumb" EXEC="qemu-arm"
- make test CC="powerpc-linux-gnu-gcc --static" EXEC="qemu-ppc"
- make test CC="mips-linux-gnu-gcc --static" EXEC="qemu-mips"

Also separated out Travis jobs and added some size reporting
2018-02-19 01:40:28 -06:00
Christopher Haster
a3fd2d4d6d Added more configurable utils
Note: It's still expected to modify lfs_utils.h when porting littlefs
to a new target/system. There's just too much room for system-specific
improvements, such as taking advantage of CRC hardware.

Rather, encouraging modification of lfs_util.h and making it easy to
modify and debug should result in better integration with the consuming
systems.

This just adds a bunch of quality-of-life improvements that should help
development and integration in littlefs.

- Macros that require no side-effects are all-caps
- System includes are only brought in when needed
- Malloc/free wrappers
- LFS_NO_* checks for quickly disabling things at the command line
- At least a little-bit more docs
2018-02-19 01:40:23 -06:00
Christopher Haster
a0a55fb9e5 Added conversion to/from little-endian on disk
Required to support big-endian processors, with the most notable being
the PowerPC architecture.

On little-endian architectures, these conversions can be optimized out
and have no code impact.

Initial patch provided by gmouchard
2018-02-19 01:39:08 -06:00
Christopher Haster
4f08424b51 Added software implementations of bitwise instructions
This helps significantly with supporting different compilers. Intrinsics for
different compilers can be added as they are found.

Note that for ARMCC, __builtin_ctz is not used. This was the result of a
strange issue where ARMCC only emits __builtin_ctz when passed the
--gnu flag, but __builtin_clz and __builtin_popcount are always emitted.
This isn't a big problem since the ARM instruction set doesn't have a
ctz instruction, and the npw2 based implementation is one of the most
efficient.

Also note that for littefs's purposes, we consider ctz(0) to be
undefined. This lets us save a branch in the software lfs_ctz
implementation.
2018-02-19 01:39:04 -06:00
Christopher Haster
59ce49fa4b Merge pull request #26 from Sim4n6/master
Added a .git ignore file
v1.2
2018-02-08 23:28:55 -06:00
iamatacos
2f8ae344d2 Added a git ignore file with .o .d blocks dir and lfs bin 2018-02-08 02:20:51 -06:00
Christopher Haster
e611cf5050 Fix incorrect lookahead population before ack
Rather than tracking all in-flight blocks blocks during a lookahead,
littlefs uses an ack scheme to mark the first allocated block that
hasn't reached the disk yet. littlefs assumes all blocks since the
last ack are bad or in-flight, and uses this to know when it's out
of storage.

However, these unacked allocations were still being populated in the
lookahead buffer. If the whole block device fits in the lookahead
buffer, _and_ littlefs managed to scan around the whole storage while
an unacked block was still in-flight, it would assume the block was
free and misallocate it.

The fix is to only fill the lookahead buffer up to the last ack.
The internal free structure was restructured to simplify the runtime
calculation of lookahead size.
2018-02-08 01:52:39 -06:00
Christopher Haster
a25743a82a Fixed some minor error code differences
- Write on read-only file to return LFS_ERR_BADF
- Renaming directory onto file to return LFS_ERR_NOTEMPTY
- Changed LFS_ERR_INVAL in lfs_file_seek to assert
2018-02-04 14:36:36 -06:00
Christopher Haster
6716b5580a Fixed error check when truncating files to larger size 2018-02-04 14:09:55 -06:00
Christopher Haster
809ffde60f Merge pull request #24 from aldot/silence-shadow-warnings-1
Silence shadow warnings
2018-02-04 13:36:55 -06:00
Christopher Haster
dc513b172f Silenced more of aldot's warnings
Flags used:
-Wall -Wextra -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes
-Wunused -Wunused-parameter -Wunused-function -Wunused-value
-Wmissing-prototypes -Wmissing-declarations -Wold-style-definition
2018-02-04 13:15:30 -06:00
Bernhard Reutner-Fischer
aa50e03684 Commentary typo fix 2018-02-04 13:15:26 -06:00
Bernhard Reutner-Fischer
6d55755128 tests: Silence warnings in template
- no previous prototype for ‘test_assert’
- no previous prototype for ‘test_count’
- unused parameter ‘b’ in test_count
- function declaration isn’t a prototype for main
2018-02-04 13:15:17 -06:00
Bernhard Reutner-Fischer
029361ea16 Silence shadow warnings 2018-02-04 13:15:09 -06:00
Christopher Haster
fd04ed4f25 Added autogenerated release notes from commits 2018-02-02 02:35:07 -06:00
Bernhard Reutner-Fischer
3101bc92b3 Do not print command invocation if QUIET 2018-02-02 09:34:01 +01:00