Implemented several functions that operate on inodes.
This commit is contained in:
parent
890c08c2ee
commit
7c84b7bcee
1 changed files with 24 additions and 0 deletions
24
inode.c
24
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue