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 | class vfile_t { |
||||||
| 43 | char path[PATH_MAX] |
|||||||
| 44 | bool_t open |
|||||||
| 45 | vmp_t *mp |
|||||||
| 46 | union file_fs_data |
|||||||
| 47 | } |
|||||||
| 48 | class file_fs_data <<union>> { |
|||||||
| 49 | ext2_dirp_t e2dir |
|||||||
| 50 | } |
|||||||
| 51 | ||||||||
|
52 | block_device_t <|-- vmp_t |
||||||
|
53 | vfs_fs_t <|-- vmp_t |
||||||
|
54 | |||||||
|
55 | ``` |
||||||
|
56 | > [!NOTE] |
||||||
| 57 | > This diagram is evolving as I am in the process of implementing |
|||||||
| 58 | > the code for this. Anything could change, so come back often. |
|||||||