aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/fs')
-rw-r--r--src/kernel/fs/ata.c120
-rw-r--r--src/kernel/fs/ata.h46
-rw-r--r--src/kernel/fs/elf.c100
-rw-r--r--src/kernel/fs/elf.h82
-rw-r--r--src/kernel/fs/ext2.c230
-rw-r--r--src/kernel/fs/ext2.h154
-rw-r--r--src/kernel/fs/fs.c61
-rw-r--r--src/kernel/fs/fs.h11
-rw-r--r--src/kernel/fs/load.c12
-rw-r--r--src/kernel/fs/load.h17
10 files changed, 0 insertions, 833 deletions
diff --git a/src/kernel/fs/ata.c b/src/kernel/fs/ata.c
deleted file mode 100644
index 2e952a1..0000000
--- a/src/kernel/fs/ata.c
+++ /dev/null
@@ -1,120 +0,0 @@
-#include <fs/ata.h>
-#include <io/io.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <system.h>
-
-static u16 sel_base_port = 0;
-static u8 sel_master_or_slave = 0;
-
-static u32 max_sector;
-
-static u8 read_stat(u16 base)
-{
- inb(base + COM_STAT);
- inb(base + COM_STAT);
- inb(base + COM_STAT);
- inb(base + COM_STAT);
-
- return inb(base + COM_STAT);
-}
-
-static void check_drive(u16 base, u8 master_or_slave)
-{
- if (sel_base_port != 0)
- return;
-
- outb(base + DRIVE_SELECT, master_or_slave);
-
- outb(base + SECTOR_COUNT, 0);
- outb(base + LBA_LOW, 0);
- outb(base + LBA_MID, 0);
- outb(base + LBA_HIGH, 0);
-
- outb(base + COM_STAT, IDENTIFY);
- u8 stat = read_stat(base);
-
- if (stat == 0)
- return;
-
- while ((stat & BSY) != 0)
- stat = read_stat(base);
-
- while ((stat & DRQ) == 0 && (stat & ERR) == 0)
- stat = read_stat(base);
-
- if ((stat & ERR) != 0)
- return;
-
- u16 drive_data[256];
- for (u32 i = 0; i < 256; i++)
- drive_data[i] = inw(base + DATA);
-
- max_sector = drive_data[MAX_28LBA_SECTORS] | drive_data[MAX_28LBA_SECTORS + 1] << 16;
-
- sel_base_port = base;
- sel_master_or_slave = master_or_slave;
-}
-
-void ata_init()
-{
- u8 pri_status = inb(PRIMARY_BASE + COM_STAT);
- u8 sec_status = inb(SECONDARY_BASE + COM_STAT);
- bool primary_floating = false;
- bool secondary_floating = false;
- if (pri_status == 0xFF)
- primary_floating = true;
- if (sec_status == 0xFF)
- secondary_floating = true;
-
- if (primary_floating && secondary_floating) {
- log("No drives attached! What's going on?");
- return;
- }
-
- check_drive(PRIMARY_BASE, SEL_MASTER);
- check_drive(PRIMARY_BASE, SEL_SLAVE);
- check_drive(SECONDARY_BASE, SEL_MASTER);
- check_drive(SECONDARY_BASE, SEL_SLAVE);
-
- if (sel_base_port == 0)
- log("No drives attached! What's going on?");
- else {
- log("Found drive: Selecting %s on the %s bus",
- sel_master_or_slave == SEL_MASTER ? "master" : "slave",
- sel_base_port == PRIMARY_BASE ? "primary" : "secondary");
- log("Max LBA value is %d", max_sector);
- }
-}
-
-static void poll()
-{
- u8 stat;
-
- do
- stat = read_stat(sel_base_port);
- while ((stat & BSY) != 0);
-}
-
-void read_abs_sectors(u32 lba, u8 sector_count, u16 buf[])
-{
- assert(lba >> LBA_BITS == 0);
-
- outb(sel_base_port + DRIVE_SELECT, (lba >> (LBA_BITS - 4)) | sel_master_or_slave | 1 << 6);
- outb(sel_base_port + SECTOR_COUNT, sector_count);
-
- outb(sel_base_port + LBA_LOW, lba & 0xFF);
- outb(sel_base_port + LBA_MID, (lba >> 8) & 0xFF);
- outb(sel_base_port + LBA_HIGH, (lba >> 16) & 0xFF);
-
- outb(sel_base_port + COM_STAT, READ_SECTORS);
-
- u32 i = 0;
- for (; sector_count > 0; sector_count--) {
- poll();
-
- asm("rep insw" ::"c"(SECTOR_SIZE / 2), "d"(sel_base_port + DATA), "D"(buf + i));
- i += SECTOR_SIZE / 2;
- }
-} \ No newline at end of file
diff --git a/src/kernel/fs/ata.h b/src/kernel/fs/ata.h
deleted file mode 100644
index 97a1069..0000000
--- a/src/kernel/fs/ata.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef ATA_DRIVER_H
-#define ATA_DRIVER_H
-
-#include <stdint.h>
-
-#define SECTOR_SIZE 512
-
-#define LBA_BITS 28
-
-// Port bases and offsets
-// TODO: Support other emulators/devices by using PCI ATA detection
-#define PRIMARY_BASE 0x1F0
-#define SECONDARY_BASE 0x170
-#define DATA 0
-#define ERROR 1
-#define SECTOR_COUNT 2
-#define LBA_LOW 3
-#define LBA_MID 4
-#define LBA_HIGH 5
-#define DRIVE_SELECT 6
-#define COM_STAT 7
-
-#define PRI_CONTROL 0x3F6
-#define SEC_CONTROL 0x376
-
-// Commands
-#define SEL_MASTER 0xA0
-#define SEL_SLAVE 0xB0
-#define IDENTIFY 0xEC
-#define READ_SECTORS 0x20
-
-// Status byte flags
-#define ERR (1 << 0)
-#define DRQ (1 << 3)
-#define SRV (1 << 4)
-#define DF (1 << 5)
-#define RDY (1 << 6)
-#define BSY (1 << 7)
-
-#define MAX_28LBA_SECTORS 60
-
-void ata_init();
-
-void read_abs_sectors(u32 lba, u8 sector_count, u16 buf[]);
-
-#endif \ No newline at end of file
diff --git a/src/kernel/fs/elf.c b/src/kernel/fs/elf.c
deleted file mode 100644
index 6585bb4..0000000
--- a/src/kernel/fs/elf.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <fs/elf.h>
-#include <fs/ext2.h>
-#include <gdt/gdt.h>
-#include <io/io.h>
-#include <lib/lib.h>
-#include <lib/stdio.h>
-#include <lib/stdlib.h>
-#include <memory/alloc.h>
-#include <memory/paging.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <system.h>
-#include <tasks/process.h>
-
-int elf_verify(struct elf_header *header)
-{
- if (header->ident[0] == ELF_MAG && header->ident[1] == 'E' && header->ident[2] == 'L' &&
- header->ident[3] == 'F' && header->ident[4] == ELF_32 &&
- header->ident[5] == ELF_LITTLE && header->ident[6] == ELF_CURRENT &&
- header->machine == ELF_386 && (header->type == ET_REL || header->type == ET_EXEC)) {
- return 1;
- }
- return 0;
-}
-
-struct process *elf_load(char *path)
-{
- log("ELF START");
-
- u8 *file = read_file(path);
- if (!file) {
- warn("File or directory not found: %s", path);
- return NULL;
- }
-
- struct elf_header *header = (struct elf_header *)file;
-
- if (!elf_verify(header)) {
- warn("File not valid: %s", path);
- return NULL;
- } else {
- debug("File is valid: %s", path);
- }
-
- struct process *proc = process_make_new();
- paging_switch_dir(proc->cr3);
-
- u32 image_low = 0xFFFFFFFF;
- u32 image_high = 0;
-
- // Parse ELF
- u32 i = 0;
- u32 j = 0;
- while (i < header->shentsize * header->shnum) {
- struct elf_section_header *sh = (void *)((u32)header + (header->shoff + i));
- if (sh->addr != 0) {
- log("%x", sh->addr);
- /* for (u32 j = 0; j < sh->size; j += PAGE_SIZE) { */
- /* paging_frame_alloc(paging_get_page(sh->addr + j, proc->cr3)); */
- /* invlpg(sh->addr + j); */
- /* } */
- while (j < sh->size) {
- paging_frame_alloc(paging_get_page(sh->addr + j, proc->cr3));
- invlpg(sh->addr + j);
- j += 0x1000;
- }
-
- if (sh->type == 8)
- // section is .bss
- memset((void *)sh->addr, 0, sh->size);
- else
- memcpy((void *)sh->addr, (void *)((u32)header + sh->offset),
- sh->size);
-
- if (sh->addr < image_low)
- image_low = sh->addr;
-
- if (sh->addr + sh->size > image_high)
- image_high = sh->addr + sh->size;
- }
- i += header->shentsize;
- }
-
- // Stack
- struct page_table_entry *stack_page = paging_get_page(USER_STACK_LOW, proc->cr3);
- paging_frame_alloc(stack_page);
- stack_page->writable = 1;
- invlpg(USER_STACK_LOW);
-
- strcpy(proc->name, path);
- proc->brk = image_high;
- proc->regs.useresp = USER_STACK_HIGH;
- proc->regs.ebp = proc->regs.useresp;
- proc->regs.esp = proc->regs.useresp;
- proc->regs.eip = header->entry;
-
- debug("Loaded file");
-
- return proc;
-}
diff --git a/src/kernel/fs/elf.h b/src/kernel/fs/elf.h
deleted file mode 100644
index 94a3863..0000000
--- a/src/kernel/fs/elf.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef MELVIX_ELF_H
-#define MELVIX_ELF_H
-
-#include <stdint.h>
-#include <tasks/process.h>
-
-#define ELF_MAG 0x7F // 0
-#define ELF_32 (1) // 4: 32-bit Architecture
-#define ELF_LITTLE (1) // 5: Little Endian
-#define ELF_CURRENT (1) // 6: ELF Current Version
-#define ELF_386 (3) // header->machine x86 machine type
-
-#define ET_NONE 0 // Unkown type
-#define ET_REL 1 // Relocatable file
-#define ET_EXEC 2 // Executable file
-
-#define PT_NULL 0
-#define PT_LOAD 1
-#define PT_DYNAMIC 2
-#define PT_INTERP 3
-#define PT_NOTE 4
-#define PT_SHLIB 5
-#define PT_PHDR 6
-#define PT_LOPROC 0x70000000
-#define PT_HIPROC 0x7fffffff
-
-#define PF_X 0x1
-#define PF_W 0x2
-#define PF_R 0x4
-
-#define USER_STACK_LOW 0x00400000
-#define USER_STACK_HIGH 0x00401000
-
-struct elf_priv_data {
- u32 sig;
-};
-
-struct elf_header {
- u8 ident[16];
- u16 type;
- u16 machine;
- u32 version;
- u32 entry;
- u32 phoff;
- u32 shoff;
- u32 flags;
- u16 ehsize;
- u16 phentsize;
- u16 phnum;
- u16 shentsize;
- u16 shnum;
- u16 shstrndx;
-};
-
-struct elf_section_header {
- u32 name;
- u32 type;
- u32 flags;
- u32 addr;
- u32 offset;
- u32 size;
- u32 link;
- u32 info;
- u32 addralign;
- u32 entsize;
-};
-
-struct elf_program_header {
- u32 type;
- u32 offset;
- u32 vaddr;
- u32 paddr;
- u32 filesz;
- u32 memsz;
- u32 flags;
- u32 align;
-};
-
-int is_elf(struct elf_header *header);
-struct process *elf_load(char *path);
-
-#endif \ No newline at end of file
diff --git a/src/kernel/fs/ext2.c b/src/kernel/fs/ext2.c
deleted file mode 100644
index 70c72aa..0000000
--- a/src/kernel/fs/ext2.c
+++ /dev/null
@@ -1,230 +0,0 @@
-#include <fs/ata.h>
-#include <fs/ext2.h>
-#include <lib/lib.h>
-#include <lib/stdlib.h>
-#include <memory/alloc.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <system.h>
-
-static struct ext2_superblock superblock;
-static struct bgd *bgdt;
-static u32 block_size;
-static u32 num_groups;
-static void read_block(u32 block_num, void *buf);
-static void load_superblock();
-static void load_bgdt();
-static void read_inode(struct ext2_inode *inode, u32 inode_num);
-
-void ext2_init_fs()
-{
- load_superblock();
- load_bgdt();
-
- struct ext2_inode root_inode;
- read_inode(&root_inode, ROOT_INODE);
- debug("Creation time: %d", root_inode.creation_time);
- debug("UID: %d", root_inode.uid);
- debug("Type & perms: 0x%x", root_inode.mode);
- debug("Size: %d", root_inode.size);
-
- debug("Files:");
- struct ext2_file file;
- ext2_open_inode(ROOT_INODE, &file);
- struct ext2_dirent dirent;
-
- while (ext2_next_dirent(&file, &dirent))
- debug("Inode %d, name '%s'", dirent.inode_num, dirent.name);
-}
-
-static void read_block(u32 block_num, void *buf)
-{
- u32 lba = block_num * block_size / SECTOR_SIZE;
- u32 sectors = block_size / SECTOR_SIZE;
-
- read_abs_sectors(lba, sectors, buf);
-}
-
-static void load_superblock()
-{
- u16 buf[SUPERBLOCK_LENGTH / 2];
-
- read_abs_sectors(SUPERBLOCK_LBA, SUPERBLOCK_SECTORS, buf);
- memcpy(&superblock, buf, sizeof(struct ext2_superblock));
-
- block_size = 1024 << superblock.log2_block_size;
- num_groups = superblock.total_blocks / superblock.blocks_per_group;
-
- assert(superblock.signature == EXT2_SIGNATURE);
- debug("Total inodes: 0x%x", superblock.total_inodes);
- debug("Total blocks: 0x%x", superblock.total_blocks);
- debug("Drive size: %dMiB", (block_size * superblock.total_blocks) >> 20);
- debug("Block size: %d", block_size);
- debug("Num blocks: %d", superblock.total_blocks);
- debug("Blocks/group: %d", superblock.blocks_per_group);
- debug("Inodes/group: %d", superblock.inodes_per_group);
- debug("Num groups: %d", num_groups);
- debug("Creator OS: %s", superblock.creator_os_id == 0 ? "Linux" : "Other");
-}
-
-static void load_bgdt()
-{
- u32 bgdt_sectors = (sizeof(struct bgd) * num_groups) / SECTOR_SIZE + 1;
- u32 bgdt_block = (SUPERBLOCK_OFFSET + SUPERBLOCK_LENGTH) / block_size + 1;
- u32 bgdt_lba = bgdt_block * block_size / SECTOR_SIZE;
-
- u16 buf[bgdt_sectors * SECTOR_SIZE / 2];
- read_abs_sectors(bgdt_lba, bgdt_sectors, buf);
-
- u32 bgdt_size = sizeof(struct bgd) * num_groups;
- bgdt = malloc(bgdt_size);
- memcpy(bgdt, buf, bgdt_size);
-}
-
-static void read_inode(struct ext2_inode *inode, u32 inode_num)
-{
- inode_num--;
- u32 block_group = inode_num / superblock.inodes_per_group;
-
- struct bgd *bgd = &bgdt[block_group];
- u32 i_table_block = bgd->inode_table_addr;
-
- u32 index = inode_num % superblock.inodes_per_group;
- u32 block_offset = (index * INODE_SIZE) / block_size;
- u32 offset_in_block = (index * INODE_SIZE) % block_size;
- u32 block = i_table_block + block_offset;
-
- u32 num_sectors = sizeof(struct ext2_inode) / SECTOR_SIZE + 1;
- u16 buf[num_sectors * SECTOR_SIZE / 2];
- read_abs_sectors(block * block_size / SECTOR_SIZE, num_sectors, buf);
- memcpy(inode, &buf[offset_in_block / 2], sizeof(struct ext2_inode));
-}
-
-void ext2_open_inode(u32 inode_num, struct ext2_file *file)
-{
- read_inode(&file->inode, inode_num);
- file->pos = 0;
- file->block_index = 0;
- file->buf = malloc(block_size);
- file->curr_block_pos = 0;
-
- read_block(file->inode.dbp[0], file->buf);
-}
-
-u32 ext2_read(struct ext2_file *file, u8 *buf, u32 count)
-{
- if (file->pos + count > file->inode.size)
- count = file->inode.size - file->pos;
-
- u32 bytes_left = count;
-
- while (bytes_left > 0) {
- u32 to_copy = bytes_left;
-
- bool new_block = file->curr_block_pos + to_copy >= block_size;
- if (new_block)
- to_copy = block_size - file->curr_block_pos;
-
- memcpy(buf + (count - bytes_left), file->buf + file->curr_block_pos, to_copy);
- file->curr_block_pos += to_copy;
- file->pos += to_copy;
- bytes_left -= to_copy;
-
- if (new_block) {
- file->curr_block_pos = 0;
- file->block_index++;
- if (file->block_index >= 12) {
- // TODO: Add triple block pointer support
- u32 *tmp = malloc(block_size);
- read_block(file->inode.ibp, tmp);
- read_block(tmp[file->block_index - 12], file->buf);
- } else {
- read_block(file->inode.dbp[file->block_index], file->buf);
- }
- }
- }
-
- return count;
-}
-
-#define READ_SIZE (sizeof(struct ext2_dirent) - sizeof(u8 *))
-
-bool ext2_next_dirent(struct ext2_file *file, struct ext2_dirent *dir)
-{
- u8 buf[READ_SIZE];
- if (ext2_read(file, buf, READ_SIZE) != READ_SIZE)
- return false;
-
- memcpy(dir, buf, READ_SIZE);
-
- u32 size = dir->name_len + 1;
- u8 *name = malloc(size);
- if (ext2_read(file, name, size - 1) != size - 1)
- return false;
-
- dir->name = name;
- dir->name[size - 1] = '\0';
-
- u32 bytes_left = dir->total_len - (READ_SIZE + size - 1);
- if (bytes_left > 0) {
- u8 dummy[bytes_left];
- ext2_read(file, dummy, bytes_left);
- }
-
- return true;
-}
-
-u32 ext2_find_in_dir(u32 dir_inode, const char *name)
-{
- u32 inode;
- struct ext2_file dir;
- struct ext2_dirent dirent;
-
- ext2_open_inode(dir_inode, &dir);
- while (ext2_next_dirent(&dir, &dirent)) {
- if (strcmp((char *)dirent.name, name) == 0) {
- inode = dirent.inode_num;
- goto cleanup;
- }
- }
-
- inode = 0;
-
-cleanup:
- free(dir.buf);
- return inode;
-}
-
-u32 ext2_look_up_path(char *path)
-{
- if (path[0] != '/')
- return 0;
-
- path++;
- u32 curr_dir_inode = ROOT_INODE;
-
- while (1) {
- u32 j;
- for (j = 0; path[j] != '/' && path[j] != '\0'; j++)
- ;
-
- if (path[j] == '\0')
- break;
-
- path[j] = '\0';
- curr_dir_inode = ext2_find_in_dir(curr_dir_inode, path);
- path[j] = '/';
-
- if (curr_dir_inode == 0)
- return 0;
-
- path += j + 1;
- }
-
- u32 inode = ext2_find_in_dir(curr_dir_inode, path);
- if (inode == 0)
- return 0;
-
- return inode;
-} \ No newline at end of file
diff --git a/src/kernel/fs/ext2.h b/src/kernel/fs/ext2.h
deleted file mode 100644
index 797985a..0000000
--- a/src/kernel/fs/ext2.h
+++ /dev/null
@@ -1,154 +0,0 @@
-#ifndef MELVIX_EXT2_H
-#define MELVIX_EXT2_H
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define ROOT_INODE 2
-
-#define EXT2_SIGNATURE 0xEF53
-#define INODE_SIZE 128
-
-#define SUPERBLOCK_OFFSET 1024
-#define SUPERBLOCK_LENGTH 1024
-
-#define SUPERBLOCK_LBA (SUPERBLOCK_OFFSET / SECTOR_SIZE)
-#define SUPERBLOCK_SECTORS (SUPERBLOCK_LENGTH / SECTOR_SIZE)
-
-struct ext2_superblock {
- u32 total_inodes;
- u32 total_blocks;
- u32 su_res_blocks; // Superuser reserved
- u32 free_blocks;
- u32 free_inodes;
- u32 superblock_block_num;
- u32 log2_block_size;
- u32 log2_frag_size;
- u32 blocks_per_group;
- u32 frags_per_group;
- u32 inodes_per_group;
- u32 last_mount_time;
- u32 last_write_time;
- u16 mounts_since_fsck;
- u16 max_mounts_since_fsck;
- u16 signature;
- u16 state; // 1 clean; 2 errors
- u16 error_action;
- u16 minor_version;
- u32 last_fsck_time;
- u32 max_time_since_fsck;
- u32 creator_os_id;
- u32 major_version;
- u16 res_block_uid;
- u16 res_block_gid;
-} __attribute__((packed));
-
-// Block group descriptor
-struct bgd {
- u32 block_bitmap_addr;
- u32 inode_bitmap_addr;
- u32 inode_table_addr;
- u16 free_blocks;
- u16 free_inodes;
- u16 used_dirs;
- u16 pad;
- u8 bg_reserved[12];
-} __attribute__((packed));
-
-struct ext2_inode {
- u16 mode;
- u16 uid;
- u32 size;
-
- u32 last_access_time;
- u32 creation_time;
- u32 last_modification_time;
- u32 deletion_time;
-
- u16 gid;
- u16 link_count;
- u32 sectors_used;
- u32 flags;
- u32 os_specific_val1;
- u32 dbp[12];
- u32 ibp;
- u32 dibp;
- u32 tibp;
- u32 gen_number;
-
- u32 reserved1;
- u32 reserved2;
-
- u32 fragment_addr;
- u8 os_specific_val2[12];
-} __attribute__((packed));
-
-#define S_IFIFO 0x1000
-#define S_IFCHR 0x2000
-#define S_IFDIR 0x4000
-#define S_IFBLK 0x6000
-#define S_IFREG 0x8000
-#define S_IFLNK 0xA000
-#define S_IFSOCK 0xC000
-
-#define S_ISDIR(m) ((m & 0170000) == 0040000)
-#define S_ISCHR(m) ((m & 0170000) == 0020000)
-#define S_ISBLK(m) ((m & 0170000) == 0060000)
-#define S_ISREG(m) ((m & 0170000) == 0100000)
-#define S_ISFIFO(m) ((m & 0170000) == 0010000)
-#define S_ISLNK(m) ((m & 0170000) == 0120000)
-#define S_ISSOCK(m) ((m & 0170000) == 0140000)
-
-#define S_ISUID 04000
-#define S_ISGID 02000
-#define S_ISTICK 01000
-#define S_IRUSR 00400
-#define S_IWUSR 00200
-#define S_IXUSR 00100
-#define S_IRGRP 00040
-#define S_IWGRP 00020
-#define S_IXGRP 00010
-#define S_IROTH 00004
-#define S_IWOTH 00002
-#define S_IXOTH 00001
-
-#define SECURE_DELETE 0x00001
-#define UNDELETE 0x00002
-#define COMPRESSED 0x00004
-#define SYNCRONOUS 0x00008
-#define IMMUTABLE 0x00010
-#define APPEND_ONLY 0x00020
-#define DUMP_IGNORE 0x00040
-#define NO_UPDATE_ACCESS 0x00080
-
-struct fs_node *ext2_root;
-
-struct ext2_dirent {
- u32 inode_num;
- u16 total_len;
- u8 name_len;
- u8 type_indicator;
- u8 *name;
-} __attribute__((packed));
-
-struct ext2_file {
- struct ext2_inode inode;
- u32 pos;
- u8 block_index;
- u8 *buf;
- u32 curr_block_pos;
-};
-
-void ext2_init_fs();
-void ext2_open_inode(u32 inode_num, struct ext2_file *file);
-u32 ext2_read(struct ext2_file *file, u8 *buf, u32 count);
-bool ext2_next_dirent(struct ext2_file *file, struct ext2_dirent *dir);
-u32 ext2_find_in_dir(u32 dir_inode, const char *name);
-u32 ext2_look_up_path(char *path);
-
-u8 *read_file(char *path);
-void ext2_node_init(struct fs_node *node);
-void ext2_mount(struct fs_node *mountpoint);
-
-#endif \ No newline at end of file
diff --git a/src/kernel/fs/fs.c b/src/kernel/fs/fs.c
deleted file mode 100644
index b9bada7..0000000
--- a/src/kernel/fs/fs.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <fs/ext2.h>
-#include <memory/alloc.h>
-#include <stdint.h>
-#include <system.h>
-
-u32 get_file_size(char *path)
-{
- u32 inode = ext2_look_up_path(path);
- struct ext2_file file;
- ext2_open_inode(inode, &file);
- if (inode != 0) {
- return file.inode.size;
- } else {
- warn("File not found");
- return -1;
- }
-}
-
-// TODO: Implement offset
-u32 read(char *path, u32 offset, u32 count, u8 *buf)
-{
- u32 inode = ext2_look_up_path(path);
- struct ext2_file file;
- ext2_open_inode(inode, &file);
- if (inode != 0) {
- debug("Reading %s: %dKiB", path, count >> 10);
- ext2_read(&file, buf, count);
- free(file.buf);
- buf[count - 1] = '\0';
- return buf;
- } else {
- warn("File not found");
- return -1;
- }
-}
-
-// TODO: Implement writing
-u32 write(char *path, u32 offset, u32 count, u8 *buf)
-{
- warn("Writing is not supported!");
- return -1;
-}
-
-u8 *read_file(char *path)
-{
- u32 inode = ext2_look_up_path(path);
- struct ext2_file file;
- ext2_open_inode(inode, &file);
- if (inode != 0) {
- u32 size = file.inode.size;
- debug("Reading %s: %dKiB", path, size >> 10);
- u8 *buf = malloc(size);
- ext2_read(&file, buf, size);
- free(file.buf);
- buf[size - 1] = '\0';
- return buf;
- } else {
- warn("File not found");
- return NULL;
- }
-} \ No newline at end of file
diff --git a/src/kernel/fs/fs.h b/src/kernel/fs/fs.h
deleted file mode 100644
index 58b23db..0000000
--- a/src/kernel/fs/fs.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef MELVIX_FS_H
-#define MELVIX_FS_H
-
-#include <stdint.h>
-
-u32 get_file_size(char *path);
-u32 read(char *path, u32 offset, u32 count, u8 *buf);
-u32 write(char *path, u32 offset, u32 count, u8 *buf);
-u8 *read_file(char *path); // Only for temp kernel reads
-
-#endif \ No newline at end of file
diff --git a/src/kernel/fs/load.c b/src/kernel/fs/load.c
deleted file mode 100644
index 0e93273..0000000
--- a/src/kernel/fs/load.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <fs/ext2.h>
-#include <fs/load.h>
-#include <lib/lib.h>
-#include <lib/stdio.h>
-#include <system.h>
-
-void load_binaries()
-{
- font = (struct font *)read_file("/bin/font");
-
- log("Successfully loaded binaries");
-} \ No newline at end of file
diff --git a/src/kernel/fs/load.h b/src/kernel/fs/load.h
deleted file mode 100644
index b2376be..0000000
--- a/src/kernel/fs/load.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef MELVIX_LOAD_H
-#define MELVIX_LOAD_H
-
-#include <stdint.h>
-
-struct font *font;
-
-struct font {
- u16 font_32[758][32];
- u16 font_24[758][24];
- u8 font_16[758][16];
- u16 cursor[19];
-};
-
-void load_binaries();
-
-#endif \ No newline at end of file