blob: 524f8fd788fd170186380a5789d755a170b9f821 (
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
28
29
30
31
32
33
34
35
36
37
38
39
|
/**
* @file
// ext2 in-ram minidriver
// =======================
//
// based on osdev wiki article: http://wiki.osdev.org/Ext2
// The 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 <stdint.h>
#include "interface/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);
/** mount */
void ext2_mount(char *path);
|