Commit Graph

55 Commits (1403dfc086b406650d4b3b38b38835b415cc55c9)

Author SHA1 Message Date
Deepika 6ee4c7e219 Fix doxygen warnings in 'features/filesystem' 2017-06-08 15:48:21 -05:00
Sam Grove 6002bdd533 Merge pull request #4439 from sg-/proper-realtek-fix
Proper fix for 1fa30b7403
2017-06-06 16:00:55 -05:00
Sam Grove 02bf926ffb Proper fix for 1fa30b7403
Replace #define with typedef
2017-06-04 11:26:21 -05:00
Sam Grove 0da63eef2b Merge pull request #4087 from geky/localfs-fslike-fix
LocalFileSystem: Repair the FileSystemLike hooks
2017-06-04 08:35:26 -05:00
Sam Grove 1fa30b7403 Resolve conflict in builtin type names
In class MBRBlockDevice the tole32 function had used union member
names u32 and u8. The introduction of REALTEK_RTL8195AM cauesd a
conflict with type names in basic_types given they're aliased as
macros to uint32_t and uint8_t respectively.
2017-06-03 18:12:28 -05:00
Christopher Haster 0fc5ce2b5e LocalFileSystem: Moved away from deprecated open functions
The old open/opendir functions did not provide a route for errors and
relied on implementations manually setting errno. Updated to return
errors directly.
2017-06-03 13:18:02 -05:00
Christopher Haster eed1cec5d8 FileSystem: Provided default implementations for all non-file operations 2017-06-03 13:18:01 -05:00
Christopher Haster 5d6fc713fb FileSystem: Reintegrated FileSystemLike interface
Required for other representations of FileSystems, ie LocalFileSystem

Introduces FileSystemHandle for the same behaviour as FileHandle and
DirHandle.

Requires the following to hook into file/dir lookup:
```
int open(FileHandle **file, const char *filename, int flags)
int open(DirHandle **dir, const char *path)
```

This hook is provided by the FileSystem class, so requires no changes
from implementations.
2017-06-03 13:17:37 -05:00
Christopher Haster c0aa841ffd FAT: Added support for block sizes of 512-4096 bytes
This is necessary for support of block devices with >512 byte
blocks, such as most SPI flash parts.

- Enabled support of up to 4096 byte blocks
- Added support for heap-backed buffers using _FS_HEAPBUF
  - Necessary to avoid stack overflows
  - Avoids over-aggresive allocations of _MAX_SS
- Enabled _FS_TINY to further reduce memory footprint
  - Haven't found a downside for this yet except for possible
    thread contention
2017-06-03 07:10:48 +01:00
Kevin Bracey 533910cb87 Correct return type of FileHandle::size()
File size should be off_t, not size_t.
2017-05-31 15:02:11 +03:00
Christopher Haster 3ee77e36f7 FAT: Fixed volume count check when formatted without MBR
This saves 64 blocks (32KB when used with 512B blocks) and drops
the minimum storage size from 64KB to 32KB.
2017-05-25 14:24:17 -05:00
Christopher Haster 3f92a15960 FAT: Added support for multiple active filesystems
- Increased _VOLUMES to 4
- Fixed a few issues in the FATFileSystem's _fsid
- Added tests for multiple partitions of fatfs
2017-05-24 11:18:47 -05:00
Christopher Haster d1468a68ab FAT: Removed implicit MBR from FAT filesystem during format
- Implicit MBR still allowed during mount
  - maintains storage compatibility
- Not needed
  - MBR utility is not exposed through the FAT filesystem,
    so the only used partition was always the first. Omitting
    the MBR is functionally equivalent
  - Saves a few blocks on storage for MBR + offset
    for FAT alignment
- Duplicated with MBRBlockDevice
  - The implicit MBR actually prevents nesting a FAT filesystem
    in the MBRBlockDevice
