feature (VFS): implemented a general 'vfs_node_delete'

This commit is contained in:
antifallobst 2023-04-20 15:30:19 +02:00
parent 6d102f6520
commit 2105446463
2 changed files with 17 additions and 0 deletions

View File

@ -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);

View File

@ -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) {