* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
@ 2012-10-03 19:53 Simon Glass
2012-10-03 19:53 ` [U-Boot] [PATCH 2/2] ext4: Fix unused variable warnings Simon Glass
2012-10-03 20:04 ` [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd Tom Rini
0 siblings, 2 replies; 13+ messages in thread
From: Simon Glass @ 2012-10-03 19:53 UTC (permalink / raw)
To: u-boot
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@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
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 2/2] ext4: Fix unused variable warnings
2012-10-03 19:53 [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd Simon Glass
@ 2012-10-03 19:53 ` Simon Glass
2012-10-04 0:32 ` Simon Glass
2012-10-03 20:04 ` [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd Tom Rini
1 sibling, 1 reply; 13+ messages in thread
From: Simon Glass @ 2012-10-03 19:53 UTC (permalink / raw)
To: u-boot
This patch fixes the following warnings with my gcc 4.6:
ext4fs.c:932:6: error: variable 'delayed_skipfirst' set but not used [-Werror=unused-but-set-variable]
ext4_common.c:381:8: error: variable 'ptr' set but not used [-Werror=unused-but-set-variable]
ext4_common.c:1170:8: error: variable 'status' set but not used [-Werror=unused-but-set-variable]
I'm not exactly sure whether this is the best fix, but it did look like
each variable is actually needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
common/cmd_ext4.c | 2 +-
fs/ext4/ext4_common.c | 7 ++++---
fs/ext4/ext4_journal.c | 4 ++--
fs/ext4/ext4fs.c | 1 +
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/common/cmd_ext4.c b/common/cmd_ext4.c
index ca46561..75bb8c1 100644
--- a/common/cmd_ext4.c
+++ b/common/cmd_ext4.c
@@ -107,7 +107,7 @@ int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
/* mount the filesystem */
if (!ext4fs_mount(info.size)) {
- printf("Bad ext4 partition %s %d:%lu\n", argv[1], dev, part);
+ printf("Bad ext4 partition %s %d:%d\n", argv[1], dev, part);
goto fail;
}
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index d6d55b9..b66beaa 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -36,6 +36,7 @@
#include <ext4fs.h>
#include <malloc.h>
#include <stddef.h>
+#include <linux/compiler.h>
#include <linux/stat.h>
#include <linux/time.h>
#include <asm/byteorder.h>
@@ -378,7 +379,7 @@ void ext4fs_update_parent_dentry(char *filename, int *p_ino, int file_type)
struct ext_filesystem *fs = get_fs();
/* directory entry */
struct ext2_dirent *dir;
- char *ptr = NULL;
+ __maybe_unused char *ptr = NULL;
char *temp_dir = NULL;
zero_buffer = zalloc(fs->blksz);
@@ -531,7 +532,7 @@ static int search_dir(struct ext2_inode *parent_inode, char *dirname)
int direct_blk_idx;
long int blknr;
int found = 0;
- char *ptr = NULL;
+ __maybe_unused char *ptr = NULL;
unsigned char *block_buffer = NULL;
struct ext2_dirent *dir = NULL;
struct ext2_dirent *previous_dir = NULL;
@@ -1170,7 +1171,7 @@ static void alloc_double_indirect_block(struct ext2_inode *file_inode,
{
short i;
short j;
- short status;
+ __maybe_unused short status;
long int actual_block_no;
/* di:double indirect */
long int di_blockno_parent;
diff --git a/fs/ext4/ext4_journal.c b/fs/ext4/ext4_journal.c
index 8a252d6..7281269 100644
--- a/fs/ext4/ext4_journal.c
+++ b/fs/ext4/ext4_journal.c
@@ -34,6 +34,7 @@
#include <malloc.h>
#include <ext_common.h>
#include "ext4_common.h"
+#include <linux/compiler.h>
static struct revoke_blk_list *revk_blk_list;
static struct revoke_blk_list *prev_node;
@@ -410,7 +411,7 @@ int ext4fs_check_journal_state(int recovery_flag)
int transaction_state = TRANSACTION_COMPLETE;
int prev_desc_logical_no = 0;
int curr_desc_logical_no = 0;
- int ofs, flags, block;
+ int ofs, flags;
struct ext2_inode inode_journal;
struct journal_superblock_t *jsb = NULL;
struct journal_header_t *jdb = NULL;
@@ -453,7 +454,6 @@ int ext4fs_check_journal_state(int recovery_flag)
i = be32_to_cpu(jsb->s_first);
while (1) {
- block = be32_to_cpu(jsb->s_first);
blknr = read_allocated_block(&inode_journal, i);
memset(temp_buff1, '\0', fs->blksz);
ext4fs_devread(blknr * fs->sect_perblk,
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 4eded1a..ccdaa15 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -37,6 +37,7 @@
#include <malloc.h>
#include <ext_common.h>
#include <ext4fs.h>
+#include <linux/compiler.h>
#include <linux/stat.h>
#include <linux/time.h>
#include <asm/byteorder.h>
--
1.7.7.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
2012-10-03 19:53 [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd Simon Glass
2012-10-03 19:53 ` [U-Boot] [PATCH 2/2] ext4: Fix unused variable warnings Simon Glass
@ 2012-10-03 20:04 ` Tom Rini
2012-10-03 20:40 ` Simon Glass
1 sibling, 1 reply; 13+ messages in thread
From: Tom Rini @ 2012-10-03 20:04 UTC (permalink / raw)
To: u-boot
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 10/03/12 12:53, Simon Glass wrote:
> 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@chromium.org>
Is there any way to change x86 to not be using a #define for gd?
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iQIcBAEBAgAGBQJQbJpVAAoJENk4IS6UOR1WdFgP/15lB4qT6FMGny9cqYn3aylV
PuzqYZOhpTzhNywFoUyPjWkp4Zgga+BB+lJ/1wu0GLv6o3aBDCBrwsoTO22RWmo0
dO0hADtycOjVTFAWUz1ORfxD1w2f06ZQPQkW72vOZCqAYMND+OqgVjwHHbWi5388
ra27zxa2nS0r3DFn+H47d3yhnooZ32jv5ChAgUfGzvU/yA8SUqfwhpt/9s2zxO40
O+Wl6FKavg4sGw4RCfAD9Cz2AR1vR80YzHcI6qFA/UUIf9M5Ai9Ka3yO/N+UBfaT
pjdc4MUh4j3Nd/l0mPxVBDNE8KQ6m56BhXLjAoPcSNisT8Dh1Uzz5nH2pJrGXNHk
JQUFXXQNEoNN8jQJKK6mrFlUYJ/YlFIYCQXPkC76WjyNmbz1Qd7wL2NmIbV9bQLZ
F3VTqXhXwjt8FG0x14+X17Q8eEABe/ONvdzAP1QZyG4UFxYKsIOumVM4T4QdY2sP
MYF4nX7tmVBxn3CVW6kwN1E8J7jxDnSWUjfiK+Sqpdw6V9biR+2Ozf8kXzWNZ0xs
QMvEiX08jyg/f6JxjvXLuess+fk0xskwIliM4WCkxZ1H3dbo1hXSVRJMTXNohEp0
hDxg9qypkrLcS9PIFHWr/oqWCIeOpOrwbVa4el/E6UboU6t91WyIxQICjxosLCg4
ViGSt12tKVckDH5yn7up
=bvjH
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
2012-10-03 20:04 ` [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd Tom Rini
@ 2012-10-03 20:40 ` Simon Glass
2012-10-03 20:47 ` Graeme Russ
2012-10-03 20:49 ` Tom Rini
0 siblings, 2 replies; 13+ messages in thread
From: Simon Glass @ 2012-10-03 20:40 UTC (permalink / raw)
To: u-boot
Hi Tom,
On Wed, Oct 3, 2012 at 1:04 PM, Tom Rini <trini@ti.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 10/03/12 12:53, Simon Glass wrote:
>
>> 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@chromium.org>
>
> Is there any way to change x86 to not be using a #define for gd?
I wasn't brave enough to look hard at that, although Graeme is on copy
and will know. It is actually using inline assembly to access this
special variable.
Regards,
Simon
>
> - --
> Tom
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
>
> iQIcBAEBAgAGBQJQbJpVAAoJENk4IS6UOR1WdFgP/15lB4qT6FMGny9cqYn3aylV
> PuzqYZOhpTzhNywFoUyPjWkp4Zgga+BB+lJ/1wu0GLv6o3aBDCBrwsoTO22RWmo0
> dO0hADtycOjVTFAWUz1ORfxD1w2f06ZQPQkW72vOZCqAYMND+OqgVjwHHbWi5388
> ra27zxa2nS0r3DFn+H47d3yhnooZ32jv5ChAgUfGzvU/yA8SUqfwhpt/9s2zxO40
> O+Wl6FKavg4sGw4RCfAD9Cz2AR1vR80YzHcI6qFA/UUIf9M5Ai9Ka3yO/N+UBfaT
> pjdc4MUh4j3Nd/l0mPxVBDNE8KQ6m56BhXLjAoPcSNisT8Dh1Uzz5nH2pJrGXNHk
> JQUFXXQNEoNN8jQJKK6mrFlUYJ/YlFIYCQXPkC76WjyNmbz1Qd7wL2NmIbV9bQLZ
> F3VTqXhXwjt8FG0x14+X17Q8eEABe/ONvdzAP1QZyG4UFxYKsIOumVM4T4QdY2sP
> MYF4nX7tmVBxn3CVW6kwN1E8J7jxDnSWUjfiK+Sqpdw6V9biR+2Ozf8kXzWNZ0xs
> QMvEiX08jyg/f6JxjvXLuess+fk0xskwIliM4WCkxZ1H3dbo1hXSVRJMTXNohEp0
> hDxg9qypkrLcS9PIFHWr/oqWCIeOpOrwbVa4el/E6UboU6t91WyIxQICjxosLCg4
> ViGSt12tKVckDH5yn7up
> =bvjH
> -----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
2012-10-03 20:40 ` Simon Glass
@ 2012-10-03 20:47 ` Graeme Russ
2012-10-03 20:58 ` Simon Glass
2012-10-03 20:49 ` Tom Rini
1 sibling, 1 reply; 13+ messages in thread
From: Graeme Russ @ 2012-10-03 20:47 UTC (permalink / raw)
To: u-boot
Hi Simon,
On Oct 4, 2012 6:40 AM, "Simon Glass" <sjg@chromium.org> wrote:
>
> Hi Tom,
>
> On Wed, Oct 3, 2012 at 1:04 PM, Tom Rini <trini@ti.com> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On 10/03/12 12:53, Simon Glass wrote:
> >
> >> 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@chromium.org>
> >
> > Is there any way to change x86 to not be using a #define for gd?
>
> I wasn't brave enough to look hard at that, although Graeme is on copy
> and will know. It is actually using inline assembly to access this
> special variable.
Isn't 'gd' used by everyone (global data)? I fail to see how this ever
worked.
Regards,
Graeme
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
2012-10-03 20:40 ` Simon Glass
2012-10-03 20:47 ` Graeme Russ
@ 2012-10-03 20:49 ` Tom Rini
2012-10-03 21:11 ` Simon Glass
1 sibling, 1 reply; 13+ messages in thread
From: Tom Rini @ 2012-10-03 20:49 UTC (permalink / raw)
To: u-boot
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 10/03/12 13:40, Simon Glass wrote:
> Hi Tom,
>
> On Wed, Oct 3, 2012 at 1:04 PM, Tom Rini <trini@ti.com> wrote: On
> 10/03/12 12:53, Simon Glass wrote:
>
>>>> 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@chromium.org>
>
>> Is there any way to change x86 to not be using a #define for gd?
>
> I wasn't brave enough to look hard at that, although Graeme is on
> copy and will know. It is actually using inline assembly to access
> this special variable.
Yeah, I took a quick stab at it myself earlier and didn't make it
work. We need to fix this for the release. My concern was "we must
share this with the kernel" but, we don't (I realized as I was
drafting this reply). So I'm more OK with taking the change now than
I was at first, but if we can not #define gd that will help prevent
the problem from popping up in the future.
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iQIcBAEBAgAGBQJQbKTnAAoJENk4IS6UOR1WJCEP/35rXvf/aAastlgJz5R/RCdM
PNfOqJrfladuRW8BcQBE2wjRR3V1D7O61AboDQmnwCuknEX+NZhEgDcTWQFBw93o
p8A0OKOMjWyMWtoJgwcTuvnJqRLaldqGyvcBaRv8X0uPYw9OJObIAmVb9n/tx6X3
i2kN0bfoPDGCgvEYm2ygXGyjvAGJ5A+5W/Cxsd+nGdjUGEBgS4q1GqEA24H++NAG
pQLo2r59pjd6IzjzHeDqPRImi9Cu5seiajjkA34fGwxZY06wreSokaut/WiTIMwb
VsYyZX6OXLcKmz2SbC8haY5FabgmF8bvkNJUMh4wMX02O3h09cOU25cWBjl0D3Lz
rfVl9sQwuyXEx5WAo0GK18wa/rt9q0mRDgaBfPeFNPoLa4lZuUZE9qEKtidX9A+G
aRjECVmCJYEq14atSqKZzeB1EshU066mN9y1XlV5B0/N95gztElQDkArFiuBmYXh
vhGvduxmR33W0EizhbZH9w53eTittKfa83GwV+SwVnYXxrytWiMPDYJzjaJ3pAcC
sxuTW65GcRbm5AEUpY3+8Uozdu7m00jGeCMi1pya+UqTam5gFVm7ee2g6PpdL2p3
mUi5cVHU58IuQdxhZqM2Omk5ptzHh23oPR0JdiG2kUoVLt3KZn9HmST9yUrLT/DP
pJ+twKTqC6YDqyLsfcDM
=Zfek
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
2012-10-03 20:47 ` Graeme Russ
@ 2012-10-03 20:58 ` Simon Glass
2012-10-03 21:44 ` Graeme Russ
0 siblings, 1 reply; 13+ messages in thread
From: Simon Glass @ 2012-10-03 20:58 UTC (permalink / raw)
To: u-boot
Hi Graeme,
On Wed, Oct 3, 2012 at 1:47 PM, Graeme Russ <graeme.russ@gmail.com> wrote:
> Hi Simon,
>
> On Oct 4, 2012 6:40 AM, "Simon Glass" <sjg@chromium.org> wrote:
>>
>> Hi Tom,
>>
>> On Wed, Oct 3, 2012 at 1:04 PM, Tom Rini <trini@ti.com> wrote:
>> > -----BEGIN PGP SIGNED MESSAGE-----
>> > Hash: SHA1
>> >
>> > On 10/03/12 12:53, Simon Glass wrote:
>> >
>> >> 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@chromium.org>
>> >
>> > Is there any way to change x86 to not be using a #define for gd?
>>
>> I wasn't brave enough to look hard at that, although Graeme is on copy
>> and will know. It is actually using inline assembly to access this
>> special variable.
>
> Isn't 'gd' used by everyone (global data)? I fail to see how this ever
> worked.
Well only x86 uses a #define for it, so other archs cause no problem.
It means that we can't use 'gd' as a symbol anywhere in U-Boot. I
suppose the only sensible use is a structure member, as here.
Regards,
Simon
>
> Regards,
>
> Graeme
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
2012-10-03 20:49 ` Tom Rini
@ 2012-10-03 21:11 ` Simon Glass
0 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2012-10-03 21:11 UTC (permalink / raw)
To: u-boot
Hi Tom,
On Wed, Oct 3, 2012 at 1:49 PM, Tom Rini <trini@ti.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 10/03/12 13:40, Simon Glass wrote:
>> Hi Tom,
>>
>> On Wed, Oct 3, 2012 at 1:04 PM, Tom Rini <trini@ti.com> wrote: On
>> 10/03/12 12:53, Simon Glass wrote:
>>
>>>>> 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@chromium.org>
>>
>>> Is there any way to change x86 to not be using a #define for gd?
>>
>> I wasn't brave enough to look hard at that, although Graeme is on
>> copy and will know. It is actually using inline assembly to access
>> this special variable.
>
> Yeah, I took a quick stab at it myself earlier and didn't make it
> work. We need to fix this for the release. My concern was "we must
> share this with the kernel" but, we don't (I realized as I was
> drafting this reply). So I'm more OK with taking the change now than
> I was at first, but if we can not #define gd that will help prevent
> the problem from popping up in the future.
Yes - if there is a fix for the x86 gd implementation then we could
skip this patch (or perhaps revert it later if the fix is really
complicated). Still, I think the patch should be harmless.
Unfortunately thought there are a few errors in the patches, so I will resend.
Regards,
Simon
>
> - --
> Tom
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
>
> iQIcBAEBAgAGBQJQbKTnAAoJENk4IS6UOR1WJCEP/35rXvf/aAastlgJz5R/RCdM
> PNfOqJrfladuRW8BcQBE2wjRR3V1D7O61AboDQmnwCuknEX+NZhEgDcTWQFBw93o
> p8A0OKOMjWyMWtoJgwcTuvnJqRLaldqGyvcBaRv8X0uPYw9OJObIAmVb9n/tx6X3
> i2kN0bfoPDGCgvEYm2ygXGyjvAGJ5A+5W/Cxsd+nGdjUGEBgS4q1GqEA24H++NAG
> pQLo2r59pjd6IzjzHeDqPRImi9Cu5seiajjkA34fGwxZY06wreSokaut/WiTIMwb
> VsYyZX6OXLcKmz2SbC8haY5FabgmF8bvkNJUMh4wMX02O3h09cOU25cWBjl0D3Lz
> rfVl9sQwuyXEx5WAo0GK18wa/rt9q0mRDgaBfPeFNPoLa4lZuUZE9qEKtidX9A+G
> aRjECVmCJYEq14atSqKZzeB1EshU066mN9y1XlV5B0/N95gztElQDkArFiuBmYXh
> vhGvduxmR33W0EizhbZH9w53eTittKfa83GwV+SwVnYXxrytWiMPDYJzjaJ3pAcC
> sxuTW65GcRbm5AEUpY3+8Uozdu7m00jGeCMi1pya+UqTam5gFVm7ee2g6PpdL2p3
> mUi5cVHU58IuQdxhZqM2Omk5ptzHh23oPR0JdiG2kUoVLt3KZn9HmST9yUrLT/DP
> pJ+twKTqC6YDqyLsfcDM
> =Zfek
> -----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
2012-10-03 20:58 ` Simon Glass
@ 2012-10-03 21:44 ` Graeme Russ
2012-10-03 22:59 ` Graeme Russ
0 siblings, 1 reply; 13+ messages in thread
From: Graeme Russ @ 2012-10-03 21:44 UTC (permalink / raw)
To: u-boot
Hi Simon,
On Oct 4, 2012 6:58 AM, "Simon Glass" <sjg@chromium.org> wrote:
>
> Hi Graeme,
>
> On Wed, Oct 3, 2012 at 1:47 PM, Graeme Russ <graeme.russ@gmail.com> wrote:
> > Hi Simon,
> >
> > On Oct 4, 2012 6:40 AM, "Simon Glass" <sjg@chromium.org> wrote:
> >>
> >> Hi Tom,
> >>
> >> On Wed, Oct 3, 2012 at 1:04 PM, Tom Rini <trini@ti.com> wrote:
> >> > -----BEGIN PGP SIGNED MESSAGE-----
> >> > Hash: SHA1
> >> >
> >> > On 10/03/12 12:53, Simon Glass wrote:
> >> >
> >> >> 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@chromium.org>
> >> >
> >> > Is there any way to change x86 to not be using a #define for gd?
> >>
> >> I wasn't brave enough to look hard at that, although Graeme is on copy
> >> and will know. It is actually using inline assembly to access this
> >> special variable.
> >
> > Isn't 'gd' used by everyone (global data)? I fail to see how this ever
> > worked.
>
> Well only x86 uses a #define for it, so other archs cause no problem.
> It means that we can't use 'gd' as a symbol anywhere in U-Boot. I
> suppose the only sensible use is a structure member, as here.
Ah, I see - and I don't see a quick and easy way out. Let me look a bit
deeper...
Regards,
Graeme
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
2012-10-03 21:44 ` Graeme Russ
@ 2012-10-03 22:59 ` Graeme Russ
2012-10-03 23:06 ` Tom Rini
0 siblings, 1 reply; 13+ messages in thread
From: Graeme Russ @ 2012-10-03 22:59 UTC (permalink / raw)
To: u-boot
Hi Simon,
On Thu, Oct 4, 2012 at 7:44 AM, Graeme Russ <graeme.russ@gmail.com> wrote:
> Hi Simon,
>
> On Oct 4, 2012 6:58 AM, "Simon Glass" <sjg@chromium.org> wrote:
>>
>> Hi Graeme,
>>
>> On Wed, Oct 3, 2012 at 1:47 PM, Graeme Russ <graeme.russ@gmail.com> wrote:
>> > Hi Simon,
>> >
>> > On Oct 4, 2012 6:40 AM, "Simon Glass" <sjg@chromium.org> wrote:
>> >>
>> >> Hi Tom,
>> >>
>> >> On Wed, Oct 3, 2012 at 1:04 PM, Tom Rini <trini@ti.com> wrote:
>> >> > -----BEGIN PGP SIGNED MESSAGE-----
>> >> > Hash: SHA1
>> >> >
>> >> > On 10/03/12 12:53, Simon Glass wrote:
>> >> >
>> >> >> 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@chromium.org>
>> >> >
>> >> > Is there any way to change x86 to not be using a #define for gd?
>> >>
>> >> I wasn't brave enough to look hard at that, although Graeme is on copy
>> >> and will know. It is actually using inline assembly to access this
>> >> special variable.
>> >
>> > Isn't 'gd' used by everyone (global data)? I fail to see how this ever
>> > worked.
>>
>> Well only x86 uses a #define for it, so other archs cause no problem.
>> It means that we can't use 'gd' as a symbol anywhere in U-Boot. I
>> suppose the only sensible use is a structure member, as here.
>
> Ah, I see - and I don't see a quick and easy way out. Let me look a bit
> deeper...
I remember now... commit 9e6c572ff03cda84c88663b23c7157d8b1f275ac
explains why the #define gd came about:
"Use the base address of the 'F' segment as a pointer to the global data
structure. By adding the linear address (i.e. the 'D' segment address) as
the first word of the global data structure, the address of the global data
relative to the 'D' segment can be found simply, for example, by:
fs movl 0, %eax
This makes the gd 'pointer' writable prior to relocation (by reloading the
Global Desctriptor Table) which brings x86 into line with all other arches
NOTE: Writing to the gd 'pointer' is expensive (but we only do it
twice) but using it to access global data members (read and write) is
still fairly cheap"
The other option was rather ugly - create gd_get() and gd_set() inline
functions and replace all instances of gd-> in all U-Boot source with
gd_get()-> or gd_set(foo). I don't think it would have made any
difference to code size, but the amount of code touched would have
been massive.
The only other option I can think of is to change gd into something
much less likely to be used as a symbol (__gd for example), but again,
the patch to do so would be huge
I'm open to alternatives
Regards,
Graeme
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
2012-10-03 22:59 ` Graeme Russ
@ 2012-10-03 23:06 ` Tom Rini
2012-10-04 0:18 ` Simon Glass
0 siblings, 1 reply; 13+ messages in thread
From: Tom Rini @ 2012-10-03 23:06 UTC (permalink / raw)
To: u-boot
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 10/03/12 15:59, Graeme Russ wrote:
> Hi Simon,
>
> On Thu, Oct 4, 2012 at 7:44 AM, Graeme Russ
> <graeme.russ@gmail.com> wrote:
>> Hi Simon,
>>
>> On Oct 4, 2012 6:58 AM, "Simon Glass" <sjg@chromium.org> wrote:
>>>
>>> Hi Graeme,
>>>
>>> On Wed, Oct 3, 2012 at 1:47 PM, Graeme Russ
>>> <graeme.russ@gmail.com> wrote:
>>>> Hi Simon,
>>>>
>>>> On Oct 4, 2012 6:40 AM, "Simon Glass" <sjg@chromium.org>
>>>> wrote:
>>>>>
>>>>> Hi Tom,
>>>>>
>>>>> On Wed, Oct 3, 2012 at 1:04 PM, Tom Rini <trini@ti.com>
>>>>> wrote:
>>>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>>>>
>>>>>> On 10/03/12 12:53, Simon Glass wrote:
>>>>>>
>>>>>>> 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@chromium.org>
>>>>>>
>>>>>> Is there any way to change x86 to not be using a #define
>>>>>> for gd?
>>>>>
>>>>> I wasn't brave enough to look hard at that, although
>>>>> Graeme is on copy and will know. It is actually using
>>>>> inline assembly to access this special variable.
>>>>
>>>> Isn't 'gd' used by everyone (global data)? I fail to see how
>>>> this ever worked.
>>>
>>> Well only x86 uses a #define for it, so other archs cause no
>>> problem. It means that we can't use 'gd' as a symbol anywhere
>>> in U-Boot. I suppose the only sensible use is a structure
>>> member, as here.
>>
>> Ah, I see - and I don't see a quick and easy way out. Let me
>> look a bit deeper...
>
> I remember now... commit 9e6c572ff03cda84c88663b23c7157d8b1f275ac
> explains why the #define gd came about:
>
> "Use the base address of the 'F' segment as a pointer to the
> global data structure. By adding the linear address (i.e. the 'D'
> segment address) as the first word of the global data structure,
> the address of the global data relative to the 'D' segment can be
> found simply, for example, by:
>
> fs movl 0, %eax
>
> This makes the gd 'pointer' writable prior to relocation (by
> reloading the Global Desctriptor Table) which brings x86 into line
> with all other arches
>
> NOTE: Writing to the gd 'pointer' is expensive (but we only do it
> twice) but using it to access global data members (read and write)
> is still fairly cheap"
>
> The other option was rather ugly - create gd_get() and gd_set()
> inline functions and replace all instances of gd-> in all U-Boot
> source with gd_get()-> or gd_set(foo). I don't think it would have
> made any difference to code size, but the amount of code touched
> would have been massive.
>
> The only other option I can think of is to change gd into something
> much less likely to be used as a symbol (__gd for example), but
> again, the patch to do so would be huge
>
> I'm open to alternatives
OK, we'll just go with re-naming the ext4 part and build-testing
things on x86 more often :) Thanks for digging up the details!
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iQIcBAEBAgAGBQJQbMTaAAoJENk4IS6UOR1WWmkP/2eRqqVTtCMwNZ6JP7W/lKDl
bGu2PrIqufPdM2CnQJPpgWWT0PcBIV8thkw5DPhJovjkH7bjFc9bmjXjX6sNZU7V
EnMxU/v6GUdCtM2QKeRv2x7a8iLj2uOcZS4tTg68vA7iD7fj5PwDBTNIGLCSh9EC
VbDo2juPXjz+jSRvuhU7w0MzbeRhwdZ2yACZjlNbnX5TdWam1iXMnxlPPh/pC0Td
ejwy0RuQwHPM7Gxy88b2wIc5DOXn8zoWrqLo1tx8B5S4b6jG+vI8zsFozi4lL9NJ
iCinGd56xDNBIQKPr2NjdpSqkh01efpHqaa7tuBa5mzswNDQikoOXE/ncPFqW618
6kaAHfzCAmSQb/QbwV5576LWw2LcQPGDzz8Mb8iL03nAgHZI8an/blEdJjK6j+1G
EpwzXQ6YkAWnrjCuAMGwfm/ARXai/Qh2YSnT5SPMxIXlWxIfAT7PsBRNbXOLQQp0
M/+NNE25cqAiZqwCxAT/eYR/huJtXbOqOj7GiH9NCn5L8c0Vm3mJ+o+YzRiraNro
D2INZRE1B7347wxb/wkjHlLTfz219RrkSNJE7HBHGPbrtSQOXZaeTa44TZPwZbKP
YuDojx9jMeuVQz1xqAoZECjdIgSEDjNcWcXU6l0JZYQClqDhxtS3GTdnlmMY0kdm
kcZsmBCbojJchtN+VUp8
=0NwK
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd
2012-10-03 23:06 ` Tom Rini
@ 2012-10-04 0:18 ` Simon Glass
0 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2012-10-04 0:18 UTC (permalink / raw)
To: u-boot
Hi,
On Wed, Oct 3, 2012 at 4:06 PM, Tom Rini <trini@ti.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 10/03/12 15:59, Graeme Russ wrote:
>> Hi Simon,
>>
>> On Thu, Oct 4, 2012 at 7:44 AM, Graeme Russ
>> <graeme.russ@gmail.com> wrote:
>>> Hi Simon,
>>>
>>> On Oct 4, 2012 6:58 AM, "Simon Glass" <sjg@chromium.org> wrote:
>>>>
>>>> Hi Graeme,
>>>>
>>>> On Wed, Oct 3, 2012 at 1:47 PM, Graeme Russ
>>>> <graeme.russ@gmail.com> wrote:
>>>>> Hi Simon,
>>>>>
>>>>> On Oct 4, 2012 6:40 AM, "Simon Glass" <sjg@chromium.org>
>>>>> wrote:
>>>>>>
>>>>>> Hi Tom,
>>>>>>
>>>>>> On Wed, Oct 3, 2012 at 1:04 PM, Tom Rini <trini@ti.com>
>>>>>> wrote:
>>>>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>>>>>
>>>>>>> On 10/03/12 12:53, Simon Glass wrote:
>>>>>>>
>>>>>>>> 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@chromium.org>
>>>>>>>
>>>>>>> Is there any way to change x86 to not be using a #define
>>>>>>> for gd?
>>>>>>
>>>>>> I wasn't brave enough to look hard at that, although
>>>>>> Graeme is on copy and will know. It is actually using
>>>>>> inline assembly to access this special variable.
>>>>>
>>>>> Isn't 'gd' used by everyone (global data)? I fail to see how
>>>>> this ever worked.
>>>>
>>>> Well only x86 uses a #define for it, so other archs cause no
>>>> problem. It means that we can't use 'gd' as a symbol anywhere
>>>> in U-Boot. I suppose the only sensible use is a structure
>>>> member, as here.
>>>
>>> Ah, I see - and I don't see a quick and easy way out. Let me
>>> look a bit deeper...
>>
>> I remember now... commit 9e6c572ff03cda84c88663b23c7157d8b1f275ac
>> explains why the #define gd came about:
>>
>> "Use the base address of the 'F' segment as a pointer to the
>> global data structure. By adding the linear address (i.e. the 'D'
>> segment address) as the first word of the global data structure,
>> the address of the global data relative to the 'D' segment can be
>> found simply, for example, by:
>>
>> fs movl 0, %eax
>>
>> This makes the gd 'pointer' writable prior to relocation (by
>> reloading the Global Desctriptor Table) which brings x86 into line
>> with all other arches
>>
>> NOTE: Writing to the gd 'pointer' is expensive (but we only do it
>> twice) but using it to access global data members (read and write)
>> is still fairly cheap"
>>
>> The other option was rather ugly - create gd_get() and gd_set()
>> inline functions and replace all instances of gd-> in all U-Boot
>> source with gd_get()-> or gd_set(foo). I don't think it would have
>> made any difference to code size, but the amount of code touched
>> would have been massive.
>>
>> The only other option I can think of is to change gd into something
>> much less likely to be used as a symbol (__gd for example), but
>> again, the patch to do so would be huge
>>
>> I'm open to alternatives
>
> OK, we'll just go with re-naming the ext4 part and build-testing
> things on x86 more often :) Thanks for digging up the details!
Sounds good, thank you both.
Regards
Simon
>
> - --
> Tom
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
>
> iQIcBAEBAgAGBQJQbMTaAAoJENk4IS6UOR1WWmkP/2eRqqVTtCMwNZ6JP7W/lKDl
> bGu2PrIqufPdM2CnQJPpgWWT0PcBIV8thkw5DPhJovjkH7bjFc9bmjXjX6sNZU7V
> EnMxU/v6GUdCtM2QKeRv2x7a8iLj2uOcZS4tTg68vA7iD7fj5PwDBTNIGLCSh9EC
> VbDo2juPXjz+jSRvuhU7w0MzbeRhwdZ2yACZjlNbnX5TdWam1iXMnxlPPh/pC0Td
> ejwy0RuQwHPM7Gxy88b2wIc5DOXn8zoWrqLo1tx8B5S4b6jG+vI8zsFozi4lL9NJ
> iCinGd56xDNBIQKPr2NjdpSqkh01efpHqaa7tuBa5mzswNDQikoOXE/ncPFqW618
> 6kaAHfzCAmSQb/QbwV5576LWw2LcQPGDzz8Mb8iL03nAgHZI8an/blEdJjK6j+1G
> EpwzXQ6YkAWnrjCuAMGwfm/ARXai/Qh2YSnT5SPMxIXlWxIfAT7PsBRNbXOLQQp0
> M/+NNE25cqAiZqwCxAT/eYR/huJtXbOqOj7GiH9NCn5L8c0Vm3mJ+o+YzRiraNro
> D2INZRE1B7347wxb/wkjHlLTfz219RrkSNJE7HBHGPbrtSQOXZaeTa44TZPwZbKP
> YuDojx9jMeuVQz1xqAoZECjdIgSEDjNcWcXU6l0JZYQClqDhxtS3GTdnlmMY0kdm
> kcZsmBCbojJchtN+VUp8
> =0NwK
> -----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH 2/2] ext4: Fix unused variable warnings
2012-10-03 19:53 ` [U-Boot] [PATCH 2/2] ext4: Fix unused variable warnings Simon Glass
@ 2012-10-04 0:32 ` Simon Glass
0 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2012-10-04 0:32 UTC (permalink / raw)
To: u-boot
Hi,
On Wed, Oct 3, 2012 at 12:53 PM, Simon Glass <sjg@chromium.org> wrote:
> This patch fixes the following warnings with my gcc 4.6:
>
> ext4fs.c:932:6: error: variable 'delayed_skipfirst' set but not used [-Werror=unused-but-set-variable]
> ext4_common.c:381:8: error: variable 'ptr' set but not used [-Werror=unused-but-set-variable]
> ext4_common.c:1170:8: error: variable 'status' set but not used [-Werror=unused-but-set-variable]
>
> I'm not exactly sure whether this is the best fix, but it did look like
> each variable is actually needed.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> common/cmd_ext4.c | 2 +-
> fs/ext4/ext4_common.c | 7 ++++---
> fs/ext4/ext4_journal.c | 4 ++--
> fs/ext4/ext4fs.c | 1 +
> 4 files changed, 8 insertions(+), 6 deletions(-)
>
Actually I think this problem was due to a broken toolchain, which
helps explain why I couldn't work out what the compiler was
complaining about. I think we should ignore this patch unless others
also see it. Sorry for the distraction.
Regards,
Simon
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-10-04 0:32 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-03 19:53 [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd Simon Glass
2012-10-03 19:53 ` [U-Boot] [PATCH 2/2] ext4: Fix unused variable warnings Simon Glass
2012-10-04 0:32 ` Simon Glass
2012-10-03 20:04 ` [U-Boot] [PATCH 1/2] ext4: Rename block group descriptor table from gd to bgd Tom Rini
2012-10-03 20:40 ` Simon Glass
2012-10-03 20:47 ` Graeme Russ
2012-10-03 20:58 ` Simon Glass
2012-10-03 21:44 ` Graeme Russ
2012-10-03 22:59 ` Graeme Russ
2012-10-03 23:06 ` Tom Rini
2012-10-04 0:18 ` Simon Glass
2012-10-03 20:49 ` Tom Rini
2012-10-03 21:11 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox