ref: c7c5aba4d7e3af2e3676051d14ed9512fac76bc2
parent: 76208824002dca9dffab5ee03fe66239ad4493b3
author: ngkaho1234 <[email protected]>
date: Tue Oct 27 18:25:17 EDT 2015
FIX: ext4_extent.c failed to be compiled.
--- a/lwext4/ext4_extent.c
+++ b/lwext4/ext4_extent.c
@@ -43,6 +43,7 @@
#include "ext4_extent.h"
#include "ext4_inode.h"
#include "ext4_super.h"
+#include "ext4_crc32c.h"
#include "ext4_blockdev.h"
#include "ext4_balloc.h"
#include "ext4_fs.h"
@@ -151,6 +152,18 @@
return checksum;
}
+static struct ext4_extent_header *ext_block_hdr(struct ext4_block *block)
+{
+ return (struct ext4_extent_header *)block->data;
+}
+
+static struct ext4_extent_tail *
+find_ext4_extent_tail(struct ext4_extent_header *eh)
+{
+ return (struct ext4_extent_tail *)(((char *)eh) +
+ EXT4_EXTENT_TAIL_OFFSET(eh));
+}
+
/*
* BIG FAT NOTES:
* Currently we do not verify the checksum of extent
@@ -465,7 +478,7 @@
}
ext4_extent_header_set_entries_count(path_ptr->header, entries);
- ext4_extent_block_csum_set(inode_ref, path_ptr->header);
+ ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
path_ptr->block.dirty = true;
/* If leaf node is empty, parent entry must be modified */
@@ -507,7 +520,7 @@
}
ext4_extent_header_set_entries_count(path_ptr->header, entries);
- ext4_extent_block_csum_set(inode_ref, path_ptr->header);
+ ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
path_ptr->block.dirty = true;
/* Free the node if it is empty */
@@ -635,7 +648,7 @@
path_ptr->depth);
ext4_extent_header_set_generation(path_ptr->header, 0);
- ext4_extent_block_csum_set(inode_ref, path_ptr->header);
+ ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
path_ptr->block.dirty = true;
/* Jump to the preceding item */
@@ -661,7 +674,7 @@
ext4_extent_header_set_entries_count(path_ptr->header,
entries + 1);
- ext4_extent_block_csum_set(inode_ref, path_ptr->header);
+ ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
path_ptr->block.dirty = true;
/* No more splitting needed */
@@ -744,7 +757,7 @@
ext4_extent_header_set_max_entries_count(old_root->header,
limit);
- ext4_extent_block_csum_set(inode_ref, ext_block_hdr(old_root->block));
+ ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&old_root->block));
old_root->block.dirty = true;
/* Re-initialize new root metadata */
@@ -859,7 +872,7 @@
inode_ref->dirty = true;
}
- ext4_extent_block_csum_set(inode_ref, ext_block_hdr(path_ptr->block));
+ ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
path_ptr->block.dirty = true;
goto finish;
@@ -901,7 +914,7 @@
inode_ref->dirty = true;
}
- ext4_extent_block_csum_set(inode_ref, ext_block_hdr(path_ptr->block));
+ ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
path_ptr->block.dirty = true;
goto finish;
@@ -942,7 +955,7 @@
inode_ref->dirty = true;
}
- ext4_extent_block_csum_set(inode_ref, ext_block_hdr(path_ptr->block));
+ ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
path_ptr->block.dirty = true;
finish: