Commit Graph

123 Commits (bc4dea2b1cb1fecff55a8b4f528b0dc2cb4e7a56)

Author SHA1 Message Date
Christopher Haster db965c1652
mbr: Added note about limitations 2018-02-14 10:31:14 -06:00
Christopher Haster 5b09daf0f9 mbr: Added checks for extended partitions 2018-02-13 14:03:02 -06:00
Christopher Haster 70cfef8630 fatfs: Removed extra MBR block
Regression after ChanFS update: Due to parameter changes in the f_mkfs
function, the option to use a separate block for MBR (FDISK) was turned
back on. This should be off as it conflicts with an explicit MBR when
using the MBRBlockDevice.
2018-02-12 17:16:10 -06:00
Brendan McDonnell 88cd13b115 cast to resolve signed/unsigned comparison compiler warning in FATFileSystem::dir_seek() 2018-02-05 15:16:02 -05:00
Cruz Monrreal 5cd30b965c
Merge pull request #5925 from geky/bd-erase-value
bd: Add get_erase_value function to the block device API
2018-01-31 12:13:54 -06:00
Amanda Butler e6949db802 bd: Copy edit BlockDevices
Copy edit SlicingBlockDevice.h
Copy edit ReadOnlyBlockDevice.h
Copy edit ProfilingBlockDevice.h
Copy edit ObservingBlockDevice.h
Copy edit MBRBlockDevice.h
Copy edit ExhaustibleBlockDevice.h
Copy edit ChainingBlockDevice.h
Copy edit BlockDevice.h

Copy edit files for active voice and consistent tense.
2018-01-29 18:45:36 -06:00
Christopher Haster 88aad81345 bd: Adopted the get_erase_value function in the util block devices 2018-01-29 15:33:02 -06:00
Christopher Haster 7707c8b8b8 bd: Added get_erase_value function to the block device API
Default implementation returns -1 and is backwards compatible
2018-01-29 15:31:07 -06:00
Christopher Haster 6e5f2439a3 littlefs: Adopted the block device sync function
Required to garuntee that data is flushed all the way down to the disk
level when a file is synced or closed.
2018-01-24 18:07:47 -06:00
Christopher Haster a4f8af9d5b bd: Adopted the sync function in the util block devices 2018-01-24 18:07:35 -06:00
Christopher Haster 3f5d618c89 bd: Add sync function to the block device API
/** Ensure data on storage is in sync with the driver
 *
 *  @return         0 on success or a negative error code on failure
 */
virtual int sync()
2018-01-24 17:58:20 -06:00
Cruz Monrreal c59c400093
Merge pull request #5832 from geky/fix-truncate-zero
littlefs: Fix file truncation without writes
2018-01-18 14:25:47 -06:00
Cruz Monrreal 698c7d9e8c
Merge pull request #5819 from geky/test-common
Add COMMON folder for tests
2018-01-18 14:20:23 -06:00
Cruz Monrreal b8abbab38b
Merge pull request #5761 from geky/littlefs-fix-lookahead-rewind
littlefs: Fix issue with immediate exhaustion and small unaligned storage
2018-01-18 13:01:25 -06:00
Cruz Monrreal 25aa0e6d37
Merge pull request #5846 from geky/fix-block-addr-overflow
littlefs: Fix block addr overflow
2018-01-16 15:53:30 -06:00
Martin Kojtal 8c78649078
Merge pull request #5829 from deepikabhavnani/fat_issue_5780_3
Fix: Sector/Size overflow from uint32_t
2018-01-15 15:22:11 +00:00
Christopher Haster 44e2ca44a8 littlefs: Fix block addr overflow
deepikabhavnani did the hard work in tracking this issue down.  Block
addresses are not cast to the correct type until after multiplying to
convert to byte addresses. This results in an overflow when the storage
is larger than 4 GB.
2018-01-12 14:44:44 -06:00
deepikabhavnani c86d757267 Fix: Sector/Size overflow from uint32_t
FATFilesystem declares sector count and size as uint32_t and block
device class arguments are addr and size which is uint64_t
While passing arguments to program/read/write API's of block device,
multiplication of uint32_t*uint32_t was not typecasted properly to
uint64_t which resulted in MSB truncation.

