A toy operating system written in C.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
786 B

#pragma once
#include "src/kernel/stream.h"
#define FILENAME_SIZE_LIMIT 255
typedef struct fs_node {
char name[FILENAME_SIZE_LIMIT + 1];
uint32_t size;
uint8_t is_dir;
uint8_t type;
} fs_node_t;
fs_node_t *fs_mount();
fs_node_t *fs_open_by(const fs_node_t *directory, const char *name, uint64_t flags);
fs_node_t *fs_open_at(const fs_node_t *directory, uint16_t index, uint64_t flags);
fs_node_t *fs_open_again(const fs_node_t *source);
stream_t *fs_open_stream(const fs_node_t *source);
void fs_read(const fs_node_t *file, uint32_t offset, uint32_t bytes, void *to);
void fs_write(fs_node_t *file, uint32_t offset, const void *from, uint32_t bytes);
void fs_truncate(fs_node_t *file, uint32_t size);
void fs_close(fs_node_t *node);
void fs_unmount(fs_node_t *fs);