summaryrefslogtreecommitdiff
path: root/ext4_utils/ext4_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext4_utils/ext4_utils.c')
-rw-r--r--ext4_utils/ext4_utils.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ext4_utils/ext4_utils.c b/ext4_utils/ext4_utils.c
index 43b44806..4b87c6e4 100644
--- a/ext4_utils/ext4_utils.c
+++ b/ext4_utils/ext4_utils.c
@@ -25,6 +25,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <stddef.h>
#include <string.h>
#ifdef USE_MINGW
@@ -362,11 +363,12 @@ void ext4_create_journal_inode()
block group */
void ext4_update_free()
{
- unsigned int i;
+ u32 i;
for (i = 0; i < aux_info.groups; i++) {
u32 bg_free_blocks = get_free_blocks(i);
u32 bg_free_inodes = get_free_inodes(i);
+ u16 crc;
aux_info.bg_desc[i].bg_free_blocks_count = bg_free_blocks;
aux_info.sb->s_free_blocks_count_lo += bg_free_blocks;
@@ -375,6 +377,13 @@ void ext4_update_free()
aux_info.sb->s_free_inodes_count += bg_free_inodes;
aux_info.bg_desc[i].bg_used_dirs_count += get_directories(i);
+
+ aux_info.bg_desc[i].bg_flags = get_bg_flags(i);
+
+ crc = ext4_crc16(~0, aux_info.sb->s_uuid, sizeof(aux_info.sb->s_uuid));
+ crc = ext4_crc16(crc, &i, sizeof(i));
+ crc = ext4_crc16(crc, &aux_info.bg_desc[i], offsetof(struct ext2_group_desc, bg_checksum));
+ aux_info.bg_desc[i].bg_checksum = crc;
}
}