Whamcloud - gitweb
e2fsck: use dgrp_t for block group numbers
authorTheodore Ts'o <tytso@mit.edu>
Tue, 3 Dec 2013 04:21:31 +0000 (23:21 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 3 Dec 2013 04:21:31 +0000 (23:21 -0500)
Make e2fsck consistently use dgrp_t for bloc group numbers to avoid
-Wconveresion noise.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/journal.c
e2fsck/message.c
e2fsck/pass1.c
e2fsck/pass2.c
e2fsck/pass4.c
e2fsck/pass5.c
e2fsck/problem.h

index bd2c9a1..eb891ca 100644 (file)
@@ -945,7 +945,8 @@ void e2fsck_move_ext3_journal(e2fsck_t ctx)
        ext2_ino_t              ino;
        errcode_t               retval;
        const char * const *    cpp;
-       int                     group, mount_flags;
+       dgrp_t                  group;
+       int                     mount_flags;
 
        clear_problem_context(&pctx);
 
index 80af1af..7b2cb62 100644 (file)
@@ -450,7 +450,7 @@ static _INLINE_ void expand_percent_expression(FILE *f, ext2_filsys fs,
                fprintf(f, "%*u", width, ctx->dir);
                break;
        case 'g':
-               fprintf(f, "%*d", width, ctx->group);
+               fprintf(f, "%*u", width, ctx->group);
                break;
        case 'i':
                fprintf(f, "%*u", width, ctx->ino);
index 3cf4aac..a853413 100644 (file)
@@ -2004,7 +2004,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
        struct process_block_struct pb;
        ext2_ino_t      ino = pctx->ino;
        struct ext2_inode *inode = pctx->inode;
-       int             bad_size = 0;
+       unsigned        bad_size = 0;
        int             dirty_inode = 0;
        int             extent_fs;
        __u64           size;
@@ -2566,14 +2566,16 @@ static int process_bad_block(ext2_filsys fs,
        return 0;
 }
 
-static void new_table_block(e2fsck_t ctx, blk64_t first_block, int group,
+static void new_table_block(e2fsck_t ctx, blk64_t first_block, dgrp_t group,
                            const char *name, int num, blk64_t *new_block)
 {
        ext2_filsys fs = ctx->fs;
        dgrp_t          last_grp;
        blk64_t         old_block = *new_block;
        blk64_t         last_block;
-       int             i, is_flexbg, flexbg, flexbg_size;
+       dgrp_t          flexbg;
+       unsigned        flexbg_size;
+       int             i, is_flexbg;
        char            *buf;
        struct problem_context  pctx;
 
index 6ef17d3..65d8de4 100644 (file)
@@ -844,7 +844,7 @@ out_htree:
        dict_init(&de_dict, DICTCOUNT_T_MAX, dict_de_cmp);
        prev = 0;
        do {
-               int group;
+               dgrp_t group;
                ext2_ino_t first_unused_inode;
 
                problem = 0;
index 2d55180..21d93f0 100644 (file)
@@ -99,7 +99,7 @@ void e2fsck_pass4(e2fsck_t ctx)
        struct problem_context  pctx;
        __u16   link_count, link_counted;
        char    *buf = 0;
-       int     group, maxgroup;
+       dgrp_t  group, maxgroup;
 
        init_resource_track(&rtrack, ctx->fs->io);
 
index feaa83e..d4bdbd8 100644 (file)
@@ -196,7 +196,7 @@ static void check_block_bitmaps(e2fsck_t ctx)
        ext2_filsys fs = ctx->fs;
        blk64_t i;
        unsigned int    *free_array;
-       int     group = 0;
+       dgrp_t          g, group = 0;
        unsigned int    blocks = 0;
        blk64_t free_blocks = 0;
        blk64_t first_free = ext2fs_blocks_count(fs->super);
@@ -498,15 +498,15 @@ redo_counts:
        } else if (fixit == 0)
                ext2fs_unmark_valid(fs);
 
-       for (i = 0; i < fs->group_desc_count; i++) {
-               if (free_array[i] != ext2fs_bg_free_blocks_count(fs, i)) {
-                       pctx.group = i;
-                       pctx.blk = ext2fs_bg_free_blocks_count(fs, i);
-                       pctx.blk2 = free_array[i];
+       for (g = 0; g < fs->group_desc_count; g++) {
+               if (free_array[g] != ext2fs_bg_free_blocks_count(fs, g)) {
+                       pctx.group = g;
+                       pctx.blk = ext2fs_bg_free_blocks_count(fs, g);
+                       pctx.blk2 = free_array[g];
 
                        if (fix_problem(ctx, PR_5_FREE_BLOCK_COUNT_GROUP,
                                        &pctx)) {
-                               ext2fs_bg_free_blocks_count_set(fs, i, free_array[i]);
+                               ext2fs_bg_free_blocks_count_set(fs, g, free_array[g]);
                                ext2fs_mark_super_dirty(fs);
                        } else
                                ext2fs_unmark_valid(fs);
@@ -536,7 +536,7 @@ static void check_inode_bitmaps(e2fsck_t ctx)
        unsigned int    free_inodes = 0;
        int             group_free = 0;
        int             dirs_count = 0;
-       int             group = 0;
+       dgrp_t          group = 0;
        unsigned int    inodes = 0;
        ext2_ino_t      *free_array;
        ext2_ino_t      *dir_array;
index 4e7c9cd..6cb09cf 100644 (file)
@@ -18,7 +18,7 @@ struct problem_context {
        struct ext2_dir_entry *dirent;
        blk64_t blk, blk2;
        e2_blkcnt_t     blkcount;
-       int             group;
+       dgrp_t          group;
        __u32           csum1, csum2;
        __u64   num;
        const char *str;