/** * @file // ext2 in-ram minidriver // ======================= // // based on osdev wiki article: http://wiki.osdev.org/Ext2 // root directory is inode 2 per definition! // we do not care about files >4gb (no triply linked lists and no size_high) // we also use only name_length_low so max length is 255 chars // // The ext2 data needs to be mapped to a continues ram area (possibly via paging) // The __ramext2_start_addr__ determines the start of the area in each of the provided // functions. */ #include #include "fs.h" /** klog some basic info about the ext2 fs */ void ext2_dump_info(uint32_t ext2_start_addr); /** read up to max characters into buffer from given inode and set __pos__ */ uint32_t ext2_read_inode(uint32_t ext2_start_addr, int inode_nr, char *buf, uint32_t *pos, uint32_t max_size); /** Simiilar to ext2_read_inode but for directory inodes. * the inode number needs to point to a directory inode * fills on fs_dirent and sets _pos_ to the position of the next */ int ext2_read_dir(uint32_t ext2_start_addr, int inode_nr, fs_dirent *dirs, uint32_t *pos); /** get inode number from file path / if not found return 0 */ uint32_t ext2_filename_to_inode(uint32_t ext2_start_addr, char *path); /** get address of first byte of given block for given inode number */ uint32_t ext2_inode_blockstart(uint32_t ext2_start_addr,uint32_t inode_nr,uint32_t block);