Luna/kernel/include/fs/VFS.h
apio 0a7d4a530d VFS, DeviceFS: Implement a device filesystem
For now, we just have a version device. (this will allow us to get rid of sys_getversion!!)
More should be implemented soon.
2022-10-11 19:21:16 +02:00

46 lines
997 B
C++

#pragma once
#include <stddef.h>
#include <stdint.h>
typedef long ssize_t;
#define VFS_FILE 0x0
#define VFS_DIRECTORY 0x1
#define VFS_MOUNTPOINT 0x1
namespace VFS
{
struct Node;
typedef ssize_t (*node_read)(Node*, size_t, size_t, char*);
typedef Node* (*node_finddir)(Node*, const char*);
typedef int (*node_mkdir)(Node*, const char*);
struct Node
{
char name[64];
uint64_t inode;
uint64_t length;
int type;
int flags;
node_read read_func;
node_finddir find_func;
node_mkdir mkdir_func;
Node* link;
};
ssize_t read(Node* node, size_t offset, size_t length, char* buffer);
int mkdir(const char* path, const char* name);
void mount_root(Node* root);
Node* resolve_path(const char* filename, Node* root = nullptr);
void mount(Node* mountpoint, Node* mounted);
void mount(const char* pathname, Node* mounted);
void unmount(Node* mountpoint);
Node* root();
}