From 2acad6b4895a0e218f9d9eece1ade23c2cf4ffc7 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 7 Jun 2008 11:04:10 -0400 Subject: [PATCH] Fix gcc -Wall warnings in e2fsck Signed-off-by: "Theodore Ts'o" --- e2fsck/gen_crc32table.c | 8 +++++++- e2fsck/jfs_user.h | 15 ++++++++------- e2fsck/pass1.c | 11 +++++------ e2fsck/recovery.c | 6 ++++-- e2fsck/unix.c | 5 +++-- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/e2fsck/gen_crc32table.c b/e2fsck/gen_crc32table.c index 89b32b2..2c1aa8e 100644 --- a/e2fsck/gen_crc32table.c +++ b/e2fsck/gen_crc32table.c @@ -71,7 +71,13 @@ static void output_table(uint32_t table[], int len, const char *trans) printf("%s(0x%8.8xL)\n", trans, table[len - 1]); } -int main(int argc, char** argv) +#ifdef __GNUC__ +#define ATTR(x) __attribute__(x) +#else +#define ATTR(x) +#endif + +int main(int argc ATTR((unused)), char** argv ATTR((unused))) { printf("/* this file is generated - do not edit */\n\n"); diff --git a/e2fsck/jfs_user.h b/e2fsck/jfs_user.h index 09d348c..22be945 100644 --- a/e2fsck/jfs_user.h +++ b/e2fsck/jfs_user.h @@ -63,13 +63,6 @@ typedef struct { typedef unsigned int __be32; -/* - * We use the standard libext2fs portability tricks for inline - * functions. - */ -extern kmem_cache_t * do_cache_create(int len); -extern void do_cache_destroy(kmem_cache_t *cache); - #define __init /* @@ -77,6 +70,14 @@ extern void do_cache_destroy(kmem_cache_t *cache); */ #include +/* + * We use the standard libext2fs portability tricks for inline + * functions. + */ +extern kmem_cache_t * do_cache_create(int len); +extern void do_cache_destroy(kmem_cache_t *cache); +extern size_t journal_tag_bytes(journal_t *journal); + #if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) #ifdef E2FSCK_INCLUDE_INLINE_FUNCS #define _INLINE_ extern diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index ee57497..3e08b61 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -1620,7 +1620,7 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx, struct ext2fs_extent extent; blk_t blk; e2_blkcnt_t blockcnt; - int i; + unsigned int i; int is_dir, is_leaf; errcode_t problem; struct ext2_extent_info info; @@ -1679,7 +1679,7 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx, pctx->errcode = ext2fs_extent_get(ehandle, EXT2_EXTENT_DOWN, &extent); if (pctx->errcode) { - printf("Error1: %s on inode %lld\n", + printf("Error1: %s on inode %u\n", error_message(pctx->errcode), pctx->ino); abort(); } @@ -1687,7 +1687,7 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx, pctx->errcode = ext2fs_extent_get(ehandle, EXT2_EXTENT_UP, &extent); if (pctx->errcode) { - printf("Error1: %s on inode %lld\n", + printf("Error1: %s on inode %u\n", error_message(pctx->errcode), pctx->ino); abort(); } @@ -1723,8 +1723,7 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx, } static void check_blocks_extents(e2fsck_t ctx, struct problem_context *pctx, - struct process_block_struct *pb, - char *block_buf) + struct process_block_struct *pb) { struct ext2_inode *inode = pctx->inode; ext2_extent_handle_t ehandle; @@ -1798,7 +1797,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx, if ((ctx->fs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS) && (inode->i_flags & EXT4_EXTENTS_FL)) - check_blocks_extents(ctx, pctx, &pb, block_buf); + check_blocks_extents(ctx, pctx, &pb); else pctx->errcode = ext2fs_block_iterate2(fs, ino, pb.is_dir ? BLOCK_FLAG_HOLE : 0, diff --git a/e2fsck/recovery.c b/e2fsck/recovery.c index 2edb576..8e40575 100644 --- a/e2fsck/recovery.c +++ b/e2fsck/recovery.c @@ -308,6 +308,7 @@ int journal_skip_recovery(journal_t *journal) return err; } +#if 0 static inline unsigned long long read_tag_block(int tag_bytes, journal_block_tag_t *tag) { unsigned long long block = be32_to_cpu(tag->t_blocknr); @@ -315,6 +316,7 @@ static inline unsigned long long read_tag_block(int tag_bytes, journal_block_tag block |= (__u64)be32_to_cpu(tag->t_blocknr_high) << 32; return block; } +#endif /* * calc_chksums calculates the checksums for the blocks described in the @@ -642,8 +644,8 @@ static int do_one_pass(journal_t *journal, if (chksum_err) { info->end_transaction = next_commit_ID; - jbd_debug(1, "Checksum_err\n"); - + jbd_debug(1, "Checksum_err %x %x\n", + crc32_sum, found_chksum); if (!JFS_HAS_INCOMPAT_FEATURE(journal, JFS_FEATURE_INCOMPAT_ASYNC_COMMIT)){ journal->j_failed_commit = diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 4ab0802..6173fc1 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -289,7 +289,8 @@ static void check_if_skip(e2fsck_t ctx) (unsigned) fs->super->s_max_mnt_count*2)) reason = 0; } else if (fs->super->s_checkinterval && - ((ctx->now - lastcheck) >= fs->super->s_checkinterval)) { + ((ctx->now - lastcheck) >= + ((time_t) fs->super->s_checkinterval))) { reason = _(" has gone %u days without being checked"); reason_arg = (ctx->now - fs->super->s_lastcheck)/(3600*24); if (batt && ((ctx->now - fs->super->s_lastcheck) < @@ -688,7 +689,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) /* What we do by default, anyway! */ break; case 'b': - res = sscanf(optarg, "%d", &ctx->use_superblock); + res = sscanf(optarg, "%u", &ctx->use_superblock); if (res != 1) goto sscanf_err; ctx->flags |= E2F_FLAG_SB_SPECIFIED; -- 1.8.3.1