[U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
Simon Glass
sjg at chromium.org
Wed Oct 3 21:53:47 CEST 2012
On x86 machines gd is unfortunately a #define, so we should avoid using
gd for anything. This patch changes uses of gd to bgd so that ext4fs
can be used on x86.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
fs/ext4/ext4_common.c | 85 ++++++++++++++++++++-------------------
fs/ext4/ext4fs.c | 105 +++++++++++++++++++++++++------------------------
include/ext4fs.h | 2 +-
3 files changed, 98 insertions(+), 94 deletions(-)
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index 3deffd5..d6d55b9 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -314,7 +314,7 @@ int ext4fs_checksum_update(unsigned int i)
struct ext_filesystem *fs = get_fs();
__u16 crc = 0;
- desc = (struct ext2_block_group *)&fs->gd[i];
+ desc = (struct ext2_block_group *)&fs->bgd[i];
if (fs->sb->feature_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) {
int offset = offsetof(struct ext2_block_group, bg_checksum);
@@ -874,17 +874,17 @@ long int ext4fs_get_new_blk_no(void)
char *zero_buffer = zalloc(fs->blksz);
if (!journal_buffer || !zero_buffer)
goto fail;
- struct ext2_block_group *gd = (struct ext2_block_group *)fs->gdtable;
+ struct ext2_block_group *bgd = (struct ext2_block_group *)fs->gdtable;
if (fs->first_pass_bbmap == 0) {
for (i = 0; i < fs->no_blkgrp; i++) {
- if (gd[i].free_blocks) {
- if (gd[i].bg_flags & EXT4_BG_BLOCK_UNINIT) {
- put_ext4(((uint64_t) (gd[i].block_id *
+ if (bgd[i].free_blocks) {
+ if (bgd[i].bg_flags & EXT4_BG_BLOCK_UNINIT) {
+ put_ext4(((uint64_t) (bgd[i].block_id *
fs->blksz)),
zero_buffer, fs->blksz);
- gd[i].bg_flags =
- gd[i].
+ bgd[i].bg_flags =
+ bgd[i].
bg_flags & ~EXT4_BG_BLOCK_UNINIT;
memcpy(fs->blk_bmaps[i], zero_buffer,
fs->blksz);
@@ -897,16 +897,16 @@ long int ext4fs_get_new_blk_no(void)
fs->curr_blkno = fs->curr_blkno +
(i * fs->blksz * 8);
fs->first_pass_bbmap++;
- gd[i].free_blocks--;
+ bgd[i].free_blocks--;
fs->sb->free_blocks--;
- status = ext4fs_devread(gd[i].block_id *
+ status = ext4fs_devread(bgd[i].block_id *
fs->sect_perblk, 0,
fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[i].block_id))
+ bgd[i].block_id))
goto fail;
goto success;
} else {
@@ -935,19 +935,19 @@ restart:
if (bg_idx >= fs->no_blkgrp)
goto fail;
- if (gd[bg_idx].free_blocks == 0) {
+ if (bgd[bg_idx].free_blocks == 0) {
debug("block group %u is full. Skipping\n", bg_idx);
fs->curr_blkno = fs->curr_blkno + blk_per_grp;
fs->curr_blkno--;
goto restart;
}
- if (gd[bg_idx].bg_flags & EXT4_BG_BLOCK_UNINIT) {
+ if (bgd[bg_idx].bg_flags & EXT4_BG_BLOCK_UNINIT) {
memset(zero_buffer, '\0', fs->blksz);
- put_ext4(((uint64_t) (gd[bg_idx].block_id * fs->blksz)),
- zero_buffer, fs->blksz);
+ put_ext4(((uint64_t) (bgd[bg_idx].block_id *
+ fs->blksz)), zero_buffer, fs->blksz);
memcpy(fs->blk_bmaps[bg_idx], zero_buffer, fs->blksz);
- gd[bg_idx].bg_flags = gd[bg_idx].bg_flags &
+ bgd[bg_idx].bg_flags = bgd[bg_idx].bg_flags &
~EXT4_BG_BLOCK_UNINIT;
}
@@ -961,18 +961,18 @@ restart:
/* journal backup */
if (prev_bg_bitmap_index != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[bg_idx].block_id
+ status = ext4fs_devread(bgd[bg_idx].block_id
* fs->sect_perblk,
0, fs->blksz, journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bitmap_index = bg_idx;
}
- gd[bg_idx].free_blocks--;
+ bgd[bg_idx].free_blocks--;
fs->sb->free_blocks--;
goto success;
}
@@ -1000,19 +1000,21 @@ int ext4fs_get_new_inode_no(void)
char *zero_buffer = zalloc(fs->blksz);
if (!journal_buffer || !zero_buffer)
goto fail;
- struct ext2_block_group *gd = (struct ext2_block_group *)fs->gdtable;
+ struct ext2_block_group *bgd = (struct ext2_block_group *)fs->gdtable;
if (fs->first_pass_ibmap == 0) {
for (i = 0; i < fs->no_blkgrp; i++) {
- if (gd[i].free_inodes) {
- if (gd[i].bg_itable_unused != gd[i].free_inodes)
- gd[i].bg_itable_unused =
- gd[i].free_inodes;
- if (gd[i].bg_flags & EXT4_BG_INODE_UNINIT) {
+ if (bgd[i].free_inodes) {
+ if (bgd[i].bg_itable_unused !=
+ bgd[i].free_inodes)
+ bgd[i].bg_itable_unused =
+ bgd[i].free_inodes;
+ if (bgd[i].bg_flags & EXT4_BG_INODE_UNINIT) {
put_ext4(((uint64_t)
- (gd[i].inode_id * fs->blksz)),
+ (bgd[i].inode_id *
+ fs->blksz)),
zero_buffer, fs->blksz);
- gd[i].bg_flags = gd[i].bg_flags &
+ bgd[i].bg_flags = bgd[i].bg_flags &
~EXT4_BG_INODE_UNINIT;
memcpy(fs->inode_bmaps[i],
zero_buffer, fs->blksz);
@@ -1025,17 +1027,17 @@ int ext4fs_get_new_inode_no(void)
fs->curr_inode_no = fs->curr_inode_no +
(i * inodes_per_grp);
fs->first_pass_ibmap++;
- gd[i].free_inodes--;
- gd[i].bg_itable_unused--;
+ bgd[i].free_inodes--;
+ bgd[i].bg_itable_unused--;
fs->sb->free_inodes--;
- status = ext4fs_devread(gd[i].inode_id *
+ status = ext4fs_devread(bgd[i].inode_id *
fs->sect_perblk, 0,
fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[i].inode_id))
+ bgd[i].inode_id))
goto fail;
goto success;
} else
@@ -1047,13 +1049,13 @@ restart:
fs->curr_inode_no++;
/* get the blockbitmap index respective to blockno */
ibmap_idx = fs->curr_inode_no / inodes_per_grp;
- if (gd[ibmap_idx].bg_flags & EXT4_BG_INODE_UNINIT) {
+ if (bgd[ibmap_idx].bg_flags & EXT4_BG_INODE_UNINIT) {
memset(zero_buffer, '\0', fs->blksz);
- put_ext4(((uint64_t) (gd[ibmap_idx].inode_id *
+ put_ext4(((uint64_t) (bgd[ibmap_idx].inode_id *
fs->blksz)), zero_buffer,
fs->blksz);
- gd[ibmap_idx].bg_flags =
- gd[ibmap_idx].bg_flags & ~EXT4_BG_INODE_UNINIT;
+ bgd[ibmap_idx].bg_flags =
+ bgd[ibmap_idx].bg_flags & ~EXT4_BG_INODE_UNINIT;
memcpy(fs->inode_bmaps[ibmap_idx], zero_buffer,
fs->blksz);
}
@@ -1069,21 +1071,22 @@ restart:
/* journal backup */
if (prev_inode_bitmap_index != ibmap_idx) {
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[ibmap_idx].inode_id
+ status = ext4fs_devread(bgd[ibmap_idx].inode_id
* fs->sect_perblk,
0, fs->blksz, journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[ibmap_idx].inode_id))
+ bgd[ibmap_idx].inode_id))
goto fail;
prev_inode_bitmap_index = ibmap_idx;
}
- if (gd[ibmap_idx].bg_itable_unused != gd[ibmap_idx].free_inodes)
- gd[ibmap_idx].bg_itable_unused =
- gd[ibmap_idx].free_inodes;
- gd[ibmap_idx].free_inodes--;
- gd[ibmap_idx].bg_itable_unused--;
+ if (bgd[ibmap_idx].bg_itable_unused !=
+ bgd[ibmap_idx].free_inodes)
+ bgd[ibmap_idx].bg_itable_unused =
+ bgd[ibmap_idx].free_inodes;
+ bgd[ibmap_idx].free_inodes--;
+ bgd[ibmap_idx].bg_itable_unused--;
fs->sb->free_inodes--;
goto success;
}
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 93dcb7e..4eded1a 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -209,14 +209,14 @@ static void ext4fs_update(void)
/* update block groups */
for (i = 0; i < fs->no_blkgrp; i++) {
- fs->gd[i].bg_checksum = ext4fs_checksum_update(i);
- put_ext4((uint64_t)(fs->gd[i].block_id * fs->blksz),
+ fs->bgd[i].bg_checksum = ext4fs_checksum_update(i);
+ put_ext4((uint64_t)(fs->bgd[i].block_id * fs->blksz),
fs->blk_bmaps[i], fs->blksz);
}
/* update inode table groups */
for (i = 0; i < fs->no_blkgrp; i++) {
- put_ext4((uint64_t) (fs->gd[i].inode_id * fs->blksz),
+ put_ext4((uint64_t) (fs->bgd[i].inode_id * fs->blksz),
fs->inode_bmaps[i], fs->blksz);
}
@@ -231,7 +231,7 @@ static void ext4fs_update(void)
gd_index = 0;
}
-int ext4fs_get_bgdtable(void)
+int ext4fs_get_gdtable(void)
{
int status;
int grp_desc_size;
@@ -266,7 +266,7 @@ fail:
static void delete_single_indirect_block(struct ext2_inode *inode)
{
- struct ext2_block_group *gd = NULL;
+ struct ext2_block_group *bgd = NULL;
static int prev_bg_bmap_idx = -1;
long int blknr;
int remainder;
@@ -280,7 +280,7 @@ static void delete_single_indirect_block(struct ext2_inode *inode)
return;
}
/* get block group descriptor table */
- gd = (struct ext2_block_group *)fs->gdtable;
+ bgd = (struct ext2_block_group *)fs->gdtable;
/* deleting the single indirect block associated with inode */
if (inode->b.blocks.indir_block != 0) {
@@ -295,18 +295,18 @@ static void delete_single_indirect_block(struct ext2_inode *inode)
bg_idx--;
}
ext4fs_reset_block_bmap(blknr, fs->blk_bmaps[bg_idx], bg_idx);
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
status =
- ext4fs_devread(gd[bg_idx].block_id *
+ ext4fs_devread(bgd[bg_idx].block_id *
fs->sect_perblk, 0, fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal
- (journal_buffer, gd[bg_idx].block_id))
+ (journal_buffer, bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -326,7 +326,7 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
unsigned int blk_per_grp = ext4fs_root->sblock.blocks_per_group;
unsigned int *di_buffer = NULL;
unsigned int *DIB_start_addr = NULL;
- struct ext2_block_group *gd = NULL;
+ struct ext2_block_group *bgd = NULL;
struct ext_filesystem *fs = get_fs();
char *journal_buffer = zalloc(fs->blksz);
if (!journal_buffer) {
@@ -334,7 +334,7 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
return;
}
/* get the block group descriptor table */
- gd = (struct ext2_block_group *)fs->gdtable;
+ bgd = (struct ext2_block_group *)fs->gdtable;
if (inode->b.blocks.double_indir_block != 0) {
di_buffer = zalloc(fs->blksz);
@@ -362,11 +362,11 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
ext4fs_reset_block_bmap(*di_buffer,
fs->blk_bmaps[bg_idx], bg_idx);
di_buffer++;
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
- status = ext4fs_devread(gd[bg_idx].block_id
+ status = ext4fs_devread(bgd[bg_idx].block_id
* fs->sect_perblk, 0,
fs->blksz,
journal_buffer);
@@ -374,7 +374,7 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -391,19 +391,19 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
bg_idx--;
}
ext4fs_reset_block_bmap(blknr, fs->blk_bmaps[bg_idx], bg_idx);
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[bg_idx].block_id *
+ status = ext4fs_devread(bgd[bg_idx].block_id *
fs->sect_perblk, 0, fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -427,7 +427,7 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
unsigned int *tib_start_addr = NULL;
unsigned int *tip_buffer = NULL;
unsigned int *tipb_start_addr = NULL;
- struct ext2_block_group *gd = NULL;
+ struct ext2_block_group *bgd = NULL;
struct ext_filesystem *fs = get_fs();
char *journal_buffer = zalloc(fs->blksz);
if (!journal_buffer) {
@@ -435,7 +435,7 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
return;
}
/* get block group descriptor table */
- gd = (struct ext2_block_group *)fs->gdtable;
+ bgd = (struct ext2_block_group *)fs->gdtable;
if (inode->b.blocks.triple_indir_block != 0) {
tigp_buffer = zalloc(fs->blksz);
@@ -477,20 +477,21 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
bg_idx);
tip_buffer++;
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
status =
- ext4fs_devread(gd[bg_idx].block_id *
- fs->sect_perblk, 0,
- fs->blksz,
- journal_buffer);
+ ext4fs_devread(
+ bgd[bg_idx].block_id *
+ fs->sect_perblk, 0,
+ fs->blksz,
+ journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].
+ bgd[bg_idx].
block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
@@ -516,20 +517,20 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
fs->blk_bmaps[bg_idx], bg_idx);
tigp_buffer++;
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
status =
- ext4fs_devread(gd[bg_idx].block_id *
+ ext4fs_devread(bgd[bg_idx].block_id *
fs->sect_perblk, 0,
fs->blksz, journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -546,19 +547,19 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
bg_idx--;
}
ext4fs_reset_block_bmap(blknr, fs->blk_bmaps[bg_idx], bg_idx);
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[bg_idx].block_id *
+ status = ext4fs_devread(bgd[bg_idx].block_id *
fs->sect_perblk, 0, fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -590,13 +591,13 @@ static int ext4fs_delete_file(int inodeno)
unsigned int blk_per_grp = ext4fs_root->sblock.blocks_per_group;
unsigned int inode_per_grp = ext4fs_root->sblock.inodes_per_group;
struct ext2_inode *inode_buffer = NULL;
- struct ext2_block_group *gd = NULL;
+ struct ext2_block_group *bgd = NULL;
struct ext_filesystem *fs = get_fs();
char *journal_buffer = zalloc(fs->blksz);
if (!journal_buffer)
return -ENOMEM;
/* get the block group descriptor table */
- gd = (struct ext2_block_group *)fs->gdtable;
+ bgd = (struct ext2_block_group *)fs->gdtable;
status = ext4fs_read_inode(ext4fs_root, inodeno, &inode);
if (status == 0)
goto fail;
@@ -631,19 +632,19 @@ static int ext4fs_delete_file(int inodeno)
debug("EXT4_EXTENTS Block releasing %ld: %d\n",
blknr, bg_idx);
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
status =
- ext4fs_devread(gd[bg_idx].block_id *
+ ext4fs_devread(bgd[bg_idx].block_id *
fs->sect_perblk, 0,
fs->blksz, journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -676,19 +677,19 @@ static int ext4fs_delete_file(int inodeno)
bg_idx);
debug("ActualB releasing %ld: %d\n", blknr, bg_idx);
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[bg_idx].block_id
+ status = ext4fs_devread(bgd[bg_idx].block_id
* fs->sect_perblk,
0, fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -701,7 +702,7 @@ static int ext4fs_delete_file(int inodeno)
/* get the block no */
inodeno--;
- blkno = __le32_to_cpu(gd[ibmap_idx].inode_table_id) +
+ blkno = __le32_to_cpu(bgd[ibmap_idx].inode_table_id) +
(inodeno % __le32_to_cpu(inode_per_grp)) / inodes_per_block;
/* get the offset of the inode */
@@ -731,15 +732,15 @@ static int ext4fs_delete_file(int inodeno)
/* update the respective inode bitmaps */
inodeno++;
ext4fs_reset_inode_bmap(inodeno, fs->inode_bmaps[ibmap_idx], ibmap_idx);
- gd[ibmap_idx].free_inodes++;
+ bgd[ibmap_idx].free_inodes++;
fs->sb->free_inodes++;
/* journal backup */
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[ibmap_idx].inode_id *
+ status = ext4fs_devread(bgd[ibmap_idx].inode_id *
fs->sect_perblk, 0, fs->blksz, journal_buffer);
if (status == 0)
goto fail;
- if (ext4fs_log_journal(journal_buffer, gd[ibmap_idx].inode_id))
+ if (ext4fs_log_journal(journal_buffer, bgd[ibmap_idx].inode_id))
goto fail;
ext4fs_update();
@@ -793,11 +794,11 @@ int ext4fs_init(void)
/* get the block group descriptor table */
fs->gdtable_blkno = ((EXT2_MIN_BLOCK_SIZE == fs->blksz) + 1);
- if (ext4fs_get_bgdtable() == -1) {
+ if (ext4fs_get_gdtable() == -1) {
printf("Error in getting the block group descriptor table\n");
goto fail;
}
- fs->gd = (struct ext2_block_group *)fs->gdtable;
+ fs->bgd = (struct ext2_block_group *)fs->gdtable;
/* load all the available bitmap block of the partition */
fs->blk_bmaps = zalloc(fs->no_blkgrp * sizeof(char *));
@@ -811,7 +812,7 @@ int ext4fs_init(void)
for (i = 0; i < fs->no_blkgrp; i++) {
status =
- ext4fs_devread(fs->gd[i].block_id * fs->sect_perblk, 0,
+ ext4fs_devread(fs->bgd[i].block_id * fs->sect_perblk, 0,
fs->blksz, (char *)fs->blk_bmaps[i]);
if (status == 0)
goto fail;
@@ -828,7 +829,7 @@ int ext4fs_init(void)
}
for (i = 0; i < fs->no_blkgrp; i++) {
- status = ext4fs_devread(fs->gd[i].inode_id * fs->sect_perblk,
+ status = ext4fs_devread(fs->bgd[i].inode_id * fs->sect_perblk,
0, fs->blksz,
(char *)fs->inode_bmaps[i]);
if (status == 0)
@@ -842,7 +843,7 @@ int ext4fs_init(void)
* reboot of a linux kernel
*/
for (i = 0; i < fs->no_blkgrp; i++)
- real_free_blocks = real_free_blocks + fs->gd[i].free_blocks;
+ real_free_blocks = real_free_blocks + fs->bgd[i].free_blocks;
if (real_free_blocks != fs->sb->free_blocks)
fs->sb->free_blocks = real_free_blocks;
@@ -907,7 +908,7 @@ void ext4fs_deinit(void)
free(fs->gdtable);
fs->gdtable = NULL;
- fs->gd = NULL;
+ fs->bgd = NULL;
/*
* reinitiliazed the global inode and
* block bitmap first execution check variables
@@ -929,7 +930,7 @@ static int ext4fs_write_file(struct ext2_inode *file_inode,
int previous_block_number = -1;
int delayed_start = 0;
int delayed_extent = 0;
- int delayed_skipfirst = 0;
+ __maybe_unused int delayed_skipfirst = 0;
int delayed_next = 0;
char *delayed_buf = NULL;
@@ -1087,7 +1088,7 @@ int ext4fs_write(const char *fname, unsigned char *buffer,
goto fail;
ibmap_idx = inodeno / ext4fs_root->sblock.inodes_per_group;
inodeno--;
- itable_blkno = __le32_to_cpu(fs->gd[ibmap_idx].inode_table_id) +
+ itable_blkno = __le32_to_cpu(fs->bgd[ibmap_idx].inode_table_id) +
(inodeno % __le32_to_cpu(sblock->inodes_per_group)) /
inodes_per_block;
blkoff = (inodeno % inodes_per_block) * fs->inodesz;
@@ -1105,7 +1106,7 @@ int ext4fs_write(const char *fname, unsigned char *buffer,
}
ibmap_idx = parent_inodeno / ext4fs_root->sblock.inodes_per_group;
parent_inodeno--;
- parent_itable_blkno = __le32_to_cpu(fs->gd[ibmap_idx].inode_table_id) +
+ parent_itable_blkno = __le32_to_cpu(fs->bgd[ibmap_idx].inode_table_id) +
(parent_inodeno %
__le32_to_cpu(sblock->inodes_per_group)) / inodes_per_block;
blkoff = (parent_inodeno % inodes_per_block) * fs->inodesz;
diff --git a/include/ext4fs.h b/include/ext4fs.h
index b6eedde..23298fc 100644
--- a/include/ext4fs.h
+++ b/include/ext4fs.h
@@ -94,7 +94,7 @@ struct ext_filesystem {
/* Superblock */
struct ext2_sblock *sb;
/* Block group descritpor table */
- struct ext2_block_group *gd;
+ struct ext2_block_group *bgd;
char *gdtable;
/* Block Bitmap Related */
--
1.7.7.3
More information about the U-Boot
mailing list