Eg. If block 0x800000 is accessed with block size 0x200, addr to be
passed (0x800000*0x200)0x100000000, but actual address passed was 0x0
which resulted in over-writting the root directory, and hence corrupted
filesystem
2018-01-12 11:12:34 -06:00
Christopher Haster 5df2b9b0e7 littlefs: Fixed file truncation without writes
In the open call, the LFS_O_TRUNC flag was correctly zeroing the file, but
it wasn't actually writing the change out to disk. This went unnoticed because
in the cases where the truncate was followed by a file write, the
updated contents would be written out correctly.

Marking the file as dirty if the file isn't already truncated fixes the
problem with the least impact. Also added better test cases around
truncating files.
2018-01-11 16:27:33 -06:00
Cruz Monrreal c0c501c70f
Merge pull request #5768 from deepikabhavnani/storage_stats
Added statvfs API to get storage statistics
2018-01-11 10:25:41 -06:00
Christopher Haster d82d9888d4 Added COMMON folder for tests
A COMMON folder allows code reuse across different test cases. This
avoids code duplication or code enterying the application space.

The COMMON folder is uppercase to match naming conventions in Mbed OS.
2018-01-09 16:11:14 -06:00
Christopher Haster 5e7c0976fa littlefs: Fixed issue with immediate exhaustion and small unaligned storage
This was a small hole in the logic that handles initializing the
lookahead buffer. To imitate exhaustion (so the block allocator
will trigger a scan), the lookahead buffer is rewound a full
lookahead and set up to look like it is exhausted. However,
unlike normal allocation, this rewind was not kept aligned to
a multiple of the scan size, which is limited by both the
lookahead buffer and the total storage size.

This bug went unnoticed for so long because it only causes
problems when the block device is both:
1. Not aligned to the lookahead buffer (not a power of 2)
2. Smaller than the lookahead buffer

While this seems like a strange corner case for a block device,
this turned out to be very common for internal flash, especially
when a handleful of blocks are reserved for code.
2018-01-04 09:49:13 -06:00
Christopher Haster ffc857ddc9 littlefs: Fixed positive seek bounds checking
This bug was a result of an annoying corner case around intermingling
signed and unsigned offsets. The boundary check that prevents seeking
a file to a position before the file was preventing valid seeks with
positive offsets.

This corner case is a bit more complicated than it looks because the
offset is signed, while the size of the file is unsigned. Simply
casting both to signed or unsigned offsets won't handle large files.
2018-01-03 18:07:17 -06:00
Christopher Haster 9dd3060d60 Added littlefs statvfs implementation 2018-01-03 12:54:28 -06:00
Christopher Haster f1a9815876 Moved squiggly bracket placement per mbed style 2018-01-03 12:30:50 -06:00
Deepika 7a90be0ce1 Added statvfs API to get storage statistics
The API is as per posix standard, but does not provide stats for file/directory.
Stats buffer (block size, total block count, free block count) is filled for
entire mounted filesystem.
2017-12-29 16:42:31 -06:00
Martin Kojtal 2e1c2a1cdf
Merge pull request #5538 from geky/littlefs-staging
Integrate littlefs into mbed OS
2017-12-01 08:15:26 +00:00
Christopher Haster c6130306e0 littlefs: Removed links to previous repository locations 2017-11-30 11:46:00 -06:00
Amanda Butler 634fcf0cc4 Copy edit littlefs
ExhaustibleBlockDevice.h
- Fix typos for consistent spelling.
ObservingBlockDevice.h
- Fix typos for consistent spelling.
ReadOnlyBlockDevice.h
- Fix typos for consistent spelling.
README.md
- Fix typos, mostly for branding.
DESIGN.md
- Make minor changes for consistent spelling and precise language.
SPEC.md
- Make minor changes for consistent spelling and precise language.
README.md
- Make minor changes for consistent spelling and precise language.
2017-11-29 16:35:06 -06:00
Christopher Haster 47684d89a5 Added test config for simulated block devices
Not all devices have enough heap to fit a simulated heap block device,
however using a simulated heap block device is preferred if available
(reduced flash wear, faster testing).

