linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] libext2fs: fix gcc -Wall nits
@ 2013-05-20 13:59 Theodore Ts'o
  2013-05-20 13:59 ` [PATCH 2/3] e2fsck: " Theodore Ts'o
  2013-05-20 13:59 ` [PATCH 3/3] misc: " Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Theodore Ts'o @ 2013-05-20 13:59 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 lib/ext2fs/blkmap64_rb.c |  4 +++-
 lib/ext2fs/crc32c.c      |  6 +++---
 lib/ext2fs/csum.c        | 22 ++++++++++++----------
 lib/ext2fs/ext2fs.h      |  4 +++-
 4 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/lib/ext2fs/blkmap64_rb.c b/lib/ext2fs/blkmap64_rb.c
index 9c1abc5..d6442fc 100644
--- a/lib/ext2fs/blkmap64_rb.c
+++ b/lib/ext2fs/blkmap64_rb.c
@@ -862,7 +862,9 @@ static void rb_print_stats(ext2fs_generic_bitmap bitmap)
 		eff);
 }
 #else
-static void rb_print_stats(ext2fs_generic_bitmap bitmap){}
+static void rb_print_stats(ext2fs_generic_bitmap bitmap EXT2FS_ATTR((unused)))
+{
+}
 #endif
 
 struct ext2_bitmap_ops ext2fs_blkmap64_rbtree = {
diff --git a/lib/ext2fs/crc32c.c b/lib/ext2fs/crc32c.c
index 4e72eda..624ad77 100644
--- a/lib/ext2fs/crc32c.c
+++ b/lib/ext2fs/crc32c.c
@@ -125,7 +125,7 @@ crc32_body(uint32_t crc, unsigned char const *buf, size_t len,
 	len = rem_len;
 	/* And the last few bytes */
 	if (len) {
-		uint8_t *p = (uint8_t *)(b + 1) - 1;
+		const uint8_t *p = (const uint8_t *)(b + 1) - 1;
 		do {
 			DO_CRC(*++p); /* use pre increment for speed */
 		} while (--len);
@@ -146,7 +146,7 @@ crc32_body(uint32_t crc, unsigned char const *buf, size_t len,
  */
 static inline uint32_t crc32_le_generic(uint32_t crc, unsigned char const *p,
 					size_t len, const uint32_t (*tab)[256],
-					uint32_t polynomial)
+					uint32_t polynomial EXT2FS_ATTR((unused)))
 {
 #if CRC_LE_BITS == 1
 	int i;
@@ -197,7 +197,7 @@ uint32_t ext2fs_crc32c_le(uint32_t crc, unsigned char const *p, size_t len)
  */
 static inline uint32_t crc32_be_generic(uint32_t crc, unsigned char const *p,
 					size_t len, const uint32_t (*tab)[256],
-					uint32_t polynomial)
+					uint32_t polynomial EXT2FS_ATTR((unused)))
 {
 #if CRC_BE_BITS == 1
 	int i;
diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c
index ebd544f..607f74a 100644
--- a/lib/ext2fs/csum.c
+++ b/lib/ext2fs/csum.c
@@ -73,7 +73,8 @@ int ext2fs_verify_csum_type(ext2_filsys fs, struct ext2_super_block *sb)
 	return sb->s_checksum_type == EXT2_CRC32C_CHKSUM;
 }
 
-static __u32 ext2fs_superblock_csum(ext2_filsys fs, struct ext2_super_block *sb)
+static __u32 ext2fs_superblock_csum(ext2_filsys fs EXT2FS_ATTR((unused)),
+				    struct ext2_super_block *sb)
 {
 	int offset = offsetof(struct ext2_super_block, s_checksum);
 
@@ -108,7 +109,8 @@ errcode_t ext2fs_superblock_csum_set(ext2_filsys fs,
 	return 0;
 }
 
-static errcode_t ext2fs_ext_attr_block_csum(ext2_filsys fs, ext2_ino_t inum,
+static errcode_t ext2fs_ext_attr_block_csum(ext2_filsys fs,
+					    ext2_ino_t inum EXT2FS_ATTR((unused)),
 					    blk64_t block,
 					    struct ext2_ext_attr_header *hdr,
 					    __u32 *crc)
@@ -190,11 +192,11 @@ static errcode_t __get_dx_countlimit(ext2_filsys fs,
 	if (rec_len == fs->blocksize && translate(dirent->name_len) == 0)
 		count_offset = 8;
 	else if (rec_len == 12) {
-		dp = (struct ext2_dir_entry *)(((void *)dirent) + rec_len);
+		dp = (struct ext2_dir_entry *)(((char *)dirent) + rec_len);
 		rec_len = translate(dp->rec_len);
 		if (rec_len != fs->blocksize - 12)
 			return EXT2_ET_DB_NOT_FOUND;
-		root = (struct ext2_dx_root_info *)(((void *)dp + 12));
+		root = (struct ext2_dx_root_info *)(((char *)dp + 12));
 		if (root->reserved_zero ||
 		    root->info_length != sizeof(struct ext2_dx_root_info))
 			return EXT2_ET_DB_NOT_FOUND;
@@ -202,7 +204,7 @@ static errcode_t __get_dx_countlimit(ext2_filsys fs,
 	} else
 		return EXT2_ET_DB_NOT_FOUND;
 
-	c = (struct ext2_dx_countlimit *)(((void *)dirent) + count_offset);
+	c = (struct ext2_dx_countlimit *)(((char *)dirent) + count_offset);
 	max_sane_entries = (fs->blocksize - count_offset) /
 			   sizeof(struct ext2_dx_entry);
 	if (ext2fs_le16_to_cpu(c->limit) > max_sane_entries ||
@@ -251,7 +253,7 @@ static errcode_t __get_dirent_tail(ext2_filsys fs,
 
 	rec_len = translate(d->rec_len);
 	while (rec_len && !(rec_len & 0x3)) {
-		d = (struct ext2_dir_entry *)(((void *)d) + rec_len);
+		d = (struct ext2_dir_entry *)(((char *)d) + rec_len);
 		if ((void *)d >= top)
 			break;
 		rec_len = translate(d->rec_len);
@@ -315,7 +317,7 @@ int ext2fs_dirent_csum_verify(ext2_filsys fs, ext2_ino_t inum,
 	 * so the swapfs.c functions won't change the endianness.
 	 */
 	retval = ext2fs_dirent_csum(fs, inum, dirent, &calculated,
-				    (void *)t - (void *)dirent);
+				    (char *)t - (char *)dirent);
 	if (retval)
 		return 0;
 	return ext2fs_le32_to_cpu(t->det_checksum) == calculated;
@@ -334,7 +336,7 @@ static errcode_t ext2fs_dirent_csum_set(ext2_filsys fs, ext2_ino_t inum,
 
 	/* swapfs.c functions don't change the checksum endianness */
 	retval = ext2fs_dirent_csum(fs, inum, dirent, &crc,
-				    (void *)t - (void *)dirent);
+				    (char *)t - (char *)dirent);
 	if (retval)
 		return retval;
 	t->det_checksum = ext2fs_cpu_to_le32(crc);
@@ -464,7 +466,7 @@ errcode_t ext2fs_dir_block_csum_set(ext2_filsys fs, ext2_ino_t inum,
 
 static struct ext3_extent_tail *get_extent_tail(struct ext3_extent_header *h)
 {
-	return (struct ext3_extent_tail *)(((void *)h) +
+	return (struct ext3_extent_tail *)(((char *)h) +
 					   EXT3_EXTENT_TAIL_OFFSET(h));
 }
 
@@ -653,7 +655,7 @@ int ext2fs_inode_csum_verify(ext2_filsys fs, ext2_ino_t inum,
 {
 	errcode_t retval;
 	__u32 provided, calculated;
-	int i, has_hi;
+	unsigned int i, has_hi;
 	char *cp;
 
 	if (fs->super->s_creator_os != EXT2_OS_LINUX ||
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index cd59473..6923f34 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -963,13 +963,15 @@ extern int ext2fs_ext_attr_block_csum_verify(ext2_filsys fs, ext2_ino_t inum,
 					     blk64_t block,
 					     struct ext2_ext_attr_header *hdr);
 #define EXT2_DIRENT_TAIL(block, blocksize) \
-	((struct ext2_dir_entry_tail *)(((void *)(block)) + \
+	((struct ext2_dir_entry_tail *)(((char *)(block)) + \
 	(blocksize) - sizeof(struct ext2_dir_entry_tail)))
 
 extern void ext2fs_initialize_dirent_tail(ext2_filsys fs,
 					  struct ext2_dir_entry_tail *t);
 extern int ext2fs_dirent_has_tail(ext2_filsys fs,
 				  struct ext2_dir_entry *dirent);
+extern int ext2fs_dirent_csum_verify(ext2_filsys fs, ext2_ino_t inum,
+				     struct ext2_dir_entry *dirent);
 extern int ext2fs_dir_block_csum_verify(ext2_filsys fs, ext2_ino_t inum,
 					struct ext2_dir_entry *dirent);
 extern errcode_t ext2fs_dir_block_csum_set(ext2_filsys fs, ext2_ino_t inum,
-- 
1.7.12.rc0.22.gcdd159b


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] e2fsck: fix gcc -Wall nits
  2013-05-20 13:59 [PATCH 1/3] libext2fs: fix gcc -Wall nits Theodore Ts'o
@ 2013-05-20 13:59 ` Theodore Ts'o
  2013-05-20 13:59 ` [PATCH 3/3] misc: " Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2013-05-20 13:59 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

[For 1.43 branch]

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 e2fsck/journal.c  | 15 +++++++++------
 e2fsck/pass5.c    |  6 ------
 e2fsck/recovery.c |  4 ++--
 e2fsck/rehash.c   |  5 ++---
 4 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 2ca19b8..45d9462 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -41,7 +41,8 @@ static int bh_count = 0;
 #undef USE_INODE_IO
 
 /* Checksumming functions */
-int e2fsck_journal_verify_csum_type(journal_t *j, journal_superblock_t *jsb)
+static int e2fsck_journal_verify_csum_type(journal_t *j,
+					   journal_superblock_t *jsb)
 {
 	if (!JFS_HAS_INCOMPAT_FEATURE(j, JFS_FEATURE_INCOMPAT_CSUM_V2))
 		return 1;
@@ -49,7 +50,7 @@ int e2fsck_journal_verify_csum_type(journal_t *j, journal_superblock_t *jsb)
 	return jsb->s_checksum_type == JBD2_CRC32C_CHKSUM;
 }
 
-static __u32 e2fsck_journal_sb_csum(journal_t *j, journal_superblock_t *jsb)
+static __u32 e2fsck_journal_sb_csum(journal_superblock_t *jsb)
 {
 	__u32 crc, old_crc;
 
@@ -62,7 +63,8 @@ static __u32 e2fsck_journal_sb_csum(journal_t *j, journal_superblock_t *jsb)
 	return crc;
 }
 
-int e2fsck_journal_sb_csum_verify(journal_t *j, journal_superblock_t *jsb)
+static int e2fsck_journal_sb_csum_verify(journal_t *j,
+					 journal_superblock_t *jsb)
 {
 	__u32 provided, calculated;
 
@@ -70,19 +72,20 @@ int e2fsck_journal_sb_csum_verify(journal_t *j, journal_superblock_t *jsb)
 		return 1;
 
 	provided = ext2fs_be32_to_cpu(jsb->s_checksum);
-	calculated = e2fsck_journal_sb_csum(j, jsb);
+	calculated = e2fsck_journal_sb_csum(jsb);
 
 	return provided == calculated;
 }
 
-errcode_t e2fsck_journal_sb_csum_set(journal_t *j, journal_superblock_t *jsb)
+static errcode_t e2fsck_journal_sb_csum_set(journal_t *j,
+					    journal_superblock_t *jsb)
 {
 	__u32 crc;
 
 	if (!JFS_HAS_INCOMPAT_FEATURE(j, JFS_FEATURE_INCOMPAT_CSUM_V2))
 		return 0;
 
-	crc = e2fsck_journal_sb_csum(j, jsb);
+	crc = e2fsck_journal_sb_csum(jsb);
 	jsb->s_checksum = ext2fs_cpu_to_be32(crc);
 	return 0;
 }
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index 86b5225..51e4683 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -82,7 +82,6 @@ void e2fsck_pass5(e2fsck_t ctx)
 static void check_inode_bitmap_checksum(e2fsck_t ctx)
 {
 	struct problem_context	pctx;
-	struct ext4_group_desc	*gdp;
 	char		*buf;
 	dgrp_t		i;
 	int		nbytes;
@@ -112,8 +111,6 @@ static void check_inode_bitmap_checksum(e2fsck_t ctx)
 			continue;
 
 		ino_itr = 1 + (i * (nbytes << 3));
-		gdp = (struct ext4_group_desc *)ext2fs_group_desc(ctx->fs,
-				ctx->fs->group_desc, i);
 		retval = ext2fs_get_inode_bitmap_range2(ctx->fs->inode_map,
 							ino_itr, nbytes << 3,
 							buf);
@@ -141,7 +138,6 @@ static void check_inode_bitmap_checksum(e2fsck_t ctx)
 static void check_block_bitmap_checksum(e2fsck_t ctx)
 {
 	struct problem_context	pctx;
-	struct ext4_group_desc	*gdp;
 	char		*buf;
 	dgrp_t		i;
 	int		nbytes;
@@ -173,8 +169,6 @@ static void check_block_bitmap_checksum(e2fsck_t ctx)
 		blk_itr = EXT2FS_B2C(ctx->fs,
 				     ctx->fs->super->s_first_data_block) +
 			  (i * (nbytes << 3));
-		gdp = (struct ext4_group_desc *)ext2fs_group_desc(ctx->fs,
-				ctx->fs->group_desc, i);
 		retval = ext2fs_get_block_bitmap_range2(ctx->fs->block_map,
 							blk_itr, nbytes << 3,
 							buf);
diff --git a/e2fsck/recovery.c b/e2fsck/recovery.c
index 7712185..b04a204 100644
--- a/e2fsck/recovery.c
+++ b/e2fsck/recovery.c
@@ -183,7 +183,7 @@ static int jbd2_descr_block_csum_verify(journal_t *j,
 	if (!JFS_HAS_INCOMPAT_FEATURE(j, JFS_FEATURE_INCOMPAT_CSUM_V2))
 		return 1;
 
-	tail = (struct journal_block_tail *)(buf + j->j_blocksize -
+	tail = (struct journal_block_tail *)((char *)buf + j->j_blocksize -
 			sizeof(struct journal_block_tail));
 	provided = tail->t_checksum;
 	tail->t_checksum = 0;
@@ -821,7 +821,7 @@ static int jbd2_revoke_block_csum_verify(journal_t *j,
 	if (!JFS_HAS_INCOMPAT_FEATURE(j, JFS_FEATURE_INCOMPAT_CSUM_V2))
 		return 1;
 
-	tail = (struct journal_revoke_tail *)(buf + j->j_blocksize -
+	tail = (struct journal_revoke_tail *)((char *)buf + j->j_blocksize -
 			sizeof(struct journal_revoke_tail));
 	provided = tail->r_checksum;
 	tail->r_checksum = 0;
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index df3afab..5592e3f 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -420,8 +420,7 @@ static int duplicate_search_and_fix(e2fsck_t ctx, ext2_filsys fs,
 
 static errcode_t copy_dir_entries(e2fsck_t ctx,
 				  struct fill_dir_struct *fd,
-				  struct out_dir *outdir,
-				  ext2_ino_t ino)
+				  struct out_dir *outdir)
 {
 	ext2_filsys 		fs = ctx->fs;
 	errcode_t		retval;
@@ -857,7 +856,7 @@ resort:
 	 * Copy the directory entries.  In a htree directory these
 	 * will become the leaf nodes.
 	 */
-	retval = copy_dir_entries(ctx, &fd, &outdir, ino);
+	retval = copy_dir_entries(ctx, &fd, &outdir);
 	if (retval)
 		goto errout;
 
-- 
1.7.12.rc0.22.gcdd159b


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] misc: fix gcc -Wall nits
  2013-05-20 13:59 [PATCH 1/3] libext2fs: fix gcc -Wall nits Theodore Ts'o
  2013-05-20 13:59 ` [PATCH 2/3] e2fsck: " Theodore Ts'o
@ 2013-05-20 13:59 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2013-05-20 13:59 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

[For 1.43 branch]

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 misc/dumpe2fs.c |  2 +-
 misc/tune2fs.c  | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index e18843e..5369ffb 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -324,7 +324,7 @@ static void list_bad_blocks(ext2_filsys fs, int dump)
 	ext2fs_badblocks_list_free(bb_list);
 }
 
-static char *journal_checksum_type_str(__u8 type)
+static const char *journal_checksum_type_str(__u8 type)
 {
 	switch (type) {
 	case JBD2_CRC32C_CHKSUM:
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 4f8cedc..7d6520e 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -448,7 +448,7 @@ struct rewrite_dir_context {
 
 static int rewrite_dir_block(ext2_filsys fs,
 			     blk64_t	*blocknr,
-			     e2_blkcnt_t blockcnt,
+			     e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
 			     blk64_t	ref_block EXT2FS_ATTR((unused)),
 			     int	ref_offset EXT2FS_ATTR((unused)),
 			     void	*priv_data)
@@ -510,7 +510,7 @@ static int rewrite_dir_block(ext2_filsys fs,
 				ctx->errcode = EXT2_ET_DIR_CORRUPTED;
 			if (ctx->errcode)
 				return BLOCK_ABORT;
-			de = (struct ext2_dir_entry *)(((void *)de) + rec_len);
+			de = (struct ext2_dir_entry *)(((char *)de) + rec_len);
 		}
 		ctx->errcode = ext2fs_get_rec_len(fs, last_de, &rec_len);
 		if (ctx->errcode)
@@ -540,7 +540,7 @@ static int rewrite_dir_block(ext2_filsys fs,
 					penultimate_de);
 			changed = 1;
 		} else {
-			int csum_size = sizeof(struct ext2_dir_entry_tail);
+			unsigned csum_size = sizeof(struct ext2_dir_entry_tail);
 			struct ext2_dir_entry_tail *t;
 
 			/*
@@ -584,8 +584,8 @@ out:
 	return 0;
 }
 
-errcode_t rewrite_directory(ext2_filsys fs, ext2_ino_t dir,
-			    struct ext2_inode *inode)
+static errcode_t rewrite_directory(ext2_filsys fs, ext2_ino_t dir,
+				   struct ext2_inode *inode)
 {
 	errcode_t	retval;
 	struct rewrite_dir_context ctx;
-- 
1.7.12.rc0.22.gcdd159b


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-20 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-20 13:59 [PATCH 1/3] libext2fs: fix gcc -Wall nits Theodore Ts'o
2013-05-20 13:59 ` [PATCH 2/3] e2fsck: " Theodore Ts'o
2013-05-20 13:59 ` [PATCH 3/3] misc: " Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).