2017-05-23 11:56:00 -05:00
Christopher Haster 590a40d9bf bd: Added MBRBlockDevice for handling a master boot record on a block device 2017-05-23 11:55:57 -05:00
Christopher Haster fd80dcc51b Filesystem: Include '.' and '..' in directory iteration
The standard is intentionally vague on if filesystems must
have '.' and '..' entries, allowing filesystems to omit this
concept completely:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html

However, the '.' and '..' entries are common on FAT filesystems
and in most other filesystems.

This enables '.' and '..' entries in the FAT filesystem.
2017-04-13 14:30:57 -05:00
Christopher Haster 18bab4e024 Filesystem: Fixed typo in param naming 2017-03-14 11:04:22 -05:00
Christopher Haster 90fc0b9c47 FileSystem: Reverted deprecation of DirHandle
Should follow same path as FileHandle, although this is less used
and there is currently no route to introduce a hook for a customized
DirHandle in retarget.
2017-03-14 11:02:34 -05:00
Christopher Haster 61c9683644 Filesystem: Moved retarget related file interfaces into platform 2017-03-14 11:02:34 -05:00
Christopher Haster 77243ef46b Filesystem: Revert deprecation of FileHandle
As identified by @hasnainvirk, @kjbracey-arm, the FileHandle and
FileBase serve two separate functions and their integration is
limiting for certain use cases.

FileLike is actually the redundant class here, but the multiple
inheritance it provides is used as a hack by the retargeting code
to get at the FileHandle implementation bound to the FileBase name.

It may make more sense for the FileBase to inherit from FileHandle,
(with perhaps a different name), but rather than explore the
possibility, this will just restore the previous hierarchy.
2017-03-14 11:02:34 -05:00
Christopher Haster 31e0875cd1 bd: Fix missing const attributes on functions 2017-03-01 16:11:40 -06:00
Christopher Haster c4649afba5 Filesystem: Last minute changes due to feedback on directory iteration
- Changed to use dirent structure type
- Fixed memory leak in closedir
2017-02-24 12:03:14 -06:00
Christopher Haster b9122c73f9 Filesystem: Integrate error handling between c++/posix layers 2017-02-24 12:03:09 -06:00
Christopher Haster c6b1fcbfa5 Filesystem: Integrate filesystem classes with common mbed.h entry point 2017-02-24 11:56:45 -06:00
Christopher Haster eea5c9f08a Filesystem: Integration with retarget code 2017-02-24 11:55:37 -06:00
Christopher Haster e5197ceaca Filesystem: Initial integration with the FATFileSystem 2017-02-24 11:53:17 -06:00
Christopher Haster ee3e920ed1 Filesystem: Moved toolchain-specific types into retarget.h 2017-02-24 11:42:32 -06:00
Christopher Haster a5245e32fe Filesystem: Created prototypical filesystem class
Intention is to make filesystem api and network stack api consistent
as current designs diverge greatly. Attempted to change as little as
possible outside of api structure.
2017-02-24 11:41:34 -06:00
Christopher Haster 2cf67734c4 Filesystem: Remove invalid write to unallocated memory in heap block device 2017-02-23 20:41:38 -06:00
Simon Hughes 410c2f8dc0 STORAGE: rebased with master and fixed FATFileSystem.cpp merge conflicts. 2017-02-23 16:50:34 +00:00
Simon Hughes 9a1966fadb STORAGE: fixes for BlockDevice test cases. 2017-02-23 16:39:51 +00:00
Christopher Haster ea5ac4bb4d Storage: Last minute changes to the block device api
- Remove write set of functions
  - Caused confusion with small benefit
  - Trivial to add later
- Remove unused error codes
  - Initial expirementation indicates most of these may not be useful
  - Trivial to add later
- Removed bd_error_t
  - Carries to additional type information, int already carries
    sufficient connotation
  - Trivial to add later

