2022-10-08 19:22:46 +00:00
|
|
|
#pragma once
|
2022-10-09 19:30:38 +00:00
|
|
|
#include <stddef.h>
|
2022-10-08 19:22:46 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-10-09 19:30:38 +00:00
|
|
|
typedef long ssize_t;
|
|
|
|
|
2022-10-08 19:22:46 +00:00
|
|
|
namespace VFS
|
|
|
|
{
|
|
|
|
struct Node;
|
|
|
|
|
2022-10-09 19:30:38 +00:00
|
|
|
typedef ssize_t (*node_read)(Node*, size_t, size_t, char*);
|
2022-10-08 19:22:46 +00:00
|
|
|
typedef Node* (*node_finddir)(Node*, const char*);
|
|
|
|
|
|
|
|
struct Node
|
|
|
|
{
|
|
|
|
char name[64];
|
|
|
|
uint64_t inode;
|
2022-10-08 19:35:19 +00:00
|
|
|
uint64_t length;
|
2022-10-08 19:22:46 +00:00
|
|
|
node_read read_func;
|
|
|
|
node_finddir find_func;
|
|
|
|
};
|
|
|
|
|
2022-10-09 19:30:38 +00:00
|
|
|
ssize_t read(Node* node, size_t offset, size_t length, char* buffer);
|
2022-10-08 19:22:46 +00:00
|
|
|
Node* open(const char* filename);
|
2022-10-09 19:19:22 +00:00
|
|
|
|
2022-10-08 19:22:46 +00:00
|
|
|
void mount_root(Node* root);
|
2022-10-09 19:19:22 +00:00
|
|
|
|
|
|
|
Node* root();
|
2022-10-08 19:22:46 +00:00
|
|
|
}
|