diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-07-07 13:50:22 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-07-07 13:50:22 -0400 |
commit | d32c915abfb224f6f6659e9cada7e9f759b7e3d2 (patch) | |
tree | a2eeecfaa15d5115ef64927db1c1daed3451fbee | |
parent | 062cc472e6cae60a1fa43976bcc6ff39f8351ccb (diff) | |
download | e2fsprogs-d32c915abfb224f6f6659e9cada7e9f759b7e3d2.tar.gz |
libext2fs: Fix gcc -Wall warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | lib/ext2fs/alloc_tables.c | 3 | ||||
-rw-r--r-- | lib/ext2fs/check_desc.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/csum.c | 10 | ||||
-rw-r--r-- | lib/ext2fs/ext2_fs.h | 7 | ||||
-rw-r--r-- | lib/ext2fs/ext2fs.h | 7 | ||||
-rw-r--r-- | lib/ext2fs/link.c | 4 | ||||
-rw-r--r-- | lib/ext2fs/openfs.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/punch.c | 8 | ||||
-rw-r--r-- | lib/ext2fs/unix_io.c | 6 |
9 files changed, 29 insertions, 20 deletions
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c index ee2ac4d2..8b1d2949 100644 --- a/lib/ext2fs/alloc_tables.c +++ b/lib/ext2fs/alloc_tables.c @@ -80,10 +80,11 @@ static blk64_t flexbg_offset(ext2_filsys fs, dgrp_t group, blk64_t start_blk, errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, ext2fs_block_bitmap bmap) { + unsigned int j; errcode_t retval; blk64_t group_blk, start_blk, last_blk, new_blk, blk; dgrp_t last_grp = 0; - int j, rem_grps = 0, flexbg_size = 0; + int rem_grps = 0, flexbg_size = 0; group_blk = ext2fs_group_first_block2(fs, group); last_blk = ext2fs_group_last_block2(fs, group); diff --git a/lib/ext2fs/check_desc.c b/lib/ext2fs/check_desc.c index 0b7052e8..da869641 100644 --- a/lib/ext2fs/check_desc.c +++ b/lib/ext2fs/check_desc.c @@ -37,7 +37,7 @@ errcode_t ext2fs_check_desc(ext2_filsys fs) blk64_t first_block = fs->super->s_first_data_block; blk64_t last_block = ext2fs_blocks_count(fs->super)-1; blk64_t blk, b; - int j; + unsigned int j; EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c index 58e29710..2fece689 100644 --- a/lib/ext2fs/csum.c +++ b/lib/ext2fs/csum.c @@ -46,7 +46,7 @@ STATIC __u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group) desc = ext2fs_group_desc(fs, fs->group_desc, group); if (fs->super->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) { - int offset = offsetof(struct ext2_group_desc, bg_checksum); + size_t offset = offsetof(struct ext2_group_desc, bg_checksum); #ifdef WORDS_BIGENDIAN struct ext4_group_desc swabdesc; @@ -127,10 +127,10 @@ errcode_t ext2fs_set_gdt_csum(ext2_filsys fs) return 0; for (i = 0; i < fs->group_desc_count; i++) { - unsigned int old_csum = ext2fs_bg_checksum(fs, i); - int old_unused = ext2fs_bg_itable_unused(fs, i); - unsigned int old_flags = ext2fs_bg_flags(fs, i); - int old_free_inodes_count = ext2fs_bg_free_inodes_count(fs, i); + __u32 old_csum = ext2fs_bg_checksum(fs, i); + __u32 old_unused = ext2fs_bg_itable_unused(fs, i); + __u32 old_flags = ext2fs_bg_flags(fs, i); + __u32 old_free_inodes_count = ext2fs_bg_free_inodes_count(fs, i); if (old_free_inodes_count == sb->s_inodes_per_group) { ext2fs_bg_flags_set(fs, i, EXT2_BG_INODE_UNINIT); diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index 0970506f..54cb3d4b 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -231,11 +231,12 @@ struct ext2_dx_countlimit { #define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_SB(s)->s_clusters_per_group) #define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) /* limits imposed by 16-bit value gd_free_{blocks,inode}_count */ -#define EXT2_MAX_BLOCKS_PER_GROUP(s) (((1 << 16) - 8) * \ +#define EXT2_MAX_BLOCKS_PER_GROUP(s) ((((unsigned) 1 << 16) - 8) * \ (EXT2_CLUSTER_SIZE(s) / \ EXT2_BLOCK_SIZE(s))) -#define EXT2_MAX_CLUSTERS_PER_GROUP(s) ((1 << 16) - 8) -#define EXT2_MAX_INODES_PER_GROUP(s) ((1 << 16) - EXT2_INODES_PER_BLOCK(s)) +#define EXT2_MAX_CLUSTERS_PER_GROUP(s) (((unsigned) 1 << 16) - 8) +#define EXT2_MAX_INODES_PER_GROUP(s) (((unsigned) 1 << 16) - \ + EXT2_INODES_PER_BLOCK(s)) #ifdef __KERNEL__ #define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block) #define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits) diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h index ee7e3c26..dc83fb0c 100644 --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@ -221,7 +221,7 @@ struct struct_ext2_filsys { dgrp_t group_desc_count; unsigned long desc_blocks; struct opaque_ext2_group_desc * group_desc; - int inode_blocks_per_group; + unsigned int inode_blocks_per_group; ext2fs_inode_bitmap inode_map; ext2fs_block_bitmap block_map; /* XXX FIXME-64: not 64-bit safe, but not used? */ @@ -1362,6 +1362,11 @@ extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list, extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr); extern errcode_t ext2fs_get_memalign(unsigned long size, unsigned long align, void *ptr); +extern errcode_t ext2fs_get_memzero(unsigned long size, void *ptr); +extern errcode_t ext2fs_get_array(unsigned long count, + unsigned long size, void *ptr); +extern errcode_t ext2fs_get_arrayzero(unsigned long count, + unsigned long size, void *ptr); extern errcode_t ext2fs_free_mem(void *ptr); extern errcode_t ext2fs_resize_mem(unsigned long old_size, unsigned long size, void *ptr); diff --git a/lib/ext2fs/link.c b/lib/ext2fs/link.c index 4cc8426a..0fd3ea86 100644 --- a/lib/ext2fs/link.c +++ b/lib/ext2fs/link.c @@ -52,9 +52,9 @@ static int link_proc(struct ext2_dir_entry *dirent, * if so, absorb it into this one. */ next = (struct ext2_dir_entry *) (buf + offset + curr_rec_len); - if ((offset + curr_rec_len < blocksize - 8) && + if ((offset + (int) curr_rec_len < blocksize - 8) && (next->inode == 0) && - (offset + curr_rec_len + next->rec_len <= blocksize)) { + (offset + (int) curr_rec_len + (int) next->rec_len <= blocksize)) { curr_rec_len += next->rec_len; ls->err = ext2fs_set_rec_len(ls->fs, curr_rec_len, dirent); if (ls->err) diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index 0fe42205..0edeb2ff 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -92,7 +92,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, errcode_t retval; unsigned long i, first_meta_bg; __u32 features; - int groups_per_block, blocks_per_group, io_flags; + unsigned int groups_per_block, blocks_per_group, io_flags; blk64_t group_block, blk; char *dest, *cp; #ifdef WORDS_BIGENDIAN diff --git a/lib/ext2fs/punch.c b/lib/ext2fs/punch.c index 8c6ec549..2f24b5ef 100644 --- a/lib/ext2fs/punch.c +++ b/lib/ext2fs/punch.c @@ -203,7 +203,7 @@ static errcode_t ext2fs_punch_extent(ext2_filsys fs, ext2_ino_t ino, if (start <= extent.e_lblk) { if (end < extent.e_lblk) goto next_extent; - dbg_printf("Case #1\n"); + dbg_printf("Case #%d\n", 1); /* Start of deleted region before extent; adjust beginning of extent */ free_start = extent.e_pblk; @@ -219,7 +219,7 @@ static errcode_t ext2fs_punch_extent(ext2_filsys fs, ext2_ino_t ino, break; /* End of deleted region after extent; adjust end of extent */ - dbg_printf("Case #2\n"); + dbg_printf("Case #%d\n", 2); newlen = start - extent.e_lblk; free_start = extent.e_pblk + newlen; free_count = extent.e_len - newlen; @@ -227,7 +227,7 @@ static errcode_t ext2fs_punch_extent(ext2_filsys fs, ext2_ino_t ino, } else { struct ext2fs_extent newex; - dbg_printf("Case #3\n"); + dbg_printf("Case #%d\n", 3); /* The hard case; we need to split the extent */ newex.e_pblk = extent.e_pblk + (end + 1 - extent.e_lblk); @@ -255,7 +255,7 @@ static errcode_t ext2fs_punch_extent(ext2_filsys fs, ext2_ino_t ino, dbg_print_extent("replacing", &extent); retval = ext2fs_extent_replace(handle, 0, &extent); } else { - dbg_printf("deleting current extent\n"); + dbg_printf("deleting current extent%s\n", ""); retval = ext2fs_extent_delete(handle, 0); } if (retval) diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c index dddaf6f2..c1d05615 100644 --- a/lib/ext2fs/unix_io.c +++ b/lib/ext2fs/unix_io.c @@ -161,12 +161,13 @@ static errcode_t unix_get_stats(io_channel channel, io_stats *stats) static errcode_t raw_read_blk(io_channel channel, struct unix_private_data *data, unsigned long long block, - int count, void *buf) + int count, void *bufv) { errcode_t retval; ssize_t size; ext2_loff_t location; int actual = 0; + unsigned char *buf = bufv; size = (count < 0) ? -count : count * channel->block_size; data->io_stats.bytes_read += size; @@ -221,12 +222,13 @@ error_out: static errcode_t raw_write_blk(io_channel channel, struct unix_private_data *data, unsigned long long block, - int count, const void *buf) + int count, const void *bufv) { ssize_t size; ext2_loff_t location; int actual = 0; errcode_t retval; + const unsigned char *buf = bufv; if (count == 1) size = channel->block_size; |