Skip to content

Commit 7a50edb

Browse files
committed
Preliminary split of storage overview docs
1 parent f6ab742 commit 7a50edb

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed
Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
<h2 id="contributing-storage">Storage</h2>
22

3-
The two storage APIs are BlockDevice and FileSystem. These APIs provide filesystem and file operations on a block device, as well as an interface for access to block-based storage.
3+
Storage support is split between filesystems and their underlying block device support. The [storage API page](/docs/v5.6/reference/storage-overview.html) has more information on existing APIs in Mbed OS for both interfaces.
4+
5+
#### Block Device
6+
7+
Adding a block device implementation is required for backing filesystems on new hardware. You can extend the [BlockDevice](https://github.com/ARMmbed/mbed-os/blob/master/features/filesystem/bd/HeapBlockDevice.h) class to provide support for unsupported storage.
8+
9+
If you want to port a new filesystem to Mbed OS on existing storage options you can skip to the following section.
10+
11+
#### Filesystems
12+
13+
To implement a new file system in Mbed OS, an implementor just needs to provide the abstract functions in the file system interface. The [FAT file system](https://github.com/ARMmbed/mbed-os/blob/master/features/filesystem/fat/FATFileSystem.cpp) provides an excellent example, you can find tests of the POSIX API here.
14+
15+
A minimal file system needs to provide the following functions:
16+
17+
- `file_open`.
18+
- `file_close`.
19+
- `file_read`.
20+
- `file_write`.
21+
- `file_seek`.
22+
23+
Here is the full API that a filesystem may implement:
24+
25+
[![View code](https://www.mbed.com/embed/?type=library)](https://github.com/ARMmbed/mbed-os/blob/master/features/filesystem/FileSystem.h#L205)
26+
27+
Filesystems must be backed by a block device in Mbed OS. If you are using supported hardware then you can continue, otherwise view the block device porting section above.

0 commit comments

Comments
 (0)