Skip to content

Commit e7a1afa

Browse files
author
Amanda Butler
authored
Make PR from #324
Make new PR from old PR I'm closing to avoid merge conflicts.
1 parent 2a79380 commit e7a1afa

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed
Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
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 file systems and their underlying block device support. The <a href="/docs/v5.6/reference/storage-overview.html" target="_blank">storage API page</a> 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 <a href="https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/class_heap_block_device.html" target="_blank">BlockDevice</a> class to provide support for unsupported storage.
8+
9+
If you want to port a new file system to Mbed OS on existing storage options you can skip to the following section.
10+
11+
#### File systems
12+
13+
To implement a new file system in Mbed OS, an implementor needs to provide the abstract functions in the file system interface. The <a href="https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/class_f_a_t_file_system.html" target="_blank">FAT file system</a> provides an excellent example.
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 file system may implement:
24+
25+
[![View code](https://www.mbed.com/embed/?type=library)](https://os-doc-builder.test.mbed.com/docs/v5.7/mbed-os-api-doxy/classmbed_1_1_file_system.html)
26+
27+
File systems must be backed by a block device in Mbed OS. If you are using supported hardware, then you can use the Mbed OS block device classes. Otherwise, view the block device porting section earlier in this guide.
28+
29+
#### Related content
30+
31+
- <a href="https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/class_heap_block_device.html" target="_blank">BlockDevice</a>.
32+
- <a href="https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/class_f_a_t_file_system.html" target="_blank">FAT file system</a>.

0 commit comments

Comments
 (0)