From 1e8fa8f4e89646339f7b50968d51df88b28b7e54 Mon Sep 17 00:00:00 2001 From: antifallobst Date: Mon, 27 Feb 2023 15:51:54 +0100 Subject: [PATCH] docs: documented vfs functions --- .wiki/Kernel-documentation.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.wiki/Kernel-documentation.md b/.wiki/Kernel-documentation.md index 7cc1f16..355f56d 100644 --- a/.wiki/Kernel-documentation.md +++ b/.wiki/Kernel-documentation.md @@ -396,30 +396,53 @@ The systems root filesystem. Every node resolve will start at this filesystem. #### `vfs_node_cache_create(node, size)` - function (vfs_node_cache_T*) +Allocates a **_size_** bytes big cache segment for **_node_**. #### `vfs_node_cache_destruct(node_cache)` - function (void) +Frees **_node_cache_** and its buffer. #### `vfs_node_create(parent, name, type, specific)` - function (vfs_node_T*) +Allocates a node with the given parameters. +The nodes _fs_ value is inherited from **_parent_**, +or from **_parent_**'s specific value if **_parent_** is a mount point. #### `vfs_node_destruct(node)` - function (void) +Recursively destructs **_node_** and all it's children. #### `vfs_node_dump_info(node, indent)` - function (void) +Prints the complete directory structure starting at **_node_**. +**_indent_** is used for the recursive calls and should be set to 0. #### `vfs_node_resolve_child(node, child_name)` - function (vfs_node_T*) +Searches **_node_** for a child named **_child_name_**. +Returns the first matching child or NULL if no matching child was found. #### `vfs_file_create(filesystem, path)` - function (vfs_node_T*) +Creates a file at **_path_** in **_filesystem_** and returns a pointer to it. +The directory in **_path_** needs to exist and the filename needs to not exist. #### `vfs_file_delete(file)` - function (void) +Deletes **_file_**. #### `vfs_file_write(file, position, size, buffer_in)` - function (void) +Writes **_size_** bytes from **_buffer_in_** at **_position_** into **_file_**. + +**Warning:** the current ramfs implementation will ignore **_position_**! #### `vfs_file_read(file, position, size, buffer_out)` - function (void) +Reads **_size_** bytes from **_file_** at **_position_** into **_buffer_out_**. + +**Warning:** the current ramfs implementation will ignore **_position_**! #### `vfs_init(boot_info)` - function (void) +Initializes the VFS. +In future this will also unpack the initial ramdisk into the _temp_ directory. #### `vfs_resolve_path(filesystem, path)` - function (vfs_node_T*) +Returns the node at **_path_** or NULL if **_path_** is invalid. -#### `vfs_unpack_archive_ustar(node, archive)` - function (void) +#### `vfs_unpack_archive_ustar(node, archive)` - function (void) [Not Implemented yet] +This will unpack a USTAR-archive (**_archive_**) at **_node_**. ### graphics/color.h