FAT Filesystem implementation additions

This commit is contained in:
2023-10-27 18:07:11 +02:00
parent 64c87a2a58
commit e82392e9d9
7 changed files with 101 additions and 74 deletions

View File

@ -80,20 +80,37 @@ FILE* VirtualFileSystem::open(const char* pathname, int flags){
}
// let's just loop through the folder first
printf("looking for: ");
for(int i = 0; i < 5; i++)
kterm_put(nextdir[i]);
kterm_put('\n');
auto* child = rootentry->children;
while(child->next != nullptr){
auto* directory = (DirectoryNode*)child->data;
for(int i = 0; i < 11 ; i++)
kterm_put(directory->name[i]);
kterm_put('\n');
if( directory->compare(directory, directory->name, nextdir) == 0){
nextdir = strtok(nullptr, "/", &tokstate);
printf("Found dir!\n");
if(nextdir == NULL){
file->root = directory->node;
file->flags =0;
file->read = FAT::Read;
return file;
}
printf("continue searching next directory!\n");
if(directory->children == nullptr)
directory->node->lookup(directory->node, directory);
child = directory->children;
}else{
child = child->next;
}
child = child->next;
}