blob: d0dd3bd241aa1c1530c7f731b8361690357039a1 [file] [log] [blame]
swissChilief829f32021-06-13 20:00:54 -07001#include <dri/fs/ext2/ext2.h>
swissChili4418ca52021-06-14 17:36:00 -07002#include <dri/ata_pio/ata_pio.h>
swissChilief829f32021-06-13 20:00:54 -07003#include <kint.h>
swissChili4418ca52021-06-14 17:36:00 -07004#include <log.h>
5
6struct ext2_superblock ext2_read_superblock()
7{
8 uchar buffer[512 * 2];
9 ata_pio_read_sectors(buffer, 2, 2);
10
11 struct ext2_superblock *sb = (void *)(buffer);
12 return *sb;
13}
swissChilief829f32021-06-13 20:00:54 -070014
15void ext2_mount(struct fs_node *where)
16{
swissChili4418ca52021-06-14 17:36:00 -070017 struct ext2_superblock sb = ext2_read_superblock();
18
swissChili9bd74de2021-06-15 20:30:48 -070019 kprintf(INFO "EXT2 magic = 0x%x\n", sb.signature);
swissChilief829f32021-06-13 20:00:54 -070020}
swissChili9bd74de2021-06-15 20:30:48 -070021
22bool ext2_valid_filesystem()
23{
24 struct ext2_superblock sb = ext2_read_superblock();
25
26 return sb.signature == EXT2_SIGNATURE;
27}