Blame
|
1 | # Filesystem Layer |
||||||
| 2 | ||||||||
| 3 | ```mermaid |
|||||||
|
4 | --- |
||||||
|
5 | title: Filesystem Structures |
||||||
|
6 | --- |
||||||
| 7 | classDiagram |
|||||||
|
8 | class vmp_t{ |
||||||
|
9 | block_device-t *dev_driver; |
||||||
| 10 | vfs_fs_t *fs_driver; |
|||||||
| 11 | char name[16]; |
|||||||
|
12 | uint8_t block_buff[BLOCK_DEVICE_BLOCK_SIZE]; |
||||||
| 13 | unsigned int mounted : 1; |
|||||||
| 14 | unsigned int read_only : 1; |
|||||||
| 15 | uint8_t subdev; |
|||||||
|
16 | union fs_data; |
||||||
|
17 | } |
||||||
| 18 | class block_device_t { |
|||||||
|
19 | bool_t active; |
||||||
| 20 | char name[16]; |
|||||||
| 21 | uint8_t num_sub_devices; |
|||||||
| 22 | ||||||||
| 23 | int (*init)(block_device_t *dev); |
|||||||
| 24 | int (*finish)(void); |
|||||||
| 25 | ||||||||
| 26 | int (*read_block)(uint32_t block_num, uint8_t *buff, uint8_t subdev); |
|||||||
| 27 | int (*write_block)(uint32_t block_num, uint8_t *buff, uint8_t subdev); |
|||||||
| 28 | ||||||||
| 29 | void *driver_data; |
|||||||
|
30 | } |
||||||
|
31 | class vfs_fs_t { |
||||||
|
32 | uint8_t type; |
||||||
| 33 | int (*handles_path)(const char *pathname); |
|||||||
| 34 | char *name; |
|||||||
| 35 | block_device_t *dev; |
|||||||
| 36 | vfs_t api; |
|||||||
|
37 | } |
||||||
|
38 | class fs_data <<union>> { |
||||||
| 39 | ext2_fs_t e2fs; |
|||||||
|
40 | } |
||||||
|
41 | |||||||
|
42 | block_device_t <|-- vmp_t |
||||||
|
43 | vfs_fs_t <|-- vmp_t |
||||||
|
44 | |||||||
|
45 | ``` |
||||||
|
46 | > [!NOTE] |
||||||
| 47 | > This diagram is evolving as I am in the process of implementing |
|||||||
| 48 | > the code for this. Anything could change, so come back often. |
|||||||