syscalls: improve working with files using vfs

This commit is contained in:
2025-08-17 16:03:41 +03:00
parent caa4005990
commit 9fdc551308
8 changed files with 58 additions and 21 deletions
+5 -2
View File
@@ -6,6 +6,7 @@
#include "../include/string.h"
#include "../include/screen.h"
#include "../include/fat.h"
#include "../include/vfs.h"
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
@@ -157,7 +158,8 @@ int sys_read(TrapFrame *tf)
{
return -EBADF;
}
return 0;//fat_fread(current->file_descriptors[tf->ebx], (void*)tf->ecx, tf->edx);
return vfs_read_file_length(current->file_descriptors[tf->ebx], (uint8_t*)tf->ecx, tf->edx);
//return 0;//fat_fread(current->file_descriptors[tf->ebx], (void*)tf->ecx, tf->edx);
}
}
@@ -208,7 +210,8 @@ int sys_open(TrapFrame *tf)
//debug_log("\n====i: %X\n", i);
if(current->file_descriptors[i] == NULL)
{
current->file_descriptors[i] = malloc(sizeof(file_t)); // Kernel malloc
current->file_descriptors[i] = (l9660_file*)malloc(sizeof(l9660_file)); // Kernel malloc
l9660_openat(current->file_descriptors[i], root_dir, filename);
//debug_log("\n====FILE_DESCRIPTOR: %X\n", i);
int result = 0;//fat_fopen(current->file_descriptors[i], filename, mode_str);
if (result < 0) {