aboutsummaryrefslogtreecommitdiff
path: root/docs/FILESYSTEM
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/FILESYSTEM34
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/FILESYSTEM b/docs/FILESYSTEM
new file mode 100644
index 0000000..a1bdc1e
--- /dev/null
+++ b/docs/FILESYSTEM
@@ -0,0 +1,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