From 1195ca0bd84693fd56f6d34a9f2de3107b9820bf Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 13 Sep 2018 23:26:47 +0200 Subject: ext2 review --- fs/ext2.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'fs/ext2.c') diff --git a/fs/ext2.c b/fs/ext2.c index b062973..d99fba7 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -1,18 +1,14 @@ -#include "kernel/kernel.h" -#include "log.h" -// ext2 minidriver -// based on osdev wiki article: http://wiki.osdev.org/Ext2 -// -// -#include "lib/string/string.h" +#include +#include +#include "kernel.h" +#include "ext2.h" +#include "log.h" -#include -#include +#include "lib/string/string.h" #include "fs.h" -#include "ext2.h" typedef struct ext2_superblock_struct { @@ -27,18 +23,19 @@ typedef struct ext2_superblock_struct uint32_t blocks_per_group; uint32_t fragments_per_group; uint32_t inodes_per_group; - uint8_t skip[12]; // maybe we will look at these fields later... + uint8_t skip[12]; // last mount time, last written time, numer of times mounted, number of mounts before checking. uint16_t ext2_sig; // 0xef5 uint16_t fs_state; uint16_t error_handle; uint16_t version_minor; - uint8_t skip2[8]; // maybe we will look at these fields later... + uint8_t skip2[8]; // last check, check interval uint32_t os_id; uint32_t version_major; uint16_t uid_reserved; uint16_t gid_reserved; }ext2_superblock; +/* we dont use this yet typedef struct ext2_superblock_ext_struct { uint32_t first_inode; @@ -62,6 +59,7 @@ typedef struct ext2_superblock_ext_struct uint32_t orpan_head; }ext2_superblock_ext; +*/ typedef struct ext2_blockgroup_desc_struct { @@ -112,13 +110,12 @@ void ram_read(char *in,char *out,int size, int count) { out[i]=in[i]; } - } int ext2_check(uint8_t *ram) { ext2_superblock super; - ext2_superblock_ext super_ext; +// ext2_superblock_ext super_ext; uint8_t *ptr=ram+1024; ram_read((char*)ptr,&super,sizeof(super),1); -- cgit v1.2.3