emmafs/inode.c

26 lines
672 B
C
Raw Permalink Normal View History

2024-10-08 23:01:29 +02:00
#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;
}