aboutsummaryrefslogtreecommitdiff
path: root/os/filesystem/ramfs.c
blob: 0c0fdff6c51b5337ce6287d3e6fe89e1680deb75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "ramfs.h"
#include "../../kernel/gpu/text_mode/display.h"

#include "../stdlib/sdtlib.h"

#define RAMDISK_SIZE 102400 // 100 blocks
#define BLOCK_SIZE 1024
#define MAX_FILES 128 // fixed size until mem management done

unsigned char ramdisk[RAMDISK_SIZE];

File_t files[MAX_FILES];
int tip_file_idx = -1;

File_t* ramfs_list_files() {
  return files;
}

int ramfs_get_tip_file_idx() {
  return tip_file_idx;
}

File_t ramfs_create_file(unsigned char *filename) {
  int i = ++tip_file_idx;
  strcpy(filename, files[i].name);
  return files[i];
}