Whamcloud - gitweb
Fix gcc -Wall nits
authorTheodore Ts'o <tytso@mit.edu>
Tue, 1 Jan 2013 18:28:27 +0000 (13:28 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 1 Jan 2013 18:28:27 +0000 (13:28 -0500)
This fixes the last set of gcc -Wall complaints.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 files changed:
debugfs/extent_inode.c
debugfs/htree.c
debugfs/zap.c
e2fsck/pass1.c
e2fsck/recovery.c
e2fsck/rehash.c
e2fsck/unix.c
e2fsck/util.c
lib/e2p/getversion.c
lib/ext2fs/blkmap64_rb.c
lib/ext2fs/imager.c
lib/ext2fs/openfs.c
misc/e2initrd_helper.c
misc/filefrag.c
misc/tune2fs.c

index 69628a9..d726b2b 100644 (file)
@@ -66,9 +66,8 @@ static char *orig_prompt, *extent_prompt;
 
 void do_extent_open(int argc, char *argv[])
 {
-       struct ext3_extent_header *eh;
        ext2_ino_t      inode;
-       int             i, ret;
+       int             ret;
        errcode_t       retval;
        char            *cp;
 
@@ -220,7 +219,6 @@ void do_delete_node(int argc, char *argv[])
 {
        struct ext2fs_extent extent;
        errcode_t       retval;
-       int             err;
 
        if (common_extent_args_process(argc, argv, 1, 1, "delete_node",
                                       "", CHECK_FS_RW | CHECK_FS_BITMAPS))
@@ -286,8 +284,6 @@ void do_replace_node(int argc, char *argv[])
 void do_split_node(int argc, char *argv[])
 {
        errcode_t       retval;
-       struct ext2fs_extent extent;
-       int err;
 
        if (common_extent_args_process(argc, argv, 1, 1, "split_node",
                                       "", CHECK_FS_RW | CHECK_FS_BITMAPS))
@@ -465,8 +461,6 @@ void do_print_all(int argc, char **argv)
 
 void do_fix_parents(int argc, char **argv)
 {
-       struct ext2fs_extent    extent;
-       struct ext2_extent_info info;
        errcode_t               retval;
 
        if (common_extent_args_process(argc, argv, 1, 1, "fix_parents", "",
@@ -515,9 +509,7 @@ void do_info(int argc, char **argv)
 
 void do_goto_block(int argc, char **argv)
 {
-       struct ext2fs_extent    extent;
        errcode_t               retval;
-       int                     op = EXT2_EXTENT_NEXT_LEAF;
        blk64_t                 blk;
        int                     level = 0, err;
 
index 29ddf9c..24f8250 100644 (file)
@@ -201,7 +201,6 @@ void do_htree_dump(int argc, char *argv[])
        char            *buf = NULL;
        struct          ext2_dx_root_info  *rootnode;
        struct          ext2_dx_entry *ent;
-       struct          ext2_dx_countlimit *limit;
        errcode_t       errcode;
 
        if (check_fs_open(argv[0]))
@@ -255,7 +254,6 @@ void do_htree_dump(int argc, char *argv[])
        fprintf(pager, "\t Flags: %d\n", rootnode->unused_flags);
 
        ent = (struct ext2_dx_entry *) (buf + 24 + rootnode->info_length);
-       limit = (struct ext2_dx_countlimit *) ent;
 
        htree_dump_int_node(current_fs, ino, &inode, rootnode, ent,
                            buf + current_fs->blocksize,
index 3f3620b..4a1afbe 100644 (file)
@@ -32,9 +32,7 @@ void do_zap_block(int argc, char *argv[])
        ext2_ino_t      inode;
        errcode_t       errcode;
        blk64_t         block;
-       int             retval;
        char            *file = NULL;
-       char            *in_file = NULL;
        int             c, err;
        int             offset = -1;
        int             length = -1;
@@ -171,14 +169,11 @@ errout:
 
 void do_dump_block(int argc, char *argv[])
 {
-       unsigned long   pattern = 0;
        unsigned char   *buf;
        ext2_ino_t      inode;
        errcode_t       errcode;
        blk64_t         block;
-       int             retval;
        char            *file = NULL;
-       char            *in_file = NULL;
        int             c, err, i, j;
        int             suppress = -1;
 
index a8231f4..9c37515 100644 (file)
@@ -274,7 +274,7 @@ static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx)
        struct ext2_super_block *sb = ctx->fs->super;
        struct ext2_inode_large *inode;
        struct ext2_ext_attr_entry *entry;
-       char *start, *end;
+       char *start;
        unsigned int storage_size, remain;
        int problem = 0;
 
@@ -283,7 +283,6 @@ static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx)
                inode->i_extra_isize;
        start = ((char *) inode) + EXT2_GOOD_OLD_INODE_SIZE +
                inode->i_extra_isize + sizeof(__u32);
-       end = (char *) inode + EXT2_INODE_SIZE(ctx->fs->super);
        entry = (struct ext2_ext_attr_entry *) start;
 
        /* scan all entry's headers first */
index fcacabb..34c9e59 100644 (file)
@@ -283,12 +283,9 @@ int journal_recover(journal_t *journal)
 int journal_skip_recovery(journal_t *journal)
 {
        int                     err;
-       journal_superblock_t *  sb;
-
        struct recovery_info    info;
 
        memset (&info, 0, sizeof(info));
-       sb = journal->j_superblock;
 
        err = do_one_pass(journal, &info, PASS_SCAN);
 
@@ -363,11 +360,6 @@ static int do_one_pass(journal_t *journal,
        int                     tag_bytes = journal_tag_bytes(journal);
        __u32                   crc32_sum = ~0; /* Transactional Checksums */
 
-       /* Precompute the maximum metadata descriptors in a descriptor block */
-       int                     MAX_BLOCKS_PER_DESC;
-       MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t))
-                              / tag_bytes);
-
        /*
         * First thing is to establish what we expect to find in the log
         * (in terms of transaction IDs), and where (in terms of log
index aa7f406..1f0a0b8 100644 (file)
@@ -828,7 +828,7 @@ void e2fsck_rehash_directories(e2fsck_t ctx)
        struct dir_info_iter *  dirinfo_iter = 0;
        ext2_ino_t              ino;
        errcode_t               retval;
-       int                     cur, max, all_dirs, dir_index, first = 1;
+       int                     cur, max, all_dirs, first = 1;
 
        init_resource_track(&rtrack, ctx->fs->io);
        all_dirs = ctx->options & E2F_OPT_COMPRESS_DIRS;
@@ -840,7 +840,6 @@ void e2fsck_rehash_directories(e2fsck_t ctx)
 
        clear_problem_context(&pctx);
 
-       dir_index = ctx->fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_DIR_INDEX;
        cur = 0;
        if (all_dirs) {
                dirinfo_iter = e2fsck_dir_info_iter_begin(ctx);
index 48db71a..6471592 100644 (file)
@@ -204,8 +204,7 @@ static void show_stats(e2fsck_t     ctx)
                        ctx->fs_blockdev_count), ctx->fs_blockdev_count);
        log_out(ctx, P_("%12u fifo\n", "%12u fifos\n", ctx->fs_fifo_count),
                ctx->fs_fifo_count);
-       log_out(ctx, P_("%12u link\n", "%12u links\n",
-                       ctx->fs_links_count - dir_links),
+       log_out(ctx, P_("%12u link\n", "%12u links\n", num_links),
                ctx->fs_links_count - dir_links);
        log_out(ctx, P_("%12u symbolic link", "%12u symbolic links",
                        ctx->fs_symlinks_count), ctx->fs_symlinks_count);
@@ -217,9 +216,8 @@ static void show_stats(e2fsck_t     ctx)
                        ctx->fs_sockets_count),
                ctx->fs_sockets_count);
        log_out(ctx, "------------\n");
-       log_out(ctx, P_("%12u file\n", "%12u files\n",
-                       ctx->fs_total_count - dir_links),
-               ctx->fs_total_count - dir_links);
+       log_out(ctx, P_("%12u file\n", "%12u files\n", num_files),
+               num_files);
 }
 
 static void check_mount(e2fsck_t ctx)
index f3ba645..a6b9e86 100644 (file)
@@ -616,7 +616,7 @@ int ext2_file_type(unsigned int mode)
 errcode_t e2fsck_zero_blocks(ext2_filsys fs, blk_t blk, int num,
                             blk_t *ret_blk, int *ret_count)
 {
-       int             j, count, next_update, next_update_incr;
+       int             j, count;
        static char     *buf;
        errcode_t       retval;
 
@@ -639,10 +639,6 @@ errcode_t e2fsck_zero_blocks(ext2_filsys fs, blk_t blk, int num,
                memset(buf, 0, fs->blocksize * STRIDE_LENGTH);
        }
        /* OK, do the write loop */
-       next_update = 0;
-       next_update_incr = num / 100;
-       if (next_update_incr < 1)
-               next_update_incr = 1;
        for (j = 0; j < num; j += STRIDE_LENGTH, blk += STRIDE_LENGTH) {
                count = num - j;
                if (count > STRIDE_LENGTH)
index e7c6fec..71031ff 100644 (file)
@@ -31,7 +31,7 @@ int getversion (int fd, unsigned long * version)
 
        r = ioctl (fd, EXT2_IOC_GETVERSION, &ver);
        *version = ver;
-       return 0;
+       return r;
 #else /* ! HAVE_EXT2_IOCTLS */
        extern int errno;
        errno = EOPNOTSUPP;
index 6007238..9a8938a 100644 (file)
@@ -677,12 +677,11 @@ static errcode_t rb_set_bmap_range(ext2fs_generic_bitmap bitmap,
        unsigned char *cp = in;
        size_t i;
        int first_set = -1;
-       int ret;
 
        bp = (struct ext2fs_rb_private *) bitmap->private;
 
        for (i = 0; i < num; i++) {
-               if (i & 7 == 0) {
+               if ((i & 7) == 0) {
                        unsigned char c = cp[i/8];
                        if (c == 0xFF) {
                                if (first_set == -1)
index a0fb81e..7f3b25b 100644 (file)
@@ -279,7 +279,7 @@ errout:
 errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
 {
        ext2fs_generic_bitmap   bmap;
-       errcode_t               err, retval;
+       errcode_t               retval;
        ssize_t                 actual;
        __u32                   itr, cnt, size;
        int                     c, total_size;
@@ -292,7 +292,6 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
                                return retval;
                }
                bmap = fs->inode_map;
-               err = EXT2_ET_MAGIC_INODE_BITMAP;
                itr = 1;
                cnt = EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count;
                size = (EXT2_INODES_PER_GROUP(fs->super) / 8);
@@ -303,7 +302,6 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
                                return retval;
                }
                bmap = fs->block_map;
-               err = EXT2_ET_MAGIC_BLOCK_BITMAP;
                itr = fs->super->s_first_data_block;
                cnt = EXT2_BLOCKS_PER_GROUP(fs->super) * fs->group_desc_count;
                size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
@@ -356,7 +354,7 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
 errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
 {
        ext2fs_generic_bitmap   bmap;
-       errcode_t               err, retval;
+       errcode_t               retval;
        __u32                   itr, cnt;
        char                    buf[1024];
        unsigned int            size;
@@ -369,7 +367,6 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
                                return retval;
                }
                bmap = fs->inode_map;
-               err = EXT2_ET_MAGIC_INODE_BITMAP;
                itr = 1;
                cnt = EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count;
                size = (EXT2_INODES_PER_GROUP(fs->super) / 8);
@@ -380,7 +377,6 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
                                return retval;
                }
                bmap = fs->block_map;
-               err = EXT2_ET_MAGIC_BLOCK_BITMAP;
                itr = fs->super->s_first_data_block;
                cnt = EXT2_BLOCKS_PER_GROUP(fs->super) * fs->group_desc_count;
                size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
index 482e4ab..d483bd9 100644 (file)
@@ -99,10 +99,11 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
        errcode_t       retval;
        unsigned long   i, first_meta_bg;
        __u32           features;
-       unsigned int    groups_per_block, blocks_per_group, io_flags;
+       unsigned int    blocks_per_group, io_flags;
        blk64_t         group_block, blk;
        char            *dest, *cp;
 #ifdef WORDS_BIGENDIAN
+       unsigned int    groups_per_block;
        struct ext2_group_desc *gdp;
        int             j;
 #endif
@@ -332,7 +333,9 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
        if (group_block == 0 && fs->blocksize == 1024)
                group_block = 1; /* Deal with 1024 blocksize && bigalloc */
        dest = (char *) fs->group_desc;
+#ifdef WORDS_BIGENDIAN
        groups_per_block = EXT2_DESC_PER_BLOCK(fs->super);
+#endif
        if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
                first_meta_bg = fs->super->s_first_meta_bg;
        else
index b2f39bc..aa97557 100644 (file)
@@ -39,7 +39,7 @@ extern char *optarg;
 #include "../version.h"
 #include "nls-enable.h"
 
-const char * program_name = "get_fstab";
+const char * program_name = "e2initrd_helper";
 char * device_name;
 static int open_flag;
 static int root_type;
@@ -327,7 +327,7 @@ static void PRS(int argc, char **argv)
                usage();
        device_name = blkid_get_devname(NULL, argv[optind], NULL);
        if (!device_name) {
-               com_err("tune2fs", 0, _("Unable to resolve '%s'"),
+               com_err(program_name, 0, _("Unable to resolve '%s'"),
                        argv[optind]);
                exit(1);
        }
@@ -342,6 +342,10 @@ static void get_root_type(ext2_filsys fs)
        int             ret;
 
        retval = get_file(fs, "/etc/fstab", &file);
+       if (retval) {
+               com_err(program_name, retval, "couldn't open /etc/fstab");
+               exit(1);
+       }
 
        while (!mem_file_eof(&file)) {
                buf = get_line(&file);
index 13f5e15..ee03a07 100644 (file)
@@ -336,7 +336,6 @@ static void frag_report(const char *filename)
        static struct statfs fsinfo;
        ext2fs_struct_stat st;
        int             blk_shift;
-       int             bs;
        long            fd;
        unsigned long   numblocks;
        int             data_blocks_per_cyl = 1;
index 84fe4ce..2c8b9e8 100644 (file)
@@ -1092,7 +1092,7 @@ static void parse_tune2fs_options(int argc, char **argv)
                *io_options++ = 0;
        device_name = blkid_get_devname(NULL, argv[optind], NULL);
        if (!device_name) {
-               com_err("tune2fs", 0, _("Unable to resolve '%s'"),
+               com_err(program_name, 0, _("Unable to resolve '%s'"),
                        argv[optind]);
                exit(1);
        }