e2fsprogs: fix trivial build warnings
PATCH 1/1 e2fsprogs: fix trivial build warnings
Quite a lot of warnings have crept into the build; this fixes many of the trivial ones. Mostly unused variables, a couple of header file inclusions, and one missing return value.
There are a few other warnings that I'll send patches for in a bit.
---
debugfs/debugfs.c +1 -1
@@ -1871,7 +1871,7 @@ static int find_supp_feature(__u32 *supp, int feature_type, char *name)void do_supported_features (int argc,char *argv[]) { -int i, j, ret; +int ret;__u32 supp[3 ] = {EXT2_LIB_FEATURE_COMPAT_SUPP ,EXT2_LIB_FEATURE_INCOMPAT_SUPP ,EXT2_LIB_FEATURE_RO_COMPAT_SUPP };
debugfs/htree.c +3 -1
@@ -22,6 +22,8 @@ extern int optind;extern char *optarg;#endif +#include "e2p/e2p.h" +#include "uuid/uuid.h" #include "debugfs.h" static FILE *pager;
@@ -413,7 +415,7 @@ static int search_dir_block(ext2_filsys fs, blk_t *blocknr,com_err ("htree_dump_leaf_inode" , errcode,"while getting rec_len for block %lu" , (unsigned long ) *blocknr); -return ; +return BLOCK_ABORT ; } if (dirent->inode && p->len == (dirent->name_len & 0xFF) &&
debugfs/ncheck.c +0 -2
@@ -34,8 +34,6 @@ static int ncheck_proc(struct ext2_dir_entry *dirent, {struct inode_walk_struct *iw = (struct inode_walk_struct *) private;int i; -char *pathname; -errcode_t retval; iw->position++;if (iw->position <=2 )
lib/ext2fs/extent.c +0 -1
@@ -1354,7 +1354,6 @@ errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags)char *cp;struct ext3_extent_header *eh;errcode_t retval =0 ; -struct ext2fs_extent extent;EXT2_CHECK_MAGIC (handle,EXT2_ET_MAGIC_EXTENT_HANDLE );
lib/ext2fs/gen_bitmap.c +0 -4
@@ -425,8 +425,6 @@ static int ext2fs_test_clear_generic_bitmap_range(ext2fs_generic_bitmap bitmap,int ext2fs_test_block_bitmap_range (ext2fs_block_bitmap bitmap,blk_t block,int num) { -int i; -EXT2_CHECK_MAGIC (bitmap,EXT2_ET_MAGIC_BLOCK_BITMAP );if ((block < bitmap->start) || (block+num-1 > bitmap->real_end)) { ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
@@ -440,8 +438,6 @@ int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,int ext2fs_test_inode_bitmap_range (ext2fs_inode_bitmap bitmap,ino_t inode,int num) { -int i; -EXT2_CHECK_MAGIC (bitmap,EXT2_ET_MAGIC_INODE_BITMAP );if ((inode < bitmap->start) || (inode+num-1 > bitmap->real_end)) { ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_TEST,
misc/filefrag.c +3 -5
@@ -171,11 +171,11 @@ int filefrag_fiemap(int fd, int blk_shift, int *num_extents)struct fiemap_extent *fm_ext = &fiemap->fm_extents[0 ];int count = (sizeof (buf) -sizeof (*fiemap)) /sizeof (struct fiemap_extent ); -unsigned long long logical_blk =0 , last_blk =0 ; +unsigned long long last_blk =0 ;unsigned long flags =0 ;static int fiemap_incompat_printed;int tot_extents =1 , n =0 ; -int last =0 , eof =0 ; +int last =0 ;int i, rc; fiemap->fm_length = ~0ULL ;
@@ -220,7 +220,7 @@ int filefrag_fiemap(int fd, int blk_shift, int *num_extents)break ;for (i =0 ; i < fiemap->fm_mapped_extents; i++) { -__u64 phy_blk, phy_start, logical_blk; +__u64 phy_blk, logical_blk;unsigned long ext_len; phy_blk = fm_ext[i].fe_physical >> blk_shift;
@@ -267,7 +267,6 @@ static void frag_report(const char *filename)int is_ext2 =0 ;static int once =1 ;unsigned int flags; -unsigned long first_blk, last_blk;int rc;#ifdef HAVE_OPEN64
@@ -378,7 +377,6 @@ int main(int argc, char**argv) {char **cpp;int c; -int ret;while ((c =getopt (argc, argv,"bsvx" )) !=EOF )switch (c) {
misc/mke2fs.c +1 -0
@@ -20,6 +20,7 @@#include <stdio.h> #include <string.h> +#include <strings.h> #include <fcntl.h> #include <ctype.h> #include <time.h>
misc/tune2fs.c +1 -1
@@ -975,7 +975,7 @@ static int get_move_bitmaps(ext2_filsys fs, int new_ino_blks_per_grp,blk_t j, needed_blocks =0 ;blk_t i_bmap, b_bmap;blk_t start_blk, end_blk; -int num, k; +int num;for (i =0 ; i < fs->group_desc_count; i++) { b_bmap = fs->group_desc[i].bg_block_bitmap;
Quoted 7 lines · Eric Sandeen
Quite a lot of warnings have crept into the build; this fixes many of the trivial ones. Mostly unused variables, a couple of header file inclusions, and one missing return value.
There are a few other warnings that I'll send patches for in a bit.
Most of these ones I had fixed in the e2fsprogs maint branch already, except for this one:
misc/mke2fs.c +1 -0
@@ -20,6 +20,7 @@#include <stdio.h> #include <string.h> +#include <strings.h> #include <fcntl.h> #include <ctype.h> #include <time.h>
... which was in one of Val's patches as well, but for the life of me I can't figure out what warnings it's supposed to suppress. It doesn't make a difference for me, and we're not using any of the traditional functions which would be defined in strings.h as opposed to string.h (i.e., bcopy, et. al.)
I assume this must be a Fedora header file thing? What difference does it make for you?
- Ted
Quoted 31 lines · Theodore Tso
Quoted 7 lines · Eric Sandeen
Quite a lot of warnings have crept into the build; this fixes many of the trivial ones. Mostly unused variables, a couple of header file inclusions, and one missing return value.
There are a few other warnings that I'll send patches for in a bit.
Most of these ones I had fixed in the e2fsprogs maint branch already, except for this one:
misc/mke2fs.c +1
-0@@ -20,6 +20,7 @@#include <stdio.h> #include <string.h> +#include <strings.h> #include <fcntl.h> #include <ctype.h> #include <time.h> ... which was in one of Val's patches as well, but for the life of me I can't figure out what warnings it's supposed to suppress. It doesn't make a difference for me, and we're not using any of the traditional functions which would be defined in
strings.has opposed tostring.h(i.e., bcopy, et. al.)
Quoted 4 lines
I assume this must be a Fedora header file thing? What difference does it make for you?
- Ted
I think it was this:
mke2fs.c: In function 'set_os':
mke2fs.c:667: warning: implicit declaration of function 'strcasecmp'
-Eric
Quoted 5 lines · Eric Sandeen
I think it was this:
mke2fs.c: In function 'set_os':
mke2fs.c:667: warning: implicit declaration of function 'strcasecmp'
Thanks, I'm not getting that warning, but according to SUSv3 strcasecmp is only defined in strings.h, and not in string.h.
- Ted