diff --git a/inode.c b/inode.c index 2999bae..3f5ecca 100644 --- a/inode.c +++ b/inode.c @@ -1 +1,25 @@ #include "inode.h" + +Inode* find_inode(char filename[], struct inode_table* itable) { + for (uint32_t i = 0; i < itable->size; i++) { + if (strcmp(filename, itable->inodes[i]->name)) { + return itable->inodes[i]; + } + } + return NULL; +} + +bool inode_exists(struct inode_table* itable, char filename[]) { + for (uint32_t i = 0; i < itable->size; i++) { + if (strcmp(filename, itable->inodes[i]->name)) { + return true; + } + } + return false; +} + +void delete_inode(struct inode_table* itable, char filename[]) { + Inode* wanted_inode = find_inode(filename, itable); + free(wanted_inode); + wanted_inode = NULL; +}