diff --git a/kernel/inc/drivers/fs/vfs.h b/kernel/inc/drivers/fs/vfs.h index 6b3decf..01bb3cd 100644 --- a/kernel/inc/drivers/fs/vfs.h +++ b/kernel/inc/drivers/fs/vfs.h @@ -59,6 +59,7 @@ void vfs_node_cache_destruct (vfs_node_cache_T* node_cache); vfs_node_T* vfs_node_create (vfs_node_T* parent, string_t name, vfs_node_type_E type, void* specific); void vfs_node_destruct (vfs_node_T* node); +void vfs_node_delete (vfs_node_T* node); void vfs_node_dump_info (vfs_node_T* node, uint64_t indent); vfs_node_T* vfs_node_resolve_child (vfs_node_T* node, string_t child_name); diff --git a/kernel/src/drivers/fs/vfs.c b/kernel/src/drivers/fs/vfs.c index 586ec6d..da0484b 100644 --- a/kernel/src/drivers/fs/vfs.c +++ b/kernel/src/drivers/fs/vfs.c @@ -157,6 +157,22 @@ void vfs_node_destruct(vfs_node_T* node) { } +void vfs_node_delete(vfs_node_T* node) { + switch (node->type) { + case VFS_NODE_FILE: { + vfs_file_delete(node); + break; + } + case VFS_NODE_DIRECTORY: { + vfs_directory_delete(node); + } + default: { + break; + } + } +} + + vfs_node_T* vfs_node_resolve_child(vfs_node_T* node, string_t child_name) { vfs_node_T* child = node->childs; while (child != NULL) {