mirror of https://github.com/vitalif/e2fsprogs
e2fsck: fix gcc -Wall nits
Perhaps the most serious fix up is a type-punning warning which could result in miscompilation with overly enthusiastic compilers. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>debian-1.42.9
parent
577c773a60
commit
68477355a9
|
@ -314,7 +314,7 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
|
||||||
BLOCK_FLAG_HOLE, 0,
|
BLOCK_FLAG_HOLE, 0,
|
||||||
process_journal_block, &pb);
|
process_journal_block, &pb);
|
||||||
if ((pb.last_block + 1) * ctx->fs->blocksize <
|
if ((pb.last_block + 1) * ctx->fs->blocksize <
|
||||||
EXT2_I_SIZE(&j_inode->i_ext2)) {
|
(int) EXT2_I_SIZE(&j_inode->i_ext2)) {
|
||||||
retval = EXT2_ET_JOURNAL_TOO_SMALL;
|
retval = EXT2_ET_JOURNAL_TOO_SMALL;
|
||||||
goto try_backup_journal;
|
goto try_backup_journal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,8 +361,7 @@ static _INLINE_ void expand_dirent_expression(FILE *f, ext2_filsys fs, char ch,
|
||||||
struct problem_context *ctx)
|
struct problem_context *ctx)
|
||||||
{
|
{
|
||||||
struct ext2_dir_entry *dirent;
|
struct ext2_dir_entry *dirent;
|
||||||
unsigned int rec_len;
|
unsigned int rec_len, len;
|
||||||
int len;
|
|
||||||
|
|
||||||
if (!ctx || !ctx->dirent)
|
if (!ctx || !ctx->dirent)
|
||||||
goto no_dirent;
|
goto no_dirent;
|
||||||
|
|
|
@ -1837,12 +1837,12 @@ report_problem:
|
||||||
}
|
}
|
||||||
/* The next extent should match this index's logical start */
|
/* The next extent should match this index's logical start */
|
||||||
if (extent.e_lblk != lblk) {
|
if (extent.e_lblk != lblk) {
|
||||||
struct ext2_extent_info info;
|
struct ext2_extent_info e_info;
|
||||||
|
|
||||||
ext2fs_extent_get_info(ehandle, &info);
|
ext2fs_extent_get_info(ehandle, &e_info);
|
||||||
pctx->blk = lblk;
|
pctx->blk = lblk;
|
||||||
pctx->blk2 = extent.e_lblk;
|
pctx->blk2 = extent.e_lblk;
|
||||||
pctx->num = info.curr_level - 1;
|
pctx->num = e_info.curr_level - 1;
|
||||||
problem = PR_1_EXTENT_INDEX_START_INVALID;
|
problem = PR_1_EXTENT_INDEX_START_INVALID;
|
||||||
if (fix_problem(ctx, problem, pctx))
|
if (fix_problem(ctx, problem, pctx))
|
||||||
ext2fs_extent_fix_parents(ehandle);
|
ext2fs_extent_fix_parents(ehandle);
|
||||||
|
@ -1882,7 +1882,8 @@ report_problem:
|
||||||
}
|
}
|
||||||
pb->fragmented = 1;
|
pb->fragmented = 1;
|
||||||
}
|
}
|
||||||
while (is_dir && ++pb->last_db_block < extent.e_lblk) {
|
while (is_dir && (++pb->last_db_block <
|
||||||
|
(e2_blkcnt_t) extent.e_lblk)) {
|
||||||
pctx->errcode = ext2fs_add_dir_block2(ctx->fs->dblist,
|
pctx->errcode = ext2fs_add_dir_block2(ctx->fs->dblist,
|
||||||
pb->ino, 0,
|
pb->ino, 0,
|
||||||
pb->last_db_block);
|
pb->last_db_block);
|
||||||
|
@ -1904,7 +1905,7 @@ report_problem:
|
||||||
(EXT2FS_B2C(ctx->fs, blk) ==
|
(EXT2FS_B2C(ctx->fs, blk) ==
|
||||||
EXT2FS_B2C(ctx->fs, pb->previous_block)) &&
|
EXT2FS_B2C(ctx->fs, pb->previous_block)) &&
|
||||||
(blk & EXT2FS_CLUSTER_MASK(ctx->fs)) ==
|
(blk & EXT2FS_CLUSTER_MASK(ctx->fs)) ==
|
||||||
(blockcnt & EXT2FS_CLUSTER_MASK(ctx->fs)))) {
|
((unsigned) blockcnt & EXT2FS_CLUSTER_MASK(ctx->fs)))) {
|
||||||
mark_block_used(ctx, blk);
|
mark_block_used(ctx, blk);
|
||||||
pb->num_blocks++;
|
pb->num_blocks++;
|
||||||
}
|
}
|
||||||
|
@ -2353,7 +2354,7 @@ static int process_block(ext2_filsys fs,
|
||||||
(EXT2FS_B2C(ctx->fs, blk) ==
|
(EXT2FS_B2C(ctx->fs, blk) ==
|
||||||
EXT2FS_B2C(ctx->fs, p->previous_block)) &&
|
EXT2FS_B2C(ctx->fs, p->previous_block)) &&
|
||||||
(blk & EXT2FS_CLUSTER_MASK(ctx->fs)) ==
|
(blk & EXT2FS_CLUSTER_MASK(ctx->fs)) ==
|
||||||
(blockcnt & EXT2FS_CLUSTER_MASK(ctx->fs)))) {
|
((unsigned) blockcnt & EXT2FS_CLUSTER_MASK(ctx->fs)))) {
|
||||||
mark_block_used(ctx, blk);
|
mark_block_used(ctx, blk);
|
||||||
p->num_blocks++;
|
p->num_blocks++;
|
||||||
}
|
}
|
||||||
|
@ -2684,7 +2685,7 @@ static void mark_table_blocks(e2fsck_t ctx)
|
||||||
ext2_filsys fs = ctx->fs;
|
ext2_filsys fs = ctx->fs;
|
||||||
blk64_t b;
|
blk64_t b;
|
||||||
dgrp_t i;
|
dgrp_t i;
|
||||||
int j;
|
unsigned int j;
|
||||||
struct problem_context pctx;
|
struct problem_context pctx;
|
||||||
|
|
||||||
clear_problem_context(&pctx);
|
clear_problem_context(&pctx);
|
||||||
|
|
|
@ -624,7 +624,6 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
|
||||||
{
|
{
|
||||||
ext2_filsys fs = ctx->fs;
|
ext2_filsys fs = ctx->fs;
|
||||||
struct process_block_struct pb;
|
struct process_block_struct pb;
|
||||||
struct ext2_inode inode;
|
|
||||||
struct problem_context pctx;
|
struct problem_context pctx;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
|
||||||
|
@ -635,33 +634,35 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
|
||||||
pctx.str = "delete_file";
|
pctx.str = "delete_file";
|
||||||
pb.cur_cluster = ~0;
|
pb.cur_cluster = ~0;
|
||||||
|
|
||||||
e2fsck_read_inode(ctx, ino, &inode, "delete_file");
|
if (ext2fs_inode_has_valid_blocks2(fs, &dp->inode))
|
||||||
if (ext2fs_inode_has_valid_blocks2(fs, &inode))
|
pctx.errcode = ext2fs_block_iterate3(fs, ino,
|
||||||
pctx.errcode = ext2fs_block_iterate3(fs, ino, BLOCK_FLAG_READ_ONLY,
|
BLOCK_FLAG_READ_ONLY,
|
||||||
block_buf, delete_file_block, &pb);
|
block_buf,
|
||||||
|
delete_file_block, &pb);
|
||||||
if (pctx.errcode)
|
if (pctx.errcode)
|
||||||
fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
|
fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
|
||||||
if (ctx->inode_bad_map)
|
if (ctx->inode_bad_map)
|
||||||
ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
|
ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
|
||||||
ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(inode.i_mode));
|
ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(dp->inode.i_mode));
|
||||||
quota_data_sub(ctx->qctx, &inode, ino, pb.dup_blocks * fs->blocksize);
|
quota_data_sub(ctx->qctx, &dp->inode, ino,
|
||||||
quota_data_inodes(ctx->qctx, &inode, ino, -1);
|
pb.dup_blocks * fs->blocksize);
|
||||||
|
quota_data_inodes(ctx->qctx, &dp->inode, ino, -1);
|
||||||
|
|
||||||
/* Inode may have changed by block_iterate, so reread it */
|
/* Inode may have changed by block_iterate, so reread it */
|
||||||
e2fsck_read_inode(ctx, ino, &inode, "delete_file");
|
e2fsck_read_inode(ctx, ino, &dp->inode, "delete_file");
|
||||||
e2fsck_clear_inode(ctx, ino, &inode, 0, "delete_file");
|
e2fsck_clear_inode(ctx, ino, &dp->inode, 0, "delete_file");
|
||||||
if (ext2fs_file_acl_block(fs, &inode) &&
|
if (ext2fs_file_acl_block(fs, &dp->inode) &&
|
||||||
(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
|
(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
|
||||||
count = 1;
|
count = 1;
|
||||||
pctx.errcode = ext2fs_adjust_ea_refcount2(fs,
|
pctx.errcode = ext2fs_adjust_ea_refcount2(fs,
|
||||||
ext2fs_file_acl_block(fs, &inode),
|
ext2fs_file_acl_block(fs, &dp->inode),
|
||||||
block_buf, -1, &count);
|
block_buf, -1, &count);
|
||||||
if (pctx.errcode == EXT2_ET_BAD_EA_BLOCK_NUM) {
|
if (pctx.errcode == EXT2_ET_BAD_EA_BLOCK_NUM) {
|
||||||
pctx.errcode = 0;
|
pctx.errcode = 0;
|
||||||
count = 1;
|
count = 1;
|
||||||
}
|
}
|
||||||
if (pctx.errcode) {
|
if (pctx.errcode) {
|
||||||
pctx.blk = ext2fs_file_acl_block(fs, &inode);
|
pctx.blk = ext2fs_file_acl_block(fs, &dp->inode);
|
||||||
fix_problem(ctx, PR_1B_ADJ_EA_REFCOUNT, &pctx);
|
fix_problem(ctx, PR_1B_ADJ_EA_REFCOUNT, &pctx);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -672,12 +673,12 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
|
||||||
*/
|
*/
|
||||||
if ((count == 0) ||
|
if ((count == 0) ||
|
||||||
ext2fs_test_block_bitmap2(ctx->block_dup_map,
|
ext2fs_test_block_bitmap2(ctx->block_dup_map,
|
||||||
ext2fs_file_acl_block(fs, &inode))) {
|
ext2fs_file_acl_block(fs, &dp->inode))) {
|
||||||
blk64_t blk = ext2fs_file_acl_block(fs, &inode);
|
blk64_t blk = ext2fs_file_acl_block(fs, &dp->inode);
|
||||||
delete_file_block(fs, &blk,
|
delete_file_block(fs, &blk,
|
||||||
BLOCK_COUNT_EXTATTR, 0, 0, &pb);
|
BLOCK_COUNT_EXTATTR, 0, 0, &pb);
|
||||||
ext2fs_file_acl_block_set(fs, &inode, blk);
|
ext2fs_file_acl_block_set(fs, &dp->inode, blk);
|
||||||
quota_data_sub(ctx->qctx, &inode, ino, fs->blocksize);
|
quota_data_sub(ctx->qctx, &dp->inode, ino, fs->blocksize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -668,7 +668,7 @@ static void salvage_directory(ext2_filsys fs,
|
||||||
*/
|
*/
|
||||||
if ((left < 0) &&
|
if ((left < 0) &&
|
||||||
((int) rec_len + left > 8) &&
|
((int) rec_len + left > 8) &&
|
||||||
(name_len + 8 <= (int) rec_len + left) &&
|
((int) name_len + 8 <= (int) rec_len + left) &&
|
||||||
dirent->inode <= fs->super->s_inodes_count &&
|
dirent->inode <= fs->super->s_inodes_count &&
|
||||||
strnlen(dirent->name, name_len) == name_len) {
|
strnlen(dirent->name, name_len) == name_len) {
|
||||||
(void) ext2fs_set_rec_len(fs, (int) rec_len + left, dirent);
|
(void) ext2fs_set_rec_len(fs, (int) rec_len + left, dirent);
|
||||||
|
|
|
@ -729,12 +729,16 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
|
||||||
unsigned long long blocknr;
|
unsigned long long blocknr;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (record_len == 4)
|
if (record_len == 4) {
|
||||||
blocknr = ext2fs_be32_to_cpu(*((__be32 *)(bh->b_data +
|
__be32 b;
|
||||||
offset)));
|
memcpy(&b, bh->b_data + offset, sizeof(__be32));
|
||||||
else
|
blocknr = ext2fs_be32_to_cpu(b);
|
||||||
blocknr = ext2fs_be64_to_cpu(*((__be64 *)(bh->b_data +
|
} else {
|
||||||
offset)));
|
__be64 b;
|
||||||
|
memcpy(&b, bh->b_data + offset, sizeof(__be64));
|
||||||
|
blocknr = ext2fs_be64_to_cpu(b);
|
||||||
|
}
|
||||||
|
|
||||||
offset += record_len;
|
offset += record_len;
|
||||||
err = journal_set_revoke(journal, blocknr, sequence);
|
err = journal_set_revoke(journal, blocknr, sequence);
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -59,7 +59,7 @@ struct fill_dir_struct {
|
||||||
e2fsck_t ctx;
|
e2fsck_t ctx;
|
||||||
struct hash_entry *harray;
|
struct hash_entry *harray;
|
||||||
int max_array, num_array;
|
int max_array, num_array;
|
||||||
int dir_size;
|
unsigned int dir_size;
|
||||||
int compress;
|
int compress;
|
||||||
ino_t parent;
|
ino_t parent;
|
||||||
};
|
};
|
||||||
|
@ -122,7 +122,7 @@ static int fill_dir_block(ext2_filsys fs,
|
||||||
if (((dir_offset + rec_len) > fs->blocksize) ||
|
if (((dir_offset + rec_len) > fs->blocksize) ||
|
||||||
(rec_len < 8) ||
|
(rec_len < 8) ||
|
||||||
((rec_len % 4) != 0) ||
|
((rec_len % 4) != 0) ||
|
||||||
(((dirent->name_len & 0xFF)+8) > rec_len)) {
|
(((dirent->name_len & 0xFF)+8U) > rec_len)) {
|
||||||
fd->err = EXT2_ET_DIR_CORRUPTED;
|
fd->err = EXT2_ET_DIR_CORRUPTED;
|
||||||
return BLOCK_ABORT;
|
return BLOCK_ABORT;
|
||||||
}
|
}
|
||||||
|
@ -404,10 +404,9 @@ static errcode_t copy_dir_entries(e2fsck_t ctx,
|
||||||
char *block_start;
|
char *block_start;
|
||||||
struct hash_entry *ent;
|
struct hash_entry *ent;
|
||||||
struct ext2_dir_entry *dirent;
|
struct ext2_dir_entry *dirent;
|
||||||
unsigned int rec_len, prev_rec_len;
|
unsigned int rec_len, prev_rec_len, left, slack, offset;
|
||||||
int i, left;
|
int i;
|
||||||
ext2_dirhash_t prev_hash;
|
ext2_dirhash_t prev_hash;
|
||||||
int offset, slack;
|
|
||||||
|
|
||||||
if (ctx->htree_slack_percentage == 255) {
|
if (ctx->htree_slack_percentage == 255) {
|
||||||
profile_get_uint(ctx->profile, "options",
|
profile_get_uint(ctx->profile, "options",
|
||||||
|
|
|
@ -331,7 +331,8 @@ static const char *lookup_table_fallback(int num, struct str_table *table)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void die_signal_handler(int signum, siginfo_t *siginfo, void *context)
|
static void die_signal_handler(int signum, siginfo_t *siginfo,
|
||||||
|
void *context EXT2FS_ATTR((unused)))
|
||||||
{
|
{
|
||||||
void *stack_syms[32];
|
void *stack_syms[32];
|
||||||
int frames;
|
int frames;
|
||||||
|
|
|
@ -465,11 +465,11 @@ void check_super_block(e2fsck_t ctx)
|
||||||
ext2_filsys fs = ctx->fs;
|
ext2_filsys fs = ctx->fs;
|
||||||
blk64_t first_block, last_block;
|
blk64_t first_block, last_block;
|
||||||
struct ext2_super_block *sb = fs->super;
|
struct ext2_super_block *sb = fs->super;
|
||||||
|
unsigned int ipg_max;
|
||||||
problem_t problem;
|
problem_t problem;
|
||||||
blk64_t blocks_per_group = fs->super->s_blocks_per_group;
|
blk64_t blocks_per_group = fs->super->s_blocks_per_group;
|
||||||
__u32 bpg_max, cpg_max;
|
__u32 bpg_max, cpg_max;
|
||||||
int inodes_per_block;
|
int inodes_per_block;
|
||||||
int ipg_max;
|
|
||||||
int inode_size;
|
int inode_size;
|
||||||
int accept_time_fudge;
|
int accept_time_fudge;
|
||||||
int broken_system_clock;
|
int broken_system_clock;
|
||||||
|
|
Loading…
Reference in New Issue