Added MBED_TEST_SIM_BLOCKDEVICE for tests that only need a simulated
block device (wear_leveling + resilience), and added support for targets
that are known to have enough heap.
2017-11-27 19:48:56 -06:00
Christopher Haster b52575bc65 littlefs: Added checks for __CLZ instruction in IAR 2017-11-27 19:48:56 -06:00
Christopher Haster 2cf4715cb6 littlefs: Increased test timeout to 4 minutes
Unfortunately there are several issues colluding to force the timeout
this high.

1. The tests push littlefs to the limits of how many errors it can
handle before failing. As a side effect this causes a massive amount
of debug/warn/error logging about the situation.

2. The logging can't be turned off for specific tests. Note: This might
change with the introduction of test-configs.

3. Logging is fixed to a baud rate of 9600. Previous testing was carried
out with a baud rate of 115200, which is the reason for the original
timeout.
2017-11-22 17:19:16 -06:00
Christopher Haster 4adf75c9aa littlefs: Moved test block devices into general block devices 2017-11-22 16:02:54 -06:00
Christopher Haster 9bc4ea6504 littlefs: Removed mbed namespace leaks 2017-11-22 16:02:54 -06:00
Christopher Haster 314995f841 Add 'features/filesystem/littlefs/' from commit 'd02b3122f006aa201bca4efc699bae40971e5a00'
git-subtree-dir: features/filesystem/littlefs
git-subtree-mainline: b025ea16d6
git-subtree-split: d02b3122f0
2017-11-22 16:02:21 -06:00
Deepika a2a7c28191 Upgrade ChanFs to R0.13a 2017-11-20 16:02:39 -06:00
Colin Hogben 452e290821 FATFileSystem: provide working dir_rewind and dir_seek
The index field of FATFS_DIR does not encapsulate all the context
required to reposition the directory traversal.  ChaN provides
f_rewinddir() but no directory seek, so rewind if necessary then step
through until the desired index is reached.
2017-11-16 12:24:04 +00:00
Jimmy Brisson 9dfbf228ec
Merge pull request #5395 from kegilbert/resolve-doxy-warnings-filesystem
Resolve doxygen warning in filesystems docs
2017-11-01 14:07:17 -05:00
Jimmy Brisson 7b2e9b1ad1
Merge pull request #5385 from kegilbert/slicingbd-ctor-rework
SlicingBD: replace second constructor with default parameter
2017-10-30 10:12:19 -05:00
Jimmy Brisson 27533ff16e
Merge pull request #5375 from kegilbert/chainingbd-address-iter-fix
ChainingBlockDevice: changing blocks address fix
2017-10-30 10:09:51 -05:00
Kevin Gilbert b9d2dbafcf Resolve doxygen warning in filesystems 2017-10-27 18:18:04 -05:00
Kevin Gilbert 84e3110b6f Replace second SlicingBD ctor with default arg
Replace second ctor in SlicingBlockDevice with default parameter for the end address in first ctor
2017-10-26 11:49:35 -05:00
Kevin Gilbert a746f95a8b Change address subtraction when moving through block devices to be the size of the entire block device not the block size 2017-10-24 18:31:46 -05:00
Kevin Gilbert 1cfaa4a4e6 Add additional information on the block parameter in the HeapBlockDevice ctor 2017-10-17 19:03:39 -05:00
Kevin Gilbert 86fa6771bd Add erase to example
Use defined blocksize constant
2017-10-10 17:19:24 -05:00
Kevin Gilbert 37b3b40e2a Update HeapBlockDevice example in header file to compile 2017-10-10 16:19:13 -05:00
Jimmy Brisson 5a018585c6 Merge pull request #5183 from geky/fix-dir-open-failures
fs: Fix dir open during failure condition
2017-09-28 13:59:28 -05:00
Jimmy Brisson 79440ae17b Merge pull request #4994 from 0x6d61726b/patch-1
missing includes for filesystem.cpp (build with VisualGDB fails)
2017-09-25 10:11:43 -05:00
Christopher Haster a6b3b55eb9 fs: Fix dir open during failure condition
Should leave the Dir in an openable state, currently does not
since it thinks it's in use by the fs it failed to open on.
2017-09-22 18:39:52 -05:00
Christopher Haster ee88097cb6 fatfs: Adopted the trim function in the FAT filesystem 2017-09-05 11:16:15 -05:00