VFS mount/umount + sys_open/close/read/fake write

This commit is contained in:
2026-04-10 14:31:38 +02:00
parent 17589d72cf
commit aff113d02b
10 changed files with 592 additions and 12 deletions
+50
View File
@@ -0,0 +1,50 @@
/*
* @author xamidev <xamidev@riseup.net>
* @brief Virtual filesystem layer
* @license GPL-3.0-only
*/
/*
PepperOS will not work like the Unix-based mountpoint approach,
but rather like what Windows does. Filesystems will be separated
into "drives", and each drive will have a number assigned.
*/
#ifndef VFS_H
#define VFS_H
#include <limine.h>
#include <stddef.h>
#include <stdint.h>
typedef enum
{
DRIVE_TAR
} DriveType;
struct drive
{
unsigned int id;
DriveType type;
struct fs_operations* operations;
struct drive* next;
};
struct fs_operations
{
int (*open)(const char* path, int flags);
int (*close)(int fd);
int64_t (*read)(int fd, char* buf, size_t count);
int64_t (*write)(int fd, char* buf, size_t count);
};
int vfs_mount(struct limine_file* file, DriveType type);
int vfs_umount(unsigned int drive_id);
int vfs_open(const char* path, int flags);
int vfs_close(int fd);
int64_t vfs_read(int fd, char* buf, size_t count);
int64_t vfs_write(int fd, const char* buf, size_t count);
#endif