emmafs/inode.c
2024-10-19 22:20:47 +02:00

25 lines
672 B
C

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