-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockHelper.hpp
More file actions
30 lines (24 loc) · 808 Bytes
/
BlockHelper.hpp
File metadata and controls
30 lines (24 loc) · 808 Bytes
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
#ifndef EXT2SUPERBLOCKHELPER_HPP
#define EXT2SUPERBLOCKHELPER_HPP
#include <vector>
#include <linux/fs.h>
#include <ext2fs/ext2_fs.h>
class BlockHelper {
public:
BlockHelper(char* ext2_dump);
ext2_super_block* as_superblock_if_present(char* ptr);
void print_superblock_information();
long get_block_size_in_bytes();
ext2_super_block* get_super_block();
char* get_block(unsigned int block_number);
char* get_block_after(const char* after);
private:
std::string get_ext2_revision();
std::string get_human_readable_state();
unsigned int get_used_block_count();
unsigned int get_used_inode_count();
const static unsigned int SUPER_BLOCK_OFFSET = 1024;
char* ext2_dump_;
ext2_super_block* super_block_ = nullptr;
};
#endif // EXT2SUPERBLOCKHELPER_HPP