Virtual File System #10

Merged
apio merged 7 commits from vfs into main 2022-10-10 18:25:43 +00:00

7 Commits

Author SHA1 Message Date
da2ede3450 Kernel, libc, userspace: Implement file descriptors
Kernel: Implement a descriptor struct which stores the opened node and read offset, and give each task 8 of those.
Implement three syscalls: sys_read, sys_open and sys_close (sys_write still writes to the console instead of using a fd, for now)
Implement three new errors: ENOENT, EBADF and EMFILE.

libc: Implement the new errors, and the new syscalls in syscall().
Also fix _RETURN_WITH_ERRNO() to set errno correctly, which was making strerror() return null, thus crashing perror().

userspace: make init demonstrate the new file API.
2022-10-10 20:21:39 +02:00
63b2de4e3c Basic FDs 2022-10-10 19:00:24 +02:00
bbe7c6e658 VFS: Implement resolve_path and form the initial ramdisk's VFS properly
Finally, resolve_path: a function which takes a path (/etc/fstab for example), and walks the VFS:
In this case, it would start with the root FS node, and ask it: "do you have a directory/file named etc?"
The node could say 'yes', 'no', or 'i'm not a directory, I'm a file' (should not be the case for the VFS root, but for the other ones it could be)
If it says yes, we continue and ask the child if it has a file named fstab. Etc...
2022-10-10 18:44:43 +02:00
2be70d0bc1 VFS: Use 64-bit numbers in read()
There is no need for any kind of 32-bit compatibility.
2022-10-09 21:30:38 +02:00
8158ddc94f VFS: be more verbose 2022-10-09 21:19:22 +02:00
b38c52f8c7 more vfs stuff 2022-10-08 21:35:19 +02:00
f3d7e220ac The beginnings of a VFS implementation!! 2022-10-08 21:22:46 +02:00