Implemented several functions that operate on inodes.

This commit is contained in:
Emma Nora Theuer 2024-10-19 22:20:47 +02:00
parent 890c08c2ee
commit 7c84b7bcee

24
inode.c
View file

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