50 lines
1.0 KiB
C
50 lines
1.0 KiB
C
/*
|
|
* @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 |