30 lines
815 B
C
30 lines
815 B
C
|
|
#ifndef KVFS_H
|
||
|
|
#define KVFS_H
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
#define VFS_FILE 0x01
|
||
|
|
#define VFS_DIRECTORY 0x02
|
||
|
|
|
||
|
|
struct vfs_node;
|
||
|
|
|
||
|
|
typedef uint32_t (*read_type_t)(struct vfs_node* node, uint32_t offset, uint32_t size, uint8_t* buffer);
|
||
|
|
typedef uint32_t (*write_type_t)(struct vfs_node* node, uint32_t offset, uint32_t size, uint8_t* buffer);
|
||
|
|
typedef struct vfs_node* (*finddir_type_t)(struct vfs_node* node, const char* name);
|
||
|
|
|
||
|
|
typedef struct vfs_node {
|
||
|
|
char name[128];
|
||
|
|
uint32_t flags; // File, directory, device, etc.
|
||
|
|
uint32_t size; // Size of file in bytes
|
||
|
|
uint32_t inode; // Unique identifier managed by the specific filesystem
|
||
|
|
|
||
|
|
read_type_t read;
|
||
|
|
write_type_t write;
|
||
|
|
finddir_type_t finddir;
|
||
|
|
|
||
|
|
struct vfs_node* mount;
|
||
|
|
} vfs_node_t;
|
||
|
|
|
||
|
|
void vfs_create_root();
|
||
|
|
|
||
|
|
#endif
|