aboutsummaryrefslogtreecommitdiff
path: root/docs/FILESYSTEM
blob: a1bdc1e4bc3dd797e7b2a55f5818f3e6803e638b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
=== Virtual Filesystem Design ===

The virtual (in-RAM) filesystem is made of levels of nodes.

            NULL
             |
            [/] --- NULL
             |
           [bin] --------------------------- [etc] ---------------------- [home] --- [var] --- NULL
             |                                 |
           [cat] --- [cd] --- [ls] --- NULL [group] --- [passwd] --- NULL

=== Sample Implementation ===

struct vfs_node {
    unsigned int flags;
    unsigned int name_len;
    char *name;
    uint64_t file_len;
    unsigned char *contents;
    struct vfs_node *parent;
    struct vfs_node *next;
    struct vfs_node *child;
};

=== The 'flags' field ===

= Bits 0-1 =

The next three values are mutually exclusive.

0: directory
1: regular file
2: special file