ref: 8b4a6cedc4a20924ed01da7609e6b158a0f15576
parent: 252c506239ab570c0f671513a3b17d3a44f86b5c
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sun Jan 31 22:18:15 EST 2016
Relocate other in-memory data structures from ext4_types.h These include ext4_inode_ref, ext4_dir_iter, ext4_dir_search_result and ext4_dir_idx_block.
--- a/include/ext4_dir.h
+++ b/include/ext4_dir.h
@@ -54,6 +54,19 @@
#include <stdint.h>
+struct ext4_dir_iter {
+ struct ext4_inode_ref *inode_ref;
+ struct ext4_block curr_blk;
+ uint64_t curr_off;
+ struct ext4_dir_en *curr;
+};
+
+struct ext4_dir_search_result {
+ struct ext4_block block;
+ struct ext4_dir_en *dentry;
+};
+
+
/**@brief Get i-node number from directory entry.
* @param de Directory entry
* @return I-node number
--- a/include/ext4_dir_idx.h
+++ b/include/ext4_dir_idx.h
@@ -55,7 +55,14 @@
#include <stdint.h>
#include <stdbool.h>
+struct ext4_dir_idx_block {
+ struct ext4_block b;
+ struct ext4_dir_idx_entry *entries;
+ struct ext4_dir_idx_entry *position;
+};
+
#define EXT4_DIR_DX_INIT_BCNT 2
+
/**@brief Initialize index structure of new directory.
* @param dir Pointer to directory i-node
--- a/include/ext4_fs.h
+++ b/include/ext4_fs.h
@@ -77,6 +77,14 @@
bool dirty;
};
+struct ext4_inode_ref {
+ struct ext4_block block;
+ struct ext4_inode *inode;
+ struct ext4_fs *fs;
+ uint32_t index;
+ bool dirty;
+};
+
/**@brief Convert block address to relative index in block group.
* @param sb Superblock pointer
--- a/include/ext4_types.h
+++ b/include/ext4_types.h
@@ -464,13 +464,6 @@
#define EXT4_INODE_ROOT_INDEX 2
-struct ext4_inode_ref {
- struct ext4_block block;
- struct ext4_inode *inode;
- struct ext4_fs *fs;
- uint32_t index;
- bool dirty;
-};
#define EXT4_DIRECTORY_FILENAME_LEN 255
@@ -506,18 +499,6 @@
uint8_t name[EXT4_DIRECTORY_FILENAME_LEN]; /* Entry name */
};
-struct ext4_dir_iter {
- struct ext4_inode_ref *inode_ref;
- struct ext4_block curr_blk;
- uint64_t curr_off;
- struct ext4_dir_en *curr;
-};
-
-struct ext4_dir_search_result {
- struct ext4_block block;
- struct ext4_dir_en *dentry;
-};
-
/* Structures for indexed directory */
struct ext4_dir_idx_climit {
@@ -562,12 +543,6 @@
struct ext4_dir_idx_node {
struct ext4_fake_dir_entry fake;
struct ext4_dir_idx_entry entries[];
-};
-
-struct ext4_dir_idx_block {
- struct ext4_block b;
- struct ext4_dir_idx_entry *entries;
- struct ext4_dir_idx_entry *position;
};
/*