working on reading elf from initrd, and getting it launched with the new scheduler

This commit is contained in:
2026-06-30 19:26:31 -05:00
parent ce81d4eb31
commit af6c1c94cf
21 changed files with 253 additions and 151 deletions

View File

@@ -22,22 +22,22 @@ vfs_node_t* vfs_create_root() {
void mount(vfs_node_t* _mnt, vfs_node_t* _fs) {
if (!_fs || !_mnt || !(_mnt->flags & VFS_DIRECTORY)) return;
_mnt->ptr = _fs;
_mnt->mnt = _fs;
}
static vfs_node_t* lookup(const char* path) {
if (path[0] != '/') return NULL;
vfs_node_t* current = root;
if (current->ptr) {
current = current->ptr;
if (current->mnt) {
current = current->mnt;
}
const char* component = path + 1;
if (*component == '\0') return current;
const char* cmp = path + 1;
if (*cmp == '\0') return current;
if (current->finddir) {
return current->finddir(current, component);
return current->finddir(current, cmp);
}
return NULL;
@@ -72,6 +72,22 @@ int read(int fd, void* buf, size_t sz) {
return bytes_read;
}
int fseek(int fd) {
}
int fstat(int fd, file_t* dst) {
if (fd < 0 || fd >= MAX_PROCESS_FDS || !fd_table[fd].node) {
return 0;
}
file_t* src = &fd_table[fd];
memcpy(src, dst, sizeof(file_t));
return 1;
}
int fseek(int fd, size_t offset) {
if (fd < 0 || fd >= MAX_PROCESS_FDS || !fd_table[fd].node) {
return 0;
}
file_t* file = &fd_table[fd];
file->offset = offset;
return 1;
}