per @c1728p9, @sg-
2017-02-23 16:39:49 +00:00
Simon Hughes 840c77793b STORAGE: Pull request 3762 review feedback changes.
- Fixing code formatting errors with astyle tool.
- Replaced use of TOOLCHAIN_xxx macros with compiler emitted macros.
- Added const to BlockDevice::get_xxx_size() member functions.
- Added documentation for FAT filesystem thread support.
- Added documentation for fat_filesystem_set_errno().
- Added documentation clarifying the reasons for errno/stat symbol definitions in retarget.h.
- Removed FAT filesystem from mbed 2 testing.
- Fixed FATMisc.h Copyright (c) 2016 year to 2017 as its a new file.
- Removed #ifndef NDEBUG from HeapBlockDevice.cpp.
- Removed unnecessary todo comment in retarget.cpp.
2017-02-23 16:39:42 +00:00
Simon Hughes b8e31c8156 Removal of SD card driver (SDBlockDevice module) and related test cases (moved into https://github.com/ARMmbed/sd-driver repository). 2017-02-23 16:39:36 +00:00
Simon Hughes 3e35d4bb81 STORAGE: added test case to write/check n x 25kB files storing ~250kB data. 2017-02-23 16:39:32 +00:00
Christopher Haster cbcc445f54 Added d_type member of dirent struct to readdir 2017-02-23 16:39:25 +00:00
Simon Hughes 2b96c74f84 STORAGE: Pull Request 3704 requested minor changes including:
- renaming FATFileSystemSetErrno() fat_file_system_set_errno.
- changing FATFileSystem::format() to be mount fs internally in function, rather than expecting fs to be mounted.
- requested const char *filename change.
2017-02-23 16:39:21 +00:00
Simon Hughes fdadb8cc66 STORAGE: moved toolchain_support.h into platform/retarget.h 2017-02-23 16:39:18 +00:00
Simon Hughes 860d7f03f2 STORAGE: fixing error handling for fopen() and other upper edge filesystem API methods.
- integrated work with new block api.
- Conflicts: features/filesystem/fat/FATFileSystem.cpp
2017-02-23 16:39:11 +00:00
Simon Hughes 0b7a2ca030 STORAGE: fixes for merging in format test with new block device implementation of format. 2017-02-23 16:38:22 +00:00
Simon Hughes 01baa72ab9 STORAGE: change FATFileSystem::format() to include allocation_unit argument, to facilitate fixing of inconsistent file systems.
Conflicts:
	features/filesystem/fat/FATFileSystem.cpp
	features/filesystem/fat/FATFileSystem.h
2017-02-23 16:38:19 +00:00
Simon Hughes 4f5e94c746 STORAGE: test case fixes to support ARMCC and IAR toolchains.
Conflicts:
	features/TESTS/filesystem/fopen/fopen.cpp
2017-02-23 16:38:15 +00:00
Christopher Haster 0176450c5a bd: Adopted the block storage api in the FATFileSystem 2017-02-23 16:37:13 +00:00
Christopher Haster ba5e1427fc bd: Added utility block device classes
- ChainingBlockDevice
- SlicingBlockDevice
2017-02-23 16:36:27 +00:00
Christopher Haster 03a332c5eb bd: Adopted the block device api in the SDBlockDevice 2017-02-23 16:36:25 +00:00
Christopher Haster 4633d3129d bd: Adopted the block device api in the HeapBlockDevice
Port of MemBlockDevice from mbed 2
2017-02-23 16:36:22 +00:00
Christopher Haster 99698379ef bd: Added prototype block device api 2017-02-23 16:36:20 +00:00
Simon D Hughes aefb03ccd6 ARMCC temporary fixes for undefined errno symbols. 2017-02-23 16:36:16 +00:00
Simon D Hughes 29f8d838d0 STORAGE: updated filesystem readme.md. 2017-02-23 16:36:10 +00:00
Simon Hughes 8378af044f Updated filesystem README.md. 2017-02-23 16:36:06 +00:00
Simon Hughes 0c87537f10 Added errno codes to retarget, mkdir() and ftell() tests. 2017-02-23 16:36:03 +00:00