|
3 | 3 | File Systems
|
4 | 4 | ############
|
5 | 5 |
|
| 6 | +Zephyr RTOS Virtual Filesystem Switch (VFS) allows applications to mount multiple |
| 7 | +file systems at different mount points (e.g., ``/fatfs`` and ``/nffs``). The |
| 8 | +mount point data structure contains all the necessary information required |
| 9 | +to instantiate, mount, and operate on a file system. The File system Switch |
| 10 | +decouples the applications from directly accessing an individual file system's |
| 11 | +specific API or internal functions by introducing file system registration |
| 12 | +mechanisms. |
6 | 13 |
|
| 14 | +In Zephyr, any file system implementation or library can be plugged into or |
| 15 | +pulled out through a file system registration API. |
7 | 16 |
|
8 |
| -.. comment |
9 |
| - not documenting |
10 |
| - .. doxygengroup:: file_system |
11 |
| - .. doxygengroup:: file_system_storage |
| 17 | +.. code-block:: c |
12 | 18 |
|
| 19 | + int fs_register(enum fs_type type, struct fs_file_system_t *fs); |
| 20 | +
|
| 21 | + int fs_unregister(enum fs_type type, struct fs_file_system_t *fs); |
| 22 | +
|
| 23 | +Zephyr RTOS supports multiple instances of a file system by making use of |
| 24 | +the mount point as the disk volume name, which is used by the file system library |
| 25 | +while formatting or mounting a disk. |
| 26 | + |
| 27 | +A file system is declared as: |
| 28 | + |
| 29 | +.. code-block:: c |
| 30 | +
|
| 31 | + static struct fs_mount_t mp = { |
| 32 | + .type = FS_FATFS, |
| 33 | + .mnt_point = FATFS_MNTP, |
| 34 | + .fs_data = &fat_fs, |
| 35 | + }; |
| 36 | +
|
| 37 | +where |
| 38 | + |
| 39 | +- ``FS_FATFS`` is the file system type like FATFS or NFFS. |
| 40 | +- ``FATFS_MNTP`` is the mount point where the file system will be mounted. |
| 41 | +- ``fat_fs`` is the file system data which will be used by fs_mount() API. |
| 42 | + |
| 43 | +Known Limitations |
| 44 | +***************** |
| 45 | + |
| 46 | +NFFS supports only one instance of file system due to the library's internal |
| 47 | +implementation limitation. |
| 48 | + |
| 49 | + |
| 50 | +Sample |
| 51 | +****** |
| 52 | + |
| 53 | +A sample of how the file system can be used is supplied in ``samples/subsys/fs``. |
13 | 54 |
|
14 | 55 | API Reference
|
15 | 56 | *************
|
|
0 commit comments